Completed
Push — master ( 8a5ab0...6436ef )
by Devin
16:24
created
includes/admin/forms/metabox.php 1 patch
Spacing   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
17
-add_filter( 'cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes' );
17
+add_filter('cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes');
18 18
 
19 19
 /**
20 20
  * Define the metabox and field configurations.
@@ -23,23 +23,23 @@  discard block
 block discarded – undo
23 23
  *
24 24
  * @return array
25 25
  */
26
-function give_single_forms_cmb2_metaboxes( array $meta_boxes ) {
26
+function give_single_forms_cmb2_metaboxes(array $meta_boxes) {
27 27
 
28 28
 	$post_id               = give_get_admin_post_id();
29
-	$price                 = give_get_form_price( $post_id );
30
-	$custom_amount_minimum = give_get_form_minimum_price( $post_id );
31
-	$goal                  = give_get_form_goal( $post_id );
32
-	$variable_pricing      = give_has_variable_prices( $post_id );
33
-	$prices                = give_get_variable_prices( $post_id );
29
+	$price                 = give_get_form_price($post_id);
30
+	$custom_amount_minimum = give_get_form_minimum_price($post_id);
31
+	$goal                  = give_get_form_goal($post_id);
32
+	$variable_pricing      = give_has_variable_prices($post_id);
33
+	$prices                = give_get_variable_prices($post_id);
34 34
 
35 35
 	//No empty prices - min. 1.00 for new forms
36
-	if ( empty( $price ) && is_null( $post_id ) ) {
37
-		$price = esc_attr( give_format_amount( '1.00' ) );
36
+	if (empty($price) && is_null($post_id)) {
37
+		$price = esc_attr(give_format_amount('1.00'));
38 38
 	}
39 39
 
40 40
 	//Min. $1.00 for new forms
41
-	if ( empty( $custom_amount_minimum ) ) {
42
-		$custom_amount_minimum = esc_attr( give_format_amount( '1.00' ) );
41
+	if (empty($custom_amount_minimum)) {
42
+		$custom_amount_minimum = esc_attr(give_format_amount('1.00'));
43 43
 	}
44 44
 
45 45
 	// Start with an underscore to hide fields from custom fields list
@@ -48,325 +48,325 @@  discard block
 block discarded – undo
48 48
 	/**
49 49
 	 * Repeatable Field Groups
50 50
 	 */
51
-	$meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array(
51
+	$meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array(
52 52
 		'id'           => 'form_field_options',
53
-		'title'        => __( 'Donation Options', 'give' ),
54
-		'object_types' => array( 'give_forms' ),
53
+		'title'        => __('Donation Options', 'give'),
54
+		'object_types' => array('give_forms'),
55 55
 		'context'      => 'normal',
56 56
 		'priority'     => 'high', //Show above Content WYSIWYG
57
-		'fields'       => apply_filters( 'give_forms_donation_form_metabox_fields', array(
57
+		'fields'       => apply_filters('give_forms_donation_form_metabox_fields', array(
58 58
 				//Donation Option
59 59
 				array(
60
-					'name'        => __( 'Donation Option', 'give' ),
61
-					'description' => __( 'Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ),
62
-					'id'          => $prefix . 'price_option',
60
+					'name'        => __('Donation Option', 'give'),
61
+					'description' => __('Would you like this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'),
62
+					'id'          => $prefix.'price_option',
63 63
 					'type'        => 'radio_inline',
64 64
 					'default'     => 'set',
65
-					'options'     => apply_filters( 'give_forms_price_options', array(
66
-						'set'   => __( 'Set Donation', 'give' ),
67
-						'multi' => __( 'Multi-level Donation', 'give' ),
68
-					) ),
65
+					'options'     => apply_filters('give_forms_price_options', array(
66
+						'set'   => __('Set Donation', 'give'),
67
+						'multi' => __('Multi-level Donation', 'give'),
68
+					)),
69 69
 				),
70 70
 				array(
71
-					'name'         => __( 'Set Donation', 'give' ),
72
-					'description'  => __( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ),
73
-					'id'           => $prefix . 'set_price',
71
+					'name'         => __('Set Donation', 'give'),
72
+					'description'  => __('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'),
73
+					'id'           => $prefix.'set_price',
74 74
 					'type'         => 'text_small',
75 75
 					'row_classes'  => 'give-subfield',
76
-					'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
77
-					'after_field'  => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
76
+					'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
77
+					'after_field'  => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
78 78
 					'attributes'   => array(
79
-						'placeholder' => give_format_amount( '1.00' ),
80
-						'value'       => give_format_amount( $price ),
79
+						'placeholder' => give_format_amount('1.00'),
80
+						'value'       => give_format_amount($price),
81 81
 						'class'       => 'cmb-type-text-small give-money-field',
82 82
 					),
83 83
 				),
84 84
 				//Donation levels: Header
85 85
 				array(
86
-					'id'   => $prefix . 'levels_header',
86
+					'id'   => $prefix.'levels_header',
87 87
 					'type' => 'levels_repeater_header',
88 88
 				),
89 89
 				//Donation Levels: Repeatable CMB2 Group
90 90
 				array(
91
-					'id'          => $prefix . 'donation_levels',
91
+					'id'          => $prefix.'donation_levels',
92 92
 					'type'        => 'group',
93 93
 					'row_classes' => 'give-subfield',
94 94
 					'options'     => array(
95
-						'add_button'    => __( 'Add Level', 'give' ),
96
-						'remove_button' => __( '<span class="dashicons dashicons-no"></span>', 'give' ),
95
+						'add_button'    => __('Add Level', 'give'),
96
+						'remove_button' => __('<span class="dashicons dashicons-no"></span>', 'give'),
97 97
 						'sortable'      => true, // beta
98 98
 					),
99 99
 					// Fields array works the same, except id's only need to be unique for this group. Prefix is not needed.
100
-					'fields'      => apply_filters( 'give_donation_levels_table_row', array(
100
+					'fields'      => apply_filters('give_donation_levels_table_row', array(
101 101
 						array(
102
-							'name' => __( 'ID', 'give' ),
103
-							'id'   => $prefix . 'id',
102
+							'name' => __('ID', 'give'),
103
+							'id'   => $prefix.'id',
104 104
 							'type' => 'levels_id',
105 105
 						),
106 106
 						array(
107
-							'name'         => __( 'Amount', 'give' ),
108
-							'id'           => $prefix . 'amount',
107
+							'name'         => __('Amount', 'give'),
108
+							'id'           => $prefix.'amount',
109 109
 							'type'         => 'text_small',
110
-							'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol  give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
111
-							'after_field'  => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol  give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
110
+							'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol  give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
111
+							'after_field'  => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol  give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
112 112
 							'attributes'   => array(
113
-								'placeholder' => give_format_amount( '1.00' ),
113
+								'placeholder' => give_format_amount('1.00'),
114 114
 								'class'       => 'cmb-type-text-small give-money-field',
115 115
 							),
116 116
 							'before'       => 'give_format_admin_multilevel_amount',
117 117
 						),
118 118
 						array(
119
-							'name'       => __( 'Text', 'give' ),
120
-							'id'         => $prefix . 'text',
119
+							'name'       => __('Text', 'give'),
120
+							'id'         => $prefix.'text',
121 121
 							'type'       => 'text',
122 122
 							'attributes' => array(
123
-								'placeholder' => __( 'Donation Level', 'give' ),
123
+								'placeholder' => __('Donation Level', 'give'),
124 124
 								'class'       => 'give-multilevel-text-field',
125 125
 							),
126 126
 						),
127 127
 						array(
128
-							'name' => __( 'Default', 'give' ),
129
-							'id'   => $prefix . 'default',
128
+							'name' => __('Default', 'give'),
129
+							'id'   => $prefix.'default',
130 130
 							'type' => 'give_default_radio_inline'
131 131
 						),
132
-					) ),
132
+					)),
133 133
 				),
134 134
 				//Display Style
135 135
 				array(
136
-					'name'        => __( 'Display Style', 'give' ),
137
-					'description' => __( 'Set how the donations levels will display on the form.', 'give' ),
138
-					'id'          => $prefix . 'display_style',
136
+					'name'        => __('Display Style', 'give'),
137
+					'description' => __('Set how the donations levels will display on the form.', 'give'),
138
+					'id'          => $prefix.'display_style',
139 139
 					'type'        => 'radio_inline',
140 140
 					'default'     => 'buttons',
141 141
 					'options'     => array(
142
-						'buttons'  => __( 'Buttons', 'give' ),
143
-						'radios'   => __( 'Radios', 'give' ),
144
-						'dropdown' => __( 'Dropdown', 'give' ),
142
+						'buttons'  => __('Buttons', 'give'),
143
+						'radios'   => __('Radios', 'give'),
144
+						'dropdown' => __('Dropdown', 'give'),
145 145
 					),
146 146
 				),
147 147
 				//Custom Amount
148 148
 				array(
149
-					'name'        => __( 'Custom Amount', 'give' ),
150
-					'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ),
151
-					'id'          => $prefix . 'custom_amount',
149
+					'name'        => __('Custom Amount', 'give'),
150
+					'description' => __('Do you want the user to be able to input their own donation amount?', 'give'),
151
+					'id'          => $prefix.'custom_amount',
152 152
 					'type'        => 'radio_inline',
153 153
 					'default'     => 'no',
154 154
 					'options'     => array(
155
-						'yes' => __( 'Yes', 'give' ),
156
-						'no'  => __( 'No', 'give' ),
155
+						'yes' => __('Yes', 'give'),
156
+						'no'  => __('No', 'give'),
157 157
 					),
158 158
 				),
159 159
 				array(
160
-					'name'         => __( 'Custom Amount Minimum', 'give' ),
161
-					'description'  => __( 'If you would like to set a minimum custom donation amount please enter it here.', 'give' ),
162
-					'id'           => $prefix . 'custom_amount_minimum',
160
+					'name'         => __('Custom Amount Minimum', 'give'),
161
+					'description'  => __('If you would like to set a minimum custom donation amount please enter it here.', 'give'),
162
+					'id'           => $prefix.'custom_amount_minimum',
163 163
 					'type'         => 'text_small',
164 164
 					'row_classes'  => 'give-subfield',
165
-					'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
166
-					'after_field'  => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
165
+					'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
166
+					'after_field'  => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
167 167
 					'attributes'   => array(
168
-						'placeholder' => give_format_amount( '1.00' ),
169
-						'value'       => give_format_amount( $custom_amount_minimum ),
168
+						'placeholder' => give_format_amount('1.00'),
169
+						'value'       => give_format_amount($custom_amount_minimum),
170 170
 						'class'       => 'cmb-type-text-small give-money-field',
171 171
 					),
172 172
 				),
173 173
 				array(
174
-					'name'        => __( 'Custom Amount Text', 'give' ),
175
-					'description' => __( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ),
176
-					'id'          => $prefix . 'custom_amount_text',
174
+					'name'        => __('Custom Amount Text', 'give'),
175
+					'description' => __('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'),
176
+					'id'          => $prefix.'custom_amount_text',
177 177
 					'type'        => 'text',
178 178
 					'row_classes' => 'give-subfield',
179 179
 					'attributes'  => array(
180 180
 						'rows'        => 3,
181
-						'placeholder' => __( 'Give a Custom Amount', 'give' ),
181
+						'placeholder' => __('Give a Custom Amount', 'give'),
182 182
 					),
183 183
 				),
184 184
 				//Goals
185 185
 				array(
186
-					'name'        => __( 'Goal', 'give' ),
187
-					'description' => __( 'Do you want to set a donation goal for this form?', 'give' ),
188
-					'id'          => $prefix . 'goal_option',
186
+					'name'        => __('Goal', 'give'),
187
+					'description' => __('Do you want to set a donation goal for this form?', 'give'),
188
+					'id'          => $prefix.'goal_option',
189 189
 					'type'        => 'radio_inline',
190 190
 					'default'     => 'no',
191 191
 					'options'     => array(
192
-						'yes' => __( 'Yes', 'give' ),
193
-						'no'  => __( 'No', 'give' ),
192
+						'yes' => __('Yes', 'give'),
193
+						'no'  => __('No', 'give'),
194 194
 					),
195 195
 				),
196 196
 				array(
197
-					'name'         => __( 'Goal Amount', 'give' ),
198
-					'description'  => __( 'This is the monetary goal amount you want to reach for this donation form.', 'give' ),
199
-					'id'           => $prefix . 'set_goal',
197
+					'name'         => __('Goal Amount', 'give'),
198
+					'description'  => __('This is the monetary goal amount you want to reach for this donation form.', 'give'),
199
+					'id'           => $prefix.'set_goal',
200 200
 					'type'         => 'text_small',
201 201
 					'row_classes'  => 'give-subfield',
202
-					'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '',
203
-					'after_field'  => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '',
202
+					'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '',
203
+					'after_field'  => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '',
204 204
 					'attributes'   => array(
205
-						'placeholder' => give_format_amount( '0.00' ),
206
-						'value'       => isset( $goal ) ? esc_attr( give_format_amount( $goal ) ) : '',
205
+						'placeholder' => give_format_amount('0.00'),
206
+						'value'       => isset($goal) ? esc_attr(give_format_amount($goal)) : '',
207 207
 						'class'       => 'cmb-type-text-small give-money-field',
208 208
 					),
209 209
 				),
210 210
 
211 211
 				array(
212
-					'name'        => __( 'Goal Format', 'give' ),
213
-					'description' => __( 'Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ),
214
-					'id'          => $prefix . 'goal_format',
212
+					'name'        => __('Goal Format', 'give'),
213
+					'description' => __('Would you like to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'),
214
+					'id'          => $prefix.'goal_format',
215 215
 					'type'        => 'radio_inline',
216 216
 					'default'     => 'amount',
217 217
 					'row_classes' => 'give-subfield',
218 218
 					'options'     => array(
219
-						'amount'     => __( 'Amount ', 'give' ),
220
-						'percentage' => __( 'Percentage', 'give' ),
219
+						'amount'     => __('Amount ', 'give'),
220
+						'percentage' => __('Percentage', 'give'),
221 221
 					),
222 222
 				),
223 223
 				array(
224
-					'name'        => __( 'Goal Progress Bar Color', 'give' ),
225
-					'id'          => $prefix . 'goal_color',
224
+					'name'        => __('Goal Progress Bar Color', 'give'),
225
+					'id'          => $prefix.'goal_color',
226 226
 					'type'        => 'colorpicker',
227 227
 					'row_classes' => 'give-subfield',
228 228
 					'default'     => '#2bc253',
229 229
 				),
230 230
 
231 231
 				array(
232
-					'name'        => __( 'Close Form when Goal Achieved', 'give' ),
233
-					'desc'        => __( 'Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give' ),
234
-					'id'          => $prefix . 'close_form_when_goal_achieved',
232
+					'name'        => __('Close Form when Goal Achieved', 'give'),
233
+					'desc'        => __('Would you like to close the donation forms and stop accepting donations once this goal has been met?', 'give'),
234
+					'id'          => $prefix.'close_form_when_goal_achieved',
235 235
 					'type'        => 'radio_inline',
236 236
 					'row_classes' => 'give-subfield',
237 237
 					'options'     => array(
238
-						'yes' => __( 'Yes', 'give' ),
239
-						'no'  => __( 'No', 'give' ),
238
+						'yes' => __('Yes', 'give'),
239
+						'no'  => __('No', 'give'),
240 240
 					),
241 241
 					'default'     => 'no',
242 242
 				),
243 243
 				array(
244
-					'name'        => __( 'Goal Achieved Message', 'give' ),
245
-					'desc'        => __( 'Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give' ),
246
-					'id'          => $prefix . 'form_goal_achieved_message',
244
+					'name'        => __('Goal Achieved Message', 'give'),
245
+					'desc'        => __('Would you like to display a custom message when the goal is closed? If none is provided the default message will be displayed', 'give'),
246
+					'id'          => $prefix.'form_goal_achieved_message',
247 247
 					'type'        => 'textarea',
248 248
 					'row_classes' => 'give-subfield',
249 249
 					'attributes'  => array(
250
-						'placeholder' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ),
250
+						'placeholder' => __('Thank you to all our donors, we have met our fundraising goal.', 'give'),
251 251
 					),
252 252
 				)
253 253
 			)
254 254
 		)
255
-	) );
255
+	));
256 256
 
257 257
 
258 258
 	/**
259 259
 	 * Content Field
260 260
 	 */
261
-	$meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array(
261
+	$meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array(
262 262
 		'id'           => 'form_content_options',
263
-		'title'        => __( 'Form Content', 'give' ),
264
-		'object_types' => array( 'give_forms' ),
263
+		'title'        => __('Form Content', 'give'),
264
+		'object_types' => array('give_forms'),
265 265
 		'context'      => 'normal',
266 266
 		'priority'     => 'high', //Show above Content WYSIWYG
267
-		'fields'       => apply_filters( 'give_forms_content_options_metabox_fields', array(
267
+		'fields'       => apply_filters('give_forms_content_options_metabox_fields', array(
268 268
 				//Donation Option
269 269
 				array(
270
-					'name'        => __( 'Display Content', 'give' ),
271
-					'description' => __( 'Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give' ),
272
-					'id'          => $prefix . 'content_option',
270
+					'name'        => __('Display Content', 'give'),
271
+					'description' => __('Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give'),
272
+					'id'          => $prefix.'content_option',
273 273
 					'type'        => 'select',
274
-					'options'     => apply_filters( 'give_forms_content_options_select', array(
275
-							'none'           => __( 'No content', 'give' ),
276
-							'give_pre_form'  => __( 'Yes, display content ABOVE the form fields', 'give' ),
277
-							'give_post_form' => __( 'Yes, display content BELOW the form fields', 'give' ),
274
+					'options'     => apply_filters('give_forms_content_options_select', array(
275
+							'none'           => __('No content', 'give'),
276
+							'give_pre_form'  => __('Yes, display content ABOVE the form fields', 'give'),
277
+							'give_post_form' => __('Yes, display content BELOW the form fields', 'give'),
278 278
 						)
279 279
 					),
280 280
 					'default'     => 'none',
281 281
 				),
282 282
 				array(
283
-					'name'        => __( 'Content', 'give' ),
284
-					'description' => __( 'This content will display on the single give form page.', 'give' ),
285
-					'id'          => $prefix . 'form_content',
283
+					'name'        => __('Content', 'give'),
284
+					'description' => __('This content will display on the single give form page.', 'give'),
285
+					'id'          => $prefix.'form_content',
286 286
 					'row_classes' => 'give-subfield',
287 287
 					'type'        => 'wysiwyg'
288 288
 				),
289 289
 			)
290 290
 		)
291
-	) );
291
+	));
292 292
 
293 293
 
294 294
 	/**
295 295
 	 * Display Options
296 296
 	 */
297
-	$meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array(
297
+	$meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array(
298 298
 			'id'           => 'form_display_options',
299
-			'title'        => __( 'Form Display Options', 'give' ),
300
-			'object_types' => array( 'give_forms' ),
299
+			'title'        => __('Form Display Options', 'give'),
300
+			'object_types' => array('give_forms'),
301 301
 			'context'      => 'normal', //  'normal', 'advanced', or 'side'
302 302
 			'priority'     => 'high', //Show above Content WYSIWYG
303 303
 			'show_names'   => true, // Show field names on the left
304
-			'fields'       => apply_filters( 'give_forms_display_options_metabox_fields', array(
304
+			'fields'       => apply_filters('give_forms_display_options_metabox_fields', array(
305 305
 					array(
306
-						'name'    => __( 'Payment Fields', 'give' ),
307
-						'desc'    => __( 'How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ),
308
-						'id'      => $prefix . 'payment_display',
306
+						'name'    => __('Payment Fields', 'give'),
307
+						'desc'    => __('How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon click slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'),
308
+						'id'      => $prefix.'payment_display',
309 309
 						'type'    => 'select',
310 310
 						'options' => array(
311
-							'onpage' => __( 'Show on Page', 'give' ),
312
-							'reveal' => __( 'Reveal Upon Click', 'give' ),
313
-							'modal'  => __( 'Modal Window Upon Click', 'give' ),
311
+							'onpage' => __('Show on Page', 'give'),
312
+							'reveal' => __('Reveal Upon Click', 'give'),
313
+							'modal'  => __('Modal Window Upon Click', 'give'),
314 314
 						),
315 315
 						'default' => 'onpage',
316 316
 					),
317 317
 					array(
318
-						'id'          => $prefix . 'reveal_label',
319
-						'name'        => __( 'Reveal / Modal Open Text', 'give' ),
320
-						'desc'        => __( 'The button label for completing the donation.', 'give' ),
318
+						'id'          => $prefix.'reveal_label',
319
+						'name'        => __('Reveal / Modal Open Text', 'give'),
320
+						'desc'        => __('The button label for completing the donation.', 'give'),
321 321
 						'type'        => 'text_small',
322 322
 						'row_classes' => 'give-subfield',
323 323
 						'attributes'  => array(
324
-							'placeholder' => __( 'Donate Now', 'give' ),
324
+							'placeholder' => __('Donate Now', 'give'),
325 325
 						),
326 326
 					),
327 327
 					array(
328
-						'id'         => $prefix . 'checkout_label',
329
-						'name'       => __( 'Complete Donation Text', 'give' ),
330
-						'desc'       => __( 'The button label for completing a donation.', 'give' ),
328
+						'id'         => $prefix.'checkout_label',
329
+						'name'       => __('Complete Donation Text', 'give'),
330
+						'desc'       => __('The button label for completing a donation.', 'give'),
331 331
 						'type'       => 'text_small',
332 332
 						'attributes' => array(
333
-							'placeholder' => __( 'Donate Now', 'give' ),
333
+							'placeholder' => __('Donate Now', 'give'),
334 334
 						),
335 335
 					),
336 336
 					array(
337
-						'name' => __( 'Default Gateway', 'give' ),
338
-						'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ),
339
-						'id'   => $prefix . 'default_gateway',
337
+						'name' => __('Default Gateway', 'give'),
338
+						'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'),
339
+						'id'   => $prefix.'default_gateway',
340 340
 						'type' => 'default_gateway'
341 341
 					),
342 342
 					array(
343
-						'name' => __( 'Disable Guest Donations', 'give' ),
344
-						'desc' => __( 'Do you want to require users be logged-in to make donations?', 'give' ),
345
-						'id'   => $prefix . 'logged_in_only',
343
+						'name' => __('Disable Guest Donations', 'give'),
344
+						'desc' => __('Do you want to require users be logged-in to make donations?', 'give'),
345
+						'id'   => $prefix.'logged_in_only',
346 346
 						'type' => 'checkbox'
347 347
 					),
348 348
 					array(
349
-						'name'    => __( 'Register / Login Form', 'give' ),
350
-						'desc'    => __( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ),
351
-						'id'      => $prefix . 'show_register_form',
349
+						'name'    => __('Register / Login Form', 'give'),
350
+						'desc'    => __('Display the registration and login forms in the payment section for non-logged-in users.', 'give'),
351
+						'id'      => $prefix.'show_register_form',
352 352
 						'type'    => 'select',
353 353
 						'options' => array(
354
-							'both'         => __( 'Registration and Login Forms', 'give' ),
355
-							'registration' => __( 'Registration Form Only', 'give' ),
356
-							'login'        => __( 'Login Form Only', 'give' ),
357
-							'none'         => __( 'None', 'give' ),
354
+							'both'         => __('Registration and Login Forms', 'give'),
355
+							'registration' => __('Registration Form Only', 'give'),
356
+							'login'        => __('Login Form Only', 'give'),
357
+							'none'         => __('None', 'give'),
358 358
 						),
359 359
 						'default' => 'none',
360 360
 					),
361 361
 					array(
362
-						'name'    => __( 'Floating Labels', 'give' ),
363
-						'desc'    => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) ),
364
-						'id'      => $prefix . 'form_floating_labels',
362
+						'name'    => __('Floating Labels', 'give'),
363
+						'desc'    => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")),
364
+						'id'      => $prefix.'form_floating_labels',
365 365
 						'type'    => 'select',
366 366
 						'options' => array(
367
-							''         => __( 'Use the global setting', 'give' ),
368
-							'enabled'  => __( 'Enabled', 'give' ),
369
-							'disabled' => __( 'Disabled', 'give' ),
367
+							''         => __('Use the global setting', 'give'),
368
+							'enabled'  => __('Enabled', 'give'),
369
+							'disabled' => __('Disabled', 'give'),
370 370
 						),
371 371
 						'default' => 'none',
372 372
 					)
@@ -378,47 +378,47 @@  discard block
 block discarded – undo
378 378
 	/**
379 379
 	 * Terms & Conditions
380 380
 	 */
381
-	$meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array(
381
+	$meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array(
382 382
 		'id'           => 'form_terms_options',
383
-		'title'        => __( 'Terms and Conditions', 'give' ),
384
-		'object_types' => array( 'give_forms' ),
383
+		'title'        => __('Terms and Conditions', 'give'),
384
+		'object_types' => array('give_forms'),
385 385
 		'context'      => 'normal',
386 386
 		'priority'     => 'high', //Show above Content WYSIWYG
387
-		'fields'       => apply_filters( 'give_forms_terms_options_metabox_fields', array(
387
+		'fields'       => apply_filters('give_forms_terms_options_metabox_fields', array(
388 388
 				//Donation Option
389 389
 				array(
390
-					'name'        => __( 'Terms and Conditions', 'give' ),
391
-					'description' => __( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ),
392
-					'id'          => $prefix . 'terms_option',
390
+					'name'        => __('Terms and Conditions', 'give'),
391
+					'description' => __('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'),
392
+					'id'          => $prefix.'terms_option',
393 393
 					'type'        => 'select',
394
-					'options'     => apply_filters( 'give_forms_content_options_select', array(
395
-							'none' => __( 'No', 'give' ),
396
-							'yes'  => __( 'Yes', 'give' ),
394
+					'options'     => apply_filters('give_forms_content_options_select', array(
395
+							'none' => __('No', 'give'),
396
+							'yes'  => __('Yes', 'give'),
397 397
 						)
398 398
 					),
399 399
 					'default'     => 'none',
400 400
 				),
401 401
 				array(
402
-					'id'          => $prefix . 'agree_label',
403
-					'name'        => __( 'Agree to Terms Label', 'give' ),
404
-					'desc'        => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ),
402
+					'id'          => $prefix.'agree_label',
403
+					'name'        => __('Agree to Terms Label', 'give'),
404
+					'desc'        => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'),
405 405
 					'type'        => 'text',
406 406
 					'row_classes' => 'give-subfield',
407 407
 					'size'        => 'regular',
408 408
 					'attributes'  => array(
409
-						'placeholder' => __( 'Agree to Terms?', 'give' ),
409
+						'placeholder' => __('Agree to Terms?', 'give'),
410 410
 					),
411 411
 				),
412 412
 				array(
413
-					'id'          => $prefix . 'agree_text',
413
+					'id'          => $prefix.'agree_text',
414 414
 					'row_classes' => 'give-subfield',
415
-					'name'        => __( 'Agreement Text', 'give' ),
416
-					'desc'        => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ),
415
+					'name'        => __('Agreement Text', 'give'),
416
+					'desc'        => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'),
417 417
 					'type'        => 'wysiwyg'
418 418
 				),
419 419
 			)
420 420
 		)
421
-	) );
421
+	));
422 422
 
423 423
 	return $meta_boxes;
424 424
 
@@ -432,11 +432,11 @@  discard block
 block discarded – undo
432 432
 
433 433
 	<div class="table-container">
434 434
 		<div class="table-row">
435
-			<div class="table-cell col-amount"><?php _e( 'Amount', 'give' ); ?></div>
436
-			<div class="table-cell col-text"><?php _e( 'Text', 'give' ); ?></div>
437
-			<div class="table-cell col-default"><?php _e( 'Default', 'give' ); ?></div>
438
-			<?php do_action( 'give_donation_levels_table_head' ); ?>
439
-			<div class="table-cell col-sort"><?php _e( 'Sort', 'give' ); ?></div>
435
+			<div class="table-cell col-amount"><?php _e('Amount', 'give'); ?></div>
436
+			<div class="table-cell col-text"><?php _e('Text', 'give'); ?></div>
437
+			<div class="table-cell col-default"><?php _e('Default', 'give'); ?></div>
438
+			<?php do_action('give_donation_levels_table_head'); ?>
439
+			<div class="table-cell col-sort"><?php _e('Sort', 'give'); ?></div>
440 440
 
441 441
 		</div>
442 442
 	</div>
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 	<?php
445 445
 }
446 446
 
447
-add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 );
447
+add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10);
448 448
 
449 449
 
450 450
 /**
@@ -461,25 +461,25 @@  discard block
 block discarded – undo
461 461
  * @param $object_type
462 462
  * @param $field_type_object
463 463
  */
464
-function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
464
+function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
465 465
 
466
-	$escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' );
466
+	$escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : '');
467 467
 
468 468
 	$field_options_array = array(
469 469
 		'class' => 'give-hidden give-level-id-input',
470
-		'name'  => $field_type_object->_name( '[level_id]' ),
471
-		'id'    => $field_type_object->_id( '_level_id' ),
470
+		'name'  => $field_type_object->_name('[level_id]'),
471
+		'id'    => $field_type_object->_id('_level_id'),
472 472
 		'value' => $escaped_value,
473 473
 		'type'  => 'number',
474 474
 		'desc'  => '',
475 475
 	);
476 476
 
477
-	echo '<p class="give-level-id">' . $escaped_value . '</p>';
478
-	echo $field_type_object->input( $field_options_array );
477
+	echo '<p class="give-level-id">'.$escaped_value.'</p>';
478
+	echo $field_type_object->input($field_options_array);
479 479
 
480 480
 }
481 481
 
482
-add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 );
482
+add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5);
483 483
 
484 484
 
485 485
 /**
@@ -491,13 +491,13 @@  discard block
 block discarded – undo
491 491
  * @param $object_type
492 492
  * @param $field_type_object
493 493
  */
494
-function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) {
495
-	echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>';
496
-	echo '<label for="' . $field_object->args['id'] . '">Default</label>';
494
+function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) {
495
+	echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>';
496
+	echo '<label for="'.$field_object->args['id'].'">Default</label>';
497 497
 
498 498
 }
499 499
 
500
-add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 );
500
+add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5);
501 501
 
502 502
 
503 503
 /**
@@ -507,20 +507,20 @@  discard block
 block discarded – undo
507 507
  */
508 508
 function give_add_shortcode_to_publish_metabox() {
509 509
 
510
-	if ( 'give_forms' !== get_post_type() ) {
510
+	if ('give_forms' !== get_post_type()) {
511 511
 		return false;
512 512
 	}
513 513
 
514 514
 	global $post;
515 515
 
516 516
 	//Only enqueue scripts for CPT on post type screen
517
-	if ( 'give_forms' === $post->post_type ) {
517
+	if ('give_forms' === $post->post_type) {
518 518
 		//Shortcode column with select all input
519
-		$shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' );
520
-		echo '<div class="shortcode-wrap box-sizing"><label>' . __( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="' . $shortcode . '"></div>';
519
+		$shortcode = htmlentities('[give_form id="'.$post->ID.'"]');
520
+		echo '<div class="shortcode-wrap box-sizing"><label>'.__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="'.$shortcode.'"></div>';
521 521
 
522 522
 	}
523 523
 
524 524
 }
525 525
 
526
-add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' );
526
+add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox');
Please login to merge, or discard this patch.
give.php 1 patch
Spacing   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
  */
41 41
 
42 42
 // Exit if accessed directly
43
-if ( ! defined( 'ABSPATH' ) ) {
43
+if ( ! defined('ABSPATH')) {
44 44
 	exit;
45 45
 }
46 46
 
47
-if ( ! class_exists( 'Give' ) ) :
47
+if ( ! class_exists('Give')) :
48 48
 	/**
49 49
 	 * Main Give Class
50 50
 	 *
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 		 * @return    Give
160 160
 		 */
161 161
 		public static function instance() {
162
-			if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) {
162
+			if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) {
163 163
 				self::$instance = new Give;
164 164
 				self::$instance->setup_constants();
165 165
 
166
-				add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) );
166
+				add_action('plugins_loaded', array(self::$instance, 'load_textdomain'));
167 167
 
168 168
 				self::$instance->includes();
169 169
 				self::$instance->roles           = new Give_Roles();
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 		 */
196 196
 		public function __clone() {
197 197
 			// Cloning instances of the class is forbidden
198
-			_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
198
+			_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
199 199
 		}
200 200
 
201 201
 		/**
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 		 */
208 208
 		public function __wakeup() {
209 209
 			// Unserializing instances of the class is forbidden
210
-			_doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'give' ), '1.0' );
210
+			_doing_it_wrong(__FUNCTION__, __('Cheatin&#8217; huh?', 'give'), '1.0');
211 211
 		}
212 212
 
213 213
 		/**
@@ -220,33 +220,33 @@  discard block
 block discarded – undo
220 220
 		private function setup_constants() {
221 221
 
222 222
 			// Plugin version
223
-			if ( ! defined( 'GIVE_VERSION' ) ) {
224
-				define( 'GIVE_VERSION', '1.5.2' );
223
+			if ( ! defined('GIVE_VERSION')) {
224
+				define('GIVE_VERSION', '1.5.2');
225 225
 			}
226 226
 
227 227
 			// Plugin Folder Path
228
-			if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
229
-				define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
228
+			if ( ! defined('GIVE_PLUGIN_DIR')) {
229
+				define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__));
230 230
 			}
231 231
 
232 232
 			// Plugin Folder URL
233
-			if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
234
-				define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
233
+			if ( ! defined('GIVE_PLUGIN_URL')) {
234
+				define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__));
235 235
 			}
236 236
 
237 237
 			// Plugin Basename aka: "give/give.php"
238
-			if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
239
-				define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
238
+			if ( ! defined('GIVE_PLUGIN_BASENAME')) {
239
+				define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__));
240 240
 			}
241 241
 
242 242
 			// Plugin Root File
243
-			if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
244
-				define( 'GIVE_PLUGIN_FILE', __FILE__ );
243
+			if ( ! defined('GIVE_PLUGIN_FILE')) {
244
+				define('GIVE_PLUGIN_FILE', __FILE__);
245 245
 			}
246 246
 
247 247
 			// Make sure CAL_GREGORIAN is defined
248
-			if ( ! defined( 'CAL_GREGORIAN' ) ) {
249
-				define( 'CAL_GREGORIAN', 1 );
248
+			if ( ! defined('CAL_GREGORIAN')) {
249
+				define('CAL_GREGORIAN', 1);
250 250
 			}
251 251
 		}
252 252
 
@@ -260,109 +260,109 @@  discard block
 block discarded – undo
260 260
 		private function includes() {
261 261
 			global $give_options;
262 262
 
263
-			require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php';
263
+			require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php';
264 264
 			$give_options = give_get_settings();
265 265
 
266
-			require_once GIVE_PLUGIN_DIR . 'includes/post-types.php';
267
-			require_once GIVE_PLUGIN_DIR . 'includes/scripts.php';
268
-			require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php';
269
-			require_once GIVE_PLUGIN_DIR . 'includes/actions.php';
270
-			require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php';
271
-
272
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php';
273
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php';
274
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php';
275
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php';
276
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php';
277
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php';
278
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php';
279
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php';
280
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php';
281
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php';
282
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php';
283
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php';
284
-			require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php';
285
-
286
-			require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php';
287
-			require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php';
288
-			require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php';
289
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php';
290
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php';
291
-			require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php';
292
-			require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php';
293
-			require_once GIVE_PLUGIN_DIR . 'includes/formatting.php';
294
-			require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php';
295
-			require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php';
296
-			require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php';
297
-			require_once GIVE_PLUGIN_DIR . 'includes/login-register.php';
298
-			require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php';
299
-			require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php';
300
-			require_once GIVE_PLUGIN_DIR . 'includes/deprecated-functions.php';
301
-
302
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php';
303
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php';
304
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php';
305
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php';
306
-			require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php';
307
-
308
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php';
309
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php';
310
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php';
311
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php';
312
-			require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php';
313
-
314
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php';
315
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php';
316
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php';
317
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php';
318
-			require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php';
319
-
320
-			if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
321
-
322
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php';
323
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php';
324
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php';
325
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php';
326
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php';
327
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php';
328
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php';
329
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php';
330
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php';
331
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php';
332
-
333
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php';
334
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php';
335
-
336
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php';
337
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php';
338
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php';
339
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php';
340
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php';
341
-
342
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php';
343
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php';
344
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php';
345
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php';
346
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php';
347
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php';
348
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php';
349
-
350
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php';
351
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php';
352
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php';
353
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php';
354
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php';
355
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php';
356
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php';
357
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php';
358
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php';
359
-
360
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php';
361
-				require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php';
266
+			require_once GIVE_PLUGIN_DIR.'includes/post-types.php';
267
+			require_once GIVE_PLUGIN_DIR.'includes/scripts.php';
268
+			require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php';
269
+			require_once GIVE_PLUGIN_DIR.'includes/actions.php';
270
+			require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php';
271
+
272
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php';
273
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php';
274
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php';
275
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php';
276
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php';
277
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php';
278
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php';
279
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php';
280
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php';
281
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php';
282
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php';
283
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php';
284
+			require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php';
285
+
286
+			require_once GIVE_PLUGIN_DIR.'includes/country-functions.php';
287
+			require_once GIVE_PLUGIN_DIR.'includes/template-functions.php';
288
+			require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php';
289
+			require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php';
290
+			require_once GIVE_PLUGIN_DIR.'includes/forms/template.php';
291
+			require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php';
292
+			require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php';
293
+			require_once GIVE_PLUGIN_DIR.'includes/formatting.php';
294
+			require_once GIVE_PLUGIN_DIR.'includes/price-functions.php';
295
+			require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php';
296
+			require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php';
297
+			require_once GIVE_PLUGIN_DIR.'includes/login-register.php';
298
+			require_once GIVE_PLUGIN_DIR.'includes/user-functions.php';
299
+			require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php';
300
+			require_once GIVE_PLUGIN_DIR.'includes/deprecated-functions.php';
301
+
302
+			require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php';
303
+			require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php';
304
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php';
305
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php';
306
+			require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php';
307
+
308
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php';
309
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php';
310
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php';
311
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php';
312
+			require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php';
313
+
314
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php';
315
+			require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php';
316
+			require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php';
317
+			require_once GIVE_PLUGIN_DIR.'includes/emails/template.php';
318
+			require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php';
319
+
320
+			if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
321
+
322
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php';
323
+				require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php';
324
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php';
325
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php';
326
+				require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php';
327
+				require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php';
328
+				require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php';
329
+				require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php';
330
+				require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php';
331
+				require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php';
332
+
333
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php';
334
+				require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php';
335
+
336
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php';
337
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php';
338
+				require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php';
339
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php';
340
+				require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php';
341
+
342
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php';
343
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php';
344
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php';
345
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php';
346
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php';
347
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php';
348
+				require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php';
349
+
350
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php';
351
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php';
352
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php';
353
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php';
354
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php';
355
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php';
356
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php';
357
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php';
358
+				require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php';
359
+
360
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php';
361
+				require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php';
362 362
 
363 363
 			}
364 364
 
365
-			require_once GIVE_PLUGIN_DIR . 'includes/install.php';
365
+			require_once GIVE_PLUGIN_DIR.'includes/install.php';
366 366
 
367 367
 		}
368 368
 
@@ -375,26 +375,26 @@  discard block
 block discarded – undo
375 375
 		 */
376 376
 		public function load_textdomain() {
377 377
 			// Set filter for Give's languages directory
378
-			$give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/';
379
-			$give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir );
378
+			$give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/';
379
+			$give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
380 380
 
381 381
 			// Traditional WordPress plugin locale filter
382
-			$locale = apply_filters( 'plugin_locale', get_locale(), 'give' );
383
-			$mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale );
382
+			$locale = apply_filters('plugin_locale', get_locale(), 'give');
383
+			$mofile = sprintf('%1$s-%2$s.mo', 'give', $locale);
384 384
 
385 385
 			// Setup paths to current locale file
386
-			$mofile_local  = $give_lang_dir . $mofile;
387
-			$mofile_global = WP_LANG_DIR . '/give/' . $mofile;
386
+			$mofile_local  = $give_lang_dir.$mofile;
387
+			$mofile_global = WP_LANG_DIR.'/give/'.$mofile;
388 388
 
389
-			if ( file_exists( $mofile_global ) ) {
389
+			if (file_exists($mofile_global)) {
390 390
 				// Look in global /wp-content/languages/give folder
391
-				load_textdomain( 'give', $mofile_global );
392
-			} elseif ( file_exists( $mofile_local ) ) {
391
+				load_textdomain('give', $mofile_global);
392
+			} elseif (file_exists($mofile_local)) {
393 393
 				// Look in local location from filter `give_languages_directory`
394
-				load_textdomain( 'give', $mofile_local );
394
+				load_textdomain('give', $mofile_local);
395 395
 			} else {
396 396
 				// Load the default language files packaged up w/ Give
397
-				load_plugin_textdomain( 'give', false, $give_lang_dir );
397
+				load_plugin_textdomain('give', false, $give_lang_dir);
398 398
 			}
399 399
 		}
400 400
 	}
