@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Donation_Form_Goal extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = esc_html__( 'Donation Form Goal', 'give' ); |
|
22 | - $this->shortcode['label'] = esc_html__( 'Donation Form Goal', 'give' ); |
|
21 | + $this->shortcode['title'] = esc_html__('Donation Form Goal', 'give'); |
|
22 | + $this->shortcode['label'] = esc_html__('Donation Form Goal', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_goal' ); |
|
24 | + parent::__construct('give_goal'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | |
34 | 34 | $create_form_link = sprintf( |
35 | 35 | /* translators: %s: create new form URL */ |
36 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
37 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
36 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
37 | + admin_url('post-new.php?post_type=give_forms') |
|
38 | 38 | ); |
39 | 39 | |
40 | 40 | return array( |
@@ -44,35 +44,35 @@ discard block |
||
44 | 44 | 'post_type' => 'give_forms', |
45 | 45 | ), |
46 | 46 | 'name' => 'id', |
47 | - 'tooltip' => esc_attr__( 'Select a Donation Form', 'give' ), |
|
48 | - 'placeholder' => esc_attr__( '- Select a Form -', 'give' ), |
|
47 | + 'tooltip' => esc_attr__('Select a Donation Form', 'give'), |
|
48 | + 'placeholder' => esc_attr__('- Select a Form -', 'give'), |
|
49 | 49 | 'required' => array( |
50 | - 'alert' => esc_html__( 'You must first select a Form!', 'give' ), |
|
51 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__( 'No donation forms were found!', 'give' ), $create_form_link ), |
|
50 | + 'alert' => esc_html__('You must first select a Form!', 'give'), |
|
51 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html__('No donation forms were found!', 'give'), $create_form_link), |
|
52 | 52 | ), |
53 | 53 | ), |
54 | 54 | array( |
55 | 55 | 'type' => 'container', |
56 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
56 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')), |
|
57 | 57 | ), |
58 | 58 | array( |
59 | 59 | 'type' => 'listbox', |
60 | 60 | 'name' => 'show_text', |
61 | - 'label' => esc_html__( 'Show Text:', 'give' ), |
|
62 | - 'tooltip' => esc_attr__( 'This text displays the amount of income raised compared to the goal.', 'give' ), |
|
61 | + 'label' => esc_html__('Show Text:', 'give'), |
|
62 | + 'tooltip' => esc_attr__('This text displays the amount of income raised compared to the goal.', 'give'), |
|
63 | 63 | 'options' => array( |
64 | - 'true' => esc_html__( 'Show', 'give' ), |
|
65 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
64 | + 'true' => esc_html__('Show', 'give'), |
|
65 | + 'false' => esc_html__('Hide', 'give'), |
|
66 | 66 | ), |
67 | 67 | ), |
68 | 68 | array( |
69 | 69 | 'type' => 'listbox', |
70 | 70 | 'name' => 'show_bar', |
71 | - 'label' => esc_html__( 'Show Progress Bar:', 'give' ), |
|
72 | - 'tooltip' => esc_attr__( 'Do you want to display the goal\'s progress bar?', 'give' ), |
|
71 | + 'label' => esc_html__('Show Progress Bar:', 'give'), |
|
72 | + 'tooltip' => esc_attr__('Do you want to display the goal\'s progress bar?', 'give'), |
|
73 | 73 | 'options' => array( |
74 | - 'true' => esc_html__( 'Show', 'give' ), |
|
75 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
74 | + 'true' => esc_html__('Show', 'give'), |
|
75 | + 'false' => esc_html__('Hide', 'give'), |
|
76 | 76 | ), |
77 | 77 | ), |
78 | 78 | ); |
@@ -248,8 +248,8 @@ |
||
248 | 248 | |
249 | 249 | // do not reindex array! |
250 | 250 | $field['options'] = array( |
251 | - '' => ( $field['placeholder'] ? $field['placeholder'] : esc_html__( '- Select -', 'give' ) ), |
|
252 | - ) + $field['options']; |
|
251 | + '' => ( $field['placeholder'] ? $field['placeholder'] : esc_html__( '- Select -', 'give' ) ), |
|
252 | + ) + $field['options']; |
|
253 | 253 | |
254 | 254 | foreach ( $field['options'] as $value => $text ) { |
255 | 255 | $new_listbox['values'][] = array( |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | * @since 1.3.0 |
12 | 12 | */ |
13 | 13 | |
14 | -defined( 'ABSPATH' ) or exit; |
|
14 | +defined('ABSPATH') or exit; |
|
15 | 15 | |
16 | 16 | abstract class Give_Shortcode_Generator { |
17 | 17 | |
@@ -57,12 +57,12 @@ discard block |
||
57 | 57 | * |
58 | 58 | * @since 1.0 |
59 | 59 | */ |
60 | - public function __construct( $shortcode ) { |
|
60 | + public function __construct($shortcode) { |
|
61 | 61 | |
62 | 62 | |
63 | 63 | $this->shortcode_tag = $shortcode; |
64 | 64 | |
65 | - add_action( 'admin_init', array( $this, 'init' ) ); |
|
65 | + add_action('admin_init', array($this, 'init')); |
|
66 | 66 | |
67 | 67 | } |
68 | 68 | |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function init() { |
75 | 75 | |
76 | - if ( $this->shortcode_tag ) { |
|
76 | + if ($this->shortcode_tag) { |
|
77 | 77 | |
78 | - $this->self = get_class( $this ); |
|
78 | + $this->self = get_class($this); |
|
79 | 79 | |
80 | 80 | $this->errors = array(); |
81 | 81 | $this->required = array(); |
@@ -84,18 +84,18 @@ discard block |
||
84 | 84 | $fields = $this->get_fields(); |
85 | 85 | |
86 | 86 | $defaults = array( |
87 | - 'btn_close' => esc_html__( 'Close', 'give' ), |
|
88 | - 'btn_okay' => esc_html__( 'Insert Shortcode', 'give' ), |
|
87 | + 'btn_close' => esc_html__('Close', 'give'), |
|
88 | + 'btn_okay' => esc_html__('Insert Shortcode', 'give'), |
|
89 | 89 | 'errors' => $this->errors, |
90 | 90 | 'fields' => $fields, |
91 | - 'label' => '[' . $this->shortcode_tag . ']', |
|
91 | + 'label' => '['.$this->shortcode_tag.']', |
|
92 | 92 | 'required' => $this->required, |
93 | - 'title' => esc_attr__( 'Insert Shortcode', 'give' ), |
|
93 | + 'title' => esc_attr__('Insert Shortcode', 'give'), |
|
94 | 94 | ); |
95 | 95 | |
96 | - if ( user_can_richedit() ) { |
|
96 | + if (user_can_richedit()) { |
|
97 | 97 | |
98 | - Give_Shortcode_Button::$shortcodes[ $this->shortcode_tag ] = wp_parse_args( $this->shortcode, $defaults ); |
|
98 | + Give_Shortcode_Button::$shortcodes[$this->shortcode_tag] = wp_parse_args($this->shortcode, $defaults); |
|
99 | 99 | |
100 | 100 | } |
101 | 101 | } |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @since 1.0 |
126 | 126 | */ |
127 | - protected function generate_fields( $defined_fields ) { |
|
127 | + protected function generate_fields($defined_fields) { |
|
128 | 128 | |
129 | 129 | $fields = array(); |
130 | 130 | |
131 | - if ( is_array( $defined_fields ) ) { |
|
131 | + if (is_array($defined_fields)) { |
|
132 | 132 | |
133 | - foreach ( $defined_fields as $field ) { |
|
133 | + foreach ($defined_fields as $field) { |
|
134 | 134 | |
135 | 135 | $defaults = array( |
136 | 136 | 'label' => false, |
@@ -141,14 +141,14 @@ discard block |
||
141 | 141 | 'type' => '', |
142 | 142 | ); |
143 | 143 | |
144 | - $field = wp_parse_args( (array) $field, $defaults ); |
|
145 | - $method = 'generate_' . strtolower( $field['type'] ); |
|
144 | + $field = wp_parse_args((array) $field, $defaults); |
|
145 | + $method = 'generate_'.strtolower($field['type']); |
|
146 | 146 | |
147 | - if ( method_exists( $this, $method ) ) { |
|
147 | + if (method_exists($this, $method)) { |
|
148 | 148 | |
149 | - $field = call_user_func( array( $this, $method ), $field ); |
|
149 | + $field = call_user_func(array($this, $method), $field); |
|
150 | 150 | |
151 | - if ( $field ) { |
|
151 | + if ($field) { |
|
152 | 152 | $fields[] = $field; |
153 | 153 | } |
154 | 154 | } |
@@ -168,22 +168,22 @@ discard block |
||
168 | 168 | protected function get_fields() { |
169 | 169 | |
170 | 170 | $defined_fields = $this->define_fields(); |
171 | - $generated_fields = $this->generate_fields( $defined_fields ); |
|
171 | + $generated_fields = $this->generate_fields($defined_fields); |
|
172 | 172 | |
173 | 173 | $errors = array(); |
174 | 174 | |
175 | - if ( ! empty( $this->errors ) ) { |
|
176 | - foreach ( $this->required as $name => $alert ) { |
|
177 | - if ( false === array_search( $name, array_column( $generated_fields, 'name' ) ) ) { |
|
175 | + if ( ! empty($this->errors)) { |
|
176 | + foreach ($this->required as $name => $alert) { |
|
177 | + if (false === array_search($name, array_column($generated_fields, 'name'))) { |
|
178 | 178 | |
179 | - $errors[] = $this->errors[ $name ]; |
|
179 | + $errors[] = $this->errors[$name]; |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
183 | 183 | $this->errors = $errors; |
184 | 184 | } |
185 | 185 | |
186 | - if ( ! empty( $errors ) ) { |
|
186 | + if ( ! empty($errors)) { |
|
187 | 187 | |
188 | 188 | return $errors; |
189 | 189 | } |
@@ -200,9 +200,9 @@ discard block |
||
200 | 200 | * |
201 | 201 | * @since 1.0 |
202 | 202 | */ |
203 | - protected function generate_container( $field ) { |
|
203 | + protected function generate_container($field) { |
|
204 | 204 | |
205 | - if ( array_key_exists( 'html', $field ) ) { |
|
205 | + if (array_key_exists('html', $field)) { |
|
206 | 206 | |
207 | 207 | return array( |
208 | 208 | 'type' => $field['type'], |
@@ -222,36 +222,36 @@ discard block |
||
222 | 222 | * |
223 | 223 | * @since 1.0 |
224 | 224 | */ |
225 | - protected function generate_listbox( $field ) { |
|
225 | + protected function generate_listbox($field) { |
|
226 | 226 | |
227 | - $listbox = shortcode_atts( array( |
|
227 | + $listbox = shortcode_atts(array( |
|
228 | 228 | 'label' => '', |
229 | 229 | 'minWidth' => '', |
230 | 230 | 'name' => false, |
231 | 231 | 'tooltip' => '', |
232 | 232 | 'type' => '', |
233 | 233 | 'value' => '', |
234 | - ), $field ); |
|
234 | + ), $field); |
|
235 | 235 | |
236 | - if ( $this->validate( $field ) ) { |
|
236 | + if ($this->validate($field)) { |
|
237 | 237 | |
238 | 238 | $new_listbox = array(); |
239 | 239 | |
240 | - foreach ( $listbox as $key => $value ) { |
|
240 | + foreach ($listbox as $key => $value) { |
|
241 | 241 | |
242 | - if ( $key == 'value' && empty( $value ) ) { |
|
243 | - $new_listbox[ $key ] = $listbox['name']; |
|
244 | - } else if ( $value ) { |
|
245 | - $new_listbox[ $key ] = $value; |
|
242 | + if ($key == 'value' && empty($value)) { |
|
243 | + $new_listbox[$key] = $listbox['name']; |
|
244 | + } else if ($value) { |
|
245 | + $new_listbox[$key] = $value; |
|
246 | 246 | } |
247 | 247 | } |
248 | 248 | |
249 | 249 | // do not reindex array! |
250 | 250 | $field['options'] = array( |
251 | - '' => ( $field['placeholder'] ? $field['placeholder'] : esc_html__( '- Select -', 'give' ) ), |
|
251 | + '' => ($field['placeholder'] ? $field['placeholder'] : esc_html__('- Select -', 'give')), |
|
252 | 252 | ) + $field['options']; |
253 | 253 | |
254 | - foreach ( $field['options'] as $value => $text ) { |
|
254 | + foreach ($field['options'] as $value => $text) { |
|
255 | 255 | $new_listbox['values'][] = array( |
256 | 256 | 'text' => $text, |
257 | 257 | 'value' => $value, |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * |
274 | 274 | * @since 1.0 |
275 | 275 | */ |
276 | - protected function generate_post( $field ) { |
|
276 | + protected function generate_post($field) { |
|
277 | 277 | |
278 | 278 | $args = array( |
279 | 279 | 'post_type' => 'post', |
@@ -282,23 +282,23 @@ discard block |
||
282 | 282 | 'posts_per_page' => 30, |
283 | 283 | ); |
284 | 284 | |
285 | - $args = wp_parse_args( (array) $field['query_args'], $args ); |
|
286 | - $posts = get_posts( $args ); |
|
285 | + $args = wp_parse_args((array) $field['query_args'], $args); |
|
286 | + $posts = get_posts($args); |
|
287 | 287 | $options = array(); |
288 | 288 | |
289 | - if ( $posts ) { |
|
290 | - foreach ( $posts as $post ) { |
|
291 | - $options[ absint( $post->ID ) ] = esc_html__( $post->post_title ); |
|
289 | + if ($posts) { |
|
290 | + foreach ($posts as $post) { |
|
291 | + $options[absint($post->ID)] = esc_html__($post->post_title); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | $field['type'] = 'listbox'; |
295 | 295 | $field['options'] = $options; |
296 | 296 | |
297 | - return $this->generate_listbox( $field ); |
|
297 | + return $this->generate_listbox($field); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | // perform validation here before returning false |
301 | - $this->validate( $field ); |
|
301 | + $this->validate($field); |
|
302 | 302 | |
303 | 303 | return false; |
304 | 304 | } |
@@ -312,9 +312,9 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @since 1.0 |
314 | 314 | */ |
315 | - protected function generate_textbox( $field ) { |
|
315 | + protected function generate_textbox($field) { |
|
316 | 316 | |
317 | - $textbox = shortcode_atts( array( |
|
317 | + $textbox = shortcode_atts(array( |
|
318 | 318 | 'label' => '', |
319 | 319 | 'maxLength' => '', |
320 | 320 | 'minHeight' => '', |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | 'tooltip' => '', |
325 | 325 | 'type' => '', |
326 | 326 | 'value' => '', |
327 | - ), $field ); |
|
327 | + ), $field); |
|
328 | 328 | |
329 | - if ( $this->validate( $field ) ) { |
|
330 | - return array_filter( $textbox, array( $this, 'return_textbox_value' ) ); |
|
329 | + if ($this->validate($field)) { |
|
330 | + return array_filter($textbox, array($this, 'return_textbox_value')); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | return false; |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | * |
341 | 341 | * @return bool |
342 | 342 | */ |
343 | - function return_textbox_value( $value ) { |
|
343 | + function return_textbox_value($value) { |
|
344 | 344 | return $value !== ''; |
345 | 345 | } |
346 | 346 | |
@@ -356,9 +356,9 @@ discard block |
||
356 | 356 | * |
357 | 357 | * @since 1.0 |
358 | 358 | */ |
359 | - protected function validate( $field ) { |
|
359 | + protected function validate($field) { |
|
360 | 360 | |
361 | - extract( shortcode_atts( |
|
361 | + extract(shortcode_atts( |
|
362 | 362 | array( |
363 | 363 | 'name' => false, |
364 | 364 | 'required' => false, |
@@ -366,36 +366,36 @@ discard block |
||
366 | 366 | ), $field ) |
367 | 367 | ); |
368 | 368 | |
369 | - if ( $name ) { |
|
369 | + if ($name) { |
|
370 | 370 | |
371 | - if ( isset( $required['error'] ) ) { |
|
371 | + if (isset($required['error'])) { |
|
372 | 372 | |
373 | 373 | $error = array( |
374 | 374 | 'type' => 'container', |
375 | 375 | 'html' => $required['error'], |
376 | 376 | ); |
377 | 377 | |
378 | - $this->errors[ $name ] = $this->generate_container( $error ); |
|
378 | + $this->errors[$name] = $this->generate_container($error); |
|
379 | 379 | } |
380 | 380 | |
381 | - if ( ! ! $required || is_array( $required ) ) { |
|
381 | + if ( ! ! $required || is_array($required)) { |
|
382 | 382 | |
383 | - $alert = esc_html__( 'Some of the Shortcode options are required.', 'give' ); |
|
383 | + $alert = esc_html__('Some of the Shortcode options are required.', 'give'); |
|
384 | 384 | |
385 | - if ( isset( $required['alert'] ) ) { |
|
385 | + if (isset($required['alert'])) { |
|
386 | 386 | |
387 | 387 | $alert = $required['alert']; |
388 | 388 | |
389 | - } else if ( ! empty( $label ) ) { |
|
389 | + } else if ( ! empty($label)) { |
|
390 | 390 | |
391 | 391 | $alert = sprintf( |
392 | 392 | /* translators: %s: option lable */ |
393 | - esc_html__( 'The "%s" option is required.', 'give' ), |
|
394 | - str_replace( ':', '', $label ) |
|
393 | + esc_html__('The "%s" option is required.', 'give'), |
|
394 | + str_replace(':', '', $label) |
|
395 | 395 | ); |
396 | 396 | } |
397 | 397 | |
398 | - $this->required[ $name ] = $alert; |
|
398 | + $this->required[$name] = $alert; |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | return true; |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Donation_History extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['label'] = esc_html__( 'Donation History', 'give' ); |
|
21 | + $this->shortcode['label'] = esc_html__('Donation History', 'give'); |
|
22 | 22 | |
23 | - parent::__construct( 'donation_history' ); |
|
23 | + parent::__construct('donation_history'); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Login extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = esc_html__( 'Login', 'give' ); |
|
22 | - $this->shortcode['label'] = esc_html__( 'Login', 'give' ); |
|
21 | + $this->shortcode['title'] = esc_html__('Login', 'give'); |
|
22 | + $this->shortcode['label'] = esc_html__('Login', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_login' ); |
|
24 | + parent::__construct('give_login'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | return array( |
35 | 35 | array( |
36 | 36 | 'type' => 'container', |
37 | - 'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Redirect URL (optional):', 'give' ) ), |
|
37 | + 'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Redirect URL (optional):', 'give')), |
|
38 | 38 | ), |
39 | 39 | array( |
40 | 40 | 'type' => 'textbox', |
41 | 41 | 'name' => 'redirect', |
42 | 42 | 'minWidth' => 320, |
43 | - 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after login.', 'give' ), |
|
43 | + 'tooltip' => esc_attr__('Enter an URL here to redirect to after login.', 'give'), |
|
44 | 44 | ), |
45 | 45 | ); |
46 | 46 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Register extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = esc_html__( 'Register', 'give' ); |
|
22 | - $this->shortcode['label'] = esc_html__( 'Register', 'give' ); |
|
21 | + $this->shortcode['title'] = esc_html__('Register', 'give'); |
|
22 | + $this->shortcode['label'] = esc_html__('Register', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_register' ); |
|
24 | + parent::__construct('give_register'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | return array( |
35 | 35 | array( |
36 | 36 | 'type' => 'container', |
37 | - 'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Redirect URL (optional):', 'give' ) ), |
|
37 | + 'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Redirect URL (optional):', 'give')), |
|
38 | 38 | ), |
39 | 39 | array( |
40 | 40 | 'type' => 'textbox', |
41 | 41 | 'name' => 'redirect', |
42 | 42 | 'minWidth' => 320, |
43 | - 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after registering.', 'give' ), |
|
43 | + 'tooltip' => esc_attr__('Enter an URL here to redirect to after registering.', 'give'), |
|
44 | 44 | ), |
45 | 45 | ); |
46 | 46 | } |
@@ -10,11 +10,11 @@ discard block |
||
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 |
||
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,326 +48,326 @@ discard block |
||
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' => esc_html__( 'Donation Options', 'give' ), |
|
54 | - 'object_types' => array( 'give_forms' ), |
|
53 | + 'title' => esc_html__('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' => esc_html__( 'Donation Option', 'give' ), |
|
61 | - 'description' => esc_html__( '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' => esc_html__('Donation Option', 'give'), |
|
61 | + 'description' => esc_html__('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' => esc_html__( 'Set Donation', 'give' ), |
|
67 | - 'multi' => esc_html__( 'Multi-level Donation', 'give' ), |
|
68 | - ) ), |
|
65 | + 'options' => apply_filters('give_forms_price_options', array( |
|
66 | + 'set' => esc_html__('Set Donation', 'give'), |
|
67 | + 'multi' => esc_html__('Multi-level Donation', 'give'), |
|
68 | + )), |
|
69 | 69 | ), |
70 | 70 | array( |
71 | - 'name' => esc_html__( 'Set Donation', 'give' ), |
|
72 | - 'description' => esc_html__( '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' => esc_html__('Set Donation', 'give'), |
|
72 | + 'description' => esc_html__('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' => esc_html__( 'Add Level', 'give' ), |
|
95 | + 'add_button' => esc_html__('Add Level', 'give'), |
|
96 | 96 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
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' => esc_html__( 'ID', 'give' ), |
|
103 | - 'id' => $prefix . 'id', |
|
102 | + 'name' => esc_html__('ID', 'give'), |
|
103 | + 'id' => $prefix.'id', |
|
104 | 104 | 'type' => 'levels_id', |
105 | 105 | ), |
106 | 106 | array( |
107 | - 'name' => esc_html__( 'Amount', 'give' ), |
|
108 | - 'id' => $prefix . 'amount', |
|
107 | + 'name' => esc_html__('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' => esc_html__( 'Text', 'give' ), |
|
120 | - 'id' => $prefix . 'text', |
|
119 | + 'name' => esc_html__('Text', 'give'), |
|
120 | + 'id' => $prefix.'text', |
|
121 | 121 | 'type' => 'text', |
122 | 122 | 'attributes' => array( |
123 | - 'placeholder' => esc_attr__( 'Donation Level', 'give' ), |
|
123 | + 'placeholder' => esc_attr__('Donation Level', 'give'), |
|
124 | 124 | 'class' => 'give-multilevel-text-field', |
125 | 125 | ), |
126 | 126 | ), |
127 | 127 | array( |
128 | - 'name' => esc_html__( 'Default', 'give' ), |
|
129 | - 'id' => $prefix . 'default', |
|
128 | + 'name' => esc_html__('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' => esc_html__( 'Display Style', 'give' ), |
|
137 | - 'description' => esc_html__( 'Set how the donations levels will display on the form.', 'give' ), |
|
138 | - 'id' => $prefix . 'display_style', |
|
136 | + 'name' => esc_html__('Display Style', 'give'), |
|
137 | + 'description' => esc_html__('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' => esc_html__( 'Buttons', 'give' ), |
|
143 | - 'radios' => esc_html__( 'Radios', 'give' ), |
|
144 | - 'dropdown' => esc_html__( 'Dropdown', 'give' ), |
|
142 | + 'buttons' => esc_html__('Buttons', 'give'), |
|
143 | + 'radios' => esc_html__('Radios', 'give'), |
|
144 | + 'dropdown' => esc_html__('Dropdown', 'give'), |
|
145 | 145 | ), |
146 | 146 | ), |
147 | 147 | //Custom Amount |
148 | 148 | array( |
149 | - 'name' => esc_html__( 'Custom Amount', 'give' ), |
|
150 | - 'description' => esc_html__( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
151 | - 'id' => $prefix . 'custom_amount', |
|
149 | + 'name' => esc_html__('Custom Amount', 'give'), |
|
150 | + 'description' => esc_html__('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' => esc_html__( 'Yes', 'give' ), |
|
156 | - 'no' => esc_html__( 'No', 'give' ), |
|
155 | + 'yes' => esc_html__('Yes', 'give'), |
|
156 | + 'no' => esc_html__('No', 'give'), |
|
157 | 157 | ), |
158 | 158 | ), |
159 | 159 | array( |
160 | - 'name' => esc_html__( 'Custom Amount Minimum', 'give' ), |
|
161 | - 'description' => esc_html__( 'If you would like to set a minimum custom donation amount please enter it here.', 'give' ), |
|
162 | - 'id' => $prefix . 'custom_amount_minimum', |
|
160 | + 'name' => esc_html__('Custom Amount Minimum', 'give'), |
|
161 | + 'description' => esc_html__('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' => esc_html__( 'Custom Amount Text', 'give' ), |
|
175 | - 'description' => esc_html__( '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' => esc_html__('Custom Amount Text', 'give'), |
|
175 | + 'description' => esc_html__('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' => esc_attr__( 'Give a Custom Amount', 'give' ), |
|
181 | + 'placeholder' => esc_attr__('Give a Custom Amount', 'give'), |
|
182 | 182 | ), |
183 | 183 | ), |
184 | 184 | //Goals |
185 | 185 | array( |
186 | - 'name' => esc_html__( 'Goal', 'give' ), |
|
187 | - 'description' => esc_html__( 'Do you want to set a donation goal for this form?', 'give' ), |
|
188 | - 'id' => $prefix . 'goal_option', |
|
186 | + 'name' => esc_html__('Goal', 'give'), |
|
187 | + 'description' => esc_html__('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' => esc_html__( 'Yes', 'give' ), |
|
193 | - 'no' => esc_html__( 'No', 'give' ), |
|
192 | + 'yes' => esc_html__('Yes', 'give'), |
|
193 | + 'no' => esc_html__('No', 'give'), |
|
194 | 194 | ), |
195 | 195 | ), |
196 | 196 | array( |
197 | - 'name' => esc_html__( 'Goal Amount', 'give' ), |
|
198 | - 'description' => esc_html__( 'This is the monetary goal amount you want to reach for this donation form.', 'give' ), |
|
199 | - 'id' => $prefix . 'set_goal', |
|
197 | + 'name' => esc_html__('Goal Amount', 'give'), |
|
198 | + 'description' => esc_html__('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' => esc_html__( 'Goal Format', 'give' ), |
|
213 | - 'description' => esc_html__( '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' => esc_html__('Goal Format', 'give'), |
|
213 | + 'description' => esc_html__('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' => esc_html__( 'Amount ', 'give' ), |
|
220 | - 'percentage' => esc_html__( 'Percentage', 'give' ), |
|
219 | + 'amount' => esc_html__('Amount ', 'give'), |
|
220 | + 'percentage' => esc_html__('Percentage', 'give'), |
|
221 | 221 | ), |
222 | 222 | ), |
223 | 223 | array( |
224 | - 'name' => esc_html__( 'Goal Progress Bar Color', 'give' ), |
|
225 | - 'id' => $prefix . 'goal_color', |
|
224 | + 'name' => esc_html__('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' => esc_html__( 'Close Form when Goal Achieved', 'give' ), |
|
233 | - 'desc' => esc_html__( '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' => esc_html__('Close Form when Goal Achieved', 'give'), |
|
233 | + 'desc' => esc_html__('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' => esc_html__( 'Yes', 'give' ), |
|
239 | - 'no' => esc_html__( 'No', 'give' ), |
|
238 | + 'yes' => esc_html__('Yes', 'give'), |
|
239 | + 'no' => esc_html__('No', 'give'), |
|
240 | 240 | ), |
241 | 241 | 'default' => 'no', |
242 | 242 | ), |
243 | 243 | array( |
244 | - 'name' => esc_html__( 'Goal Achieved Message', 'give' ), |
|
245 | - 'desc' => esc_html__( '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' => esc_html__('Goal Achieved Message', 'give'), |
|
245 | + 'desc' => esc_html__('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' => esc_attr__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
250 | + 'placeholder' => esc_attr__('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' => esc_html__( 'Form Content', 'give' ), |
|
264 | - 'object_types' => array( 'give_forms' ), |
|
263 | + 'title' => esc_html__('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' => esc_html__( 'Display Content', 'give' ), |
|
271 | - 'description' => esc_html__( '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' => esc_html__('Display Content', 'give'), |
|
271 | + 'description' => esc_html__('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' => esc_html__( 'No content', 'give' ), |
|
276 | - 'give_pre_form' => esc_html__( 'Yes, display content ABOVE the form fields', 'give' ), |
|
277 | - 'give_post_form' => esc_html__( 'Yes, display content BELOW the form fields', 'give' ), |
|
274 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
275 | + 'none' => esc_html__('No content', 'give'), |
|
276 | + 'give_pre_form' => esc_html__('Yes, display content ABOVE the form fields', 'give'), |
|
277 | + 'give_post_form' => esc_html__('Yes, display content BELOW the form fields', 'give'), |
|
278 | 278 | ) |
279 | 279 | ), |
280 | 280 | 'default' => 'none', |
281 | 281 | ), |
282 | 282 | array( |
283 | - 'name' => esc_html__( 'Content', 'give' ), |
|
284 | - 'description' => esc_html__( 'This content will display on the single give form page.', 'give' ), |
|
285 | - 'id' => $prefix . 'form_content', |
|
283 | + 'name' => esc_html__('Content', 'give'), |
|
284 | + 'description' => esc_html__('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' => esc_html__( 'Form Display Options', 'give' ), |
|
300 | - 'object_types' => array( 'give_forms' ), |
|
299 | + 'title' => esc_html__('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' => esc_html__( 'Payment Fields', 'give' ), |
|
307 | - 'desc' => esc_html__( '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' => esc_html__('Payment Fields', 'give'), |
|
307 | + 'desc' => esc_html__('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' => esc_html__( 'Show on Page', 'give' ), |
|
312 | - 'reveal' => esc_html__( 'Reveal Upon Click', 'give' ), |
|
313 | - 'modal' => esc_html__( 'Modal Window Upon Click', 'give' ), |
|
311 | + 'onpage' => esc_html__('Show on Page', 'give'), |
|
312 | + 'reveal' => esc_html__('Reveal Upon Click', 'give'), |
|
313 | + 'modal' => esc_html__('Modal Window Upon Click', 'give'), |
|
314 | 314 | ), |
315 | 315 | 'default' => 'onpage', |
316 | 316 | ), |
317 | 317 | array( |
318 | - 'id' => $prefix . 'reveal_label', |
|
319 | - 'name' => esc_html__( 'Reveal / Modal Open Text', 'give' ), |
|
320 | - 'desc' => esc_html__( 'The button label for completing the donation.', 'give' ), |
|
318 | + 'id' => $prefix.'reveal_label', |
|
319 | + 'name' => esc_html__('Reveal / Modal Open Text', 'give'), |
|
320 | + 'desc' => esc_html__('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' => esc_attr__( 'Donate Now', 'give' ), |
|
324 | + 'placeholder' => esc_attr__('Donate Now', 'give'), |
|
325 | 325 | ), |
326 | 326 | ), |
327 | 327 | array( |
328 | - 'id' => $prefix . 'checkout_label', |
|
329 | - 'name' => esc_html__( 'Complete Donation Text', 'give' ), |
|
330 | - 'desc' => esc_html__( 'The button label for completing a donation.', 'give' ), |
|
328 | + 'id' => $prefix.'checkout_label', |
|
329 | + 'name' => esc_html__('Complete Donation Text', 'give'), |
|
330 | + 'desc' => esc_html__('The button label for completing a donation.', 'give'), |
|
331 | 331 | 'type' => 'text_small', |
332 | 332 | 'attributes' => array( |
333 | - 'placeholder' => esc_attr__( 'Donate Now', 'give' ), |
|
333 | + 'placeholder' => esc_attr__('Donate Now', 'give'), |
|
334 | 334 | ), |
335 | 335 | ), |
336 | 336 | array( |
337 | - 'name' => esc_html__( 'Default Gateway', 'give' ), |
|
338 | - 'desc' => esc_html__( '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' => esc_html__('Default Gateway', 'give'), |
|
338 | + 'desc' => esc_html__('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' => esc_html__( 'Disable Guest Donations', 'give' ), |
|
344 | - 'desc' => esc_html__( 'Do you want to require users be logged-in to make donations?', 'give' ), |
|
345 | - 'id' => $prefix . 'logged_in_only', |
|
343 | + 'name' => esc_html__('Disable Guest Donations', 'give'), |
|
344 | + 'desc' => esc_html__('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' => esc_html__( 'Register / Login Form', 'give' ), |
|
350 | - 'desc' => esc_html__( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
351 | - 'id' => $prefix . 'show_register_form', |
|
349 | + 'name' => esc_html__('Register / Login Form', 'give'), |
|
350 | + 'desc' => esc_html__('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' => esc_html__( 'Registration and Login Forms', 'give' ), |
|
355 | - 'registration' => esc_html__( 'Registration Form Only', 'give' ), |
|
356 | - 'login' => esc_html__( 'Login Form Only', 'give' ), |
|
357 | - 'none' => esc_html__( 'None', 'give' ), |
|
354 | + 'both' => esc_html__('Registration and Login Forms', 'give'), |
|
355 | + 'registration' => esc_html__('Registration Form Only', 'give'), |
|
356 | + 'login' => esc_html__('Login Form Only', 'give'), |
|
357 | + 'none' => esc_html__('None', 'give'), |
|
358 | 358 | ), |
359 | 359 | 'default' => 'none', |
360 | 360 | ), |
361 | 361 | array( |
362 | - 'name' => esc_html__( 'Floating Labels', 'give' ), |
|
362 | + 'name' => esc_html__('Floating Labels', 'give'), |
|
363 | 363 | /* translators: %s: forms http://bradfrost.com/blog/post/float-label-pattern/ */ |
364 | - '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/" ) ), |
|
365 | - 'id' => $prefix . 'form_floating_labels', |
|
364 | + '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/")), |
|
365 | + 'id' => $prefix.'form_floating_labels', |
|
366 | 366 | 'type' => 'select', |
367 | 367 | 'options' => array( |
368 | - '' => esc_html__( 'Use the global setting', 'give' ), |
|
369 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
370 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
368 | + '' => esc_html__('Use the global setting', 'give'), |
|
369 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
370 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
371 | 371 | ), |
372 | 372 | 'default' => 'none', |
373 | 373 | ) |
@@ -379,47 +379,47 @@ discard block |
||
379 | 379 | /** |
380 | 380 | * Terms & Conditions |
381 | 381 | */ |
382 | - $meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array( |
|
382 | + $meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array( |
|
383 | 383 | 'id' => 'form_terms_options', |
384 | - 'title' => esc_html__( 'Terms and Conditions', 'give' ), |
|
385 | - 'object_types' => array( 'give_forms' ), |
|
384 | + 'title' => esc_html__('Terms and Conditions', 'give'), |
|
385 | + 'object_types' => array('give_forms'), |
|
386 | 386 | 'context' => 'normal', |
387 | 387 | 'priority' => 'high', //Show above Content WYSIWYG |
388 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
388 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
389 | 389 | //Donation Option |
390 | 390 | array( |
391 | - 'name' => esc_html__( 'Terms and Conditions', 'give' ), |
|
392 | - 'description' => esc_html__( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ), |
|
393 | - 'id' => $prefix . 'terms_option', |
|
391 | + 'name' => esc_html__('Terms and Conditions', 'give'), |
|
392 | + 'description' => esc_html__('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'), |
|
393 | + 'id' => $prefix.'terms_option', |
|
394 | 394 | 'type' => 'select', |
395 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
396 | - 'none' => esc_html__( 'No', 'give' ), |
|
397 | - 'yes' => esc_html__( 'Yes', 'give' ), |
|
395 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
396 | + 'none' => esc_html__('No', 'give'), |
|
397 | + 'yes' => esc_html__('Yes', 'give'), |
|
398 | 398 | ) |
399 | 399 | ), |
400 | 400 | 'default' => 'none', |
401 | 401 | ), |
402 | 402 | array( |
403 | - 'id' => $prefix . 'agree_label', |
|
404 | - 'name' => esc_html__( 'Agree to Terms Label', 'give' ), |
|
405 | - 'desc' => esc_html__( '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' ), |
|
403 | + 'id' => $prefix.'agree_label', |
|
404 | + 'name' => esc_html__('Agree to Terms Label', 'give'), |
|
405 | + 'desc' => esc_html__('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'), |
|
406 | 406 | 'type' => 'text', |
407 | 407 | 'row_classes' => 'give-subfield', |
408 | 408 | 'size' => 'regular', |
409 | 409 | 'attributes' => array( |
410 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
410 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
411 | 411 | ), |
412 | 412 | ), |
413 | 413 | array( |
414 | - 'id' => $prefix . 'agree_text', |
|
414 | + 'id' => $prefix.'agree_text', |
|
415 | 415 | 'row_classes' => 'give-subfield', |
416 | - 'name' => esc_html__( 'Agreement Text', 'give' ), |
|
417 | - 'desc' => esc_html__( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
416 | + 'name' => esc_html__('Agreement Text', 'give'), |
|
417 | + 'desc' => esc_html__('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
418 | 418 | 'type' => 'wysiwyg' |
419 | 419 | ), |
420 | 420 | ) |
421 | 421 | ) |
422 | - ) ); |
|
422 | + )); |
|
423 | 423 | |
424 | 424 | return $meta_boxes; |
425 | 425 | |
@@ -433,11 +433,11 @@ discard block |
||
433 | 433 | |
434 | 434 | <div class="table-container"> |
435 | 435 | <div class="table-row"> |
436 | - <div class="table-cell col-amount"><?php esc_html_e( 'Amount', 'give' ); ?></div> |
|
437 | - <div class="table-cell col-text"><?php esc_html_e( 'Text', 'give' ); ?></div> |
|
438 | - <div class="table-cell col-default"><?php esc_html_e( 'Default', 'give' ); ?></div> |
|
439 | - <?php do_action( 'give_donation_levels_table_head' ); ?> |
|
440 | - <div class="table-cell col-sort"><?php esc_html_e( 'Sort', 'give' ); ?></div> |
|
436 | + <div class="table-cell col-amount"><?php esc_html_e('Amount', 'give'); ?></div> |
|
437 | + <div class="table-cell col-text"><?php esc_html_e('Text', 'give'); ?></div> |
|
438 | + <div class="table-cell col-default"><?php esc_html_e('Default', 'give'); ?></div> |
|
439 | + <?php do_action('give_donation_levels_table_head'); ?> |
|
440 | + <div class="table-cell col-sort"><?php esc_html_e('Sort', 'give'); ?></div> |
|
441 | 441 | |
442 | 442 | </div> |
443 | 443 | </div> |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | <?php |
446 | 446 | } |
447 | 447 | |
448 | -add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 ); |
|
448 | +add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10); |
|
449 | 449 | |
450 | 450 | |
451 | 451 | /** |
@@ -462,25 +462,25 @@ discard block |
||
462 | 462 | * @param $object_type |
463 | 463 | * @param $field_type_object |
464 | 464 | */ |
465 | -function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
465 | +function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
466 | 466 | |
467 | - $escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' ); |
|
467 | + $escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : ''); |
|
468 | 468 | |
469 | 469 | $field_options_array = array( |
470 | 470 | 'class' => 'give-hidden give-level-id-input', |
471 | - 'name' => $field_type_object->_name( '[level_id]' ), |
|
472 | - 'id' => $field_type_object->_id( '_level_id' ), |
|
471 | + 'name' => $field_type_object->_name('[level_id]'), |
|
472 | + 'id' => $field_type_object->_id('_level_id'), |
|
473 | 473 | 'value' => $escaped_value, |
474 | 474 | 'type' => 'number', |
475 | 475 | 'desc' => '', |
476 | 476 | ); |
477 | 477 | |
478 | - echo '<p class="give-level-id">' . $escaped_value . '</p>'; |
|
479 | - echo $field_type_object->input( $field_options_array ); |
|
478 | + echo '<p class="give-level-id">'.$escaped_value.'</p>'; |
|
479 | + echo $field_type_object->input($field_options_array); |
|
480 | 480 | |
481 | 481 | } |
482 | 482 | |
483 | -add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 ); |
|
483 | +add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5); |
|
484 | 484 | |
485 | 485 | |
486 | 486 | /** |
@@ -492,13 +492,13 @@ discard block |
||
492 | 492 | * @param $object_type |
493 | 493 | * @param $field_type_object |
494 | 494 | */ |
495 | -function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
496 | - 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 ) . '>'; |
|
497 | - echo '<label for="' . $field_object->args['id'] . '">Default</label>'; |
|
495 | +function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
496 | + 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).'>'; |
|
497 | + echo '<label for="'.$field_object->args['id'].'">Default</label>'; |
|
498 | 498 | |
499 | 499 | } |
500 | 500 | |
501 | -add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 ); |
|
501 | +add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5); |
|
502 | 502 | |
503 | 503 | |
504 | 504 | /** |
@@ -508,20 +508,20 @@ discard block |
||
508 | 508 | */ |
509 | 509 | function give_add_shortcode_to_publish_metabox() { |
510 | 510 | |
511 | - if ( 'give_forms' !== get_post_type() ) { |
|
511 | + if ('give_forms' !== get_post_type()) { |
|
512 | 512 | return false; |
513 | 513 | } |
514 | 514 | |
515 | 515 | global $post; |
516 | 516 | |
517 | 517 | //Only enqueue scripts for CPT on post type screen |
518 | - if ( 'give_forms' === $post->post_type ) { |
|
518 | + if ('give_forms' === $post->post_type) { |
|
519 | 519 | //Shortcode column with select all input |
520 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
521 | - echo '<div class="shortcode-wrap box-sizing"><label>' . esc_html__( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
520 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]'); |
|
521 | + echo '<div class="shortcode-wrap box-sizing"><label>'.esc_html__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="'.$shortcode.'"></div>'; |
|
522 | 522 | |
523 | 523 | } |
524 | 524 | |
525 | 525 | } |
526 | 526 | |
527 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
527 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox'); |
@@ -10,7 +10,7 @@ discard block |
||
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 | |
@@ -27,34 +27,34 @@ discard block |
||
27 | 27 | * @return array $form_columns Updated array of forms columns |
28 | 28 | * Post Type List Table |
29 | 29 | */ |
30 | -function give_form_columns( $give_form_columns ) { |
|
30 | +function give_form_columns($give_form_columns) { |
|
31 | 31 | |
32 | 32 | //Standard columns |
33 | 33 | $give_form_columns = array( |
34 | 34 | 'cb' => '<input type="checkbox"/>', |
35 | - 'title' => esc_html__( 'Name', 'give' ), |
|
36 | - 'form_category' => esc_html__( 'Categories', 'give' ), |
|
37 | - 'form_tag' => esc_html__( 'Tags', 'give' ), |
|
38 | - 'price' => esc_html__( 'Price', 'give' ), |
|
39 | - 'goal' => esc_html__( 'Goal', 'give' ), |
|
40 | - 'donations' => esc_html__( 'Donations', 'give' ), |
|
41 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
42 | - 'shortcode' => esc_html__( 'Shortcode', 'give' ), |
|
43 | - 'date' => esc_html__( 'Date', 'give' ) |
|
35 | + 'title' => esc_html__('Name', 'give'), |
|
36 | + 'form_category' => esc_html__('Categories', 'give'), |
|
37 | + 'form_tag' => esc_html__('Tags', 'give'), |
|
38 | + 'price' => esc_html__('Price', 'give'), |
|
39 | + 'goal' => esc_html__('Goal', 'give'), |
|
40 | + 'donations' => esc_html__('Donations', 'give'), |
|
41 | + 'earnings' => esc_html__('Income', 'give'), |
|
42 | + 'shortcode' => esc_html__('Shortcode', 'give'), |
|
43 | + 'date' => esc_html__('Date', 'give') |
|
44 | 44 | ); |
45 | 45 | |
46 | 46 | //Does the user want categories / tags? |
47 | - if ( give_get_option( 'enable_categories' ) !== 'on' ) { |
|
48 | - unset( $give_form_columns['form_category'] ); |
|
47 | + if (give_get_option('enable_categories') !== 'on') { |
|
48 | + unset($give_form_columns['form_category']); |
|
49 | 49 | } |
50 | - if ( give_get_option( 'enable_tags' ) !== 'on' ) { |
|
51 | - unset( $give_form_columns['form_tag'] ); |
|
50 | + if (give_get_option('enable_tags') !== 'on') { |
|
51 | + unset($give_form_columns['form_tag']); |
|
52 | 52 | } |
53 | 53 | |
54 | - return apply_filters( 'give_forms_columns', $give_form_columns ); |
|
54 | + return apply_filters('give_forms_columns', $give_form_columns); |
|
55 | 55 | } |
56 | 56 | |
57 | -add_filter( 'manage_edit-give_forms_columns', 'give_form_columns' ); |
|
57 | +add_filter('manage_edit-give_forms_columns', 'give_form_columns'); |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Render Give Form Columns |
@@ -66,67 +66,67 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @return void |
68 | 68 | */ |
69 | -function give_render_form_columns( $column_name, $post_id ) { |
|
70 | - if ( get_post_type( $post_id ) == 'give_forms' ) { |
|
69 | +function give_render_form_columns($column_name, $post_id) { |
|
70 | + if (get_post_type($post_id) == 'give_forms') { |
|
71 | 71 | global $give_options; |
72 | 72 | |
73 | - $style = isset( $give_options['button_style'] ) ? $give_options['button_style'] : 'button'; |
|
74 | - $color = isset( $give_options['checkout_color'] ) ? $give_options['checkout_color'] : 'blue'; |
|
75 | - $color = ( $color == 'inherit' ) ? '' : $color; |
|
73 | + $style = isset($give_options['button_style']) ? $give_options['button_style'] : 'button'; |
|
74 | + $color = isset($give_options['checkout_color']) ? $give_options['checkout_color'] : 'blue'; |
|
75 | + $color = ($color == 'inherit') ? '' : $color; |
|
76 | 76 | |
77 | - $purchase_text = ! empty( $give_options['add_to_cart_text'] ) ? $give_options['add_to_cart_text'] : esc_html__( 'Purchase', 'give' ); |
|
77 | + $purchase_text = ! empty($give_options['add_to_cart_text']) ? $give_options['add_to_cart_text'] : esc_html__('Purchase', 'give'); |
|
78 | 78 | |
79 | - switch ( $column_name ) { |
|
79 | + switch ($column_name) { |
|
80 | 80 | case 'form_category': |
81 | - echo get_the_term_list( $post_id, 'give_forms_category', '', ', ', '' ); |
|
81 | + echo get_the_term_list($post_id, 'give_forms_category', '', ', ', ''); |
|
82 | 82 | break; |
83 | 83 | case 'form_tag': |
84 | - echo get_the_term_list( $post_id, 'give_forms_tag', '', ', ', '' ); |
|
84 | + echo get_the_term_list($post_id, 'give_forms_tag', '', ', ', ''); |
|
85 | 85 | break; |
86 | 86 | case 'price': |
87 | - if ( give_has_variable_prices( $post_id ) ) { |
|
88 | - echo give_price_range( $post_id ); |
|
87 | + if (give_has_variable_prices($post_id)) { |
|
88 | + echo give_price_range($post_id); |
|
89 | 89 | } else { |
90 | - echo give_price( $post_id, false ); |
|
91 | - echo '<input type="hidden" class="formprice-' . $post_id . '" value="' . give_get_form_price( $post_id ) . '" />'; |
|
90 | + echo give_price($post_id, false); |
|
91 | + echo '<input type="hidden" class="formprice-'.$post_id.'" value="'.give_get_form_price($post_id).'" />'; |
|
92 | 92 | } |
93 | 93 | break; |
94 | 94 | case 'goal': |
95 | - $goal_option = get_post_meta( $post_id, '_give_goal_option', true ); |
|
96 | - if ( ! empty( $goal_option ) && $goal_option === 'yes' ) { |
|
97 | - echo give_goal( $post_id, false ); |
|
95 | + $goal_option = get_post_meta($post_id, '_give_goal_option', true); |
|
96 | + if ( ! empty($goal_option) && $goal_option === 'yes') { |
|
97 | + echo give_goal($post_id, false); |
|
98 | 98 | } else { |
99 | - esc_html_e( 'No Goal Set', 'give' ); |
|
99 | + esc_html_e('No Goal Set', 'give'); |
|
100 | 100 | } |
101 | 101 | |
102 | - echo '<input type="hidden" class="formgoal-' . $post_id . '" value="' . give_get_form_goal( $post_id ) . '" />'; |
|
102 | + echo '<input type="hidden" class="formgoal-'.$post_id.'" value="'.give_get_form_goal($post_id).'" />'; |
|
103 | 103 | break; |
104 | 104 | case 'donations': |
105 | - if ( current_user_can( 'view_give_forms_stats', $post_id ) ) { |
|
106 | - echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=logs&view=sales&form=' . $post_id ) ) . '">'; |
|
107 | - echo give_get_form_sales_stats( $post_id ); |
|
105 | + if (current_user_can('view_give_forms_stats', $post_id)) { |
|
106 | + echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&tab=logs&view=sales&form='.$post_id)).'">'; |
|
107 | + echo give_get_form_sales_stats($post_id); |
|
108 | 108 | echo '</a>'; |
109 | 109 | } else { |
110 | 110 | echo '-'; |
111 | 111 | } |
112 | 112 | break; |
113 | 113 | case 'earnings': |
114 | - if ( current_user_can( 'view_give_forms_stats', $post_id ) ) { |
|
115 | - echo '<a href="' . esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-reports&view=forms&form-id=' . $post_id ) ) . '">'; |
|
116 | - echo give_currency_filter( give_format_amount( give_get_form_earnings_stats( $post_id ) ) ); |
|
114 | + if (current_user_can('view_give_forms_stats', $post_id)) { |
|
115 | + echo '<a href="'.esc_url(admin_url('edit.php?post_type=give_forms&page=give-reports&view=forms&form-id='.$post_id)).'">'; |
|
116 | + echo give_currency_filter(give_format_amount(give_get_form_earnings_stats($post_id))); |
|
117 | 117 | echo '</a>'; |
118 | 118 | } else { |
119 | 119 | echo '-'; |
120 | 120 | } |
121 | 121 | break; |
122 | 122 | case 'shortcode': |
123 | - echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id="' . absint( $post_id ) . '"]">'; |
|
123 | + echo '<input onclick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly="" value="[give_form id="'.absint($post_id).'"]">'; |
|
124 | 124 | break; |
125 | 125 | } |
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | -add_action( 'manage_posts_custom_column', 'give_render_form_columns', 10, 2 ); |
|
129 | +add_action('manage_posts_custom_column', 'give_render_form_columns', 10, 2); |
|
130 | 130 | |
131 | 131 | /** |
132 | 132 | * Registers the sortable columns in the list table |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * |
138 | 138 | * @return array $columns Array of sortable columns |
139 | 139 | */ |
140 | -function give_sortable_form_columns( $columns ) { |
|
140 | +function give_sortable_form_columns($columns) { |
|
141 | 141 | $columns['price'] = 'price'; |
142 | 142 | $columns['sales'] = 'sales'; |
143 | 143 | $columns['earnings'] = 'earnings'; |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | return $columns; |
147 | 147 | } |
148 | 148 | |
149 | -add_filter( 'manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns' ); |
|
149 | +add_filter('manage_edit-give_forms_sortable_columns', 'give_sortable_form_columns'); |
|
150 | 150 | |
151 | 151 | /** |
152 | 152 | * Sorts Columns in the Forms List Table |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | * |
158 | 158 | * @return array $vars Array of all the sort variables |
159 | 159 | */ |
160 | -function give_sort_forms( $vars ) { |
|
160 | +function give_sort_forms($vars) { |
|
161 | 161 | // Check if we're viewing the "give_forms" post type |
162 | - if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) { |
|
162 | + if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) { |
|
163 | 163 | // Check if 'orderby' is set to "sales" |
164 | - if ( isset( $vars['orderby'] ) && 'sales' == $vars['orderby'] ) { |
|
164 | + if (isset($vars['orderby']) && 'sales' == $vars['orderby']) { |
|
165 | 165 | $vars = array_merge( |
166 | 166 | $vars, |
167 | 167 | array( |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | } |
173 | 173 | |
174 | 174 | // Check if "orderby" is set to "earnings" |
175 | - if ( isset( $vars['orderby'] ) && 'earnings' == $vars['orderby'] ) { |
|
175 | + if (isset($vars['orderby']) && 'earnings' == $vars['orderby']) { |
|
176 | 176 | $vars = array_merge( |
177 | 177 | $vars, |
178 | 178 | array( |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | } |
184 | 184 | |
185 | 185 | // Check if "orderby" is set to "price" |
186 | - if ( isset( $vars['orderby'] ) && 'price' == $vars['orderby'] ) { |
|
186 | + if (isset($vars['orderby']) && 'price' == $vars['orderby']) { |
|
187 | 187 | $vars = array_merge( |
188 | 188 | $vars, |
189 | 189 | array( |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | // Check if "orderby" is set to "goal" |
197 | - if ( isset( $vars['orderby'] ) && 'goal' == $vars['orderby'] ) { |
|
197 | + if (isset($vars['orderby']) && 'goal' == $vars['orderby']) { |
|
198 | 198 | $vars = array_merge( |
199 | 199 | $vars, |
200 | 200 | array( |
@@ -217,16 +217,16 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @return array Array of all sort variables |
219 | 219 | */ |
220 | -function give_filter_forms( $vars ) { |
|
221 | - if ( isset( $vars['post_type'] ) && 'give_forms' == $vars['post_type'] ) { |
|
220 | +function give_filter_forms($vars) { |
|
221 | + if (isset($vars['post_type']) && 'give_forms' == $vars['post_type']) { |
|
222 | 222 | |
223 | 223 | // If an author ID was passed, use it |
224 | - if ( isset( $_REQUEST['author'] ) && ! current_user_can( 'view_give_reports' ) ) { |
|
224 | + if (isset($_REQUEST['author']) && ! current_user_can('view_give_reports')) { |
|
225 | 225 | |
226 | 226 | $author_id = $_REQUEST['author']; |
227 | - if ( (int) $author_id !== get_current_user_id() ) { |
|
227 | + if ((int) $author_id !== get_current_user_id()) { |
|
228 | 228 | // Tried to view the products of another person, sorry |
229 | - wp_die( esc_html__( 'You do not have permission to view this data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
229 | + wp_die(esc_html__('You do not have permission to view this data.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
230 | 230 | } |
231 | 231 | $vars = array_merge( |
232 | 232 | $vars, |
@@ -251,11 +251,11 @@ discard block |
||
251 | 251 | * @return void |
252 | 252 | */ |
253 | 253 | function give_forms_load() { |
254 | - add_filter( 'request', 'give_sort_forms' ); |
|
255 | - add_filter( 'request', 'give_filter_forms' ); |
|
254 | + add_filter('request', 'give_sort_forms'); |
|
255 | + add_filter('request', 'give_filter_forms'); |
|
256 | 256 | } |
257 | 257 | |
258 | -add_action( 'load-edit.php', 'give_forms_load', 9999 ); |
|
258 | +add_action('load-edit.php', 'give_forms_load', 9999); |
|
259 | 259 | |
260 | 260 | /** |
261 | 261 | * Remove Forms Month Filter |
@@ -269,17 +269,17 @@ discard block |
||
269 | 269 | * @global $typenow The post type we are viewing |
270 | 270 | * @return array Empty array disables the dropdown |
271 | 271 | */ |
272 | -function give_remove_month_filter( $dates ) { |
|
272 | +function give_remove_month_filter($dates) { |
|
273 | 273 | global $typenow; |
274 | 274 | |
275 | - if ( $typenow == 'give_forms' ) { |
|
275 | + if ($typenow == 'give_forms') { |
|
276 | 276 | $dates = array(); |
277 | 277 | } |
278 | 278 | |
279 | 279 | return $dates; |
280 | 280 | } |
281 | 281 | |
282 | -add_filter( 'months_dropdown_results', 'give_remove_month_filter', 99 ); |
|
282 | +add_filter('months_dropdown_results', 'give_remove_month_filter', 99); |
|
283 | 283 | |
284 | 284 | /** |
285 | 285 | * Adds price field to Quick Edit options |
@@ -291,8 +291,8 @@ discard block |
||
291 | 291 | * |
292 | 292 | * @return void |
293 | 293 | */ |
294 | -function give_price_field_quick_edit( $column_name, $post_type ) { |
|
295 | - if ( $column_name != 'price' || $post_type != 'give_forms' ) { |
|
294 | +function give_price_field_quick_edit($column_name, $post_type) { |
|
295 | + if ($column_name != 'price' || $post_type != 'give_forms') { |
|
296 | 296 | return; |
297 | 297 | } |
298 | 298 | ?> |
@@ -301,12 +301,12 @@ discard block |
||
301 | 301 | <h4><?php |
302 | 302 | printf( |
303 | 303 | /* translators: %s: forms singular label */ |
304 | - esc_html__( '%s Configuration', 'give' ), |
|
304 | + esc_html__('%s Configuration', 'give'), |
|
305 | 305 | give_get_forms_label_singular() |
306 | 306 | ); |
307 | 307 | ?></h4> |
308 | 308 | <label> |
309 | - <span class="title"><?php esc_html_e( 'Price', 'give' ); ?></span> |
|
309 | + <span class="title"><?php esc_html_e('Price', 'give'); ?></span> |
|
310 | 310 | <span class="input-text-wrap"> |
311 | 311 | <input type="text" name="_give_regprice" class="text regprice" /> |
312 | 312 | </span> |
@@ -317,8 +317,8 @@ discard block |
||
317 | 317 | <?php |
318 | 318 | } |
319 | 319 | |
320 | -add_action( 'quick_edit_custom_box', 'give_price_field_quick_edit', 10, 2 ); |
|
321 | -add_action( 'bulk_edit_custom_box', 'give_price_field_quick_edit', 10, 2 ); |
|
320 | +add_action('quick_edit_custom_box', 'give_price_field_quick_edit', 10, 2); |
|
321 | +add_action('bulk_edit_custom_box', 'give_price_field_quick_edit', 10, 2); |
|
322 | 322 | |
323 | 323 | /** |
324 | 324 | * Updates price when saving post |
@@ -329,23 +329,23 @@ discard block |
||
329 | 329 | * |
330 | 330 | * @return void |
331 | 331 | */ |
332 | -function give_price_save_quick_edit( $post_id ) { |
|
333 | - if ( ! isset( $_POST['post_type'] ) || 'give_forms' !== $_POST['post_type'] ) { |
|
332 | +function give_price_save_quick_edit($post_id) { |
|
333 | + if ( ! isset($_POST['post_type']) || 'give_forms' !== $_POST['post_type']) { |
|
334 | 334 | return; |
335 | 335 | } |
336 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
336 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
337 | 337 | return $post_id; |
338 | 338 | } |
339 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
339 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
340 | 340 | return $post_id; |
341 | 341 | } |
342 | 342 | |
343 | - if ( isset( $_REQUEST['_give_regprice'] ) ) { |
|
344 | - update_post_meta( $post_id, '_give_set_price', strip_tags( stripslashes( $_REQUEST['_give_regprice'] ) ) ); |
|
343 | + if (isset($_REQUEST['_give_regprice'])) { |
|
344 | + update_post_meta($post_id, '_give_set_price', strip_tags(stripslashes($_REQUEST['_give_regprice']))); |
|
345 | 345 | } |
346 | 346 | } |
347 | 347 | |
348 | -add_action( 'save_post', 'give_price_save_quick_edit' ); |
|
348 | +add_action('save_post', 'give_price_save_quick_edit'); |
|
349 | 349 | |
350 | 350 | /** |
351 | 351 | * Process bulk edit actions via AJAX |
@@ -355,18 +355,18 @@ discard block |
||
355 | 355 | */ |
356 | 356 | function give_save_bulk_edit() { |
357 | 357 | |
358 | - $post_ids = ( isset( $_POST['post_ids'] ) && ! empty( $_POST['post_ids'] ) ) ? $_POST['post_ids'] : array(); |
|
358 | + $post_ids = (isset($_POST['post_ids']) && ! empty($_POST['post_ids'])) ? $_POST['post_ids'] : array(); |
|
359 | 359 | |
360 | - if ( ! empty( $post_ids ) && is_array( $post_ids ) ) { |
|
361 | - $price = isset( $_POST['price'] ) ? strip_tags( stripslashes( $_POST['price'] ) ) : 0; |
|
362 | - foreach ( $post_ids as $post_id ) { |
|
360 | + if ( ! empty($post_ids) && is_array($post_ids)) { |
|
361 | + $price = isset($_POST['price']) ? strip_tags(stripslashes($_POST['price'])) : 0; |
|
362 | + foreach ($post_ids as $post_id) { |
|
363 | 363 | |
364 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
364 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
365 | 365 | continue; |
366 | 366 | } |
367 | 367 | |
368 | - if ( ! empty( $price ) ) { |
|
369 | - update_post_meta( $post_id, '_give_set_price', give_sanitize_amount( $price ) ); |
|
368 | + if ( ! empty($price)) { |
|
369 | + update_post_meta($post_id, '_give_set_price', give_sanitize_amount($price)); |
|
370 | 370 | } |
371 | 371 | } |
372 | 372 | } |
@@ -374,4 +374,4 @@ discard block |
||
374 | 374 | die(); |
375 | 375 | } |
376 | 376 | |
377 | -add_action( 'wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit' ); |
|
377 | +add_action('wp_ajax_give_save_bulk_edit', 'give_save_bulk_edit'); |
@@ -13,7 +13,7 @@ discard block |
||
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 |
||
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,20 +47,20 @@ discard block |
||
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 | 52 | /* translators: %s: upgrade URL */ |
53 | - '<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>', |
|
54 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) ) |
|
53 | + '<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>', |
|
54 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id')) |
|
55 | 55 | ); |
56 | 56 | } |
57 | 57 | |
58 | 58 | //v1.3.4 Upgrades //ensure the user has gone through 1.3.4 |
59 | - 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 | + 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'))) { |
|
60 | 60 | printf( |
61 | 61 | /* translators: %s: upgrade URL */ |
62 | - '<div class="updated"><p>' . __( 'Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>', |
|
63 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) ) |
|
62 | + '<div class="updated"><p>'.__('Give needs to upgrade the transaction database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>', |
|
63 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status')) |
|
64 | 64 | ); |
65 | 65 | } |
66 | 66 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | |
71 | 71 | } |
72 | 72 | |
73 | -add_action( 'admin_notices', 'give_show_upgrade_notices' ); |
|
73 | +add_action('admin_notices', 'give_show_upgrade_notices'); |
|
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Triggers all upgrade functions |
@@ -82,26 +82,26 @@ discard block |
||
82 | 82 | */ |
83 | 83 | function give_trigger_upgrades() { |
84 | 84 | |
85 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
86 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
85 | + if ( ! current_user_can('manage_give_settings')) { |
|
86 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
87 | 87 | } |
88 | 88 | |
89 | - $give_version = get_option( 'give_version' ); |
|
89 | + $give_version = get_option('give_version'); |
|
90 | 90 | |
91 | - if ( ! $give_version ) { |
|
91 | + if ( ! $give_version) { |
|
92 | 92 | // 1.0 is the first version to use this option so we must add it |
93 | 93 | $give_version = '1.0'; |
94 | - add_option( 'give_version', $give_version ); |
|
94 | + add_option('give_version', $give_version); |
|
95 | 95 | } |
96 | 96 | |
97 | - update_option( 'give_version', GIVE_VERSION ); |
|
97 | + update_option('give_version', GIVE_VERSION); |
|
98 | 98 | |
99 | - if ( DOING_AJAX ) { |
|
100 | - die( 'complete' ); |
|
99 | + if (DOING_AJAX) { |
|
100 | + die('complete'); |
|
101 | 101 | } // Let AJAX know that the upgrade is complete |
102 | 102 | } |
103 | 103 | |
104 | -add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' ); |
|
104 | +add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades'); |
|
105 | 105 | |
106 | 106 | /** |
107 | 107 | * Check if the upgrade routine has been run for a specific action |
@@ -112,15 +112,15 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @return bool If the action has been added to the completed actions array |
114 | 114 | */ |
115 | -function give_has_upgrade_completed( $upgrade_action = '' ) { |
|
115 | +function give_has_upgrade_completed($upgrade_action = '') { |
|
116 | 116 | |
117 | - if ( empty( $upgrade_action ) ) { |
|
117 | + if (empty($upgrade_action)) { |
|
118 | 118 | return false; |
119 | 119 | } |
120 | 120 | |
121 | 121 | $completed_upgrades = give_get_completed_upgrades(); |
122 | 122 | |
123 | - return in_array( $upgrade_action, $completed_upgrades ); |
|
123 | + return in_array($upgrade_action, $completed_upgrades); |
|
124 | 124 | |
125 | 125 | } |
126 | 126 | |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | * |
134 | 134 | * @return bool If the function was successfully added |
135 | 135 | */ |
136 | -function give_set_upgrade_complete( $upgrade_action = '' ) { |
|
136 | +function give_set_upgrade_complete($upgrade_action = '') { |
|
137 | 137 | |
138 | - if ( empty( $upgrade_action ) ) { |
|
138 | + if (empty($upgrade_action)) { |
|
139 | 139 | return false; |
140 | 140 | } |
141 | 141 | |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | $completed_upgrades[] = $upgrade_action; |
144 | 144 | |
145 | 145 | // Remove any blanks, and only show uniques |
146 | - $completed_upgrades = array_unique( array_values( $completed_upgrades ) ); |
|
146 | + $completed_upgrades = array_unique(array_values($completed_upgrades)); |
|
147 | 147 | |
148 | - return update_option( 'give_completed_upgrades', $completed_upgrades ); |
|
148 | + return update_option('give_completed_upgrades', $completed_upgrades); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | */ |
157 | 157 | function give_get_completed_upgrades() { |
158 | 158 | |
159 | - $completed_upgrades = get_option( 'give_completed_upgrades' ); |
|
159 | + $completed_upgrades = get_option('give_completed_upgrades'); |
|
160 | 160 | |
161 | - if ( false === $completed_upgrades ) { |
|
161 | + if (false === $completed_upgrades) { |
|
162 | 162 | $completed_upgrades = array(); |
163 | 163 | } |
164 | 164 | |
@@ -177,30 +177,30 @@ discard block |
||
177 | 177 | */ |
178 | 178 | function give_v132_upgrade_give_payment_customer_id() { |
179 | 179 | global $wpdb; |
180 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
181 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
180 | + if ( ! current_user_can('manage_give_settings')) { |
|
181 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
182 | 182 | } |
183 | 183 | |
184 | - ignore_user_abort( true ); |
|
184 | + ignore_user_abort(true); |
|
185 | 185 | |
186 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
187 | - @set_time_limit( 0 ); |
|
186 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
187 | + @set_time_limit(0); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | //UPDATE DB METAKEYS |
191 | 191 | $sql = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'"; |
192 | - $query = $wpdb->query( $sql ); |
|
192 | + $query = $wpdb->query($sql); |
|
193 | 193 | |
194 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
195 | - give_set_upgrade_complete( 'upgrade_give_payment_customer_id' ); |
|
196 | - delete_option( 'give_doing_upgrade' ); |
|
197 | - wp_redirect( admin_url() ); |
|
194 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
195 | + give_set_upgrade_complete('upgrade_give_payment_customer_id'); |
|
196 | + delete_option('give_doing_upgrade'); |
|
197 | + wp_redirect(admin_url()); |
|
198 | 198 | exit; |
199 | 199 | |
200 | 200 | |
201 | 201 | } |
202 | 202 | |
203 | -add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' ); |
|
203 | +add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id'); |
|
204 | 204 | |
205 | 205 | /** |
206 | 206 | * Upgrades the Offline Status |
@@ -214,14 +214,14 @@ discard block |
||
214 | 214 | |
215 | 215 | global $wpdb; |
216 | 216 | |
217 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
218 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
217 | + if ( ! current_user_can('manage_give_settings')) { |
|
218 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
219 | 219 | } |
220 | 220 | |
221 | - ignore_user_abort( true ); |
|
221 | + ignore_user_abort(true); |
|
222 | 222 | |
223 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
224 | - @set_time_limit( 0 ); |
|
223 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
224 | + @set_time_limit(0); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | // Get abandoned offline payments |
@@ -231,35 +231,35 @@ discard block |
||
231 | 231 | $where .= "AND ( p.post_status = 'abandoned' )"; |
232 | 232 | $where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )"; |
233 | 233 | |
234 | - $sql = $select . $join . $where; |
|
235 | - $found_payments = $wpdb->get_col( $sql ); |
|
234 | + $sql = $select.$join.$where; |
|
235 | + $found_payments = $wpdb->get_col($sql); |
|
236 | 236 | |
237 | 237 | |
238 | - foreach ( $found_payments as $payment ) { |
|
238 | + foreach ($found_payments as $payment) { |
|
239 | 239 | |
240 | 240 | //Only change ones marked abandoned since our release last week |
241 | 241 | //because the admin may have marked some abandoned themselves |
242 | - $modified_time = get_post_modified_time( 'U', false, $payment ); |
|
242 | + $modified_time = get_post_modified_time('U', false, $payment); |
|
243 | 243 | |
244 | 244 | //1450124863 = 12/10/2015 20:42:25 |
245 | - if ( $modified_time >= 1450124863 ) { |
|
245 | + if ($modified_time >= 1450124863) { |
|
246 | 246 | |
247 | - give_update_payment_status( $payment, 'pending' ); |
|
247 | + give_update_payment_status($payment, 'pending'); |
|
248 | 248 | |
249 | 249 | } |
250 | 250 | |
251 | 251 | } |
252 | 252 | |
253 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
254 | - give_set_upgrade_complete( 'upgrade_give_offline_status' ); |
|
255 | - delete_option( 'give_doing_upgrade' ); |
|
256 | - wp_redirect( admin_url() ); |
|
253 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
254 | + give_set_upgrade_complete('upgrade_give_offline_status'); |
|
255 | + delete_option('give_doing_upgrade'); |
|
256 | + wp_redirect(admin_url()); |
|
257 | 257 | exit; |
258 | 258 | |
259 | 259 | |
260 | 260 | } |
261 | 261 | |
262 | -add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' ); |
|
262 | +add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status'); |
|
263 | 263 | |
264 | 264 | |
265 | 265 | /** |
@@ -271,17 +271,17 @@ discard block |
||
271 | 271 | */ |
272 | 272 | function give_v152_cleanup_users() { |
273 | 273 | |
274 | - $give_version = get_option( 'give_version' ); |
|
274 | + $give_version = get_option('give_version'); |
|
275 | 275 | |
276 | - if ( ! $give_version ) { |
|
276 | + if ( ! $give_version) { |
|
277 | 277 | // 1.0 is the first version to use this option so we must add it |
278 | 278 | $give_version = '1.0'; |
279 | 279 | } |
280 | 280 | |
281 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
281 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
282 | 282 | |
283 | 283 | //v1.5.2 Upgrades |
284 | - if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) { |
|
284 | + if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) { |
|
285 | 285 | |
286 | 286 | //Delete all caps with "ss" |
287 | 287 | //Also delete all unused "campaign" roles |
@@ -328,9 +328,9 @@ discard block |
||
328 | 328 | ); |
329 | 329 | |
330 | 330 | global $wp_roles; |
331 | - foreach ( $delete_caps as $cap ) { |
|
332 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
333 | - $wp_roles->remove_cap( $role, $cap ); |
|
331 | + foreach ($delete_caps as $cap) { |
|
332 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
333 | + $wp_roles->remove_cap($role, $cap); |
|
334 | 334 | } |
335 | 335 | } |
336 | 336 | |
@@ -340,12 +340,12 @@ discard block |
||
340 | 340 | $roles->add_caps(); |
341 | 341 | |
342 | 342 | //The Update Ran |
343 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
344 | - give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' ); |
|
345 | - delete_option( 'give_doing_upgrade' ); |
|
343 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
344 | + give_set_upgrade_complete('upgrade_give_user_caps_cleanup'); |
|
345 | + delete_option('give_doing_upgrade'); |
|
346 | 346 | |
347 | 347 | } |
348 | 348 | |
349 | 349 | } |
350 | 350 | |
351 | -add_action( 'admin_init', 'give_v152_cleanup_users' ); |
|
352 | 351 | \ No newline at end of file |
352 | +add_action('admin_init', 'give_v152_cleanup_users'); |
|
353 | 353 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
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 | |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * @return void |
22 | 22 | */ |
23 | 23 | function give_upgrades_screen() { |
24 | - $action = isset( $_GET['give-upgrade'] ) ? sanitize_text_field( $_GET['give-upgrade'] ) : ''; |
|
25 | - $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; |
|
26 | - $total = isset( $_GET['total'] ) ? absint( $_GET['total'] ) : false; |
|
27 | - $custom = isset( $_GET['custom'] ) ? absint( $_GET['custom'] ) : 0; |
|
28 | - $number = isset( $_GET['number'] ) ? absint( $_GET['number'] ) : 100; |
|
29 | - $steps = round( ( $total / $number ), 0 ); |
|
24 | + $action = isset($_GET['give-upgrade']) ? sanitize_text_field($_GET['give-upgrade']) : ''; |
|
25 | + $step = isset($_GET['step']) ? absint($_GET['step']) : 1; |
|
26 | + $total = isset($_GET['total']) ? absint($_GET['total']) : false; |
|
27 | + $custom = isset($_GET['custom']) ? absint($_GET['custom']) : 0; |
|
28 | + $number = isset($_GET['number']) ? absint($_GET['number']) : 100; |
|
29 | + $steps = round(($total / $number), 0); |
|
30 | 30 | |
31 | 31 | $doing_upgrade_args = array( |
32 | 32 | 'page' => 'give-upgrades', |
@@ -36,25 +36,25 @@ discard block |
||
36 | 36 | 'custom' => $custom, |
37 | 37 | 'steps' => $steps |
38 | 38 | ); |
39 | - update_option( 'give_doing_upgrade', $doing_upgrade_args ); |
|
40 | - if ( $step > $steps ) { |
|
39 | + update_option('give_doing_upgrade', $doing_upgrade_args); |
|
40 | + if ($step > $steps) { |
|
41 | 41 | // Prevent a weird case where the estimate was off. Usually only a couple. |
42 | 42 | $steps = $step; |
43 | 43 | } |
44 | 44 | ?> |
45 | 45 | <div class="wrap"> |
46 | - <h2><?php esc_html_e( 'Give - Upgrades', 'give' ); ?></h2> |
|
46 | + <h2><?php esc_html_e('Give - Upgrades', 'give'); ?></h2> |
|
47 | 47 | |
48 | - <?php if ( ! empty( $action ) ) : ?> |
|
48 | + <?php if ( ! empty($action)) : ?> |
|
49 | 49 | |
50 | 50 | <div id="give-upgrade-status"> |
51 | - <p style="font-size: 20px;max-width: 900px;"><?php esc_html_e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); ?> |
|
52 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
51 | + <p style="font-size: 20px;max-width: 900px;"><?php esc_html_e('The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give'); ?> |
|
52 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
53 | 53 | </p> |
54 | 54 | |
55 | - <?php if ( ! empty( $total ) ) : ?> |
|
55 | + <?php if ( ! empty($total)) : ?> |
|
56 | 56 | <p> |
57 | - <strong><?php printf( esc_html__( 'Step %d of approximately %d running', 'give' ), $step, $steps ); ?></strong> |
|
57 | + <strong><?php printf(esc_html__('Step %d of approximately %d running', 'give'), $step, $steps); ?></strong> |
|
58 | 58 | </p> |
59 | 59 | <?php endif; ?> |
60 | 60 | </div> |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | |
69 | 69 | <div id="give-upgrade-status"> |
70 | 70 | <p style="font-size: 20px;max-width: 900px;"> |
71 | - <?php esc_html_e( 'The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give' ); ?> |
|
72 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
71 | + <?php esc_html_e('The upgrade process has started, please be patient and do not close this window or navigate away from this page. This could take several minutes depending on the upgrade and the size of your website. You will be automatically redirected when the upgrade is finished.', 'give'); ?> |
|
72 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/spinner.gif'; ?>" id="give-upgrade-loader" style=" position: relative; top: 3px; left: 6px;" /> |
|
73 | 73 | </p> |
74 | 74 | </div> |
75 | 75 | <script type="text/javascript"> |