Please login to merge, or discard this patch.
includes/admin/upgrades/upgrade-functions.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Exit if accessed directly
16
-if ( ! defined( 'ABSPATH' ) ) {
16
+if ( ! defined('ABSPATH')) {
17 17
 	exit;
18 18
 }
19 19
 
@@ -25,18 +25,18 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function give_show_upgrade_notices() {
27 27
 
28
-	if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) {
28
+	if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') {
29 29
 		return;
30 30
 	} // Don't show notices on the upgrades page
31 31
 
32
-	$give_version = get_option( 'give_version' );
32
+	$give_version = get_option('give_version');
33 33
 
34
-	if ( ! $give_version ) {
34
+	if ( ! $give_version) {
35 35
 		// 1.0 is the first version to use this option so we must add it
36 36
 		$give_version = '1.0';
37 37
 	}
38 38
 
39
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
39
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
40 40
 
41 41
 	/*
42 42
 	 *  NOTICE:
@@ -47,18 +47,18 @@  discard block
 block discarded – undo
47 47
 	 */
48 48
 
49 49
 	//v1.3.2 Upgrades
50
-	if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) {
50
+	if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) {
51 51
 		printf(
52
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
53
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) )
52
+			'<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
53
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id'))
54 54
 		);
55 55
 	}
56 56
 
57 57
 	//v1.3.4 Upgrades //ensure the user has gone through 1.3.4
58
-	if ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ) {
58
+	if (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))) {
59 59
 		printf(
60
-			'<div class="updated"><p>' . __( 'Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>',
61
-			esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) )
60
+			'<div class="updated"><p>'.__('Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>',
61
+			esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status'))
62 62
 		);
63 63
 	}
64 64
 
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 
69 69
 }
70 70
 
71
-add_action( 'admin_notices', 'give_show_upgrade_notices' );
71
+add_action('admin_notices', 'give_show_upgrade_notices');
72 72
 
73 73
 /**
74 74
  * Triggers all upgrade functions
@@ -80,26 +80,26 @@  discard block
 block discarded – undo
80 80
  */
81 81
 function give_trigger_upgrades() {
82 82
 
83
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
84
-		wp_die( __( 'You do not have permission to do Give upgrades', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
83
+	if ( ! current_user_can('manage_give_settings')) {
84
+		wp_die(__('You do not have permission to do Give upgrades', 'give'), __('Error', 'give'), array('response' => 403));
85 85
 	}
86 86
 
87
-	$give_version = get_option( 'give_version' );
87
+	$give_version = get_option('give_version');
88 88
 
89
-	if ( ! $give_version ) {
89
+	if ( ! $give_version) {
90 90
 		// 1.0 is the first version to use this option so we must add it
91 91
 		$give_version = '1.0';
92
-		add_option( 'give_version', $give_version );
92
+		add_option('give_version', $give_version);
93 93
 	}
94 94
 
95
-	update_option( 'give_version', GIVE_VERSION );
95
+	update_option('give_version', GIVE_VERSION);
96 96
 
97
-	if ( DOING_AJAX ) {
98
-		die( 'complete' );
97
+	if (DOING_AJAX) {
98
+		die('complete');
99 99
 	} // Let AJAX know that the upgrade is complete
100 100
 }
101 101
 
102
-add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' );
102
+add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades');
103 103
 
104 104
 /**
105 105
  * Check if the upgrade routine has been run for a specific action
@@ -110,15 +110,15 @@  discard block
 block discarded – undo
110 110
  *
111 111
  * @return bool                   If the action has been added to the completed actions array
112 112
  */
113
-function give_has_upgrade_completed( $upgrade_action = '' ) {
113
+function give_has_upgrade_completed($upgrade_action = '') {
114 114
 
115
-	if ( empty( $upgrade_action ) ) {
115
+	if (empty($upgrade_action)) {
116 116
 		return false;
117 117
 	}
118 118
 
119 119
 	$completed_upgrades = give_get_completed_upgrades();
120 120
 
121
-	return in_array( $upgrade_action, $completed_upgrades );
121
+	return in_array($upgrade_action, $completed_upgrades);
122 122
 
123 123
 }
124 124
 
@@ -131,9 +131,9 @@  discard block
 block discarded – undo
131 131
  *
132 132
  * @return bool                   If the function was successfully added
133 133
  */
134
-function give_set_upgrade_complete( $upgrade_action = '' ) {
134
+function give_set_upgrade_complete($upgrade_action = '') {
135 135
 
136
-	if ( empty( $upgrade_action ) ) {
136
+	if (empty($upgrade_action)) {
137 137
 		return false;
138 138
 	}
139 139
 
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
 	$completed_upgrades[] = $upgrade_action;
142 142
 
143 143
 	// Remove any blanks, and only show uniques
144
-	$completed_upgrades = array_unique( array_values( $completed_upgrades ) );
144
+	$completed_upgrades = array_unique(array_values($completed_upgrades));
145 145
 
146
-	return update_option( 'give_completed_upgrades', $completed_upgrades );
146
+	return update_option('give_completed_upgrades', $completed_upgrades);
147 147
 }
148 148
 
149 149
 /**
@@ -154,9 +154,9 @@  discard block
 block discarded – undo
154 154
  */
155 155
 function give_get_completed_upgrades() {
156 156
 
157
-	$completed_upgrades = get_option( 'give_completed_upgrades' );
157
+	$completed_upgrades = get_option('give_completed_upgrades');
158 158
 
159
-	if ( false === $completed_upgrades ) {
159
+	if (false === $completed_upgrades) {
160 160
 		$completed_upgrades = array();
161 161
 	}
162 162
 
@@ -175,30 +175,30 @@  discard block
 block discarded – undo
175 175
  */
176 176
 function give_v132_upgrade_give_payment_customer_id() {
177 177
 	global $wpdb;
178
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
179
-		wp_die( __( 'You do not have permission to do Give upgrades', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
178
+	if ( ! current_user_can('manage_give_settings')) {
179
+		wp_die(__('You do not have permission to do Give upgrades', 'give'), __('Error', 'give'), array('response' => 403));
180 180
 	}
181 181
 
182
-	ignore_user_abort( true );
182
+	ignore_user_abort(true);
183 183
 
184
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
185
-		@set_time_limit( 0 );
184
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
185
+		@set_time_limit(0);
186 186
 	}
187 187
 
188 188
 	//UPDATE DB METAKEYS
189 189
 	$sql   = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'";
190
-	$query = $wpdb->query( $sql );
190
+	$query = $wpdb->query($sql);
191 191
 
192
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
193
-	give_set_upgrade_complete( 'upgrade_give_payment_customer_id' );
194
-	delete_option( 'give_doing_upgrade' );
195
-	wp_redirect( admin_url() );
192
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
193
+	give_set_upgrade_complete('upgrade_give_payment_customer_id');
194
+	delete_option('give_doing_upgrade');
195
+	wp_redirect(admin_url());
196 196
 	exit;
197 197
 
198 198
 
199 199
 }
200 200
 
201
-add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' );
201
+add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id');
202 202
 
203 203
 /**
204 204
  * Upgrades the Offline Status
@@ -212,14 +212,14 @@  discard block
 block discarded – undo
212 212
 
213 213
 	global $wpdb;
214 214
 
215
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
216
-		wp_die( __( 'You do not have permission to do Give upgrades', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) );
215
+	if ( ! current_user_can('manage_give_settings')) {
216
+		wp_die(__('You do not have permission to do Give upgrades', 'give'), __('Error', 'give'), array('response' => 403));
217 217
 	}
218 218
 
219
-	ignore_user_abort( true );
219
+	ignore_user_abort(true);
220 220
 
221
-	if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) {
222
-		@set_time_limit( 0 );
221
+	if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) {
222
+		@set_time_limit(0);
223 223
 	}
224 224
 
225 225
 	// Get abandoned offline payments
@@ -229,35 +229,35 @@  discard block
 block discarded – undo
229 229
 	$where .= "AND ( p.post_status = 'abandoned' )";
230 230
 	$where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )";
231 231
 
232
-	$sql            = $select . $join . $where;
233
-	$found_payments = $wpdb->get_col( $sql );
232
+	$sql            = $select.$join.$where;
233
+	$found_payments = $wpdb->get_col($sql);
234 234
 
235 235
 
236
-	foreach ( $found_payments as $payment ) {
236
+	foreach ($found_payments as $payment) {
237 237
 
238 238
 		//Only change ones marked abandoned since our release last week
239 239
 		//because the admin may have marked some abandoned themselves
240
-		$modified_time = get_post_modified_time( 'U', false, $payment );
240
+		$modified_time = get_post_modified_time('U', false, $payment);
241 241
 
242 242
 		//1450124863 =  12/10/2015 20:42:25
243
-		if ( $modified_time >= 1450124863 ) {
243
+		if ($modified_time >= 1450124863) {
244 244
 
245
-			give_update_payment_status( $payment, 'pending' );
245
+			give_update_payment_status($payment, 'pending');
246 246
 
247 247
 		}
248 248
 
249 249
 	}
250 250
 
251
-	update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
252
-	give_set_upgrade_complete( 'upgrade_give_offline_status' );
253
-	delete_option( 'give_doing_upgrade' );
254
-	wp_redirect( admin_url() );
251
+	update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
252
+	give_set_upgrade_complete('upgrade_give_offline_status');
253
+	delete_option('give_doing_upgrade');
254
+	wp_redirect(admin_url());
255 255
 	exit;
256 256
 
257 257
 
258 258
 }
259 259
 
260
-add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' );
260
+add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status');
261 261
 
262 262
 
263 263
 /**
@@ -269,17 +269,17 @@  discard block
 block discarded – undo
269 269
  */
270 270
 function give_v152_cleanup_users() {
271 271
 
272
-	$give_version = get_option( 'give_version' );
272
+	$give_version = get_option('give_version');
273 273
 
274
-	if ( ! $give_version ) {
274
+	if ( ! $give_version) {
275 275
 		// 1.0 is the first version to use this option so we must add it
276 276
 		$give_version = '1.0';
277 277
 	}
278 278
 
279
-	$give_version = preg_replace( '/[^0-9.].*/', '', $give_version );
279
+	$give_version = preg_replace('/[^0-9.].*/', '', $give_version);
280 280
 
281 281
 	//v1.5.2 Upgrades
282
-	if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) {
282
+	if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) {
283 283
 
284 284
 		//Delete all caps with "ss"
285 285
 		//Also delete all unused "campaign" roles
@@ -326,9 +326,9 @@  discard block
 block discarded – undo
326 326
 		);
327 327
 	
328 328
 		global $wp_roles;
329
-		foreach ( $delete_caps as $cap ) {
330
-			foreach ( array_keys( $wp_roles->roles ) as $role ) {
331
-				$wp_roles->remove_cap( $role, $cap );
329
+		foreach ($delete_caps as $cap) {
330
+			foreach (array_keys($wp_roles->roles) as $role) {
331
+				$wp_roles->remove_cap($role, $cap);
332 332
 			}
333 333
 		}
334 334
 	
@@ -338,12 +338,12 @@  discard block
 block discarded – undo
338 338
 		$roles->add_caps();
339 339
 		
340 340
 		//The Update Ran
341
-		update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) );
342
-		give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' );
343
-		delete_option( 'give_doing_upgrade' );
341
+		update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION));
342
+		give_set_upgrade_complete('upgrade_give_user_caps_cleanup');
343
+		delete_option('give_doing_upgrade');
344 344
 
345 345
 	}
346 346
 
347 347
 }
348 348
 
349
-add_action( 'admin_init', 'give_v152_cleanup_users' );
350 349
\ No newline at end of file
350
+add_action('admin_init', 'give_v152_cleanup_users');
351 351
\ No newline at end of file
Please login to merge, or discard this patch.
includes/post-types.php 1 patch
Spacing   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -23,40 +23,40 @@  discard block
 block discarded – undo
23 23
 function give_setup_post_types() {
24 24
 
25 25
 	/** Give Forms Post Type */
26
-	$give_forms_singular = give_get_option( 'disable_forms_singular' ) !== 'on' ? true : false;
26
+	$give_forms_singular = give_get_option('disable_forms_singular') !== 'on' ? true : false;
27 27
 
28
-	$give_forms_archives = give_get_option( 'disable_forms_archives' ) !== 'on' ? true : false;
28
+	$give_forms_archives = give_get_option('disable_forms_archives') !== 'on' ? true : false;
29 29
 
30
-	$give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations';
30
+	$give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations';
31 31
 	//support for old 'GIVE_FORMS_SLUG' constant
32
-	if ( defined( 'GIVE_FORMS_SLUG' ) ) {
32
+	if (defined('GIVE_FORMS_SLUG')) {
33 33
 		$give_forms_slug = GIVE_FORMS_SLUG;
34 34
 	}
35 35
 
36
-	$give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array(
36
+	$give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array(
37 37
 		'slug'       => $give_forms_slug,
38 38
 		'with_front' => false
39 39
 	);
40 40
 
41
-	$give_forms_labels = apply_filters( 'give_forms_labels', array(
42
-		'name'               => __( 'Donation %2$s', 'give' ),
41
+	$give_forms_labels = apply_filters('give_forms_labels', array(
42
+		'name'               => __('Donation %2$s', 'give'),
43 43
 		'singular_name'      => '%1$s',
44
-		'add_new'            => __( 'Add %1$s', 'give' ),
45
-		'add_new_item'       => __( 'Add New Donation %1$s', 'give' ),
46
-		'edit_item'          => __( 'Edit Donation %1$s', 'give' ),
47
-		'new_item'           => __( 'New %1$s', 'give' ),
48
-		'all_items'          => __( 'All %2$s', 'give' ),
49
-		'view_item'          => __( 'View %1$s', 'give' ),
50
-		'search_items'       => __( 'Search %2$s', 'give' ),
51
-		'not_found'          => __( 'No %2$s found', 'give' ),
52
-		'not_found_in_trash' => __( 'No %2$s found in Trash', 'give' ),
44
+		'add_new'            => __('Add %1$s', 'give'),
45
+		'add_new_item'       => __('Add New Donation %1$s', 'give'),
46
+		'edit_item'          => __('Edit Donation %1$s', 'give'),
47
+		'new_item'           => __('New %1$s', 'give'),
48
+		'all_items'          => __('All %2$s', 'give'),
49
+		'view_item'          => __('View %1$s', 'give'),
50
+		'search_items'       => __('Search %2$s', 'give'),
51
+		'not_found'          => __('No %2$s found', 'give'),
52
+		'not_found_in_trash' => __('No %2$s found in Trash', 'give'),
53 53
 		'parent_item_colon'  => '',
54
-		'menu_name'          => apply_filters( 'give_menu_name', __( 'Donations', 'give' ) ),
55
-		'name_admin_bar'     => apply_filters( 'give_name_admin_bar_name', __( 'Donation Form', 'give' ) )
56
-	) );
54
+		'menu_name'          => apply_filters('give_menu_name', __('Donations', 'give')),
55
+		'name_admin_bar'     => apply_filters('give_name_admin_bar_name', __('Donation Form', 'give'))
56
+	));
57 57
 
58
-	foreach ( $give_forms_labels as $key => $value ) {
59
-		$give_forms_labels[ $key ] = sprintf( $value, give_get_forms_label_singular(), give_get_forms_label_plural() );
58
+	foreach ($give_forms_labels as $key => $value) {
59
+		$give_forms_labels[$key] = sprintf($value, give_get_forms_label_singular(), give_get_forms_label_plural());
60 60
 	}
61 61
 
62 62
 	//Default give_forms supports
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 	);
70 70
 
71 71
 	//Has the user disabled the excerpt
72
-	if ( give_get_option( 'disable_forms_excerpt' ) === 'on' ) {
73
-		unset( $give_form_supports[2] );
72
+	if (give_get_option('disable_forms_excerpt') === 'on') {
73
+		unset($give_form_supports[2]);
74 74
 	}
75 75
 
76 76
 	//Has user disabled the featured image?
77
-	if ( give_get_option( 'disable_form_featured_img' ) === 'on' ) {
78
-		unset( $give_form_supports[1] );
79
-		remove_action( 'give_before_single_form_summary', 'give_show_form_images' );
77
+	if (give_get_option('disable_form_featured_img') === 'on') {
78
+		unset($give_form_supports[1]);
79
+		remove_action('give_before_single_form_summary', 'give_show_form_images');
80 80
 	}
81 81
 
82 82
 	$give_forms_args = array(
@@ -92,42 +92,42 @@  discard block
 block discarded – undo
92 92
 		'has_archive'        => $give_forms_archives,
93 93
 		'menu_icon'          => 'dashicons-give',
94 94
 		'hierarchical'       => false,
95
-		'supports'           => apply_filters( 'give_forms_supports', $give_form_supports ),
95
+		'supports'           => apply_filters('give_forms_supports', $give_form_supports),
96 96
 	);
97
-	register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) );
97
+	register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args));
98 98
 	
99 99
 	/** Payment Post Type */
100 100
 	$payment_labels = array(
101
-		'name'               => _x( 'Donations', 'post type general name', 'give' ),
102
-		'singular_name'      => _x( 'Donation', 'post type singular name', 'give' ),
103
-		'add_new'            => __( 'Add New', 'give' ),
104
-		'add_new_item'       => __( 'Add New Donation', 'give' ),
105
-		'edit_item'          => __( 'Edit Donation', 'give' ),
106
-		'new_item'           => __( 'New Donation', 'give' ),
107
-		'all_items'          => __( 'All Donations', 'give' ),
108
-		'view_item'          => __( 'View Donation', 'give' ),
109
-		'search_items'       => __( 'Search Donations', 'give' ),
110
-		'not_found'          => __( 'No Donations found', 'give' ),
111
-		'not_found_in_trash' => __( 'No Donations found in Trash', 'give' ),
101
+		'name'               => _x('Donations', 'post type general name', 'give'),
102
+		'singular_name'      => _x('Donation', 'post type singular name', 'give'),
103
+		'add_new'            => __('Add New', 'give'),
104
+		'add_new_item'       => __('Add New Donation', 'give'),
105
+		'edit_item'          => __('Edit Donation', 'give'),
106
+		'new_item'           => __('New Donation', 'give'),
107
+		'all_items'          => __('All Donations', 'give'),
108
+		'view_item'          => __('View Donation', 'give'),
109
+		'search_items'       => __('Search Donations', 'give'),
110
+		'not_found'          => __('No Donations found', 'give'),
111
+		'not_found_in_trash' => __('No Donations found in Trash', 'give'),
112 112
 		'parent_item_colon'  => '',
113
-		'menu_name'          => __( 'Transactions', 'give' )
113
+		'menu_name'          => __('Transactions', 'give')
114 114
 	);
115 115
 
116 116
 	$payment_args = array(
117
-		'labels'          => apply_filters( 'give_payment_labels', $payment_labels ),
117
+		'labels'          => apply_filters('give_payment_labels', $payment_labels),
118 118
 		'public'          => false,
119 119
 		'query_var'       => false,
120 120
 		'rewrite'         => false,
121 121
 		'map_meta_cap'    => true,
122 122
 		'capability_type' => 'give_payment',
123
-		'supports'        => array( 'title' ),
123
+		'supports'        => array('title'),
124 124
 		'can_export'      => true
125 125
 	);
126
-	register_post_type( 'give_payment', $payment_args );
126
+	register_post_type('give_payment', $payment_args);
127 127
 
128 128
 }
129 129
 
130
-add_action( 'init', 'give_setup_post_types', 1 );
130
+add_action('init', 'give_setup_post_types', 1);
131 131
 
132 132
 
133 133
 /**
@@ -140,30 +140,30 @@  discard block
 block discarded – undo
140 140
  */
141 141
 function give_setup_taxonomies() {
142 142
 
143
-	$slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations';
143
+	$slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations';
144 144
 
145 145
 	/** Categories */
146 146
 	$category_labels = array(
147
-		'name'              => sprintf( _x( '%s Categories', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ),
148
-		'singular_name'     => _x( 'Category', 'taxonomy singular name', 'give' ),
149
-		'search_items'      => __( 'Search Categories', 'give' ),
150
-		'all_items'         => __( 'All Categories', 'give' ),
151
-		'parent_item'       => __( 'Parent Category', 'give' ),
152
-		'parent_item_colon' => __( 'Parent Category:', 'give' ),
153
-		'edit_item'         => __( 'Edit Category', 'give' ),
154
-		'update_item'       => __( 'Update Category', 'give' ),
155
-		'add_new_item'      => sprintf( __( 'Add New %s Category', 'give' ), give_get_forms_label_singular() ),
156
-		'new_item_name'     => __( 'New Category Name', 'give' ),
157
-		'menu_name'         => __( 'Categories', 'give' ),
147
+		'name'              => sprintf(_x('%s Categories', 'taxonomy general name', 'give'), give_get_forms_label_singular()),
148
+		'singular_name'     => _x('Category', 'taxonomy singular name', 'give'),
149
+		'search_items'      => __('Search Categories', 'give'),
150
+		'all_items'         => __('All Categories', 'give'),
151
+		'parent_item'       => __('Parent Category', 'give'),
152
+		'parent_item_colon' => __('Parent Category:', 'give'),
153
+		'edit_item'         => __('Edit Category', 'give'),
154
+		'update_item'       => __('Update Category', 'give'),
155
+		'add_new_item'      => sprintf(__('Add New %s Category', 'give'), give_get_forms_label_singular()),
156
+		'new_item_name'     => __('New Category Name', 'give'),
157
+		'menu_name'         => __('Categories', 'give'),
158 158
 	);
159 159
 
160
-	$category_args = apply_filters( 'give_forms_category_args', array(
160
+	$category_args = apply_filters('give_forms_category_args', array(
161 161
 			'hierarchical' => true,
162
-			'labels'       => apply_filters( 'give_forms_category_labels', $category_labels ),
162
+			'labels'       => apply_filters('give_forms_category_labels', $category_labels),
163 163
 			'show_ui'      => true,
164 164
 			'query_var'    => 'give_forms_category',
165 165
 			'rewrite'      => array(
166
-				'slug'         => $slug . '/category',
166
+				'slug'         => $slug.'/category',
167 167
 				'with_front'   => false,
168 168
 				'hierarchical' => true
169 169
 			),
@@ -177,34 +177,34 @@  discard block
 block discarded – undo
177 177
 	);
178 178
 
179 179
 	//Does the user want categories?
180
-	if ( give_get_option( 'enable_categories' ) == 'on' ) {
181
-		register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args );
182
-		register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' );
180
+	if (give_get_option('enable_categories') == 'on') {
181
+		register_taxonomy('give_forms_category', array('give_forms'), $category_args);
182
+		register_taxonomy_for_object_type('give_forms_category', 'give_forms');
183 183
 	}
184 184
 
185 185
 
186 186
 	/** Tags */
187 187
 	$tag_labels = array(
188
-		'name'                  => sprintf( _x( '%s Tags', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ),
189
-		'singular_name'         => _x( 'Tag', 'taxonomy singular name', 'give' ),
190
-		'search_items'          => __( 'Search Tags', 'give' ),
191
-		'all_items'             => __( 'All Tags', 'give' ),
192
-		'parent_item'           => __( 'Parent Tag', 'give' ),
193
-		'parent_item_colon'     => __( 'Parent Tag:', 'give' ),
194
-		'edit_item'             => __( 'Edit Tag', 'give' ),
195
-		'update_item'           => __( 'Update Tag', 'give' ),
196
-		'add_new_item'          => __( 'Add New Tag', 'give' ),
197
-		'new_item_name'         => __( 'New Tag Name', 'give' ),
198
-		'menu_name'             => __( 'Tags', 'give' ),
199
-		'choose_from_most_used' => sprintf( __( 'Choose from most used %s tags', 'give' ), give_get_forms_label_singular() ),
188
+		'name'                  => sprintf(_x('%s Tags', 'taxonomy general name', 'give'), give_get_forms_label_singular()),
189
+		'singular_name'         => _x('Tag', 'taxonomy singular name', 'give'),
190
+		'search_items'          => __('Search Tags', 'give'),
191
+		'all_items'             => __('All Tags', 'give'),
192
+		'parent_item'           => __('Parent Tag', 'give'),
193
+		'parent_item_colon'     => __('Parent Tag:', 'give'),
194
+		'edit_item'             => __('Edit Tag', 'give'),
195
+		'update_item'           => __('Update Tag', 'give'),
196
+		'add_new_item'          => __('Add New Tag', 'give'),
197
+		'new_item_name'         => __('New Tag Name', 'give'),
198
+		'menu_name'             => __('Tags', 'give'),
199
+		'choose_from_most_used' => sprintf(__('Choose from most used %s tags', 'give'), give_get_forms_label_singular()),
200 200
 	);
201 201
 
202
-	$tag_args = apply_filters( 'give_forms_tag_args', array(
202
+	$tag_args = apply_filters('give_forms_tag_args', array(
203 203
 			'hierarchical' => false,
204
-			'labels'       => apply_filters( 'give_forms_tag_labels', $tag_labels ),
204
+			'labels'       => apply_filters('give_forms_tag_labels', $tag_labels),
205 205
 			'show_ui'      => true,
206 206
 			'query_var'    => 'give_forms_tag',
207
-			'rewrite'      => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ),
207
+			'rewrite'      => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true),
208 208
 			'capabilities' => array(
209 209
 				'manage_terms' => 'manage_give_forms_terms',
210 210
 				'edit_terms'   => 'edit_give_forms_terms',
@@ -215,15 +215,15 @@  discard block
 block discarded – undo
215 215
 		)
216 216
 	);
217 217
 
218
-	if ( give_get_option( 'enable_tags' ) == 'on' ) {
219
-		register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args );
220
-		register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' );
218
+	if (give_get_option('enable_tags') == 'on') {
219
+		register_taxonomy('give_forms_tag', array('give_forms'), $tag_args);
220
+		register_taxonomy_for_object_type('give_forms_tag', 'give_forms');
221 221
 	}
222 222
 
223 223
 
224 224
 }
225 225
 
226
-add_action( 'init', 'give_setup_taxonomies', 0 );
226
+add_action('init', 'give_setup_taxonomies', 0);
227 227
 
228 228
 
229 229
 /**
@@ -234,11 +234,11 @@  discard block
 block discarded – undo
234 234
  */
235 235
 function give_get_default_form_labels() {
236 236
 	$defaults = array(
237
-		'singular' => __( 'Form', 'give' ),
238
-		'plural'   => __( 'Forms', 'give' )
237
+		'singular' => __('Form', 'give'),
238
+		'plural'   => __('Forms', 'give')
239 239
 	);
240 240
 
241
-	return apply_filters( 'give_default_form_name', $defaults );
241
+	return apply_filters('give_default_form_name', $defaults);
242 242
 }
243 243
 
244 244
 /**
@@ -250,10 +250,10 @@  discard block
 block discarded – undo
250 250
  *
251 251
  * @return string $defaults['singular'] Singular label
252 252
  */
253
-function give_get_forms_label_singular( $lowercase = false ) {
253
+function give_get_forms_label_singular($lowercase = false) {
254 254
 	$defaults = give_get_default_form_labels();
255 255
 
256
-	return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular'];
256
+	return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular'];
257 257
 }
258 258
 
259 259
 /**
@@ -262,10 +262,10 @@  discard block
 block discarded – undo
262 262
  * @since 1.0
263 263
  * @return string $defaults['plural'] Plural label
264 264
  */
265
-function give_get_forms_label_plural( $lowercase = false ) {
265
+function give_get_forms_label_plural($lowercase = false) {
266 266
 	$defaults = give_get_default_form_labels();
267 267
 
268
-	return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural'];
268
+	return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural'];
269 269
 }
270 270
 
271 271
 /**
@@ -277,26 +277,26 @@  discard block
 block discarded – undo
277 277
  *
278 278
  * @return string $title New placeholder text
279 279
  */
280
-function give_change_default_title( $title ) {
280
+function give_change_default_title($title) {
281 281
 	// If a frontend plugin uses this filter (check extensions before changing this function)
282
-	if ( ! is_admin() ) {
282
+	if ( ! is_admin()) {
283 283
 		$label = give_get_forms_label_singular();
284
-		$title = sprintf( __( 'Enter %s title here', 'give' ), $label );
284
+		$title = sprintf(__('Enter %s title here', 'give'), $label);
285 285
 
286 286
 		return $title;
287 287
 	}
288 288
 
289 289
 	$screen = get_current_screen();
290 290
 
291
-	if ( 'give_forms' == $screen->post_type ) {
291
+	if ('give_forms' == $screen->post_type) {
292 292
 		$label = give_get_forms_label_singular();
293
-		$title = sprintf( __( 'Enter %s title here', 'give' ), $label );
293
+		$title = sprintf(__('Enter %s title here', 'give'), $label);
294 294
 	}
295 295
 
296 296
 	return $title;
297 297
 }
298 298
 
299
-add_filter( 'enter_title_here', 'give_change_default_title' );
299
+add_filter('enter_title_here', 'give_change_default_title');
300 300
 
301 301
 /**
302 302
  * Registers Custom Post Statuses which are used by the Payments
@@ -306,50 +306,50 @@  discard block
 block discarded – undo
306 306
  */
307 307
 function give_register_post_type_statuses() {
308 308
 	// Payment Statuses
309
-	register_post_status( 'refunded', array(
310
-		'label'                     => _x( 'Refunded', 'Refunded payment status', 'give' ),
309
+	register_post_status('refunded', array(
310
+		'label'                     => _x('Refunded', 'Refunded payment status', 'give'),
311 311
 		'public'                    => true,
312 312
 		'exclude_from_search'       => false,
313 313
 		'show_in_admin_all_list'    => true,
314 314
 		'show_in_admin_status_list' => true,
315
-		'label_count'               => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' )
316
-	) );
317
-	register_post_status( 'failed', array(
318
-		'label'                     => _x( 'Failed', 'Failed payment status', 'give' ),
315
+		'label_count'               => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give')
316
+	));
317
+	register_post_status('failed', array(
318
+		'label'                     => _x('Failed', 'Failed payment status', 'give'),
319 319
 		'public'                    => true,
320 320
 		'exclude_from_search'       => false,
321 321
 		'show_in_admin_all_list'    => true,
322 322
 		'show_in_admin_status_list' => true,
323
-		'label_count'               => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' )
324
-	) );
325
-	register_post_status( 'revoked', array(
326
-		'label'                     => _x( 'Revoked', 'Revoked payment status', 'give' ),
323
+		'label_count'               => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give')
324
+	));
325
+	register_post_status('revoked', array(
326
+		'label'                     => _x('Revoked', 'Revoked payment status', 'give'),
327 327
 		'public'                    => true,
328 328
 		'exclude_from_search'       => false,
329 329
 		'show_in_admin_all_list'    => true,
330 330
 		'show_in_admin_status_list' => true,
331
-		'label_count'               => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' )
332
-	) );
333
-	register_post_status( 'cancelled', array(
334
-		'label'                     => _x( 'Cancelled', 'Cancelled payment status', 'give' ),
331
+		'label_count'               => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give')
332
+	));
333
+	register_post_status('cancelled', array(
334
+		'label'                     => _x('Cancelled', 'Cancelled payment status', 'give'),
335 335
 		'public'                    => true,
336 336
 		'exclude_from_search'       => false,
337 337
 		'show_in_admin_all_list'    => true,
338 338
 		'show_in_admin_status_list' => true,
339
-		'label_count'               => _n_noop( 'Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give' )
340
-	) );
341
-	register_post_status( 'abandoned', array(
342
-		'label'                     => _x( 'Abandoned', 'Abandoned payment status', 'give' ),
339
+		'label_count'               => _n_noop('Cancelled <span class="count">(%s)</span>', 'Cancelled <span class="count">(%s)</span>', 'give')
340
+	));
341
+	register_post_status('abandoned', array(
342
+		'label'                     => _x('Abandoned', 'Abandoned payment status', 'give'),
343 343
 		'public'                    => true,
344 344
 		'exclude_from_search'       => false,
345 345
 		'show_in_admin_all_list'    => true,
346 346
 		'show_in_admin_status_list' => true,
347
-		'label_count'               => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' )
348
-	) );
347
+		'label_count'               => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give')
348
+	));
349 349
 
350 350
 }
351 351
 
352
-add_action( 'init', 'give_register_post_type_statuses' );
352
+add_action('init', 'give_register_post_type_statuses');
353 353
 
354 354
 /**
355 355
  * Updated Messages
@@ -362,43 +362,43 @@  discard block
 block discarded – undo
362 362
  *
363 363
  * @return array $messages New post updated messages
364 364
  */
365
-function give_updated_messages( $messages ) {
365
+function give_updated_messages($messages) {
366 366
 	global $post, $post_ID;
367 367
 
368
-	$url1 = '<a href="' . get_permalink( $post_ID ) . '">';
368
+	$url1 = '<a href="'.get_permalink($post_ID).'">';
369 369
 	$url2 = give_get_forms_label_singular();
370 370
 	$url3 = '</a>';
371 371
 
372 372
 	$messages['give_forms'] = array(
373
-		1 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
374
-		4 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
375
-		6 => sprintf( __( '%2$s published. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
376
-		7 => sprintf( __( '%2$s saved. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ),
377
-		8 => sprintf( __( '%2$s submitted. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 )
373
+		1 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
374
+		4 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
375
+		6 => sprintf(__('%2$s published. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
376
+		7 => sprintf(__('%2$s saved. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3),
377
+		8 => sprintf(__('%2$s submitted. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3)
378 378
 	);
379 379
 
380 380
 	return $messages;
381 381
 }
382 382
 
383
-add_filter( 'post_updated_messages', 'give_updated_messages' );
383
+add_filter('post_updated_messages', 'give_updated_messages');
384 384
 
385 385
 
386 386
 /**
387 387
  * Setup Post Type Images
388 388
  */
389
-add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 );
389
+add_action('after_setup_theme', 'give_add_thumbnail_support', 10);
390 390
 
391 391
 /**
392 392
  * Ensure post thumbnail support is turned on
393 393
  */
394 394
 function give_add_thumbnail_support() {
395
-	if ( give_get_option( 'disable_form_featured_img' ) === 'on' ) {
395
+	if (give_get_option('disable_form_featured_img') === 'on') {
396 396
 		return;
397 397
 	}
398
-	if ( ! current_theme_supports( 'post-thumbnails' ) ) {
399
-		add_theme_support( 'post-thumbnails' );
398
+	if ( ! current_theme_supports('post-thumbnails')) {
399
+		add_theme_support('post-thumbnails');
400 400
 	}
401
-	add_post_type_support( 'give_forms', 'thumbnail' );
401
+	add_post_type_support('give_forms', 'thumbnail');
402 402
 }
403 403
 
404 404
 /**
@@ -410,19 +410,19 @@  discard block
 block discarded – undo
410 410
 function give_widgets_init() {
411 411
 
412 412
 	//Single Give Forms (disabled if single turned off in settings)
413
-	if ( give_get_option( 'disable_forms_singular' ) !== 'on' && give_get_option( 'disable_form_sidebar' ) !== 'on' ) {
413
+	if (give_get_option('disable_forms_singular') !== 'on' && give_get_option('disable_form_sidebar') !== 'on') {
414 414
 
415
-		register_sidebar( apply_filters( 'give_forms_single_sidebar', array(
416
-			'name'          => __( 'Give Single Form Sidebar', 'give' ),
415
+		register_sidebar(apply_filters('give_forms_single_sidebar', array(
416
+			'name'          => __('Give Single Form Sidebar', 'give'),
417 417
 			'id'            => 'give-forms-sidebar',
418
-			'description'   => __( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ),
418
+			'description'   => __('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'),
419 419
 			'before_widget' => '<div id="%1$s" class="widget %2$s">',
420 420
 			'after_widget'  => '</div>',
421 421
 			'before_title'  => '<h3 class="widgettitle widget-title">',
422 422
 			'after_title'   => '</h3>',
423
-		) ) );
423
+		)));
424 424
 
425 425
 	}
426 426
 }
427 427
 
428
-add_action( 'widgets_init', 'give_widgets_init', 999 );
428
+add_action('widgets_init', 'give_widgets_init', 999);
Please login to merge, or discard this patch.
includes/class-give-customer.php 1 patch
Spacing   +128 added lines, -128 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -97,29 +97,29 @@  discard block
 block discarded – undo
97 97
 	 * @param bool $_id_or_email
98 98
 	 * @param bool $by_user_id
99 99
 	 */
100
-	public function __construct( $_id_or_email = false, $by_user_id = false ) {
100
+	public function __construct($_id_or_email = false, $by_user_id = false) {
101 101
 
102 102
 		$this->db = new Give_DB_Customers;
103 103
 
104
-		if ( false === $_id_or_email || ( is_numeric( $_id_or_email ) && (int) $_id_or_email !== absint( $_id_or_email ) ) ) {
104
+		if (false === $_id_or_email || (is_numeric($_id_or_email) && (int) $_id_or_email !== absint($_id_or_email))) {
105 105
 			return false;
106 106
 		}
107 107
 
108
-		$by_user_id = is_bool( $by_user_id ) ? $by_user_id : false;
108
+		$by_user_id = is_bool($by_user_id) ? $by_user_id : false;
109 109
 
110
-		if ( is_numeric( $_id_or_email ) ) {
110
+		if (is_numeric($_id_or_email)) {
111 111
 			$field = $by_user_id ? 'user_id' : 'id';
112 112
 		} else {
113 113
 			$field = 'email';
114 114
 		}
115 115
 
116
-		$customer = $this->db->get_customer_by( $field, $_id_or_email );
116
+		$customer = $this->db->get_customer_by($field, $_id_or_email);
117 117
 
118
-		if ( empty( $customer ) || ! is_object( $customer ) ) {
118
+		if (empty($customer) || ! is_object($customer)) {
119 119
 			return false;
120 120
 		}
121 121
 
122
-		$this->setup_customer( $customer );
122
+		$this->setup_customer($customer);
123 123
 
124 124
 	}
125 125
 
@@ -132,15 +132,15 @@  discard block
 block discarded – undo
132 132
 	 *
133 133
 	 * @return bool             If the setup was successful or not
134 134
 	 */
135
-	private function setup_customer( $customer ) {
135
+	private function setup_customer($customer) {
136 136
 
137
-		if ( ! is_object( $customer ) ) {
137
+		if ( ! is_object($customer)) {
138 138
 			return false;
139 139
 		}
140 140
 
141
-		foreach ( $customer as $key => $value ) {
141
+		foreach ($customer as $key => $value) {
142 142
 
143
-			switch ( $key ) {
143
+			switch ($key) {
144 144
 
145 145
 				case 'notes':
146 146
 					$this->$key = $this->get_notes();
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 		}
156 156
 
157 157
 		// Customer ID and email are the only things that are necessary, make sure they exist
158
-		if ( ! empty( $this->id ) && ! empty( $this->email ) ) {
158
+		if ( ! empty($this->id) && ! empty($this->email)) {
159 159
 			return true;
160 160
 		}
161 161
 
@@ -168,15 +168,15 @@  discard block
 block discarded – undo
168 168
 	 *
169 169
 	 * @since 1.0
170 170
 	 */
171
-	public function __get( $key ) {
171
+	public function __get($key) {
172 172
 
173
-		if ( method_exists( $this, 'get_' . $key ) ) {
173
+		if (method_exists($this, 'get_'.$key)) {
174 174
 
175
-			return call_user_func( array( $this, 'get_' . $key ) );
175
+			return call_user_func(array($this, 'get_'.$key));
176 176
 
177 177
 		} else {
178 178
 
179
-			return new WP_Error( 'give-customer-invalid-property', sprintf( __( 'Can\'t get property %s', 'give' ), $key ) );
179
+			return new WP_Error('give-customer-invalid-property', sprintf(__('Can\'t get property %s', 'give'), $key));
180 180
 
181 181
 		}
182 182
 
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
 	 *
192 192
 	 * @return mixed        False if not a valid creation, Customer ID if user is found or valid creation
193 193
 	 */
194
-	public function create( $data = array() ) {
194
+	public function create($data = array()) {
195 195
 
196
-		if ( $this->id != 0 || empty( $data ) ) {
196
+		if ($this->id != 0 || empty($data)) {
197 197
 			return false;
198 198
 		}
199 199
 
@@ -201,34 +201,34 @@  discard block
 block discarded – undo
201 201
 			'payment_ids' => ''
202 202
 		);
203 203
 
204
-		$args = wp_parse_args( $data, $defaults );
205
-		$args = $this->sanitize_columns( $args );
204
+		$args = wp_parse_args($data, $defaults);
205
+		$args = $this->sanitize_columns($args);
206 206
 
207
-		if ( empty( $args['email'] ) || ! is_email( $args['email'] ) ) {
207
+		if (empty($args['email']) || ! is_email($args['email'])) {
208 208
 			return false;
209 209
 		}
210 210
 
211
-		if ( ! empty( $args['payment_ids'] ) && is_array( $args['payment_ids'] ) ) {
212
-			$args['payment_ids'] = implode( ',', array_unique( array_values( $args['payment_ids'] ) ) );
211
+		if ( ! empty($args['payment_ids']) && is_array($args['payment_ids'])) {
212
+			$args['payment_ids'] = implode(',', array_unique(array_values($args['payment_ids'])));
213 213
 		}
214 214
 
215
-		do_action( 'give_customer_pre_create', $args );
215
+		do_action('give_customer_pre_create', $args);
216 216
 
217 217
 		$created = false;
218 218
 
219 219
 		// The DB class 'add' implies an update if the customer being asked to be created already exists
220
-		if ( $this->db->add( $data ) ) {
220
+		if ($this->db->add($data)) {
221 221
 
222 222
 			// We've successfully added/updated the customer, reset the class vars with the new data
223
-			$customer = $this->db->get_customer_by( 'email', $args['email'] );
223
+			$customer = $this->db->get_customer_by('email', $args['email']);
224 224
 
225 225
 			// Setup the customer data with the values from DB
226
-			$this->setup_customer( $customer );
226
+			$this->setup_customer($customer);
227 227
 
228 228
 			$created = $this->id;
229 229
 		}
230 230
 
231
-		do_action( 'give_customer_post_create', $created, $args );
231
+		do_action('give_customer_post_create', $created, $args);
232 232
 
233 233
 		return $created;
234 234
 
@@ -243,27 +243,27 @@  discard block
 block discarded – undo
243 243
 	 *
244 244
 	 * @return bool         If the update was successful or not
245 245
 	 */
246
-	public function update( $data = array() ) {
246
+	public function update($data = array()) {
247 247
 
248
-		if ( empty( $data ) ) {
248
+		if (empty($data)) {
249 249
 			return false;
250 250
 		}
251 251
 
252
-		$data = $this->sanitize_columns( $data );
252
+		$data = $this->sanitize_columns($data);
253 253
 
254
-		do_action( 'give_customer_pre_update', $this->id, $data );
254
+		do_action('give_customer_pre_update', $this->id, $data);
255 255
 
256 256
 		$updated = false;
257 257
 
258
-		if ( $this->db->update( $this->id, $data ) ) {
258
+		if ($this->db->update($this->id, $data)) {
259 259
 
260
-			$customer = $this->db->get_customer_by( 'id', $this->id );
261
-			$this->setup_customer( $customer );
260
+			$customer = $this->db->get_customer_by('id', $this->id);
261
+			$this->setup_customer($customer);
262 262
 
263 263
 			$updated = true;
264 264
 		}
265 265
 
266
-		do_action( 'give_customer_post_update', $updated, $this->id, $data );
266
+		do_action('give_customer_post_update', $updated, $this->id, $data);
267 267
 
268 268
 		return $updated;
269 269
 	}
@@ -279,44 +279,44 @@  discard block
 block discarded – undo
279 279
 	 *
280 280
 	 * @return bool            If the attachment was successfuly
281 281
 	 */
282
-	public function attach_payment( $payment_id = 0, $update_stats = true ) {
282
+	public function attach_payment($payment_id = 0, $update_stats = true) {
283 283
 
284
-		if ( empty( $payment_id ) ) {
284
+		if (empty($payment_id)) {
285 285
 			return false;
286 286
 		}
287 287
 
288
-		if ( empty( $this->payment_ids ) ) {
288
+		if (empty($this->payment_ids)) {
289 289
 
290 290
 			$new_payment_ids = $payment_id;
291 291
 
292 292
 		} else {
293 293
 
294
-			$payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) );
294
+			$payment_ids = array_map('absint', explode(',', $this->payment_ids));
295 295
 
296
-			if ( in_array( $payment_id, $payment_ids ) ) {
296
+			if (in_array($payment_id, $payment_ids)) {
297 297
 				$update_stats = false;
298 298
 			}
299 299
 
300 300
 			$payment_ids[] = $payment_id;
301 301
 
302
-			$new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
302
+			$new_payment_ids = implode(',', array_unique(array_values($payment_ids)));
303 303
 
304 304
 		}
305 305
 
306
-		do_action( 'give_customer_pre_attach_payment', $payment_id, $this->id );
306
+		do_action('give_customer_pre_attach_payment', $payment_id, $this->id);
307 307
 
308
-		$payment_added = $this->update( array( 'payment_ids' => $new_payment_ids ) );
308
+		$payment_added = $this->update(array('payment_ids' => $new_payment_ids));
309 309
 
310
-		if ( $payment_added ) {
310
+		if ($payment_added) {
311 311
 
312 312
 			$this->payment_ids = $new_payment_ids;
313 313
 
314 314
 			// We added this payment successfully, increment the stats
315
-			if ( $update_stats ) {
316
-				$payment_amount = give_get_payment_amount( $payment_id );
315
+			if ($update_stats) {
316
+				$payment_amount = give_get_payment_amount($payment_id);
317 317
 
318
-				if ( ! empty( $payment_amount ) ) {
319
-					$this->increase_value( $payment_amount );
318
+				if ( ! empty($payment_amount)) {
319
+					$this->increase_value($payment_amount);
320 320
 				}
321 321
 
322 322
 				$this->increase_purchase_count();
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 
325 325
 		}
326 326
 
327
-		do_action( 'give_customer_post_attach_payment', $payment_added, $payment_id, $this->id );
327
+		do_action('give_customer_post_attach_payment', $payment_added, $payment_id, $this->id);
328 328
 
329 329
 		return $payment_added;
330 330
 	}
@@ -340,50 +340,50 @@  discard block
 block discarded – undo
340 340
 	 *
341 341
 	 * @return boolean             If the removal was successful
342 342
 	 */
343
-	public function remove_payment( $payment_id = 0, $update_stats = true ) {
343
+	public function remove_payment($payment_id = 0, $update_stats = true) {
344 344
 
345
-		if ( empty( $payment_id ) ) {
345
+		if (empty($payment_id)) {
346 346
 			return false;
347 347
 		}
348 348
 
349
-		$payment = new Give_Payment( $payment_id );
349
+		$payment = new Give_Payment($payment_id);
350 350
 
351
-		if ( 'publish' !== $payment->status && 'revoked' !== $payment->status ) {
351
+		if ('publish' !== $payment->status && 'revoked' !== $payment->status) {
352 352
 			$update_stats = false;
353 353
 		}
354 354
 
355 355
 		$new_payment_ids = '';
356 356
 
357
-		if ( ! empty( $this->payment_ids ) ) {
357
+		if ( ! empty($this->payment_ids)) {
358 358
 
359
-			$payment_ids = array_map( 'absint', explode( ',', $this->payment_ids ) );
359
+			$payment_ids = array_map('absint', explode(',', $this->payment_ids));
360 360
 
361
-			$pos = array_search( $payment_id, $payment_ids );
362
-			if ( false === $pos ) {
361
+			$pos = array_search($payment_id, $payment_ids);
362
+			if (false === $pos) {
363 363
 				return false;
364 364
 			}
365 365
 
366
-			unset( $payment_ids[ $pos ] );
367
-			$payment_ids = array_filter( $payment_ids );
366
+			unset($payment_ids[$pos]);
367
+			$payment_ids = array_filter($payment_ids);
368 368
 
369
-			$new_payment_ids = implode( ',', array_unique( array_values( $payment_ids ) ) );
369
+			$new_payment_ids = implode(',', array_unique(array_values($payment_ids)));
370 370
 
371 371
 		}
372 372
 
373
-		do_action( 'give_customer_pre_remove_payment', $payment_id, $this->id );
373
+		do_action('give_customer_pre_remove_payment', $payment_id, $this->id);
374 374
 
375
-		$payment_removed = $this->update( array( 'payment_ids' => $new_payment_ids ) );
375
+		$payment_removed = $this->update(array('payment_ids' => $new_payment_ids));
376 376
 
377
-		if ( $payment_removed ) {
377
+		if ($payment_removed) {
378 378
 
379 379
 			$this->payment_ids = $new_payment_ids;
380 380
 
381
-			if ( $update_stats ) {
381
+			if ($update_stats) {
382 382
 				// We removed this payment successfully, decrement the stats
383
-				$payment_amount = give_get_payment_amount( $payment_id );
383
+				$payment_amount = give_get_payment_amount($payment_id);
384 384
 
385
-				if ( ! empty( $payment_amount ) ) {
386
-					$this->decrease_value( $payment_amount );
385
+				if ( ! empty($payment_amount)) {
386
+					$this->decrease_value($payment_amount);
387 387
 				}
388 388
 
389 389
 				$this->decrease_purchase_count();
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 
392 392
 		}
393 393
 
394
-		do_action( 'give_customer_post_remove_payment', $payment_removed, $payment_id, $this->id );
394
+		do_action('give_customer_post_remove_payment', $payment_removed, $payment_id, $this->id);
395 395
 
396 396
 		return $payment_removed;
397 397
 
@@ -406,22 +406,22 @@  discard block
 block discarded – undo
406 406
 	 *
407 407
 	 * @return int            The purchase count
408 408
 	 */
409
-	public function increase_purchase_count( $count = 1 ) {
409
+	public function increase_purchase_count($count = 1) {
410 410
 
411 411
 		// Make sure it's numeric and not negative
412
-		if ( ! is_numeric( $count ) || $count != absint( $count ) ) {
412
+		if ( ! is_numeric($count) || $count != absint($count)) {
413 413
 			return false;
414 414
 		}
415 415
 
416 416
 		$new_total = (int) $this->purchase_count + (int) $count;
417 417
 
418
-		do_action( 'give_customer_pre_increase_purchase_count', $count, $this->id );
418
+		do_action('give_customer_pre_increase_purchase_count', $count, $this->id);
419 419
 
420
-		if ( $this->update( array( 'purchase_count' => $new_total ) ) ) {
420
+		if ($this->update(array('purchase_count' => $new_total))) {
421 421
 			$this->purchase_count = $new_total;
422 422
 		}
423 423
 
424
-		do_action( 'give_customer_post_increase_purchase_count', $this->purchase_count, $count, $this->id );
424
+		do_action('give_customer_post_increase_purchase_count', $this->purchase_count, $count, $this->id);
425 425
 
426 426
 		return $this->purchase_count;
427 427
 	}
@@ -435,26 +435,26 @@  discard block
 block discarded – undo
435 435
 	 *
436 436
 	 * @return mixed          If successful, the new count, otherwise false
437 437
 	 */
438
-	public function decrease_purchase_count( $count = 1 ) {
438
+	public function decrease_purchase_count($count = 1) {
439 439
 
440 440
 		// Make sure it's numeric and not negative
441
-		if ( ! is_numeric( $count ) || $count != absint( $count ) ) {
441
+		if ( ! is_numeric($count) || $count != absint($count)) {
442 442
 			return false;
443 443
 		}
444 444
 
445 445
 		$new_total = (int) $this->purchase_count - (int) $count;
446 446
 
447
-		if ( $new_total < 0 ) {
447
+		if ($new_total < 0) {
448 448
 			$new_total = 0;
449 449
 		}
450 450
 
451
-		do_action( 'give_customer_pre_decrease_purchase_count', $count, $this->id );
451
+		do_action('give_customer_pre_decrease_purchase_count', $count, $this->id);
452 452
 
453
-		if ( $this->update( array( 'purchase_count' => $new_total ) ) ) {
453
+		if ($this->update(array('purchase_count' => $new_total))) {
454 454
 			$this->purchase_count = $new_total;
455 455
 		}
456 456
 
457
-		do_action( 'give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id );
457
+		do_action('give_customer_post_decrease_purchase_count', $this->purchase_count, $count, $this->id);
458 458
 
459 459
 		return $this->purchase_count;
460 460
 	}
@@ -468,17 +468,17 @@  discard block
 block discarded – undo
468 468
 	 *
469 469
 	 * @return mixed         If successful, the new value, otherwise false
470 470
 	 */
471
-	public function increase_value( $value = 0.00 ) {
471
+	public function increase_value($value = 0.00) {
472 472
 
473
-		$new_value = floatval( $this->purchase_value ) + $value;
473
+		$new_value = floatval($this->purchase_value) + $value;
474 474
 
475
-		do_action( 'give_customer_pre_increase_value', $value, $this->id );
475
+		do_action('give_customer_pre_increase_value', $value, $this->id);
476 476
 
477
-		if ( $this->update( array( 'purchase_value' => $new_value ) ) ) {
477
+		if ($this->update(array('purchase_value' => $new_value))) {
478 478
 			$this->purchase_value = $new_value;
479 479
 		}
480 480
 
481
-		do_action( 'give_customer_post_increase_value', $this->purchase_value, $value, $this->id );
481
+		do_action('give_customer_post_increase_value', $this->purchase_value, $value, $this->id);
482 482
 
483 483
 		return $this->purchase_value;
484 484
 	}
@@ -492,21 +492,21 @@  discard block
 block discarded – undo
492 492
 	 *
493 493
 	 * @return mixed         If successful, the new value, otherwise false
494 494
 	 */
495
-	public function decrease_value( $value = 0.00 ) {
495
+	public function decrease_value($value = 0.00) {
496 496
 
497
-		$new_value = floatval( $this->purchase_value ) - $value;
497
+		$new_value = floatval($this->purchase_value) - $value;
498 498
 
499
-		if ( $new_value < 0 ) {
499
+		if ($new_value < 0) {
500 500
 			$new_value = 0.00;
501 501
 		}
502 502
 
503
-		do_action( 'give_customer_pre_decrease_value', $value, $this->id );
503
+		do_action('give_customer_pre_decrease_value', $value, $this->id);
504 504
 
505
-		if ( $this->update( array( 'purchase_value' => $new_value ) ) ) {
505
+		if ($this->update(array('purchase_value' => $new_value))) {
506 506
 			$this->purchase_value = $new_value;
507 507
 		}
508 508
 
509
-		do_action( 'give_customer_post_decrease_value', $this->purchase_value, $value, $this->id );
509
+		do_action('give_customer_post_decrease_value', $this->purchase_value, $value, $this->id);
510 510
 
511 511
 		return $this->purchase_value;
512 512
 	}
@@ -521,15 +521,15 @@  discard block
 block discarded – undo
521 521
 	 *
522 522
 	 * @return array           The notes requsted
523 523
 	 */
524
-	public function get_notes( $length = 20, $paged = 1 ) {
524
+	public function get_notes($length = 20, $paged = 1) {
525 525
 
526
-		$length = is_numeric( $length ) ? $length : 20;
527
-		$offset = is_numeric( $paged ) && $paged != 1 ? ( ( absint( $paged ) - 1 ) * $length ) : 0;
526
+		$length = is_numeric($length) ? $length : 20;
527
+		$offset = is_numeric($paged) && $paged != 1 ? ((absint($paged) - 1) * $length) : 0;
528 528
 
529 529
 		$all_notes   = $this->get_raw_notes();
530
-		$notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) );
530
+		$notes_array = array_reverse(array_filter(explode("\n\n", $all_notes)));
531 531
 
532
-		$desired_notes = array_slice( $notes_array, $offset, $length );
532
+		$desired_notes = array_slice($notes_array, $offset, $length);
533 533
 
534 534
 		return $desired_notes;
535 535
 
@@ -544,9 +544,9 @@  discard block
 block discarded – undo
544 544
 	public function get_notes_count() {
545 545
 
546 546
 		$all_notes   = $this->get_raw_notes();
547
-		$notes_array = array_reverse( array_filter( explode( "\n\n", $all_notes ) ) );
547
+		$notes_array = array_reverse(array_filter(explode("\n\n", $all_notes)));
548 548
 
549
-		return count( $notes_array );
549
+		return count($notes_array);
550 550
 
551 551
 	}
552 552
 
@@ -559,32 +559,32 @@  discard block
 block discarded – undo
559 559
 	 *
560 560
 	 * @return string|boolean The new note if added succesfully, false otherwise
561 561
 	 */
562
-	public function add_note( $note = '' ) {
562
+	public function add_note($note = '') {
563 563
 
564
-		$note = trim( $note );
565
-		if ( empty( $note ) ) {
564
+		$note = trim($note);
565
+		if (empty($note)) {
566 566
 			return false;
567 567
 		}
568 568
 
569 569
 		$notes = $this->get_raw_notes();
570 570
 
571
-		if ( empty( $notes ) ) {
571
+		if (empty($notes)) {
572 572
 			$notes = '';
573 573
 		}
574 574
 
575
-		$note_string = date_i18n( 'F j, Y H:i:s', current_time( 'timestamp' ) ) . ' - ' . $note;
576
-		$new_note    = apply_filters( 'give_customer_add_note_string', $note_string );
577
-		$notes .= "\n\n" . $new_note;
575
+		$note_string = date_i18n('F j, Y H:i:s', current_time('timestamp')).' - '.$note;
576
+		$new_note    = apply_filters('give_customer_add_note_string', $note_string);
577
+		$notes .= "\n\n".$new_note;
578 578
 
579
-		do_action( 'give_customer_pre_add_note', $new_note, $this->id );
579
+		do_action('give_customer_pre_add_note', $new_note, $this->id);
580 580
 
581
-		$updated = $this->update( array( 'notes' => $notes ) );
581
+		$updated = $this->update(array('notes' => $notes));
582 582
 
583
-		if ( $updated ) {
583
+		if ($updated) {
584 584
 			$this->notes = $this->get_notes();
585 585
 		}
586 586
 
587
-		do_action( 'give_customer_post_add_note', $this->notes, $new_note, $this->id );
587
+		do_action('give_customer_post_add_note', $this->notes, $new_note, $this->id);
588 588
 
589 589
 		// Return the formatted note, so we can test, as well as update any displays
590 590
 		return $new_note;
@@ -599,7 +599,7 @@  discard block
 block discarded – undo
599 599
 	 */
600 600
 	private function get_raw_notes() {
601 601
 
602
-		$all_notes = $this->db->get_column( 'notes', $this->id );
602
+		$all_notes = $this->db->get_column('notes', $this->id);
603 603
 
604 604
 		return $all_notes;
605 605
 
@@ -614,51 +614,51 @@  discard block
 block discarded – undo
614 614
 	 *
615 615
 	 * @return array       The sanitized data, based off column defaults
616 616
 	 */
617
-	private function sanitize_columns( $data ) {
617
+	private function sanitize_columns($data) {
618 618
 
619 619
 		$columns        = $this->db->get_columns();
620 620
 		$default_values = $this->db->get_column_defaults();
621 621
 
622
-		foreach ( $columns as $key => $type ) {
622
+		foreach ($columns as $key => $type) {
623 623
 
624 624
 			// Only sanitize data that we were provided
625
-			if ( ! array_key_exists( $key, $data ) ) {
625
+			if ( ! array_key_exists($key, $data)) {
626 626
 				continue;
627 627
 			}
628 628
 
629
-			switch ( $type ) {
629
+			switch ($type) {
630 630
 
631 631
 				case '%s':
632
-					if ( 'email' == $key ) {
633
-						$data[ $key ] = sanitize_email( $data[ $key ] );
634
-					} elseif ( 'notes' == $key ) {
635
-						$data[ $key ] = strip_tags( $data[ $key ] );
632
+					if ('email' == $key) {
633
+						$data[$key] = sanitize_email($data[$key]);
634
+					} elseif ('notes' == $key) {
635
+						$data[$key] = strip_tags($data[$key]);
636 636
 					} else {
637
-						$data[ $key ] = sanitize_text_field( $data[ $key ] );
637
+						$data[$key] = sanitize_text_field($data[$key]);
638 638
 					}
639 639
 					break;
640 640
 
641 641
 				case '%d':
642
-					if ( ! is_numeric( $data[ $key ] ) || (int) $data[ $key ] !== absint( $data[ $key ] ) ) {
643
-						$data[ $key ] = $default_values[ $key ];
642
+					if ( ! is_numeric($data[$key]) || (int) $data[$key] !== absint($data[$key])) {
643
+						$data[$key] = $default_values[$key];
644 644
 					} else {
645
-						$data[ $key ] = absint( $data[ $key ] );
645
+						$data[$key] = absint($data[$key]);
646 646
 					}
647 647
 					break;
648 648
 
649 649
 				case '%f':
650 650
 					// Convert what was given to a float
651
-					$value = floatval( $data[ $key ] );
651
+					$value = floatval($data[$key]);
652 652
 
653
-					if ( ! is_float( $value ) ) {
654
-						$data[ $key ] = $default_values[ $key ];
653
+					if ( ! is_float($value)) {
654
+						$data[$key] = $default_values[$key];
655 655
 					} else {
656
-						$data[ $key ] = $value;
656
+						$data[$key] = $value;
657 657
 					}
658 658
 					break;
659 659
 
660 660
 				default:
661
-					$data[ $key ] = sanitize_text_field( $data[ $key ] );
661
+					$data[$key] = sanitize_text_field($data[$key]);
662 662
 					break;
663 663
 
664 664
 			}
Please login to merge, or discard this patch.
includes/admin/reporting/class-gateway-error-logs-list-table.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 // Exit if accessed directly
12
-if ( ! defined( 'ABSPATH' ) ) {
12
+if ( ! defined('ABSPATH')) {
13 13
 	exit;
14 14
 }
15 15
 
16 16
 // Load WP_List_Table if not loaded
17
-if ( ! class_exists( 'WP_List_Table' ) ) {
18
-	require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
17
+if ( ! class_exists('WP_List_Table')) {
18
+	require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php';
19 19
 }
20 20
 
21 21
 /**
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 		global $status, $page;
46 46
 
47 47
 		// Set parent defaults
48
-		parent::__construct( array(
49
-			'singular' => give_get_forms_label_singular(),    // Singular name of the listed records
50
-			'plural'   => give_get_forms_label_plural(),        // Plural name of the listed records
48
+		parent::__construct(array(
49
+			'singular' => give_get_forms_label_singular(), // Singular name of the listed records
50
+			'plural'   => give_get_forms_label_plural(), // Plural name of the listed records
51 51
 			'ajax'     => false                        // Does this table support ajax?
52
-		) );
52
+		));
53 53
 	}
54 54
 
55 55
 	/**
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 * @return string Column Name
65 65
 	 */
66
-	public function column_default( $item, $column_name ) {
67
-		switch ( $column_name ) {
66
+	public function column_default($item, $column_name) {
67
+		switch ($column_name) {
68 68
 			case 'ID' :
69 69
 				return $item['ID_label'];
70 70
 			case 'error' :
71
-				return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : __( 'Payment Error', 'give' );
71
+				return get_the_title($item['ID']) ? get_the_title($item['ID']) : __('Payment Error', 'give');
72 72
 			default:
73
-				return $item[ $column_name ];
73
+				return $item[$column_name];
74 74
 		}
75 75
 	}
76 76
 
@@ -84,29 +84,29 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @return void
86 86
 	 */
87
-	public function column_message( $item ) {
87
+	public function column_message($item) {
88 88
 
89 89
 		?>
90
-		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox" title="<?php _e( 'View Log Message', 'give' ); ?> "><?php _e( 'View Log Message', 'give' ); ?></a>
90
+		<a href="#TB_inline?width=640&amp;inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox" title="<?php _e('View Log Message', 'give'); ?> "><?php _e('View Log Message', 'give'); ?></a>
91 91
 		<div id="log-message-<?php echo $item['ID']; ?>" style="display:none;">
92 92
 			<?php
93 93
 
94
-			$log_message = get_post_field( 'post_content', $item['ID'] );
94
+			$log_message = get_post_field('post_content', $item['ID']);
95 95
 
96
-			$serialized  = strpos( $log_message, '{"' );
96
+			$serialized  = strpos($log_message, '{"');
97 97
 
98 98
 			// Check to see if the log message contains serialized information
99
-			if ( $serialized !== false ) {
100
-				$length = strlen( $log_message ) - $serialized;
101
-				$intro  = substr( $log_message, 0, - $length );
102
-				$data   = substr( $log_message, $serialized, strlen( $log_message ) - 1 );
99
+			if ($serialized !== false) {
100
+				$length = strlen($log_message) - $serialized;
101
+				$intro  = substr($log_message, 0, - $length);
102
+				$data   = substr($log_message, $serialized, strlen($log_message) - 1);
103 103
 
104
-				echo wpautop( $intro );
105
-				echo wpautop( '<strong>' . __( 'Log data:', 'give' ) . '</strong>' );
106
-				echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>';
104
+				echo wpautop($intro);
105
+				echo wpautop('<strong>'.__('Log data:', 'give').'</strong>');
106
+				echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>';
107 107
 			} else {
108 108
 				// No serialized data found
109
-				echo wpautop( $log_message );
109
+				echo wpautop($log_message);
110 110
 			}
111 111
 			?>
112 112
 		</div>
@@ -122,12 +122,12 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function get_columns() {
124 124
 		$columns = array(
125
-			'ID'         => __( 'Log ID', 'give' ),
126
-			'payment_id' => __( 'Payment ID', 'give' ),
127
-			'error'      => __( 'Error', 'give' ),
128
-			'message'    => __( 'Error Message', 'give' ),
129
-			'gateway'    => __( 'Gateway', 'give' ),
130
-			'date'       => __( 'Date', 'give' )
125
+			'ID'         => __('Log ID', 'give'),
126
+			'payment_id' => __('Payment ID', 'give'),
127
+			'error'      => __('Error', 'give'),
128
+			'message'    => __('Error Message', 'give'),
129
+			'gateway'    => __('Gateway', 'give'),
130
+			'date'       => __('Date', 'give')
131 131
 		);
132 132
 
133 133
 		return $columns;
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @return int Current page number
142 142
 	 */
143 143
 	public function get_paged() {
144
-		return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1;
144
+		return isset($_GET['paged']) ? absint($_GET['paged']) : 1;
145 145
 	}
146 146
 
147 147
 	/**
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * @since  1.0
152 152
 	 * @return void
153 153
 	 */
154
-	public function bulk_actions( $which = '' ) {
154
+	public function bulk_actions($which = '') {
155 155
 		give_log_views();
156 156
 	}
157 157
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		global $give_logs;
168 168
 
169 169
 		// Prevent the queries from getting cached. Without this there are occasional memory issues for some installs
170
-		wp_suspend_cache_addition( true );
170
+		wp_suspend_cache_addition(true);
171 171
 
172 172
 		$logs_data = array();
173 173
 		$paged     = $this->get_paged();
@@ -176,17 +176,17 @@  discard block
 block discarded – undo
176 176
 			'paged'    => $paged
177 177
 		);
178 178
 
179
-		$logs = $give_logs->get_connected_logs( $log_query );
179
+		$logs = $give_logs->get_connected_logs($log_query);
180 180
 
181
-		if ( $logs ) {
182
-			foreach ( $logs as $log ) {
181
+		if ($logs) {
182
+			foreach ($logs as $log) {
183 183
 
184 184
 				$logs_data[] = array(
185 185
 					'ID'         => $log->ID,
186
-					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>',
186
+					'ID_label'   => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>',
187 187
 					'payment_id' => $log->post_parent,
188 188
 					'error'      => 'error',
189
-					'gateway'    => give_get_payment_gateway( $log->post_parent ),
189
+					'gateway'    => give_get_payment_gateway($log->post_parent),
190 190
 					'date'       => $log->post_date
191 191
 				);
192 192
 			}
@@ -207,19 +207,19 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @param string $which
209 209
 	 */
210
-	protected function display_tablenav( $which ) {
211
-		if ( 'top' === $which ) {
212
-			wp_nonce_field( 'bulk-' . $this->_args['plural'] );
210
+	protected function display_tablenav($which) {
211
+		if ('top' === $which) {
212
+			wp_nonce_field('bulk-'.$this->_args['plural']);
213 213
 		}
214 214
 		?>
215
-		<div class="tablenav <?php echo esc_attr( $which ); ?>">
215
+		<div class="tablenav <?php echo esc_attr($which); ?>">
216 216
 
217 217
 			<div class="alignleft actions bulkactions">
218
-				<?php $this->bulk_actions( $which ); ?>
218
+				<?php $this->bulk_actions($which); ?>
219 219
 			</div>
220 220
 			<?php
221
-			$this->extra_tablenav( $which );
222
-			$this->pagination( $which );
221
+			$this->extra_tablenav($which);
222
+			$this->pagination($which);
223 223
 			?>
224 224
 
225 225
 			<br class="clear"/>
@@ -246,15 +246,15 @@  discard block
 block discarded – undo
246 246
 		$columns               = $this->get_columns();
247 247
 		$hidden                = array(); // No hidden columns
248 248
 		$sortable              = $this->get_sortable_columns();
249
-		$this->_column_headers = array( $columns, $hidden, $sortable );
249
+		$this->_column_headers = array($columns, $hidden, $sortable);
250 250
 		$current_page          = $this->get_pagenum();
251 251
 		$this->items           = $this->get_logs();
252
-		$total_items           = $give_logs->get_log_count( 0, 'gateway_error' );
252
+		$total_items           = $give_logs->get_log_count(0, 'gateway_error');
253 253
 
254
-		$this->set_pagination_args( array(
254
+		$this->set_pagination_args(array(
255 255
 				'total_items' => $total_items,
256 256
 				'per_page'    => $this->per_page,
257
-				'total_pages' => ceil( $total_items / $this->per_page )
257
+				'total_pages' => ceil($total_items / $this->per_page)
258 258
 			)
259 259
 		);
260 260
 	}
Please login to merge, or discard this patch.
includes/emails/template.php 1 patch
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
  *
42 42
  * @return string $message Fully formatted message
43 43
  */
44
-function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) {
45
-	return give_do_email_tags( $message, $payment_id );
44
+function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) {
45
+	return give_do_email_tags($message, $payment_id);
46 46
 }
47 47
 
48 48
 /**
@@ -54,40 +54,40 @@  discard block
 block discarded – undo
54 54
  *
55 55
  * @return string $message Fully formatted message
56 56
  */
57
-function give_email_preview_template_tags( $message ) {
57
+function give_email_preview_template_tags($message) {
58 58
 
59
-	$price = give_currency_filter( give_format_amount( 10.50 ) );
59
+	$price = give_currency_filter(give_format_amount(10.50));
60 60
 
61 61
 	$gateway = 'PayPal';
62 62
 
63
-	$receipt_id = strtolower( md5( uniqid() ) );
63
+	$receipt_id = strtolower(md5(uniqid()));
64 64
 
65
-	$notes = __( 'These are some sample notes added to a donation.', 'give' );
65
+	$notes = __('These are some sample notes added to a donation.', 'give');
66 66
 
67
-	$payment_id = rand( 1, 100 );
67
+	$payment_id = rand(1, 100);
68 68
 
69 69
 	$receipt_link = sprintf(
70 70
 		'<a href="%1$s">%2$s</a>',
71
-		esc_url( add_query_arg( array( 'payment_key' => $receipt_id, 'give_action' => 'view_receipt' ), home_url() ) ),
72
-		__( 'View the receipt in your browser', 'give' )
71
+		esc_url(add_query_arg(array('payment_key' => $receipt_id, 'give_action' => 'view_receipt'), home_url())),
72
+		__('View the receipt in your browser', 'give')
73 73
 	);
74 74
 
75 75
 	$user = wp_get_current_user();
76 76
 
77
-	$message = str_replace( '{name}', $user->display_name, $message );
78
-	$message = str_replace( '{fullname}', $user->display_name, $message );
79
-	$message = str_replace( '{username}', $user->user_login, $message );
80
-	$message = str_replace( '{date}', date( get_option( 'date_format' ), current_time( 'timestamp' ) ), $message );
81
-	$message = str_replace( '{price}', $price, $message );
82
-	$message = str_replace( '{donation}', 'Sample Donation Form Title', $message );
83
-	$message = str_replace( '{receipt_id}', $receipt_id, $message );
84
-	$message = str_replace( '{payment_method}', $gateway, $message );
85
-	$message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message );
86
-	$message = str_replace( '{product_notes}', $notes, $message );
87
-	$message = str_replace( '{payment_id}', $payment_id, $message );
88
-	$message = str_replace( '{receipt_link}', $receipt_link, $message );
89
-
90
-	return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) );
77
+	$message = str_replace('{name}', $user->display_name, $message);
78
+	$message = str_replace('{fullname}', $user->display_name, $message);
79
+	$message = str_replace('{username}', $user->user_login, $message);
80
+	$message = str_replace('{date}', date(get_option('date_format'), current_time('timestamp')), $message);
81
+	$message = str_replace('{price}', $price, $message);
82
+	$message = str_replace('{donation}', 'Sample Donation Form Title', $message);
83
+	$message = str_replace('{receipt_id}', $receipt_id, $message);
84
+	$message = str_replace('{payment_method}', $gateway, $message);
85
+	$message = str_replace('{sitename}', get_bloginfo('name'), $message);
86
+	$message = str_replace('{product_notes}', $notes, $message);
87
+	$message = str_replace('{payment_id}', $payment_id, $message);
88
+	$message = str_replace('{receipt_link}', $receipt_link, $message);
89
+
90
+	return wpautop(apply_filters('give_email_preview_template_tags', $message));
91 91
 }
92 92
 
93 93
 /**
@@ -100,20 +100,20 @@  discard block
 block discarded – undo
100 100
  * @since  1.0
101 101
  * @return array|bool
102 102
  */
103
-add_filter( 'give_settings_emails', 'give_email_template_preview' );
103
+add_filter('give_settings_emails', 'give_email_template_preview');
104 104
 
105
-function give_email_template_preview( $array ) {
105
+function give_email_template_preview($array) {
106 106
 
107
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
107
+	if ( ! current_user_can('manage_give_settings')) {
108 108
 		return false;
109 109
 	}
110 110
 	$custom_field = array(
111
-		'name' => __( 'Preview Email', 'give' ),
112
-		'desc' => __( 'Click the buttons to preview emails.', 'give' ),
111
+		'name' => __('Preview Email', 'give'),
112
+		'desc' => __('Click the buttons to preview emails.', 'give'),
113 113
 		'id'   => 'give_email_preview_buttons',
114 114
 		'type' => 'email_preview_buttons'
115 115
 	);
116
-	array_splice( $array, 5, 0, array( $custom_field ) );
116
+	array_splice($array, 5, 0, array($custom_field));
117 117
 
118 118
 	return $array; // splice in at position 3;
119 119
 }
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
 function give_email_preview_buttons_callback() {
130 130
 	ob_start();
131 131
 	?>
132
-	<a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary" target="_blank" title="<?php _e( 'Donation Receipt Preview', 'give' ); ?> "><?php _e( 'Preview Donation Receipt', 'give' ); ?></a>
133
-	<a href="<?php echo wp_nonce_url( add_query_arg( array(
132
+	<a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary" target="_blank" title="<?php _e('Donation Receipt Preview', 'give'); ?> "><?php _e('Preview Donation Receipt', 'give'); ?></a>
133
+	<a href="<?php echo wp_nonce_url(add_query_arg(array(
134 134
 		'give_action'  => 'send_test_email',
135 135
 		'give-message' => 'sent-test-email'
136
-	) ), 'give-test-email' ); ?>" title="<?php _e( 'This will send a demo donation receipt to the emails listed below.', 'give' ); ?>" class="button-secondary"><?php _e( 'Send Test Email', 'give' ); ?></a>
136
+	)), 'give-test-email'); ?>" title="<?php _e('This will send a demo donation receipt to the emails listed below.', 'give'); ?>" class="button-secondary"><?php _e('Send Test Email', 'give'); ?></a>
137 137
 	<?php
138 138
 	echo ob_get_clean();
139 139
 }
@@ -146,27 +146,27 @@  discard block
 block discarded – undo
146 146
  */
147 147
 function give_display_email_template_preview() {
148 148
 
149
-	if ( empty( $_GET['give_action'] ) ) {
149
+	if (empty($_GET['give_action'])) {
150 150
 		return;
151 151
 	}
152 152
 
153
-	if ( 'preview_email' !== $_GET['give_action'] ) {
153
+	if ('preview_email' !== $_GET['give_action']) {
154 154
 		return;
155 155
 	}
156 156
 
157
-	if ( ! current_user_can( 'manage_give_settings' ) ) {
157
+	if ( ! current_user_can('manage_give_settings')) {
158 158
 		return;
159 159
 	}
160 160
 
161
-	Give()->emails->heading = __( 'Donation Receipt', 'give' );
161
+	Give()->emails->heading = __('Donation Receipt', 'give');
162 162
 
163
-	echo Give()->emails->build_email( give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ) );
163
+	echo Give()->emails->build_email(give_email_preview_template_tags(give_get_email_body_content(0, array())));
164 164
 
165 165
 	exit;
166 166
 
167 167
 }
168 168
 
169
-add_action( 'template_redirect', 'give_display_email_template_preview' );
169
+add_action('template_redirect', 'give_display_email_template_preview');
170 170
 
171 171
 /**
172 172
  * Email Template Body
@@ -178,19 +178,19 @@  discard block
 block discarded – undo
178 178
  *
179 179
  * @return string $email_body Body of the email
180 180
  */
181
-function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) {
181
+function give_get_email_body_content($payment_id = 0, $payment_data = array()) {
182 182
 
183 183
 	global $give_options;
184 184
 
185 185
 	$default_email_body = give_get_default_donation_receipt_email();
186 186
 
187
-	$email = isset( $give_options['donation_receipt'] ) ? stripslashes( $give_options['donation_receipt'] ) : $default_email_body;
187
+	$email = isset($give_options['donation_receipt']) ? stripslashes($give_options['donation_receipt']) : $default_email_body;
188 188
 
189
-	$email_body = wpautop( $email );
189
+	$email_body = wpautop($email);
190 190
 
191
-	$email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data );
191
+	$email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data);
192 192
 
193
-	return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data );
193
+	return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data);
194 194
 }
195 195
 
196 196
 
@@ -206,37 +206,37 @@  discard block
 block discarded – undo
206 206
  *
207 207
  * @return string $email_body Body of the email
208 208
  */
209
-function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) {
209
+function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) {
210 210
 	global $give_options;
211 211
 
212
-	$user_info = maybe_unserialize( $payment_data['user_info'] );
213
-	$email     = give_get_payment_user_email( $payment_id );
212
+	$user_info = maybe_unserialize($payment_data['user_info']);
213
+	$email     = give_get_payment_user_email($payment_id);
214 214
 
215
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
216
-		$user_data = get_userdata( $user_info['id'] );
215
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
216
+		$user_data = get_userdata($user_info['id']);
217 217
 		$name      = $user_data->display_name;
218
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
219
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
218
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
219
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
220 220
 	} else {
221 221
 		$name = $email;
222 222
 	}
223 223
 
224
-	$gateway = give_get_gateway_admin_label( get_post_meta( $payment_id, '_give_payment_gateway', true ) );
224
+	$gateway = give_get_gateway_admin_label(get_post_meta($payment_id, '_give_payment_gateway', true));
225 225
 
226
-	$default_email_body = __( 'Hello', 'give' ) . "\n\n" . __( 'A donation has been made', 'give' ) . ".\n\n";
227
-	$default_email_body .= sprintf( __( '%s sold:', 'give' ), give_get_forms_label_plural() ) . "\n\n";
226
+	$default_email_body = __('Hello', 'give')."\n\n".__('A donation has been made', 'give').".\n\n";
227
+	$default_email_body .= sprintf(__('%s sold:', 'give'), give_get_forms_label_plural())."\n\n";
228 228
 
229
-	$default_email_body .= __( 'Donor: ', 'give' ) . " " . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n";
230
-	$default_email_body .= __( 'Amount: ', 'give' ) . " " . html_entity_decode( give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n";
231
-	$default_email_body .= __( 'Payment Method: ', 'give' ) . " " . $gateway . "\n\n";
229
+	$default_email_body .= __('Donor: ', 'give')." ".html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n";
230
+	$default_email_body .= __('Amount: ', 'give')." ".html_entity_decode(give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))), ENT_COMPAT, 'UTF-8')."\n";
231
+	$default_email_body .= __('Payment Method: ', 'give')." ".$gateway."\n\n";
232 232
 
233
-	$default_email_body .= __( 'Thank you', 'give' );
233
+	$default_email_body .= __('Thank you', 'give');
234 234
 
235
-	$email = isset( $give_options['donation_notification'] ) ? stripslashes( $give_options['donation_notification'] ) : $default_email_body;
235
+	$email = isset($give_options['donation_notification']) ? stripslashes($give_options['donation_notification']) : $default_email_body;
236 236
 
237
-	$email_body = give_do_email_tags( $email, $payment_id );
237
+	$email_body = give_do_email_tags($email, $payment_id);
238 238
 
239
-	return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data );
239
+	return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data);
240 240
 }
241 241
 
242 242
 /**
@@ -249,15 +249,15 @@  discard block
 block discarded – undo
249 249
  * @since  1.0
250 250
  */
251 251
 function give_render_receipt_in_browser() {
252
-	if ( ! isset( $_GET['payment_key'] ) ) {
253
-		wp_die( __( 'Missing donation payment key.', 'give' ), __( 'Error', 'give' ) );
252
+	if ( ! isset($_GET['payment_key'])) {
253
+		wp_die(__('Missing donation payment key.', 'give'), __('Error', 'give'));
254 254
 	}
255 255
 
256
-	$key = urlencode( $_GET['payment_key'] );
256
+	$key = urlencode($_GET['payment_key']);
257 257
 
258 258
 	ob_start();
259 259
 	//Disallows caching of the page
260
-	header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
260
+	header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
261 261
 	header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
262 262
 	header("Cache-Control: post-check=0, pre-check=0", false);
263 263
 	header("Pragma: no-cache"); // HTTP/1.0
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	<!DOCTYPE html>
267 267
 	<html lang="en">
268 268
 		<head>
269
-			<title><?php _e( 'Donation Receipt', 'give' ); ?></title>
269
+			<title><?php _e('Donation Receipt', 'give'); ?></title>
270 270
 			<meta charset="utf-8" />
271 271
 
272 272
 			<!-- Further disallowing of caching of this page -->
@@ -280,12 +280,12 @@  discard block
 block discarded – undo
280 280
 
281 281
 			<?php wp_head(); ?>
282 282
 		</head>
283
-		<body class="<?php echo apply_filters( 'give_receipt_page_body_class', 'give_receipt_page' ); ?>">
283
+		<body class="<?php echo apply_filters('give_receipt_page_body_class', 'give_receipt_page'); ?>">
284 284
 
285 285
 			<div id="give_receipt_wrapper">
286
-				<?php do_action( 'give_render_receipt_in_browser_before' ); ?>
287
-				<?php echo do_shortcode( '[give_receipt payment_key=' . $key . ']' ); ?>
288
-				<?php do_action( 'give_render_receipt_in_browser_after' ); ?>
286
+				<?php do_action('give_render_receipt_in_browser_before'); ?>
287
+				<?php echo do_shortcode('[give_receipt payment_key='.$key.']'); ?>
288
+				<?php do_action('give_render_receipt_in_browser_after'); ?>
289 289
 			</div>
290 290
 
291 291
 			<?php wp_footer(); ?>
@@ -296,4 +296,4 @@  discard block
 block discarded – undo
296 296
 	die();
297 297
 }
298 298
 
299
-add_action( 'give_view_receipt', 'give_render_receipt_in_browser' );
299
+add_action('give_view_receipt', 'give_render_receipt_in_browser');
Please login to merge, or discard this patch.
includes/gateways/offline-donations.php 1 patch
Spacing   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -18,17 +18,17 @@  discard block
 block discarded – undo
18 18
  *
19 19
  * @return array
20 20
  */
21
-function give_offline_register_gateway( $gateways ) {
21
+function give_offline_register_gateway($gateways) {
22 22
 	// Format: ID => Name
23 23
 	$gateways['offline'] = array(
24
-		'admin_label'    => esc_attr__( 'Offline Donation', 'give' ),
25
-		'checkout_label' => esc_attr__( 'Offline Donation', 'give' )
24
+		'admin_label'    => esc_attr__('Offline Donation', 'give'),
25
+		'checkout_label' => esc_attr__('Offline Donation', 'give')
26 26
 	);
27 27
 
28 28
 	return $gateways;
29 29
 }
30 30
 
31
-add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 );
31
+add_filter('give_payment_gateways', 'give_offline_register_gateway', 1);
32 32
 
33 33
 
34 34
 /**
@@ -40,55 +40,55 @@  discard block
 block discarded – undo
40 40
  *
41 41
  * @return void
42 42
  */
43
-function give_offline_payment_cc_form( $form_id ) {
43
+function give_offline_payment_cc_form($form_id) {
44 44
 
45
-	$post_offline_customization_option = get_post_meta( $form_id, '_give_customize_offline_donations', true );
46
-	$post_offline_instructions         = get_post_meta( $form_id, '_give_offline_checkout_notes', true );
47
-	$global_offline_instruction        = give_get_option( 'global_offline_donation_content' );
45
+	$post_offline_customization_option = get_post_meta($form_id, '_give_customize_offline_donations', true);
46
+	$post_offline_instructions         = get_post_meta($form_id, '_give_offline_checkout_notes', true);
47
+	$global_offline_instruction        = give_get_option('global_offline_donation_content');
48 48
 	$offline_instructions              = $global_offline_instruction;
49 49
 
50
-	if ( $post_offline_customization_option == 'yes' ) {
50
+	if ($post_offline_customization_option == 'yes') {
51 51
 		$offline_instructions = $post_offline_instructions;
52 52
 	}
53 53
 
54 54
 
55 55
 	ob_start(); ?>
56
-	<?php do_action( 'give_before_offline_info_fields', $form_id ); ?>
56
+	<?php do_action('give_before_offline_info_fields', $form_id); ?>
57 57
 	<fieldset id="give_offline_payment_info">
58 58
 		<?php
59
-		$settings_url         = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' );
60
-		$offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( esc_attr__( 'Please enter offline donation instructions in the %s.', 'give' ), '<a href="' . $settings_url . '">' . __( 'this form\'s settings', 'give' ) . '</a>' );
61
-		echo wpautop( stripslashes( $offline_instructions ) );
59
+		$settings_url         = admin_url('post.php?post='.$form_id.'&action=edit&message=1');
60
+		$offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(esc_attr__('Please enter offline donation instructions in the %s.', 'give'), '<a href="'.$settings_url.'">'.__('this form\'s settings', 'give').'</a>');
61
+		echo wpautop(stripslashes($offline_instructions));
62 62
 		?>
63 63
 	</fieldset>
64
-	<?php do_action( 'give_after_offline_info_fields', $form_id ); ?>
64
+	<?php do_action('give_after_offline_info_fields', $form_id); ?>
65 65
 	<?php
66 66
 	echo ob_get_clean();
67 67
 }
68 68
 
69
-add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' );
69
+add_action('give_offline_cc_form', 'give_offline_payment_cc_form');
70 70
 
71 71
 /**
72 72
  * Give Offline Billing Field
73 73
  *
74 74
  * @param $form_id
75 75
  */
76
-function give_offline_billing_fields( $form_id ) {
76
+function give_offline_billing_fields($form_id) {
77 77
 	//Enable Default CC fields (billing info)
78
-	$post_offline_cc_fields        = get_post_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true );
79
-	$post_offline_customize_option = get_post_meta( $form_id, '_give_customize_offline_donations', true );
78
+	$post_offline_cc_fields        = get_post_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true);
79
+	$post_offline_customize_option = get_post_meta($form_id, '_give_customize_offline_donations', true);
80 80
 
81
-	$global_offline_cc_fields      = give_get_option( 'give_offline_donation_enable_billing_fields' );
81
+	$global_offline_cc_fields      = give_get_option('give_offline_donation_enable_billing_fields');
82 82
 
83 83
 	//Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options
84
-	if ( $global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes' ) {
85
-		give_default_cc_address_fields( $form_id );
86
-	} elseif($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') {
87
-		give_default_cc_address_fields( $form_id );
84
+	if ($global_offline_cc_fields == 'on' && $post_offline_customize_option !== 'yes') {
85
+		give_default_cc_address_fields($form_id);
86
+	} elseif ($post_offline_customize_option == 'yes' && $post_offline_cc_fields == 'on') {
87
+		give_default_cc_address_fields($form_id);
88 88
 	}
89 89
 }
90 90
 
91
-add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 );
91
+add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1);
92 92
 
93 93
 /**
94 94
  * Process the payment
@@ -99,16 +99,16 @@  discard block
 block discarded – undo
99 99
  *
100 100
  * @return void
101 101
  */
102
-function give_offline_process_payment( $purchase_data ) {
102
+function give_offline_process_payment($purchase_data) {
103 103
 
104
-	$purchase_summary = give_get_purchase_summary( $purchase_data );
104
+	$purchase_summary = give_get_purchase_summary($purchase_data);
105 105
 
106 106
 	// setup the payment details
107 107
 	$payment_data = array(
108 108
 		'price'           => $purchase_data['price'],
109 109
 		'give_form_title' => $purchase_data['post_data']['give-form-title'],
110
-		'give_form_id'    => intval( $purchase_data['post_data']['give-form-id'] ),
111
-		'give_price_id'   => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '',
110
+		'give_form_id'    => intval($purchase_data['post_data']['give-form-id']),
111
+		'give_price_id'   => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '',
112 112
 		'date'            => $purchase_data['date'],
113 113
 		'user_email'      => $purchase_data['user_email'],
114 114
 		'purchase_key'    => $purchase_data['purchase_key'],
@@ -120,20 +120,20 @@  discard block
 block discarded – undo
120 120
 
121 121
 
122 122
 	// record the pending payment
123
-	$payment = give_insert_payment( $payment_data );
123
+	$payment = give_insert_payment($payment_data);
124 124
 
125
-	if ( $payment ) {
126
-		give_offline_send_admin_notice( $payment );
127
-		give_offline_send_donor_instructions( $payment );
125
+	if ($payment) {
126
+		give_offline_send_admin_notice($payment);
127
+		give_offline_send_donor_instructions($payment);
128 128
 		give_send_to_success_page();
129 129
 	} else {
130 130
 		// if errors are present, send the user back to the donation form so they can be corrected
131
-		give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] );
131
+		give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']);
132 132
 	}
133 133
 
134 134
 }
135 135
 
136
-add_action( 'give_gateway_offline', 'give_offline_process_payment' );
136
+add_action('give_gateway_offline', 'give_offline_process_payment');
137 137
 
138 138
 
139 139
 /**
@@ -146,47 +146,47 @@  discard block
 block discarded – undo
146 146
  * @since       1.0
147 147
  * @return void
148 148
  */
149
-function give_offline_send_donor_instructions( $payment_id = 0 ) {
149
+function give_offline_send_donor_instructions($payment_id = 0) {
150 150
 
151
-	$payment_data                      = give_get_payment_meta( $payment_id );
152
-	$post_offline_customization_option = get_post_meta( $payment_data['form_id'], '_give_customize_offline_donations', true );
151
+	$payment_data                      = give_get_payment_meta($payment_id);
152
+	$post_offline_customization_option = get_post_meta($payment_data['form_id'], '_give_customize_offline_donations', true);
153 153
 
154 154
 	//Customize email content depending on whether the single form has been customized
155
-	$email_content = give_get_option( 'global_offline_donation_email' );
155
+	$email_content = give_get_option('global_offline_donation_email');
156 156
 
157
-	if ( $post_offline_customization_option === 'yes' ) {
158
-		$email_content = get_post_meta( $payment_data['form_id'], '_give_offline_donation_email', true );
157
+	if ($post_offline_customization_option === 'yes') {
158
+		$email_content = get_post_meta($payment_data['form_id'], '_give_offline_donation_email', true);
159 159
 	}
160 160
 
161
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
162
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data );
161
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
162
+	$from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
163 163
 
164
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
165
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data );
164
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
165
+	$from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
166 166
 
167
-	$to_email = give_get_payment_user_email( $payment_id );
167
+	$to_email = give_get_payment_user_email($payment_id);
168 168
 
169
-	$subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) );
170
-	if ( $post_offline_customization_option === 'yes' ) {
171
-		$subject = get_post_meta( $payment_data['form_id'], '_give_offline_donation_subject', true );
169
+	$subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give'));
170
+	if ($post_offline_customization_option === 'yes') {
171
+		$subject = get_post_meta($payment_data['form_id'], '_give_offline_donation_subject', true);
172 172
 	}
173 173
 
174
-	$subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
175
-	$subject = give_do_email_tags( $subject, $payment_id );
174
+	$subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id);
175
+	$subject = give_do_email_tags($subject, $payment_id);
176 176
 
177
-	$attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data );
178
-	$message     = give_do_email_tags( $email_content, $payment_id );
177
+	$attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data);
178
+	$message     = give_do_email_tags($email_content, $payment_id);
179 179
 
180 180
 	$emails = Give()->emails;
181 181
 
182
-	$emails->__set( 'from_name', $from_name );
183
-	$emails->__set( 'from_email', $from_email );
184
-	$emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) );
182
+	$emails->__set('from_name', $from_name);
183
+	$emails->__set('from_email', $from_email);
184
+	$emails->__set('heading', __('Offline Donation Instructions', 'give'));
185 185
 
186
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
187
-	$emails->__set( 'headers', $headers );
186
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
187
+	$emails->__set('headers', $headers);
188 188
 
189
-	$emails->send( $to_email, $subject, $message, $attachments );
189
+	$emails->send($to_email, $subject, $message, $attachments);
190 190
 
191 191
 }
192 192
 
@@ -203,50 +203,50 @@  discard block
 block discarded – undo
203 203
  * @return void
204 204
  *
205 205
  */
206
-function give_offline_send_admin_notice( $payment_id = 0 ) {
206
+function give_offline_send_admin_notice($payment_id = 0) {
207 207
 
208 208
 	/* Send an email notification to the admin */
209 209
 	$admin_email = give_get_admin_notice_emails();
210
-	$user_info   = give_get_payment_meta_user_info( $payment_id );
210
+	$user_info   = give_get_payment_meta_user_info($payment_id);
211 211
 
212
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) {
213
-		$user_data = get_userdata( $user_info['id'] );
212
+	if (isset($user_info['id']) && $user_info['id'] > 0) {
213
+		$user_data = get_userdata($user_info['id']);
214 214
 		$name      = $user_data->display_name;
215
-	} elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) {
216
-		$name = $user_info['first_name'] . ' ' . $user_info['last_name'];
215
+	} elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) {
216
+		$name = $user_info['first_name'].' '.$user_info['last_name'];
217 217
 	} else {
218 218
 		$name = $user_info['email'];
219 219
 	}
220 220
 
221
-	$amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) );
221
+	$amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id)));
222 222
 
223
-	$admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', esc_attr__( 'New Pending Donation', 'give' ), $payment_id );
223
+	$admin_subject = apply_filters('give_offline_admin_donation_notification_subject', esc_attr__('New Pending Donation', 'give'), $payment_id);
224 224
 
225
-	$admin_message = esc_attr__( 'Dear Admin,', 'give' ) . "\n\n";
226
-	$admin_message .= esc_attr__( 'An offline donation has been made on your website: ', 'give' ) . get_bloginfo( 'name' ) . ' ';
227
-	$admin_message .= esc_attr__( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n";
225
+	$admin_message = esc_attr__('Dear Admin,', 'give')."\n\n";
226
+	$admin_message .= esc_attr__('An offline donation has been made on your website: ', 'give').get_bloginfo('name').' ';
227
+	$admin_message .= esc_attr__('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n";
228 228
 
229 229
 
230
-	$admin_message .= '<strong>' . esc_attr__( 'Donor: ', 'give' ) . '</strong>' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n";
231
-	$admin_message .= '<strong>' . esc_attr__( 'Amount: ', 'give' ) . '</strong>' . html_entity_decode( $amount, ENT_COMPAT, 'UTF-8' ) . "\n\n";
230
+	$admin_message .= '<strong>'.esc_attr__('Donor: ', 'give').'</strong>'.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n";
231
+	$admin_message .= '<strong>'.esc_attr__('Amount: ', 'give').'</strong>'.html_entity_decode($amount, ENT_COMPAT, 'UTF-8')."\n\n";
232 232
 
233 233
 	$admin_message .= sprintf(
234 234
 		'<a href="%1$s">%2$s</a>',
235
-		admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ),
236
-		__( 'Click Here to View and/or Update Donation Details', 'give' )
237
-	) . "\n\n";
235
+		admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id),
236
+		__('Click Here to View and/or Update Donation Details', 'give')
237
+	)."\n\n";
238 238
 
239
-	$admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id );
240
-	$attachments   = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id );
241
-	$admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id );
239
+	$admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id);
240
+	$attachments   = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id);
241
+	$admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id);
242 242
 
243 243
 	//Send Email
244 244
 	$emails = Give()->emails;
245
-	if ( ! empty( $admin_headers ) ) {
246
-		$emails->__set( 'headers', $admin_headers );
245
+	if ( ! empty($admin_headers)) {
246
+		$emails->__set('headers', $admin_headers);
247 247
 	}
248 248
 
249
-	$emails->send( $admin_email, $admin_subject, $admin_message, $attachments );
249
+	$emails->send($admin_email, $admin_subject, $admin_message, $attachments);
250 250
 
251 251
 }
252 252
 
@@ -257,15 +257,15 @@  discard block
 block discarded – undo
257 257
  * @since  1.0
258 258
  * @return array
259 259
  */
260
-function give_offline_add_settings( $settings ) {
260
+function give_offline_add_settings($settings) {
261 261
 
262 262
 	//Vars
263 263
 	$prefix = '_give_';
264 264
 
265
-	$is_gateway_active = give_is_gateway_active( 'offline' );
265
+	$is_gateway_active = give_is_gateway_active('offline');
266 266
 
267 267
 	//this gateway isn't active
268
-	if ( ! $is_gateway_active ) {
268
+	if ( ! $is_gateway_active) {
269 269
 		//return settings and bounce
270 270
 		return $settings;
271 271
 	}
@@ -274,27 +274,27 @@  discard block
 block discarded – undo
274 274
 	$check_settings = array(
275 275
 
276 276
 		array(
277
-			'name'    => esc_attr__( 'Customize Offline Donations', 'give' ),
278
-			'desc'    => esc_attr__( 'If you would like to customize the donation instructions for this specific forms check this option.', 'give' ),
279
-			'id'      => $prefix . 'customize_offline_donations',
277
+			'name'    => esc_attr__('Customize Offline Donations', 'give'),
278
+			'desc'    => esc_attr__('If you would like to customize the donation instructions for this specific forms check this option.', 'give'),
279
+			'id'      => $prefix.'customize_offline_donations',
280 280
 			'type'    => 'radio_inline',
281 281
 			'default' => 'no',
282 282
 			'options' => array(
283
-				'yes' => esc_attr__( 'Yes', 'give' ),
284
-				'no'  => esc_attr__( 'No', 'give' ),
283
+				'yes' => esc_attr__('Yes', 'give'),
284
+				'no'  => esc_attr__('No', 'give'),
285 285
 			),
286 286
 		),
287 287
 		array(
288
-			'name'        => esc_attr__( 'Request Billing Information', 'give' ),
289
-			'desc'        => esc_attr__( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ),
290
-			'id'          => $prefix . 'offline_donation_enable_billing_fields_single',
288
+			'name'        => esc_attr__('Request Billing Information', 'give'),
289
+			'desc'        => esc_attr__('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'),
290
+			'id'          => $prefix.'offline_donation_enable_billing_fields_single',
291 291
 			'row_classes' => 'give-subfield',
292 292
 			'type'        => 'checkbox'
293 293
 		),
294 294
 		array(
295
-			'id'          => $prefix . 'offline_checkout_notes',
296
-			'name'        => esc_attr__( 'Offline Donation Instructions', 'give' ),
297
-			'desc'        => esc_attr__( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
295
+			'id'          => $prefix.'offline_checkout_notes',
296
+			'name'        => esc_attr__('Offline Donation Instructions', 'give'),
297
+			'desc'        => esc_attr__('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
298 298
 			'default'     => give_get_default_offline_donation_content(),
299 299
 			'type'        => 'wysiwyg',
300 300
 			'row_classes' => 'give-subfield',
@@ -303,17 +303,17 @@  discard block
 block discarded – undo
303 303
 			)
304 304
 		),
305 305
 		array(
306
-			'id'          => $prefix . 'offline_donation_subject',
307
-			'name'        => esc_attr__( 'Offline Donation Email Instructions Subject', 'give' ),
308
-			'desc'        => esc_attr__( 'Enter the subject line for the donation receipt email.', 'give' ),
309
-			'default'     => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ),
306
+			'id'          => $prefix.'offline_donation_subject',
307
+			'name'        => esc_attr__('Offline Donation Email Instructions Subject', 'give'),
308
+			'desc'        => esc_attr__('Enter the subject line for the donation receipt email.', 'give'),
309
+			'default'     => esc_attr__('{donation} - Offline Donation Instructions', 'give'),
310 310
 			'row_classes' => 'give-subfield',
311 311
 			'type'        => 'text'
312 312
 		),
313 313
 		array(
314
-			'id'          => $prefix . 'offline_donation_email',
315
-			'name'        => esc_attr__( 'Offline Donation Email Instructions', 'give' ),
316
-			'desc'        => esc_attr__( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ),
314
+			'id'          => $prefix.'offline_donation_email',
315
+			'name'        => esc_attr__('Offline Donation Email Instructions', 'give'),
316
+			'desc'        => esc_attr__('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give'),
317 317
 			'default'     => give_get_default_offline_donation_email_content(),
318 318
 			'type'        => 'wysiwyg',
319 319
 			'row_classes' => 'give-subfield',
@@ -323,10 +323,10 @@  discard block
 block discarded – undo
323 323
 		)
324 324
 	);
325 325
 
326
-	return array_merge( $settings, $check_settings );
326
+	return array_merge($settings, $check_settings);
327 327
 }
328 328
 
329
-add_filter( 'give_forms_display_options_metabox_fields', 'give_offline_add_settings' );
329
+add_filter('give_forms_display_options_metabox_fields', 'give_offline_add_settings');
330 330
 
331 331
 
332 332
 /**
@@ -338,20 +338,20 @@  discard block
 block discarded – undo
338 338
  */
339 339
 function give_get_default_offline_donation_content() {
340 340
 
341
-	$sitename = get_bloginfo( 'sitename' );
341
+	$sitename = get_bloginfo('sitename');
342 342
 
343
-	$default_text = '<p>' . esc_attr__( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>';
343
+	$default_text = '<p>'.esc_attr__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>';
344 344
 	$default_text .= '<ol>';
345
-	$default_text .= '<li>' . _x( 'Make a check payable to ', 'Step 1 for donating offline by check', 'give' ) . '"' . $sitename . '"' . '</li>';
346
-	$default_text .= '<li>' . _x( 'On the memo line of the check, please indicate that the donation is for ', 'Step 2 for donating by check; this explains who the check should be written to', 'give' ) . '"' . $sitename . '"' . '</li>';
347
-	$default_text .= '<li>' . _x( 'Please mail your check to:', 'Step 3; where to mail the check', 'give' ) . '</li>';
345
+	$default_text .= '<li>'._x('Make a check payable to ', 'Step 1 for donating offline by check', 'give').'"'.$sitename.'"'.'</li>';
346
+	$default_text .= '<li>'._x('On the memo line of the check, please indicate that the donation is for ', 'Step 2 for donating by check; this explains who the check should be written to', 'give').'"'.$sitename.'"'.'</li>';
347
+	$default_text .= '<li>'._x('Please mail your check to:', 'Step 3; where to mail the check', 'give').'</li>';
348 348
 	$default_text .= '</ol>';
349
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
349
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
350 350
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>123 G Street </em><br>';
351 351
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>San Diego, CA 92101 </em><br>';
352
-	$default_text .= '<p>' . esc_attr__( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>';
352
+	$default_text .= '<p>'.esc_attr__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>';
353 353
 
354
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
354
+	return apply_filters('give_default_offline_donation_content', $default_text);
355 355
 
356 356
 }
357 357
 
@@ -364,21 +364,21 @@  discard block
 block discarded – undo
364 364
  */
365 365
 function give_get_default_offline_donation_email_content() {
366 366
 
367
-	$sitename     = get_bloginfo( 'sitename' );
368
-	$default_text = '<p>' . esc_attr__( 'Dear {name},', 'give' ) . '</p>';
369
-	$default_text .= '<p>' . esc_attr__( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>';
367
+	$sitename     = get_bloginfo('sitename');
368
+	$default_text = '<p>'.esc_attr__('Dear {name},', 'give').'</p>';
369
+	$default_text .= '<p>'.esc_attr__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>';
370 370
 	$default_text .= '<ol>';
371
-	$default_text .= '<li>' . _x( 'Make a check payable to ', 'Step 1 for donating offline by check', 'give' ) . '"' . $sitename . '"' . '</li>';
372
-	$default_text .= '<li>' . _x( 'On the memo line of the check, please indicate that the donation is for ', 'Step 2 for donating by check; this explains who the check should be written to', 'give' ) . '"' . $sitename . '"' . '</li>';
373
-	$default_text .= '<li>' . _x( 'Please mail your check to:', 'Step 3; where to mail the check', 'give' ) . '</li>';
371
+	$default_text .= '<li>'._x('Make a check payable to ', 'Step 1 for donating offline by check', 'give').'"'.$sitename.'"'.'</li>';
372
+	$default_text .= '<li>'._x('On the memo line of the check, please indicate that the donation is for ', 'Step 2 for donating by check; this explains who the check should be written to', 'give').'"'.$sitename.'"'.'</li>';
373
+	$default_text .= '<li>'._x('Please mail your check to:', 'Step 3; where to mail the check', 'give').'</li>';
374 374
 	$default_text .= '</ol>';
375
-	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>' . $sitename . '</em><br>';
375
+	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>'.$sitename.'</em><br>';
376 376
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>123 G Street </em><br>';
377 377
 	$default_text .= '&nbsp;&nbsp;&nbsp;&nbsp;<em>San Diego, CA 92101 </em><br>';
378
-	$default_text .= '<p>' . esc_attr__( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>';
379
-	$default_text .= '<p>' . esc_attr__( 'Sincerely,', 'give' ) . '</p>';
380
-	$default_text .= '<p>' . $sitename . '</p>';
378
+	$default_text .= '<p>'.esc_attr__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>';
379
+	$default_text .= '<p>'.esc_attr__('Sincerely,', 'give').'</p>';
380
+	$default_text .= '<p>'.$sitename.'</p>';
381 381
 
382
-	return apply_filters( 'give_default_offline_donation_content', $default_text );
382
+	return apply_filters('give_default_offline_donation_content', $default_text);
383 383
 
384 384
 }
Please login to merge, or discard this patch.
includes/emails/functions.php 1 patch
Spacing   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 // Exit if accessed directly
13
-if ( ! defined( 'ABSPATH' ) ) {
13
+if ( ! defined('ABSPATH')) {
14 14
 	exit;
15 15
 }
16 16
 
@@ -26,39 +26,39 @@  discard block
 block discarded – undo
26 26
  *
27 27
  * @return void
28 28
  */
29
-function give_email_donation_receipt( $payment_id, $admin_notice = true ) {
29
+function give_email_donation_receipt($payment_id, $admin_notice = true) {
30 30
 
31
-	$payment_data = give_get_payment_meta( $payment_id );
31
+	$payment_data = give_get_payment_meta($payment_id);
32 32
 
33
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
34
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data );
33
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
34
+	$from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
35 35
 
36
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
37
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data );
36
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
37
+	$from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
38 38
 
39
-	$to_email = give_get_payment_user_email( $payment_id );
39
+	$to_email = give_get_payment_user_email($payment_id);
40 40
 
41
-	$subject = give_get_option( 'donation_subject', __( 'Donation Receipt', 'give' ) );
42
-	$subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id );
43
-	$subject = give_do_email_tags( $subject, $payment_id );
41
+	$subject = give_get_option('donation_subject', __('Donation Receipt', 'give'));
42
+	$subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id);
43
+	$subject = give_do_email_tags($subject, $payment_id);
44 44
 
45
-	$attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data );
46
-	$message     = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id );
45
+	$attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data);
46
+	$message     = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id);
47 47
 
48 48
 	$emails = Give()->emails;
49 49
 
50
-	$emails->__set( 'from_name', $from_name );
51
-	$emails->__set( 'from_email', $from_email );
52
-	$emails->__set( 'heading', __( 'Donation Receipt', 'give' ) );
50
+	$emails->__set('from_name', $from_name);
51
+	$emails->__set('from_email', $from_email);
52
+	$emails->__set('heading', __('Donation Receipt', 'give'));
53 53
 
54 54
 
55
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data );
56
-	$emails->__set( 'headers', $headers );
55
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data);
56
+	$emails->__set('headers', $headers);
57 57
 
58
-	$emails->send( $to_email, $subject, $message, $attachments );
58
+	$emails->send($to_email, $subject, $message, $attachments);
59 59
 
60
-	if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) {
61
-		do_action( 'give_admin_sale_notice', $payment_id, $payment_data );
60
+	if ($admin_notice && ! give_admin_notices_disabled($payment_id)) {
61
+		do_action('give_admin_sale_notice', $payment_id, $payment_data);
62 62
 	}
63 63
 }
64 64
 
@@ -71,29 +71,29 @@  discard block
 block discarded – undo
71 71
  */
72 72
 function give_email_test_donation_receipt() {
73 73
 
74
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
75
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, 0, array() );
74
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
75
+	$from_name = apply_filters('give_purchase_from_name', $from_name, 0, array());
76 76
 
77
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
78
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, 0, array() );
77
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
78
+	$from_email = apply_filters('give_purchase_from_address', $from_email, 0, array());
79 79
 
80
-	$subject = give_get_option( 'donation_subject', __( 'Donation Receipt', 'give' ) );
81
-	$subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 );
82
-	$subject = give_do_email_tags( $subject, 0 );
80
+	$subject = give_get_option('donation_subject', __('Donation Receipt', 'give'));
81
+	$subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0);
82
+	$subject = give_do_email_tags($subject, 0);
83 83
 
84
-	$attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() );
84
+	$attachments = apply_filters('give_receipt_attachments', array(), 0, array());
85 85
 
86
-	$message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) );
86
+	$message = give_email_preview_template_tags(give_get_email_body_content(0, array()));
87 87
 
88 88
 	$emails = Give()->emails;
89
-	$emails->__set( 'from_name', $from_name );
90
-	$emails->__set( 'from_email', $from_email );
91
-	$emails->__set( 'heading', __( 'Donation Receipt', 'give' ) );
89
+	$emails->__set('from_name', $from_name);
90
+	$emails->__set('from_email', $from_email);
91
+	$emails->__set('heading', __('Donation Receipt', 'give'));
92 92
 
93
-	$headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() );
94
-	$emails->__set( 'headers', $headers );
93
+	$headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array());
94
+	$emails->__set('headers', $headers);
95 95
 
96
-	$emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments );
96
+	$emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments);
97 97
 
98 98
 }
99 99
 
@@ -107,49 +107,49 @@  discard block
 block discarded – undo
107 107
  *
108 108
  * @return void
109 109
  */
110
-function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) {
110
+function give_admin_email_notice($payment_id = 0, $payment_data = array()) {
111 111
 
112
-	$payment_id = absint( $payment_id );
112
+	$payment_id = absint($payment_id);
113 113
 
114
-	if ( empty( $payment_id ) ) {
114
+	if (empty($payment_id)) {
115 115
 		return;
116 116
 	}
117 117
 
118
-	if ( ! give_get_payment_by( 'id', $payment_id ) ) {
118
+	if ( ! give_get_payment_by('id', $payment_id)) {
119 119
 		return;
120 120
 	}
121 121
 
122
-	$from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) );
123
-	$from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data );
122
+	$from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES));
123
+	$from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data);
124 124
 
125
-	$from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) );
126
-	$from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data );
125
+	$from_email = give_get_option('from_email', get_bloginfo('admin_email'));
126
+	$from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data);
127 127
 
128
-	$subject = give_get_option( 'donation_notification_subject', sprintf( __( 'New Donation - Payment #%s', 'give' ), $payment_id ) );
129
-	$subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id );
130
-	$subject = give_do_email_tags( $subject, $payment_id );
128
+	$subject = give_get_option('donation_notification_subject', sprintf(__('New Donation - Payment #%s', 'give'), $payment_id));
129
+	$subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id);
130
+	$subject = give_do_email_tags($subject, $payment_id);
131 131
 
132
-	$headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n";
133
-	$headers .= "Reply-To: " . $from_email . "\r\n";
132
+	$headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n";
133
+	$headers .= "Reply-To: ".$from_email."\r\n";
134 134
 	//$headers  .= "MIME-Version: 1.0\r\n";
135 135
 	$headers .= "Content-Type: text/html; charset=utf-8\r\n";
136
-	$headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data );
136
+	$headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data);
137 137
 
138
-	$attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data );
138
+	$attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data);
139 139
 
140
-	$message = give_get_donation_notification_body_content( $payment_id, $payment_data );
140
+	$message = give_get_donation_notification_body_content($payment_id, $payment_data);
141 141
 
142 142
 	$emails = Give()->emails;
143
-	$emails->__set( 'from_name', $from_name );
144
-	$emails->__set( 'from_email', $from_email );
145
-	$emails->__set( 'headers', $headers );
146
-	$emails->__set( 'heading', __( 'New Donation!', 'give' ) );
143
+	$emails->__set('from_name', $from_name);
144
+	$emails->__set('from_email', $from_email);
145
+	$emails->__set('headers', $headers);
146
+	$emails->__set('heading', __('New Donation!', 'give'));
147 147
 
148
-	$emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments );
148
+	$emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments);
149 149
 
150 150
 }
151 151
 
152
-add_action( 'give_admin_sale_notice', 'give_admin_email_notice', 10, 2 );
152
+add_action('give_admin_sale_notice', 'give_admin_email_notice', 10, 2);
153 153
 
154 154
 /**
155 155
  * Retrieves the emails for which admin notifications are sent to (these can be
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
 function give_get_admin_notice_emails() {
163 163
 	global $give_options;
164 164
 
165
-	$emails = isset( $give_options['admin_notice_emails'] ) && strlen( trim( $give_options['admin_notice_emails'] ) ) > 0 ? $give_options['admin_notice_emails'] : get_bloginfo( 'admin_email' );
166
-	$emails = array_map( 'trim', explode( "\n", $emails ) );
165
+	$emails = isset($give_options['admin_notice_emails']) && strlen(trim($give_options['admin_notice_emails'])) > 0 ? $give_options['admin_notice_emails'] : get_bloginfo('admin_email');
166
+	$emails = array_map('trim', explode("\n", $emails));
167 167
 
168
-	return apply_filters( 'give_admin_notice_emails', $emails );
168
+	return apply_filters('give_admin_notice_emails', $emails);
169 169
 }
170 170
 
171 171
 /**
@@ -177,11 +177,11 @@  discard block
 block discarded – undo
177 177
  *
178 178
  * @return mixed
179 179
  */
180
-function give_admin_notices_disabled( $payment_id = 0 ) {
180
+function give_admin_notices_disabled($payment_id = 0) {
181 181
 
182
-	$retval = give_get_option( 'disable_admin_notices' );
182
+	$retval = give_get_option('disable_admin_notices');
183 183
 
184
-	return apply_filters( 'give_admin_notices_disabled', $retval, $payment_id );
184
+	return apply_filters('give_admin_notices_disabled', $retval, $payment_id);
185 185
 }
186 186
 
187 187
 /**
@@ -194,17 +194,17 @@  discard block
 block discarded – undo
194 194
  */
195 195
 function give_get_default_donation_notification_email() {
196 196
 
197
-	$default_email_body = __( 'Hi there,', 'give' ) . "\n\n" . __( 'This email is to inform you that a new donation has been made on your website: ', 'give' ) . '<a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n";
198
-	$default_email_body .= '<strong>' . __( 'Donor: ', 'give' ) . '</strong> ' . ' {name}' . "\n";
199
-	$default_email_body .= '<strong>' . __( 'Donation: ', 'give' ) . '</strong> ' . ' {donation}' . "\n";
200
-	$default_email_body .= '<strong>' . __( 'Amount: ', 'give' ) . '</strong> ' . ' {price}' . "\n";
201
-	$default_email_body .= '<strong>' . __( 'Payment Method: ', 'give' ) . '</strong> ' . ' {payment_method}' . "\n\n";
202
-	$default_email_body .= __( 'Thank you,', 'give' ) . "\n\n" . '{sitename}';
197
+	$default_email_body = __('Hi there,', 'give')."\n\n".__('This email is to inform you that a new donation has been made on your website: ', 'give').'<a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n";
198
+	$default_email_body .= '<strong>'.__('Donor: ', 'give').'</strong> '.' {name}'."\n";
199
+	$default_email_body .= '<strong>'.__('Donation: ', 'give').'</strong> '.' {donation}'."\n";
200
+	$default_email_body .= '<strong>'.__('Amount: ', 'give').'</strong> '.' {price}'."\n";
201
+	$default_email_body .= '<strong>'.__('Payment Method: ', 'give').'</strong> '.' {payment_method}'."\n\n";
202
+	$default_email_body .= __('Thank you,', 'give')."\n\n".'{sitename}';
203 203
 
204
-	$custom_message = give_get_option( 'donation_notification' );
205
-	$message        = ! empty( $custom_message ) ? $custom_message : $default_email_body;
204
+	$custom_message = give_get_option('donation_notification');
205
+	$message        = ! empty($custom_message) ? $custom_message : $default_email_body;
206 206
 
207
-	return apply_filters( 'give_default_donation_notification_email', $message );
207
+	return apply_filters('give_default_donation_notification_email', $message);
208 208
 }
209 209
 
210 210
 
@@ -218,26 +218,26 @@  discard block
 block discarded – undo
218 218
  */
219 219
 function give_get_default_donation_receipt_email() {
220 220
 
221
-	$default_email_body = __( 'Dear', 'give' ) . " {name},\n\n";
222
-	$default_email_body .= __( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n";
223
-	$default_email_body .= '<strong>' . __( 'Donor', 'give' ) . ':</strong> ' . '{fullname}' . "\n";
224
-	$default_email_body .= '<strong>' . __( 'Donation', 'give' ) . ':</strong> ' . '{donation}' . "\n";
225
-	$default_email_body .= '<strong>' . __( 'Donation Date', 'give' ) . ':</strong> ' . '{date}' . "\n";
226
-	$default_email_body .= '<strong>' . __( 'Amount', 'give' ) . ':</strong> ' . '{price}' . "\n";
227
-	$default_email_body .= '<strong>' . __( 'Payment Method', 'give' ) . ':</strong> ' . '{payment_method}' . "\n";
228
-	$default_email_body .= '<strong>' . __( 'Payment ID', 'give' ) . ':</strong> ' . '{payment_id}' . "\n";
229
-	$default_email_body .= '<strong>' . __( 'Receipt ID', 'give' ) . ':</strong> ' . '{receipt_id}' . "\n\n";
230
-	$default_email_body .= '{receipt_link}' . "\n\n";
221
+	$default_email_body = __('Dear', 'give')." {name},\n\n";
222
+	$default_email_body .= __('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n";
223
+	$default_email_body .= '<strong>'.__('Donor', 'give').':</strong> '.'{fullname}'."\n";
224
+	$default_email_body .= '<strong>'.__('Donation', 'give').':</strong> '.'{donation}'."\n";
225
+	$default_email_body .= '<strong>'.__('Donation Date', 'give').':</strong> '.'{date}'."\n";
226
+	$default_email_body .= '<strong>'.__('Amount', 'give').':</strong> '.'{price}'."\n";
227
+	$default_email_body .= '<strong>'.__('Payment Method', 'give').':</strong> '.'{payment_method}'."\n";
228
+	$default_email_body .= '<strong>'.__('Payment ID', 'give').':</strong> '.'{payment_id}'."\n";
229
+	$default_email_body .= '<strong>'.__('Receipt ID', 'give').':</strong> '.'{receipt_id}'."\n\n";
230
+	$default_email_body .= '{receipt_link}'."\n\n";
231 231
 
232 232
 	$default_email_body .= "\n\n";
233
-	$default_email_body .= __( 'Sincerely,', 'give' );
234
-	$default_email_body .= "\n" . '{sitename}' . "\n";
233
+	$default_email_body .= __('Sincerely,', 'give');
234
+	$default_email_body .= "\n".'{sitename}'."\n";
235 235
 
236
-	$custom_message = give_get_option( 'donation_receipt' );
236
+	$custom_message = give_get_option('donation_receipt');
237 237
 
238
-	$message = ! empty( $custom_message ) ? $custom_message : $default_email_body;
238
+	$message = ! empty($custom_message) ? $custom_message : $default_email_body;
239 239
 
240
-	return apply_filters( 'give_default_donation_receipt_email', $message );
240
+	return apply_filters('give_default_donation_receipt_email', $message);
241 241
 }
242 242
 
243 243
 /**
@@ -249,19 +249,19 @@  discard block
 block discarded – undo
249 249
  *
250 250
  * @return array $email_names
251 251
  */
252
-function give_get_email_names( $user_info ) {
252
+function give_get_email_names($user_info) {
253 253
 	$email_names = array();
254
-	$user_info   = maybe_unserialize( $user_info );
254
+	$user_info   = maybe_unserialize($user_info);
255 255
 
256 256
 	$email_names['fullname'] = '';
257
-	if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) {
258
-		$user_data               = get_userdata( $user_info['id'] );
257
+	if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) {
258
+		$user_data               = get_userdata($user_info['id']);
259 259
 		$email_names['name']     = $user_info['first_name'];
260
-		$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
260
+		$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
261 261
 		$email_names['username'] = $user_data->user_login;
262
-	} elseif ( isset( $user_info['first_name'] ) ) {
262
+	} elseif (isset($user_info['first_name'])) {
263 263
 		$email_names['name']     = $user_info['first_name'];
264
-		$email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name'];
264
+		$email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name'];
265 265
 		$email_names['username'] = $user_info['first_name'];
266 266
 	} else {
267 267
 		$email_names['name']     = $user_info['email'];
Please login to merge, or discard this patch.