@@ -42,16 +42,16 @@ |
||
42 | 42 | 'minWidth' => 320, |
43 | 43 | 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after login.', 'give' ), |
44 | 44 | ), |
45 | - array( |
|
46 | - 'type' => 'container', |
|
47 | - 'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Logout Redirect URL (optional):', 'give' ) ), |
|
48 | - ), |
|
49 | - array( |
|
50 | - 'type' => 'textbox', |
|
51 | - 'name' => 'logout-redirect', |
|
52 | - 'minWidth' => 320, |
|
53 | - 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after logout.', 'give' ), |
|
54 | - ), |
|
45 | + array( |
|
46 | + 'type' => 'container', |
|
47 | + 'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Logout Redirect URL (optional):', 'give' ) ), |
|
48 | + ), |
|
49 | + array( |
|
50 | + 'type' => 'textbox', |
|
51 | + 'name' => 'logout-redirect', |
|
52 | + 'minWidth' => 320, |
|
53 | + 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after logout.', 'give' ), |
|
54 | + ), |
|
55 | 55 | ); |
56 | 56 | } |
57 | 57 | } |
@@ -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,10 +21,10 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function __construct() { |
23 | 23 | |
24 | - $this->shortcode['title'] = esc_html__( 'Login', 'give' ); |
|
25 | - $this->shortcode['label'] = esc_html__( 'Login', 'give' ); |
|
24 | + $this->shortcode['title'] = esc_html__('Login', 'give'); |
|
25 | + $this->shortcode['label'] = esc_html__('Login', 'give'); |
|
26 | 26 | |
27 | - parent::__construct( 'give_login' ); |
|
27 | + parent::__construct('give_login'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -37,23 +37,23 @@ discard block |
||
37 | 37 | return array( |
38 | 38 | array( |
39 | 39 | 'type' => 'container', |
40 | - 'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Login Redirect URL (optional):', 'give' ) ), |
|
40 | + 'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Login Redirect URL (optional):', 'give')), |
|
41 | 41 | ), |
42 | 42 | array( |
43 | 43 | 'type' => 'textbox', |
44 | 44 | 'name' => 'login-redirect', |
45 | 45 | 'minWidth' => 320, |
46 | - 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after login.', 'give' ), |
|
46 | + 'tooltip' => esc_attr__('Enter an URL here to redirect to after login.', 'give'), |
|
47 | 47 | ), |
48 | 48 | array( |
49 | 49 | 'type' => 'container', |
50 | - 'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Logout Redirect URL (optional):', 'give' ) ), |
|
50 | + 'html' => sprintf('<p class="no-margin">%s</p>', esc_html__('Logout Redirect URL (optional):', 'give')), |
|
51 | 51 | ), |
52 | 52 | array( |
53 | 53 | 'type' => 'textbox', |
54 | 54 | 'name' => 'logout-redirect', |
55 | 55 | 'minWidth' => 320, |
56 | - 'tooltip' => esc_attr__( 'Enter an URL here to redirect to after logout.', 'give' ), |
|
56 | + 'tooltip' => esc_attr__('Enter an URL here to redirect to after logout.', 'give'), |
|
57 | 57 | ), |
58 | 58 | ); |
59 | 59 | } |
@@ -248,8 +248,8 @@ |
||
248 | 248 | |
249 | 249 | // do not reindex array! |
250 | 250 | $field['options'] = array( |
251 | - '' => ( $field['placeholder'] ? $field['placeholder'] : esc_attr__( '- Select -', 'give' ) ), |
|
252 | - ) + $field['options']; |
|
251 | + '' => ( $field['placeholder'] ? $field['placeholder'] : esc_attr__( '- 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 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | * |
63 | 63 | * @since 1.0 |
64 | 64 | */ |
65 | - public function __construct( $shortcode ) { |
|
65 | + public function __construct($shortcode) { |
|
66 | 66 | |
67 | 67 | $this->shortcode_tag = $shortcode; |
68 | 68 | |
69 | - add_action( 'admin_init', array( $this, 'init' ) ); |
|
69 | + add_action('admin_init', array($this, 'init')); |
|
70 | 70 | |
71 | 71 | } |
72 | 72 | |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function init() { |
79 | 79 | |
80 | - if ( $this->shortcode_tag ) { |
|
80 | + if ($this->shortcode_tag) { |
|
81 | 81 | |
82 | - $this->self = get_class( $this ); |
|
82 | + $this->self = get_class($this); |
|
83 | 83 | |
84 | 84 | $this->errors = array(); |
85 | 85 | $this->required = array(); |
@@ -88,18 +88,18 @@ discard block |
||
88 | 88 | $fields = $this->get_fields(); |
89 | 89 | |
90 | 90 | $defaults = array( |
91 | - 'btn_close' => esc_html__( 'Close', 'give' ), |
|
92 | - 'btn_okay' => esc_html__( 'Insert Shortcode', 'give' ), |
|
91 | + 'btn_close' => esc_html__('Close', 'give'), |
|
92 | + 'btn_okay' => esc_html__('Insert Shortcode', 'give'), |
|
93 | 93 | 'errors' => $this->errors, |
94 | 94 | 'fields' => $fields, |
95 | - 'label' => '[' . $this->shortcode_tag . ']', |
|
95 | + 'label' => '['.$this->shortcode_tag.']', |
|
96 | 96 | 'required' => $this->required, |
97 | - 'title' => esc_html__( 'Insert Shortcode', 'give' ), |
|
97 | + 'title' => esc_html__('Insert Shortcode', 'give'), |
|
98 | 98 | ); |
99 | 99 | |
100 | - if ( user_can_richedit() ) { |
|
100 | + if (user_can_richedit()) { |
|
101 | 101 | |
102 | - Give_Shortcode_Button::$shortcodes[ $this->shortcode_tag ] = wp_parse_args( $this->shortcode, $defaults ); |
|
102 | + Give_Shortcode_Button::$shortcodes[$this->shortcode_tag] = wp_parse_args($this->shortcode, $defaults); |
|
103 | 103 | |
104 | 104 | } |
105 | 105 | } |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | * |
129 | 129 | * @since 1.0 |
130 | 130 | */ |
131 | - protected function generate_fields( $defined_fields ) { |
|
131 | + protected function generate_fields($defined_fields) { |
|
132 | 132 | |
133 | 133 | $fields = array(); |
134 | 134 | |
135 | - if ( is_array( $defined_fields ) ) { |
|
135 | + if (is_array($defined_fields)) { |
|
136 | 136 | |
137 | - foreach ( $defined_fields as $field ) { |
|
137 | + foreach ($defined_fields as $field) { |
|
138 | 138 | |
139 | 139 | $defaults = array( |
140 | 140 | 'label' => false, |
@@ -145,14 +145,14 @@ discard block |
||
145 | 145 | 'type' => '', |
146 | 146 | ); |
147 | 147 | |
148 | - $field = wp_parse_args( (array) $field, $defaults ); |
|
149 | - $method = 'generate_' . strtolower( $field['type'] ); |
|
148 | + $field = wp_parse_args((array) $field, $defaults); |
|
149 | + $method = 'generate_'.strtolower($field['type']); |
|
150 | 150 | |
151 | - if ( method_exists( $this, $method ) ) { |
|
151 | + if (method_exists($this, $method)) { |
|
152 | 152 | |
153 | - $field = call_user_func( array( $this, $method ), $field ); |
|
153 | + $field = call_user_func(array($this, $method), $field); |
|
154 | 154 | |
155 | - if ( $field ) { |
|
155 | + if ($field) { |
|
156 | 156 | $fields[] = $field; |
157 | 157 | } |
158 | 158 | } |
@@ -172,23 +172,23 @@ discard block |
||
172 | 172 | protected function get_fields() { |
173 | 173 | |
174 | 174 | $defined_fields = $this->define_fields(); |
175 | - $generated_fields = $this->generate_fields( $defined_fields ); |
|
175 | + $generated_fields = $this->generate_fields($defined_fields); |
|
176 | 176 | |
177 | 177 | $errors = array(); |
178 | 178 | |
179 | - if ( ! empty( $this->errors ) ) { |
|
180 | - foreach ( $this->required as $name => $alert ) { |
|
179 | + if ( ! empty($this->errors)) { |
|
180 | + foreach ($this->required as $name => $alert) { |
|
181 | 181 | // Using WordPress function in place of array_column wp_list_pluck as it support older version as well. |
182 | - if ( false === array_search( $name, give_list_pluck( $generated_fields, 'name' ) ) ) { |
|
182 | + if (false === array_search($name, give_list_pluck($generated_fields, 'name'))) { |
|
183 | 183 | |
184 | - $errors[] = $this->errors[ $name ]; |
|
184 | + $errors[] = $this->errors[$name]; |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
188 | 188 | $this->errors = $errors; |
189 | 189 | } |
190 | 190 | |
191 | - if ( ! empty( $errors ) ) { |
|
191 | + if ( ! empty($errors)) { |
|
192 | 192 | |
193 | 193 | return $errors; |
194 | 194 | } |
@@ -205,9 +205,9 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @since 1.0 |
207 | 207 | */ |
208 | - protected function generate_container( $field ) { |
|
208 | + protected function generate_container($field) { |
|
209 | 209 | |
210 | - if ( array_key_exists( 'html', $field ) ) { |
|
210 | + if (array_key_exists('html', $field)) { |
|
211 | 211 | |
212 | 212 | return array( |
213 | 213 | 'type' => $field['type'], |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | * |
228 | 228 | * @since 1.0 |
229 | 229 | */ |
230 | - protected function generate_listbox( $field ) { |
|
230 | + protected function generate_listbox($field) { |
|
231 | 231 | |
232 | - $listbox = shortcode_atts( array( |
|
232 | + $listbox = shortcode_atts(array( |
|
233 | 233 | 'label' => '', |
234 | 234 | 'minWidth' => '', |
235 | 235 | 'name' => false, |
@@ -237,27 +237,27 @@ discard block |
||
237 | 237 | 'type' => '', |
238 | 238 | 'value' => '', |
239 | 239 | 'classes' => '' |
240 | - ), $field ); |
|
240 | + ), $field); |
|
241 | 241 | |
242 | - if ( $this->validate( $field ) ) { |
|
242 | + if ($this->validate($field)) { |
|
243 | 243 | |
244 | 244 | $new_listbox = array(); |
245 | 245 | |
246 | - foreach ( $listbox as $key => $value ) { |
|
246 | + foreach ($listbox as $key => $value) { |
|
247 | 247 | |
248 | - if ( $key == 'value' && empty( $value ) ) { |
|
249 | - $new_listbox[ $key ] = $listbox['name']; |
|
250 | - } else if ( $value ) { |
|
251 | - $new_listbox[ $key ] = $value; |
|
248 | + if ($key == 'value' && empty($value)) { |
|
249 | + $new_listbox[$key] = $listbox['name']; |
|
250 | + } else if ($value) { |
|
251 | + $new_listbox[$key] = $value; |
|
252 | 252 | } |
253 | 253 | } |
254 | 254 | |
255 | 255 | // do not reindex array! |
256 | 256 | $field['options'] = array( |
257 | - '' => ( $field['placeholder'] ? $field['placeholder'] : esc_attr__( '- Select -', 'give' ) ), |
|
257 | + '' => ($field['placeholder'] ? $field['placeholder'] : esc_attr__('- Select -', 'give')), |
|
258 | 258 | ) + $field['options']; |
259 | 259 | |
260 | - foreach ( $field['options'] as $value => $text ) { |
|
260 | + foreach ($field['options'] as $value => $text) { |
|
261 | 261 | $new_listbox['values'][] = array( |
262 | 262 | 'text' => $text, |
263 | 263 | 'value' => $value, |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * |
280 | 280 | * @since 1.0 |
281 | 281 | */ |
282 | - protected function generate_post( $field ) { |
|
282 | + protected function generate_post($field) { |
|
283 | 283 | |
284 | 284 | $args = array( |
285 | 285 | 'post_type' => 'post', |
@@ -289,26 +289,26 @@ discard block |
||
289 | 289 | 'suppress_filters' => false, |
290 | 290 | ); |
291 | 291 | |
292 | - $args = wp_parse_args( (array) $field['query_args'], $args ); |
|
292 | + $args = wp_parse_args((array) $field['query_args'], $args); |
|
293 | 293 | |
294 | - $posts = get_posts( $args ); |
|
294 | + $posts = get_posts($args); |
|
295 | 295 | $options = array(); |
296 | 296 | |
297 | - if ( ! empty( $posts ) ) { |
|
298 | - foreach ( $posts as $post ) { |
|
299 | - $options[ absint( $post->ID ) ] = empty( $post->post_title ) |
|
300 | - ? sprintf( __( 'Untitled (#%s)', 'give' ), $post->ID ) |
|
301 | - : apply_filters( 'the_title', $post->post_title ); |
|
297 | + if ( ! empty($posts)) { |
|
298 | + foreach ($posts as $post) { |
|
299 | + $options[absint($post->ID)] = empty($post->post_title) |
|
300 | + ? sprintf(__('Untitled (#%s)', 'give'), $post->ID) |
|
301 | + : apply_filters('the_title', $post->post_title); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | $field['type'] = 'listbox'; |
305 | 305 | $field['options'] = $options; |
306 | 306 | |
307 | - return $this->generate_listbox( $field ); |
|
307 | + return $this->generate_listbox($field); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | // perform validation here before returning false |
311 | - $this->validate( $field ); |
|
311 | + $this->validate($field); |
|
312 | 312 | |
313 | 313 | return false; |
314 | 314 | } |
@@ -322,9 +322,9 @@ discard block |
||
322 | 322 | * |
323 | 323 | * @since 1.0 |
324 | 324 | */ |
325 | - protected function generate_textbox( $field ) { |
|
325 | + protected function generate_textbox($field) { |
|
326 | 326 | |
327 | - $textbox = shortcode_atts( array( |
|
327 | + $textbox = shortcode_atts(array( |
|
328 | 328 | 'label' => '', |
329 | 329 | 'maxLength' => '', |
330 | 330 | 'minHeight' => '', |
@@ -336,15 +336,15 @@ discard block |
||
336 | 336 | 'value' => '', |
337 | 337 | 'classes' => '', |
338 | 338 | 'placeholder' => '' |
339 | - ), $field ); |
|
339 | + ), $field); |
|
340 | 340 | |
341 | 341 | // Remove empty placeholder. |
342 | - if( empty( $textbox['placeholder'] ) ) { |
|
343 | - unset( $textbox['placeholder'] ); |
|
342 | + if (empty($textbox['placeholder'])) { |
|
343 | + unset($textbox['placeholder']); |
|
344 | 344 | } |
345 | 345 | |
346 | - if ( $this->validate( $field ) ) { |
|
347 | - return array_filter( $textbox, array( $this, 'return_textbox_value' ) ); |
|
346 | + if ($this->validate($field)) { |
|
347 | + return array_filter($textbox, array($this, 'return_textbox_value')); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | return false; |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | * |
358 | 358 | * @return bool |
359 | 359 | */ |
360 | - function return_textbox_value( $value ) { |
|
360 | + function return_textbox_value($value) { |
|
361 | 361 | return $value !== ''; |
362 | 362 | } |
363 | 363 | |
@@ -373,9 +373,9 @@ discard block |
||
373 | 373 | * |
374 | 374 | * @since 1.0 |
375 | 375 | */ |
376 | - protected function validate( $field ) { |
|
376 | + protected function validate($field) { |
|
377 | 377 | |
378 | - extract( shortcode_atts( |
|
378 | + extract(shortcode_atts( |
|
379 | 379 | array( |
380 | 380 | 'name' => false, |
381 | 381 | 'required' => false, |
@@ -383,36 +383,36 @@ discard block |
||
383 | 383 | ), $field ) |
384 | 384 | ); |
385 | 385 | |
386 | - if ( $name ) { |
|
386 | + if ($name) { |
|
387 | 387 | |
388 | - if ( isset( $required['error'] ) ) { |
|
388 | + if (isset($required['error'])) { |
|
389 | 389 | |
390 | 390 | $error = array( |
391 | 391 | 'type' => 'container', |
392 | 392 | 'html' => $required['error'], |
393 | 393 | ); |
394 | 394 | |
395 | - $this->errors[ $name ] = $this->generate_container( $error ); |
|
395 | + $this->errors[$name] = $this->generate_container($error); |
|
396 | 396 | } |
397 | 397 | |
398 | - if ( ! ! $required || is_array( $required ) ) { |
|
398 | + if ( ! ! $required || is_array($required)) { |
|
399 | 399 | |
400 | - $alert = esc_html__( 'Some of the shortcode options are required.', 'give' ); |
|
400 | + $alert = esc_html__('Some of the shortcode options are required.', 'give'); |
|
401 | 401 | |
402 | - if ( isset( $required['alert'] ) ) { |
|
402 | + if (isset($required['alert'])) { |
|
403 | 403 | |
404 | 404 | $alert = $required['alert']; |
405 | 405 | |
406 | - } else if ( ! empty( $label ) ) { |
|
406 | + } else if ( ! empty($label)) { |
|
407 | 407 | |
408 | 408 | $alert = sprintf( |
409 | 409 | /* translators: %s: option label */ |
410 | - esc_html__( 'The "%s" option is required.', 'give' ), |
|
411 | - str_replace( ':', '', $label ) |
|
410 | + esc_html__('The "%s" option is required.', 'give'), |
|
411 | + str_replace(':', '', $label) |
|
412 | 412 | ); |
413 | 413 | } |
414 | 414 | |
415 | - $this->required[ $name ] = $alert; |
|
415 | + $this->required[$name] = $alert; |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | return true; |
@@ -85,7 +85,7 @@ |
||
85 | 85 | * |
86 | 86 | * @since 1.8 |
87 | 87 | * |
88 | - * @param $setting_tab |
|
88 | + * @param string $setting_tab |
|
89 | 89 | * |
90 | 90 | * @return string |
91 | 91 | */ |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! class_exists( 'Give_CMB2_Settings_Loader' ) ) : |
|
12 | +if ( ! class_exists('Give_CMB2_Settings_Loader')) : |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * This class loads the cmb2 settings. |
@@ -52,30 +52,30 @@ discard block |
||
52 | 52 | |
53 | 53 | // Get current tab. |
54 | 54 | $this->current_tab = give_get_current_setting_tab(); |
55 | - $this->current_section = empty( $_REQUEST['section'] ) ? ( current( array_keys( $this->get_sections() ) ) ) : sanitize_title( $_REQUEST['section'] ); |
|
55 | + $this->current_section = empty($_REQUEST['section']) ? (current(array_keys($this->get_sections()))) : sanitize_title($_REQUEST['section']); |
|
56 | 56 | |
57 | 57 | // Tab ID. |
58 | 58 | $this->id = $this->current_tab; |
59 | 59 | |
60 | 60 | // Add addon tabs. |
61 | - add_filter( 'give-settings_tabs_array', array( $this, 'add_addon_settings_page' ), 999999 ); |
|
61 | + add_filter('give-settings_tabs_array', array($this, 'add_addon_settings_page'), 999999); |
|
62 | 62 | |
63 | 63 | // Add save hook to addons. |
64 | - add_action( 'give-settings_get_settings_pages', array( $this, 'setup_addon_save_hook' ), 999999 ); |
|
64 | + add_action('give-settings_get_settings_pages', array($this, 'setup_addon_save_hook'), 999999); |
|
65 | 65 | |
66 | 66 | // Add backward compatibility filters plugin settings. |
67 | - $setting_tabs = array( 'general', 'gateways', 'display', 'emails', 'addons', 'licenses' ); |
|
67 | + $setting_tabs = array('general', 'gateways', 'display', 'emails', 'addons', 'licenses'); |
|
68 | 68 | |
69 | 69 | // Filter Payment Gateways settings. |
70 | - if ( in_array( $this->current_tab, $setting_tabs ) ) { |
|
71 | - add_filter( "give_get_settings_{$this->current_tab}", array( |
|
70 | + if (in_array($this->current_tab, $setting_tabs)) { |
|
71 | + add_filter("give_get_settings_{$this->current_tab}", array( |
|
72 | 72 | $this, |
73 | 73 | 'get_filtered_addon_settings', |
74 | - ), 999999, 1 ); |
|
75 | - add_filter( "give_get_sections_{$this->current_tab}", array( |
|
74 | + ), 999999, 1); |
|
75 | + add_filter("give_get_sections_{$this->current_tab}", array( |
|
76 | 76 | $this, |
77 | 77 | 'get_filtered_addon_sections', |
78 | - ), 999999, 1 ); |
|
78 | + ), 999999, 1); |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return string |
90 | 90 | */ |
91 | - function set_default_setting_tab( $setting_tab ) { |
|
91 | + function set_default_setting_tab($setting_tab) { |
|
92 | 92 | $default_tab = ''; |
93 | 93 | |
94 | 94 | // Set default tab to first setting tab. |
95 | - if ( $sections = array_keys( $this->get_sections() ) ) { |
|
96 | - $default_tab = current( $sections ); |
|
95 | + if ($sections = array_keys($this->get_sections())) { |
|
96 | + $default_tab = current($sections); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | return $default_tab; |
@@ -108,29 +108,29 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return mixed |
110 | 110 | */ |
111 | - function add_addon_settings_page( $pages ) { |
|
111 | + function add_addon_settings_page($pages) { |
|
112 | 112 | // Previous setting page. |
113 | 113 | $previous_pages = $this->prev_settings->give_get_settings_tabs(); |
114 | 114 | |
115 | 115 | // API and System Info setting tab merge to Tools setting tab, so remove them from tabs. |
116 | - unset( $previous_pages['api'] ); |
|
117 | - unset( $previous_pages['system_info'] ); |
|
116 | + unset($previous_pages['api']); |
|
117 | + unset($previous_pages['system_info']); |
|
118 | 118 | |
119 | 119 | // Tab is not register. |
120 | - $pages_diff = array_keys( array_diff( $previous_pages, $pages ) ); |
|
120 | + $pages_diff = array_keys(array_diff($previous_pages, $pages)); |
|
121 | 121 | |
122 | 122 | // Merge old settings with new settings. |
123 | - $pages = array_merge( $pages, $previous_pages ); |
|
123 | + $pages = array_merge($pages, $previous_pages); |
|
124 | 124 | |
125 | - if ( in_array( $this->current_tab, $pages_diff ) ) { |
|
125 | + if (in_array($this->current_tab, $pages_diff)) { |
|
126 | 126 | // Filter & actions. |
127 | - add_filter( "give_default_setting_tab_section_{$this->current_tab}", array( |
|
127 | + add_filter("give_default_setting_tab_section_{$this->current_tab}", array( |
|
128 | 128 | $this, |
129 | 129 | 'set_default_setting_tab', |
130 | - ), 10 ); |
|
131 | - add_action( "give-settings_sections_{$this->current_tab}_page", array( $this, 'output_sections' ) ); |
|
132 | - add_action( "give-settings_settings_{$this->current_tab}_page", array( $this, 'output' ), 10 ); |
|
133 | - add_action( "give-settings_save_{$this->current_tab}", array( $this, 'save' ) ); |
|
130 | + ), 10); |
|
131 | + add_action("give-settings_sections_{$this->current_tab}_page", array($this, 'output_sections')); |
|
132 | + add_action("give-settings_settings_{$this->current_tab}_page", array($this, 'output'), 10); |
|
133 | + add_action("give-settings_save_{$this->current_tab}", array($this, 'save')); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | return $pages; |
@@ -146,29 +146,29 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @return mixed |
148 | 148 | */ |
149 | - function setup_addon_save_hook( $pages ) { |
|
149 | + function setup_addon_save_hook($pages) { |
|
150 | 150 | $page_ids = array(); |
151 | 151 | |
152 | - foreach ( $pages as $page ) { |
|
153 | - $page_ids = $page->add_settings_page( $page_ids ); |
|
152 | + foreach ($pages as $page) { |
|
153 | + $page_ids = $page->add_settings_page($page_ids); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | // Previous setting page. |
157 | 157 | $previous_pages = $this->prev_settings->give_get_settings_tabs(); |
158 | 158 | |
159 | 159 | // API and System Info setting tab merge to Tools setting tab, so remove them from tabs. |
160 | - unset( $previous_pages['api'] ); |
|
161 | - unset( $previous_pages['system_info'] ); |
|
160 | + unset($previous_pages['api']); |
|
161 | + unset($previous_pages['system_info']); |
|
162 | 162 | |
163 | 163 | // Tab is not register. |
164 | - $pages_diff = array_keys( array_diff( $previous_pages, $page_ids ) ); |
|
164 | + $pages_diff = array_keys(array_diff($previous_pages, $page_ids)); |
|
165 | 165 | |
166 | 166 | // Merge old settings with new settings. |
167 | 167 | // $pages = array_merge( $page_ids, $previous_pages ); |
168 | 168 | |
169 | - if ( in_array( $this->current_tab, $pages_diff ) ) { |
|
169 | + if (in_array($this->current_tab, $pages_diff)) { |
|
170 | 170 | // Filter & actions. |
171 | - add_action( "give-settings_save_{$this->current_tab}", array( $this, 'save' ) ); |
|
171 | + add_action("give-settings_save_{$this->current_tab}", array($this, 'save')); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | return $pages; |
@@ -183,16 +183,16 @@ discard block |
||
183 | 183 | * |
184 | 184 | * @return string |
185 | 185 | */ |
186 | - function get_section_name( $field_name ) { |
|
186 | + function get_section_name($field_name) { |
|
187 | 187 | // Bailout. |
188 | - if ( empty( $field_name ) ) { |
|
188 | + if (empty($field_name)) { |
|
189 | 189 | return $field_name; |
190 | 190 | } |
191 | 191 | |
192 | - $section_name = explode( ' ', $field_name ); |
|
192 | + $section_name = explode(' ', $field_name); |
|
193 | 193 | |
194 | 194 | // Output. |
195 | - return strip_tags( implode( ' ', $section_name ) ); |
|
195 | + return strip_tags(implode(' ', $section_name)); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @return mixed |
209 | 209 | */ |
210 | - public function en_translation( $translation, $text ) { |
|
210 | + public function en_translation($translation, $text) { |
|
211 | 211 | return $text; |
212 | 212 | } |
213 | 213 | |
@@ -221,59 +221,59 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @return mixed |
223 | 223 | */ |
224 | - function get_filtered_addon_sections( $sections = array() ) { |
|
224 | + function get_filtered_addon_sections($sections = array()) { |
|
225 | 225 | // New sections. |
226 | 226 | $new_sections = array(); |
227 | - $sections_ID = array_keys( $sections ); |
|
228 | - $setting_fields = $this->prev_settings->give_settings( $this->current_tab ); |
|
227 | + $sections_ID = array_keys($sections); |
|
228 | + $setting_fields = $this->prev_settings->give_settings($this->current_tab); |
|
229 | 229 | |
230 | 230 | // We need untranslated settings for backward compatibility. |
231 | - add_filter( 'gettext', array( $this, 'en_translation' ), 10, 2 ); |
|
232 | - $en_setting_fields = $this->prev_settings->give_settings( $this->current_tab ); |
|
233 | - remove_filter( 'gettext', array( $this, 'en_translation' ), 10 ); |
|
231 | + add_filter('gettext', array($this, 'en_translation'), 10, 2); |
|
232 | + $en_setting_fields = $this->prev_settings->give_settings($this->current_tab); |
|
233 | + remove_filter('gettext', array($this, 'en_translation'), 10); |
|
234 | 234 | |
235 | - if ( ! empty( $setting_fields ) && ! empty( $setting_fields['fields'] ) ) { |
|
235 | + if ( ! empty($setting_fields) && ! empty($setting_fields['fields'])) { |
|
236 | 236 | |
237 | - foreach ( $setting_fields['fields'] as $index => $field ) { |
|
237 | + foreach ($setting_fields['fields'] as $index => $field) { |
|
238 | 238 | // Collect new sections from addons. |
239 | - if ( 'give_title' !== $field['type'] ) { |
|
239 | + if ('give_title' !== $field['type']) { |
|
240 | 240 | continue; |
241 | 241 | } |
242 | 242 | |
243 | 243 | // Untranslated setting name. |
244 | - $en_setting_field_name = isset( $en_setting_fields['fields'][ $index ]['name'] ) ? $en_setting_fields['fields'][ $index ]['name'] : ''; |
|
244 | + $en_setting_field_name = isset($en_setting_fields['fields'][$index]['name']) ? $en_setting_fields['fields'][$index]['name'] : ''; |
|
245 | 245 | |
246 | 246 | // Section name. |
247 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : ''; |
|
248 | - $section_name = $this->get_section_name( $field['name'] ); |
|
247 | + $field['name'] = isset($field['name']) ? $field['name'] : ''; |
|
248 | + $section_name = $this->get_section_name($field['name']); |
|
249 | 249 | |
250 | 250 | // Check if section name exit and section title array is not empty. |
251 | - if ( ! empty( $sections ) && ! empty( $en_setting_field_name ) ) { |
|
251 | + if ( ! empty($sections) && ! empty($en_setting_field_name)) { |
|
252 | 252 | |
253 | 253 | // Bailout: Do not load section if it is already exist. |
254 | 254 | if ( |
255 | - in_array( sanitize_title( $en_setting_field_name ), $sections_ID ) // Check section id. |
|
256 | - || in_array( $section_name, $sections ) // Check section name. |
|
255 | + in_array(sanitize_title($en_setting_field_name), $sections_ID) // Check section id. |
|
256 | + || in_array($section_name, $sections) // Check section name. |
|
257 | 257 | ) { |
258 | 258 | continue; |
259 | 259 | } |
260 | 260 | } |
261 | 261 | |
262 | 262 | // Collect new sections from addons. |
263 | - $new_sections[ sanitize_title( $field['name'] ) ] = $section_name; |
|
263 | + $new_sections[sanitize_title($field['name'])] = $section_name; |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
267 | 267 | // Add new section. |
268 | - if ( ! empty( $new_sections ) ) { |
|
269 | - $sections = array_merge( $sections, $new_sections ); |
|
268 | + if ( ! empty($new_sections)) { |
|
269 | + $sections = array_merge($sections, $new_sections); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | // Remove section tab conditionally. |
273 | - switch ( give_get_current_setting_tab() ) { |
|
273 | + switch (give_get_current_setting_tab()) { |
|
274 | 274 | case 'emails': |
275 | 275 | // unset( $sections['donation-receipt'] ); |
276 | - unset( $sections['new-donation-notification'] ); |
|
276 | + unset($sections['new-donation-notification']); |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | // Output. |
@@ -291,23 +291,23 @@ discard block |
||
291 | 291 | * |
292 | 292 | * @return array |
293 | 293 | */ |
294 | - function get_filtered_addon_settings( $settings, $setting_fields = array() ) { |
|
294 | + function get_filtered_addon_settings($settings, $setting_fields = array()) { |
|
295 | 295 | global $wp_filter; |
296 | 296 | |
297 | 297 | $new_setting_fields = array(); |
298 | 298 | |
299 | - if ( ! empty( $settings ) ) { |
|
299 | + if ( ! empty($settings)) { |
|
300 | 300 | // Bailout: If setting array contain first element of type title then it means it is already created with new setting api (skip this section ). |
301 | - if ( isset( $settings[0]['type'] ) && 'title' == $settings[0]['type'] ) { |
|
301 | + if (isset($settings[0]['type']) && 'title' == $settings[0]['type']) { |
|
302 | 302 | $last_sectionend_pos = 0; |
303 | - foreach ( $settings as $index => $setting ) { |
|
303 | + foreach ($settings as $index => $setting) { |
|
304 | 304 | // We need setting till last section end. |
305 | - if ( 'sectionend' === $setting['type'] ) { |
|
305 | + if ('sectionend' === $setting['type']) { |
|
306 | 306 | $last_sectionend_pos = ++ $index; |
307 | 307 | } |
308 | 308 | } |
309 | 309 | |
310 | - $settings = array_slice( $settings, 0, $last_sectionend_pos ); |
|
310 | + $settings = array_slice($settings, 0, $last_sectionend_pos); |
|
311 | 311 | |
312 | 312 | return $settings; |
313 | 313 | } |
@@ -316,24 +316,24 @@ discard block |
||
316 | 316 | $prev_title_field_id = ''; |
317 | 317 | |
318 | 318 | // Create new setting fields. |
319 | - foreach ( $settings as $index => $field ) { |
|
319 | + foreach ($settings as $index => $field) { |
|
320 | 320 | |
321 | 321 | // Bailout: Must need field type to process. |
322 | - if ( ! isset( $field['type'] ) ) { |
|
322 | + if ( ! isset($field['type'])) { |
|
323 | 323 | continue; |
324 | 324 | } |
325 | 325 | |
326 | 326 | // Set wrapper class if any. |
327 | - if ( ! empty( $field['row_classes'] ) ) { |
|
327 | + if ( ! empty($field['row_classes'])) { |
|
328 | 328 | $field['wrapper_class'] = $field['row_classes']; |
329 | - unset( $field['row_classes'] ); |
|
329 | + unset($field['row_classes']); |
|
330 | 330 | } |
331 | 331 | |
332 | - $field['name'] = ! isset( $field['name'] ) ? '' : $field['name']; |
|
333 | - $field['desc'] = ! isset( $field['desc'] ) ? '' : $field['desc']; |
|
332 | + $field['name'] = ! isset($field['name']) ? '' : $field['name']; |
|
333 | + $field['desc'] = ! isset($field['desc']) ? '' : $field['desc']; |
|
334 | 334 | |
335 | 335 | // Modify cmb2 setting fields. |
336 | - switch ( $field['type'] ) { |
|
336 | + switch ($field['type']) { |
|
337 | 337 | case 'text' : |
338 | 338 | case 'file' : |
339 | 339 | $field['css'] = 'width:25em;'; |
@@ -357,18 +357,18 @@ discard block |
||
357 | 357 | $field['type'] = 'title'; |
358 | 358 | |
359 | 359 | // Since we are showing sections, so there now ned to show horizontal rules. |
360 | - if ( '<hr>' === $field['desc'] ) { |
|
360 | + if ('<hr>' === $field['desc']) { |
|
361 | 361 | $field['desc'] = ''; |
362 | 362 | } |
363 | 363 | |
364 | 364 | break; |
365 | 365 | } |
366 | 366 | |
367 | - if ( 'title' === $field['type'] ) { |
|
367 | + if ('title' === $field['type']) { |
|
368 | 368 | |
369 | 369 | // If we do not have first element as title then these field will be skip from frontend |
370 | 370 | // because there are not belong to any section, so put all abandon fields under first section. |
371 | - if ( $index && empty( $prev_title_field_id ) ) { |
|
371 | + if ($index && empty($prev_title_field_id)) { |
|
372 | 372 | array_unshift( |
373 | 373 | $new_setting_fields, |
374 | 374 | array( |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | $prev_title_field_id = $field['id']; |
383 | 383 | |
384 | 384 | continue; |
385 | - } elseif ( $index ) { |
|
385 | + } elseif ($index) { |
|
386 | 386 | // Section end. |
387 | 387 | $new_setting_fields[] = array( |
388 | 388 | 'type' => 'sectionend', |
@@ -414,52 +414,52 @@ discard block |
||
414 | 414 | |
415 | 415 | // Check if setting page has title section or not. |
416 | 416 | // If setting page does not have title section then add title section to it and fix section end array id. |
417 | - if ( 'title' !== $new_setting_fields[0]['type'] ) { |
|
417 | + if ('title' !== $new_setting_fields[0]['type']) { |
|
418 | 418 | array_unshift( |
419 | 419 | $new_setting_fields, |
420 | 420 | array( |
421 | - 'title' => ( isset( $settings['give_title'] ) ? $settings['give_title'] : '' ), |
|
421 | + 'title' => (isset($settings['give_title']) ? $settings['give_title'] : ''), |
|
422 | 422 | 'type' => 'title', |
423 | - 'desc' => ! empty( $setting_fields['desc'] ) ? $setting_fields['desc'] : '', |
|
424 | - 'id' => ( isset( $settings['id'] ) ? $settings['id'] : '' ), |
|
423 | + 'desc' => ! empty($setting_fields['desc']) ? $setting_fields['desc'] : '', |
|
424 | + 'id' => (isset($settings['id']) ? $settings['id'] : ''), |
|
425 | 425 | ) |
426 | 426 | ); |
427 | 427 | |
428 | 428 | // Update id in section end array if does not contain. |
429 | - if ( empty( $new_setting_fields[ count( $new_setting_fields ) - 1 ]['id'] ) ) { |
|
430 | - $new_setting_fields[ count( $new_setting_fields ) - 1 ]['id'] = ( isset( $settings['id'] ) ? $settings['id'] : '' ); |
|
429 | + if (empty($new_setting_fields[count($new_setting_fields) - 1]['id'])) { |
|
430 | + $new_setting_fields[count($new_setting_fields) - 1]['id'] = (isset($settings['id']) ? $settings['id'] : ''); |
|
431 | 431 | } |
432 | 432 | } |
433 | 433 | |
434 | 434 | // Return only section related settings. |
435 | - if ( $sections = $this->get_filtered_addon_sections() ) { |
|
436 | - $new_setting_fields = $this->get_section_settings( $new_setting_fields ); |
|
435 | + if ($sections = $this->get_filtered_addon_sections()) { |
|
436 | + $new_setting_fields = $this->get_section_settings($new_setting_fields); |
|
437 | 437 | } |
438 | 438 | |
439 | 439 | // Third party plugin backward compatibility. |
440 | - $wp_filter_keys = array_keys( $wp_filter ); |
|
441 | - foreach ( $new_setting_fields as $index => $field ) { |
|
442 | - if ( ! isset( $field['type'] ) || in_array( $field['type'], array( 'title', 'sectionend' ) ) ) { |
|
440 | + $wp_filter_keys = array_keys($wp_filter); |
|
441 | + foreach ($new_setting_fields as $index => $field) { |
|
442 | + if ( ! isset($field['type']) || in_array($field['type'], array('title', 'sectionend'))) { |
|
443 | 443 | continue; |
444 | 444 | } |
445 | 445 | |
446 | 446 | $cmb2_filter_name = "cmb2_render_{$field['type']}"; |
447 | 447 | |
448 | - if ( in_array( $cmb2_filter_name, $wp_filter_keys ) ) { |
|
448 | + if (in_array($cmb2_filter_name, $wp_filter_keys)) { |
|
449 | 449 | |
450 | - if ( 0 >= version_compare( 4.7, get_bloginfo( 'version' ) ) && ! empty( $wp_filter[ $cmb2_filter_name ]->callbacks ) ) { |
|
451 | - $cmb2_filter_arr = current( $wp_filter[ $cmb2_filter_name ]->callbacks ); |
|
450 | + if (0 >= version_compare(4.7, get_bloginfo('version')) && ! empty($wp_filter[$cmb2_filter_name]->callbacks)) { |
|
451 | + $cmb2_filter_arr = current($wp_filter[$cmb2_filter_name]->callbacks); |
|
452 | 452 | } else { |
453 | - $cmb2_filter_arr = current( $wp_filter[ $cmb2_filter_name ] ); |
|
453 | + $cmb2_filter_arr = current($wp_filter[$cmb2_filter_name]); |
|
454 | 454 | } |
455 | 455 | |
456 | - if ( ! empty( $cmb2_filter_arr ) ) { |
|
456 | + if ( ! empty($cmb2_filter_arr)) { |
|
457 | 457 | // Note: function can be called either globally or with class object, it depends on how developer invoke it. |
458 | - $new_setting_fields[ $index ]['func'] = current( $cmb2_filter_arr ); |
|
459 | - add_action( "give_admin_field_{$field['type']}", array( |
|
458 | + $new_setting_fields[$index]['func'] = current($cmb2_filter_arr); |
|
459 | + add_action("give_admin_field_{$field['type']}", array( |
|
460 | 460 | $this, |
461 | 461 | 'addon_setting_field', |
462 | - ), 10, 2 ); |
|
462 | + ), 10, 2); |
|
463 | 463 | } |
464 | 464 | } |
465 | 465 | } |
@@ -480,31 +480,31 @@ discard block |
||
480 | 480 | * |
481 | 481 | * @return array |
482 | 482 | */ |
483 | - function get_section_settings( $tab_settings ) { |
|
483 | + function get_section_settings($tab_settings) { |
|
484 | 484 | $current_section = give_get_current_setting_section(); |
485 | 485 | |
486 | 486 | // Note: If we are opening default tab for addon setting then it is possible that we will get empty string as current section |
487 | 487 | // because default section filter added after save hook fire, so we will always get problem to save first section [default] or if there are only on section |
488 | 488 | // This is hack to fix this. |
489 | - if ( empty( $current_section ) ) { |
|
490 | - $current_section = $this->set_default_setting_tab( $current_section ); |
|
489 | + if (empty($current_section)) { |
|
490 | + $current_section = $this->set_default_setting_tab($current_section); |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | $section_start = false; |
494 | 494 | $section_end = false; |
495 | 495 | $section_only_setting_fields = array(); |
496 | 496 | |
497 | - foreach ( $tab_settings as $field ) { |
|
498 | - if ( 'title' == $field['type'] && $current_section == sanitize_title( $field['title'] ) ) { |
|
497 | + foreach ($tab_settings as $field) { |
|
498 | + if ('title' == $field['type'] && $current_section == sanitize_title($field['title'])) { |
|
499 | 499 | $section_start = true; |
500 | 500 | } |
501 | 501 | |
502 | - if ( ! $section_start || $section_end ) { |
|
502 | + if ( ! $section_start || $section_end) { |
|
503 | 503 | continue; |
504 | 504 | } |
505 | 505 | |
506 | - if ( $section_start && ! $section_end ) { |
|
507 | - if ( 'sectionend' == $field['type'] ) { |
|
506 | + if ($section_start && ! $section_end) { |
|
507 | + if ('sectionend' == $field['type']) { |
|
508 | 508 | $section_end = true; |
509 | 509 | } |
510 | 510 | $section_only_setting_fields[] = $field; |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | // Remove title from setting, prevent it from render in setting tab. |
515 | 515 | $section_only_setting_fields[0]['title'] = ''; |
516 | 516 | |
517 | - return apply_filters( "give_get_settings_{$this->current_tab}_{$current_section}", $section_only_setting_fields, $tab_settings ); |
|
517 | + return apply_filters("give_get_settings_{$this->current_tab}_{$current_section}", $section_only_setting_fields, $tab_settings); |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | |
@@ -528,17 +528,17 @@ discard block |
||
528 | 528 | * |
529 | 529 | * @return void |
530 | 530 | */ |
531 | - function addon_setting_field( $field, $saved_value ) { |
|
531 | + function addon_setting_field($field, $saved_value) { |
|
532 | 532 | // Create object for cmb2 function callback backward compatibility. |
533 | 533 | // Note: Do not call any cmb2 function on these objects |
534 | - $field_obj = (object) array( 'args' => $field ); |
|
535 | - $field_type_obj = (object) array( 'field' => $field_obj ); |
|
534 | + $field_obj = (object) array('args' => $field); |
|
535 | + $field_type_obj = (object) array('field' => $field_obj); |
|
536 | 536 | |
537 | - switch ( $this->current_tab ) : |
|
537 | + switch ($this->current_tab) : |
|
538 | 538 | case 'licenses': |
539 | 539 | ?> |
540 | 540 | <div class="give-settings-wrap give-settings-wrap-<?php echo $this->current_tab; ?>"> |
541 | - <?php $field['func']['function']( $field_obj, $saved_value, '', '', $field_type_obj ); ?> |
|
541 | + <?php $field['func']['function']($field_obj, $saved_value, '', '', $field_type_obj); ?> |
|
542 | 542 | </div> |
543 | 543 | <?php break; |
544 | 544 | |
@@ -546,21 +546,21 @@ discard block |
||
546 | 546 | $colspan = 'colspan="2"'; |
547 | 547 | ?> |
548 | 548 | <tr valign="top"> |
549 | - <?php if ( ! empty( $field['name'] ) && ! in_array( $field['name'], array( ' ' ) ) ) : ?> |
|
549 | + <?php if ( ! empty($field['name']) && ! in_array($field['name'], array(' '))) : ?> |
|
550 | 550 | <th scope="row" class="titledesc"> |
551 | - <label for="<?php echo esc_attr( $field['name'] ); ?>"><?php echo $field['title']; ?></label> |
|
551 | + <label for="<?php echo esc_attr($field['name']); ?>"><?php echo $field['title']; ?></label> |
|
552 | 552 | </th> |
553 | 553 | <?php $colspan = ''; ?> |
554 | 554 | <?php endif; ?> |
555 | 555 | <td class="give-forminp" <?php echo $colspan; ?>> |
556 | 556 | <?php |
557 | - if ( is_array( $field['func']['function'] ) ) { |
|
557 | + if (is_array($field['func']['function'])) { |
|
558 | 558 | $classname = $field['func']['function'][0]; |
559 | 559 | $function_name = $field['func']['function'][1]; |
560 | - $classname->$function_name( $field_obj, $saved_value, '', '', $field_type_obj ); |
|
560 | + $classname->$function_name($field_obj, $saved_value, '', '', $field_type_obj); |
|
561 | 561 | } else { |
562 | 562 | $function_name = $field['func']['function']; |
563 | - $function_name( $field_obj, $saved_value, '', '', $field_type_obj ); |
|
563 | + $function_name($field_obj, $saved_value, '', '', $field_type_obj); |
|
564 | 564 | } |
565 | 565 | ?> |
566 | 566 | </td> |
@@ -578,10 +578,10 @@ discard block |
||
578 | 578 | public function get_sections() { |
579 | 579 | $sections = array(); |
580 | 580 | |
581 | - if ( ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) && ! empty( $setting_fields['fields'] ) ) { |
|
582 | - foreach ( $setting_fields['fields'] as $field ) { |
|
583 | - if ( 'give_title' == $field['type'] ) { |
|
584 | - $sections[ sanitize_title( $field['name'] ) ] = $this->get_section_name( $field['name'] ); |
|
581 | + if (($setting_fields = $this->prev_settings->give_settings($this->current_tab)) && ! empty($setting_fields['fields'])) { |
|
582 | + foreach ($setting_fields['fields'] as $field) { |
|
583 | + if ('give_title' == $field['type']) { |
|
584 | + $sections[sanitize_title($field['name'])] = $this->get_section_name($field['name']); |
|
585 | 585 | } |
586 | 586 | } |
587 | 587 | } |
@@ -601,16 +601,16 @@ discard block |
||
601 | 601 | |
602 | 602 | $new_setting_fields = array(); |
603 | 603 | |
604 | - if ( $setting_fields = $this->prev_settings->give_settings( $this->current_tab ) ) { |
|
605 | - if ( isset( $setting_fields['fields'] ) ) { |
|
604 | + if ($setting_fields = $this->prev_settings->give_settings($this->current_tab)) { |
|
605 | + if (isset($setting_fields['fields'])) { |
|
606 | 606 | |
607 | 607 | $tab_data = array( |
608 | 608 | 'id' => $setting_fields['id'], |
609 | 609 | 'give_title' => $setting_fields['give_title'], |
610 | - 'desc' => ( isset( $setting_fields['desc'] ) ? $setting_fields['desc'] : '' ), |
|
610 | + 'desc' => (isset($setting_fields['desc']) ? $setting_fields['desc'] : ''), |
|
611 | 611 | ); |
612 | 612 | |
613 | - $new_setting_fields = $this->get_filtered_addon_settings( $setting_fields['fields'], $tab_data ); |
|
613 | + $new_setting_fields = $this->get_filtered_addon_settings($setting_fields['fields'], $tab_data); |
|
614 | 614 | } |
615 | 615 | } |
616 | 616 | |
@@ -627,24 +627,24 @@ discard block |
||
627 | 627 | $sections = $this->get_sections(); |
628 | 628 | |
629 | 629 | // Show section settings only if setting section exist. |
630 | - if ( $this->current_section && ! in_array( $this->current_section, array_keys( $sections ) ) ) { |
|
631 | - echo '<div class="error"><p>' . __( 'Oops, this settings page does not exist.', 'give' ) . '</p></div>'; |
|
630 | + if ($this->current_section && ! in_array($this->current_section, array_keys($sections))) { |
|
631 | + echo '<div class="error"><p>'.__('Oops, this settings page does not exist.', 'give').'</p></div>'; |
|
632 | 632 | $GLOBALS['give_hide_save_button'] = true; |
633 | 633 | |
634 | 634 | return; |
635 | 635 | } |
636 | 636 | |
637 | 637 | // Bailout. |
638 | - if ( empty( $sections ) ) { |
|
638 | + if (empty($sections)) { |
|
639 | 639 | return; |
640 | 640 | } |
641 | 641 | |
642 | 642 | echo '<ul class="give-subsubsub">'; |
643 | 643 | |
644 | - $array_keys = array_keys( $sections ); |
|
644 | + $array_keys = array_keys($sections); |
|
645 | 645 | |
646 | - foreach ( $sections as $id => $label ) { |
|
647 | - echo '<li><a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=' . $this->current_tab . '§ion=' . sanitize_title( $id ) ) . '" class="' . ( $this->current_section == $id ? 'current' : '' ) . '">' . strip_tags( $label ) . '</a> ' . ( end( $array_keys ) == $id ? '' : '|' ) . ' </li>'; |
|
646 | + foreach ($sections as $id => $label) { |
|
647 | + echo '<li><a href="'.admin_url('edit.php?post_type=give_forms&page=give-settings&tab='.$this->current_tab.'§ion='.sanitize_title($id)).'" class="'.($this->current_section == $id ? 'current' : '').'">'.strip_tags($label).'</a> '.(end($array_keys) == $id ? '' : '|').' </li>'; |
|
648 | 648 | } |
649 | 649 | |
650 | 650 | echo '</ul><br class="clear" /><hr>'; |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | public function output() { |
660 | 660 | $settings = $this->get_settings(); |
661 | 661 | |
662 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
662 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
663 | 663 | } |
664 | 664 | |
665 | 665 | /** |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | public function save() { |
672 | 672 | $settings = $this->get_settings(); |
673 | 673 | |
674 | - Give_Admin_Settings::save_fields( $settings, 'give_settings' ); |
|
674 | + Give_Admin_Settings::save_fields($settings, 'give_settings'); |
|
675 | 675 | } |
676 | 676 | } |
677 | 677 | endif; |
@@ -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 | |
@@ -36,29 +36,29 @@ discard block |
||
36 | 36 | /** |
37 | 37 | * Templates |
38 | 38 | */ |
39 | - add_filter( 'template_include', array( __CLASS__, 'template_loader' ) ); |
|
39 | + add_filter('template_include', array(__CLASS__, 'template_loader')); |
|
40 | 40 | |
41 | 41 | /** |
42 | 42 | * Content Wrappers |
43 | 43 | */ |
44 | - add_action( 'give_before_main_content', 'give_output_content_wrapper', 10 ); |
|
45 | - add_action( 'give_after_main_content', 'give_output_content_wrapper_end', 10 ); |
|
44 | + add_action('give_before_main_content', 'give_output_content_wrapper', 10); |
|
45 | + add_action('give_after_main_content', 'give_output_content_wrapper_end', 10); |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Entry Summary Classes |
49 | 49 | */ |
50 | - add_filter( 'give_forms_single_summary_classes', array( $this, 'give_set_single_summary_classes' ) ); |
|
50 | + add_filter('give_forms_single_summary_classes', array($this, 'give_set_single_summary_classes')); |
|
51 | 51 | |
52 | 52 | /** |
53 | 53 | * Sidebar |
54 | 54 | */ |
55 | - add_action( 'give_before_single_form_summary', array( $this, 'give_output_sidebar_option' ), 1 ); |
|
55 | + add_action('give_before_single_form_summary', array($this, 'give_output_sidebar_option'), 1); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * Single Forms Summary Box |
59 | 59 | */ |
60 | - add_action( 'give_single_form_summary', 'give_template_single_title', 5 ); |
|
61 | - add_action( 'give_single_form_summary', 'give_get_donation_form', 10 ); |
|
60 | + add_action('give_single_form_summary', 'give_template_single_title', 5); |
|
61 | + add_action('give_single_form_summary', 'give_get_donation_form', 10); |
|
62 | 62 | |
63 | 63 | } |
64 | 64 | |
@@ -73,10 +73,10 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return string $classes List of space separated class names. |
75 | 75 | */ |
76 | - public function give_set_single_summary_classes( $classes ) { |
|
76 | + public function give_set_single_summary_classes($classes) { |
|
77 | 77 | |
78 | 78 | //Add full width class when feature image is disabled AND no widgets are present |
79 | - if ( ! give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) ) { |
|
79 | + if ( ! give_is_setting_enabled(give_get_option('form_sidebar'))) { |
|
80 | 80 | $classes .= ' give-full-width'; |
81 | 81 | } |
82 | 82 | |
@@ -97,11 +97,11 @@ discard block |
||
97 | 97 | public function give_output_sidebar_option() { |
98 | 98 | |
99 | 99 | //Add full width class when feature image is disabled AND no widgets are present |
100 | - if ( give_is_setting_enabled( give_get_option( 'form_sidebar' ) ) ) { |
|
101 | - add_action( 'give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5 ); |
|
102 | - add_action( 'give_before_single_form_summary', 'give_show_form_images', 10 ); |
|
103 | - add_action( 'give_before_single_form_summary', 'give_get_forms_sidebar', 20 ); |
|
104 | - add_action( 'give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30 ); |
|
100 | + if (give_is_setting_enabled(give_get_option('form_sidebar'))) { |
|
101 | + add_action('give_before_single_form_summary', 'give_left_sidebar_pre_wrap', 5); |
|
102 | + add_action('give_before_single_form_summary', 'give_show_form_images', 10); |
|
103 | + add_action('give_before_single_form_summary', 'give_get_forms_sidebar', 20); |
|
104 | + add_action('give_before_single_form_summary', 'give_left_sidebar_post_wrap', 30); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | } |
@@ -123,20 +123,20 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @return string $template |
125 | 125 | */ |
126 | - public static function template_loader( $template ) { |
|
127 | - $find = array( 'give.php' ); |
|
126 | + public static function template_loader($template) { |
|
127 | + $find = array('give.php'); |
|
128 | 128 | $file = ''; |
129 | 129 | |
130 | - if ( is_single() && get_post_type() == 'give_forms' ) { |
|
130 | + if (is_single() && get_post_type() == 'give_forms') { |
|
131 | 131 | $file = 'single-give-form.php'; |
132 | 132 | $find[] = $file; |
133 | - $find[] = apply_filters( 'give_template_path', 'give/' ) . $file; |
|
133 | + $find[] = apply_filters('give_template_path', 'give/').$file; |
|
134 | 134 | } |
135 | 135 | |
136 | - if ( $file ) { |
|
137 | - $template = locate_template( array_unique( $find ) ); |
|
138 | - if ( ! $template ) { |
|
139 | - $template = GIVE_PLUGIN_DIR . '/templates/' . $file; |
|
136 | + if ($file) { |
|
137 | + $template = locate_template(array_unique($find)); |
|
138 | + if ( ! $template) { |
|
139 | + $template = GIVE_PLUGIN_DIR.'/templates/'.$file; |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 |
@@ -1283,7 +1283,7 @@ |
||
1283 | 1283 | * |
1284 | 1284 | * @param $field |
1285 | 1285 | * |
1286 | - * @return string |
|
1286 | + * @return integer |
|
1287 | 1287 | */ |
1288 | 1288 | function _give_set_field_give_id_default_value( $field ) { |
1289 | 1289 | return 0; |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | type="radio" |
558 | 558 | style="' . esc_attr( $field['style'] ) . '" |
559 | 559 | ' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' ' |
560 | - . give_get_custom_attributes( $field ) . ' |
|
560 | + . give_get_custom_attributes( $field ) . ' |
|
561 | 561 | /> ' . esc_html( $value ) . '</label> |
562 | 562 | </li>'; |
563 | 563 | } |
@@ -725,9 +725,9 @@ discard block |
||
725 | 725 | $field['title'] = isset( $field['title'] ) ? $field['title'] : 'Documentation'; |
726 | 726 | |
727 | 727 | echo '<p class="give-docs-link"><a href="' . esc_url( $field['url'] ) |
728 | - . '" target="_blank">' |
|
729 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $field['title'] ) |
|
730 | - . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
728 | + . '" target="_blank">' |
|
729 | + . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $field['title'] ) |
|
730 | + . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
731 | 731 | } |
732 | 732 | |
733 | 733 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | +if ( ! defined('ABSPATH')) { |
|
12 | 12 | exit; // Exit if accessed directly |
13 | 13 | } |
14 | 14 | |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @return bool|string |
24 | 24 | */ |
25 | -function give_is_field_callback_exist( $field ) { |
|
26 | - return ( give_get_field_callback( $field ) ? true : false ); |
|
25 | +function give_is_field_callback_exist($field) { |
|
26 | + return (give_get_field_callback($field) ? true : false); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return bool|string |
37 | 37 | */ |
38 | -function give_get_field_callback( $field ) { |
|
38 | +function give_get_field_callback($field) { |
|
39 | 39 | $func_name_prefix = 'give'; |
40 | 40 | $func_name = ''; |
41 | 41 | |
42 | 42 | // Set callback function on basis of cmb2 field name. |
43 | - switch ( $field['type'] ) { |
|
43 | + switch ($field['type']) { |
|
44 | 44 | case 'radio_inline': |
45 | 45 | $func_name = "{$func_name_prefix}_radio"; |
46 | 46 | break; |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | default: |
87 | 87 | |
88 | 88 | if ( |
89 | - array_key_exists( 'callback', $field ) |
|
90 | - && ! empty( $field['callback'] ) |
|
89 | + array_key_exists('callback', $field) |
|
90 | + && ! empty($field['callback']) |
|
91 | 91 | ) { |
92 | 92 | $func_name = $field['callback']; |
93 | 93 | } else { |
@@ -100,15 +100,15 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @since 1.8 |
102 | 102 | */ |
103 | - $func_name = apply_filters( 'give_get_field_callback', $func_name, $field ); |
|
103 | + $func_name = apply_filters('give_get_field_callback', $func_name, $field); |
|
104 | 104 | |
105 | 105 | // Exit if not any function exist. |
106 | 106 | // Check if render callback exist or not. |
107 | - if ( empty( $func_name ) ) { |
|
107 | + if (empty($func_name)) { |
|
108 | 108 | return false; |
109 | - } elseif ( is_string( $func_name ) && ! function_exists( "$func_name" ) ) { |
|
109 | + } elseif (is_string($func_name) && ! function_exists("$func_name")) { |
|
110 | 110 | return false; |
111 | - } elseif ( is_array( $func_name ) && ! method_exists( $func_name[0], "$func_name[1]" ) ) { |
|
111 | + } elseif (is_array($func_name) && ! method_exists($func_name[0], "$func_name[1]")) { |
|
112 | 112 | return false; |
113 | 113 | } |
114 | 114 | |
@@ -124,35 +124,35 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return bool |
126 | 126 | */ |
127 | -function give_render_field( $field ) { |
|
127 | +function give_render_field($field) { |
|
128 | 128 | |
129 | 129 | // Check if render callback exist or not. |
130 | - if ( ! ( $func_name = give_get_field_callback( $field ) ) ) { |
|
130 | + if ( ! ($func_name = give_get_field_callback($field))) { |
|
131 | 131 | return false; |
132 | 132 | } |
133 | 133 | |
134 | 134 | // CMB2 compatibility: Push all classes to attributes's class key |
135 | - if ( empty( $field['class'] ) ) { |
|
135 | + if (empty($field['class'])) { |
|
136 | 136 | $field['class'] = ''; |
137 | 137 | } |
138 | 138 | |
139 | - if ( empty( $field['attributes']['class'] ) ) { |
|
139 | + if (empty($field['attributes']['class'])) { |
|
140 | 140 | $field['attributes']['class'] = ''; |
141 | 141 | } |
142 | 142 | |
143 | - $field['attributes']['class'] = trim( "give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}" ); |
|
144 | - unset( $field['class'] ); |
|
143 | + $field['attributes']['class'] = trim("give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}"); |
|
144 | + unset($field['class']); |
|
145 | 145 | |
146 | 146 | // CMB2 compatibility: Set wrapper class if any. |
147 | - if ( ! empty( $field['row_classes'] ) ) { |
|
147 | + if ( ! empty($field['row_classes'])) { |
|
148 | 148 | $field['wrapper_class'] = $field['row_classes']; |
149 | - unset( $field['row_classes'] ); |
|
149 | + unset($field['row_classes']); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | // Set field params on basis of cmb2 field name. |
153 | - switch ( $field['type'] ) { |
|
153 | + switch ($field['type']) { |
|
154 | 154 | case 'radio_inline': |
155 | - if ( empty( $field['wrapper_class'] ) ) { |
|
155 | + if (empty($field['wrapper_class'])) { |
|
156 | 156 | $field['wrapper_class'] = ''; |
157 | 157 | } |
158 | 158 | $field['wrapper_class'] .= ' give-inline-radio-fields'; |
@@ -165,15 +165,15 @@ discard block |
||
165 | 165 | case 'text-small' : |
166 | 166 | case 'text_small' : |
167 | 167 | // CMB2 compatibility: Set field type to text. |
168 | - $field['type'] = isset( $field['attributes']['type'] ) ? $field['attributes']['type'] : 'text'; |
|
168 | + $field['type'] = isset($field['attributes']['type']) ? $field['attributes']['type'] : 'text'; |
|
169 | 169 | |
170 | 170 | // CMB2 compatibility: Set data type to price. |
171 | 171 | if ( |
172 | - empty( $field['data_type'] ) |
|
173 | - && ! empty( $field['attributes']['class'] ) |
|
172 | + empty($field['data_type']) |
|
173 | + && ! empty($field['attributes']['class']) |
|
174 | 174 | && ( |
175 | - false !== strpos( $field['attributes']['class'], 'money' ) |
|
176 | - || false !== strpos( $field['attributes']['class'], 'amount' ) |
|
175 | + false !== strpos($field['attributes']['class'], 'money') |
|
176 | + || false !== strpos($field['attributes']['class'], 'amount') |
|
177 | 177 | ) |
178 | 178 | ) { |
179 | 179 | $field['data_type'] = 'decimal'; |
@@ -192,26 +192,26 @@ discard block |
||
192 | 192 | case 'give_default_radio_inline': |
193 | 193 | $field['type'] = 'radio'; |
194 | 194 | $field['options'] = array( |
195 | - 'default' => __( 'Default' ), |
|
195 | + 'default' => __('Default'), |
|
196 | 196 | ); |
197 | 197 | break; |
198 | 198 | |
199 | 199 | case 'donation_limit': |
200 | - $field['type'] = 'donation_limit'; |
|
200 | + $field['type'] = 'donation_limit'; |
|
201 | 201 | break; |
202 | 202 | } // End switch(). |
203 | 203 | |
204 | 204 | // CMB2 compatibility: Add support to define field description by desc & description param. |
205 | 205 | // We encourage you to use description param. |
206 | - $field['description'] = ( ! empty( $field['description'] ) |
|
206 | + $field['description'] = ( ! empty($field['description']) |
|
207 | 207 | ? $field['description'] |
208 | - : ( ! empty( $field['desc'] ) ? $field['desc'] : '' ) ); |
|
208 | + : ( ! empty($field['desc']) ? $field['desc'] : '')); |
|
209 | 209 | |
210 | 210 | // Call render function. |
211 | - if ( is_array( $func_name ) ) { |
|
212 | - $func_name[0]->{$func_name[1]}( $field ); |
|
211 | + if (is_array($func_name)) { |
|
212 | + $func_name[0]->{$func_name[1]}($field); |
|
213 | 213 | } else { |
214 | - $func_name( $field ); |
|
214 | + $func_name($field); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | return true; |
@@ -241,29 +241,29 @@ discard block |
||
241 | 241 | * } |
242 | 242 | * @return void |
243 | 243 | */ |
244 | -function give_text_input( $field ) { |
|
244 | +function give_text_input($field) { |
|
245 | 245 | global $thepostid, $post; |
246 | 246 | |
247 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
248 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
249 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
250 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
251 | - $field['type'] = isset( $field['type'] ) ? $field['type'] : 'text'; |
|
247 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
248 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
249 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
250 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
251 | + $field['type'] = isset($field['type']) ? $field['type'] : 'text'; |
|
252 | 252 | $field['before_field'] = ''; |
253 | 253 | $field['after_field'] = ''; |
254 | - $data_type = empty( $field['data_type'] ) ? '' : $field['data_type']; |
|
254 | + $data_type = empty($field['data_type']) ? '' : $field['data_type']; |
|
255 | 255 | |
256 | - switch ( $data_type ) { |
|
256 | + switch ($data_type) { |
|
257 | 257 | case 'price' : |
258 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_decimal( give_maybe_sanitize_amount( $field['value'] ), false, false ) : $field['value'] ); |
|
258 | + $field['value'] = ( ! empty($field['value']) ? give_format_decimal(give_maybe_sanitize_amount($field['value']), false, false) : $field['value']); |
|
259 | 259 | |
260 | - $field['before_field'] = ! empty( $field['before_field'] ) ? $field['before_field'] : ( give_get_option( 'currency_position', 'before' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '' ); |
|
261 | - $field['after_field'] = ! empty( $field['after_field'] ) ? $field['after_field'] : ( give_get_option( 'currency_position', 'before' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '' ); |
|
260 | + $field['before_field'] = ! empty($field['before_field']) ? $field['before_field'] : (give_get_option('currency_position', 'before') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : ''); |
|
261 | + $field['after_field'] = ! empty($field['after_field']) ? $field['after_field'] : (give_get_option('currency_position', 'before') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : ''); |
|
262 | 262 | break; |
263 | 263 | |
264 | 264 | case 'decimal' : |
265 | 265 | $field['attributes']['class'] .= ' give_input_decimal'; |
266 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_decimal( give_maybe_sanitize_amount( $field['value'] ), false, false ) : $field['value'] ); |
|
266 | + $field['value'] = ( ! empty($field['value']) ? give_format_decimal(give_maybe_sanitize_amount($field['value']), false, false) : $field['value']); |
|
267 | 267 | break; |
268 | 268 | |
269 | 269 | default : |
@@ -271,20 +271,20 @@ discard block |
||
271 | 271 | } |
272 | 272 | |
273 | 273 | ?> |
274 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
275 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
274 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
275 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
276 | 276 | <?php echo $field['before_field']; ?> |
277 | 277 | <input |
278 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
279 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
280 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
281 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
282 | - value="<?php echo esc_attr( $field['value'] ); ?>" |
|
283 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
278 | + type="<?php echo esc_attr($field['type']); ?>" |
|
279 | + style="<?php echo esc_attr($field['style']); ?>" |
|
280 | + name="<?php echo give_get_field_name($field); ?>" |
|
281 | + id="<?php echo esc_attr($field['id']); ?>" |
|
282 | + value="<?php echo esc_attr($field['value']); ?>" |
|
283 | + <?php echo give_get_custom_attributes($field); ?> |
|
284 | 284 | /> |
285 | 285 | <?php echo $field['after_field']; ?> |
286 | 286 | <?php |
287 | - echo give_get_field_description( $field ); |
|
287 | + echo give_get_field_description($field); |
|
288 | 288 | echo '</p>'; |
289 | 289 | } |
290 | 290 | |
@@ -314,59 +314,57 @@ discard block |
||
314 | 314 | * |
315 | 315 | * @return void |
316 | 316 | */ |
317 | -function give_chosen_input( $field ) { |
|
317 | +function give_chosen_input($field) { |
|
318 | 318 | global $thepostid, $post; |
319 | 319 | |
320 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
321 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
322 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
320 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
321 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
322 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
323 | 323 | $field['before_field'] = ''; |
324 | 324 | $field['after_field'] = ''; |
325 | - $placeholder = isset( $field['placeholder'] ) ? 'data-placeholder="' . $field['placeholder'] . '"' : ''; |
|
326 | - $data_type = ! empty( $field['data_type'] ) ? $field['data_type'] : ''; |
|
325 | + $placeholder = isset($field['placeholder']) ? 'data-placeholder="'.$field['placeholder'].'"' : ''; |
|
326 | + $data_type = ! empty($field['data_type']) ? $field['data_type'] : ''; |
|
327 | 327 | $type = ''; |
328 | 328 | $allow_new_values = ''; |
329 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
330 | - $field['value'] = is_array( $field['value'] ) ? |
|
331 | - array_fill_keys( array_filter( $field['value'] ), 'selected' ) : |
|
332 | - $field['value']; |
|
333 | - $title_prefixes_value = ( is_array( $field['value'] ) && count( $field['value'] ) > 0 ) ? |
|
334 | - array_merge( $field['options'], $field['value'] ) : |
|
335 | - $field['options']; |
|
329 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
330 | + $field['value'] = is_array($field['value']) ? |
|
331 | + array_fill_keys(array_filter($field['value']), 'selected') : $field['value']; |
|
332 | + $title_prefixes_value = (is_array($field['value']) && count($field['value']) > 0) ? |
|
333 | + array_merge($field['options'], $field['value']) : $field['options']; |
|
336 | 334 | |
337 | 335 | // Set attributes based on multiselect datatype. |
338 | - if ( 'multiselect' === $data_type ) { |
|
336 | + if ('multiselect' === $data_type) { |
|
339 | 337 | $type = 'multiple'; |
340 | 338 | $allow_new_values = 'data-allows-new-values="true"'; |
341 | 339 | } |
342 | 340 | |
343 | 341 | ?> |
344 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
345 | - <label for="<?php echo esc_attr( give_get_field_name( $field ) ); ?>"> |
|
346 | - <?php echo wp_kses_post( $field['name'] ); ?> |
|
342 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
343 | + <label for="<?php echo esc_attr(give_get_field_name($field)); ?>"> |
|
344 | + <?php echo wp_kses_post($field['name']); ?> |
|
347 | 345 | </label> |
348 | - <?php echo esc_attr( $field['before_field'] ); ?> |
|
346 | + <?php echo esc_attr($field['before_field']); ?> |
|
349 | 347 | <select |
350 | 348 | class="give-select-chosen give-chosen-settings" |
351 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
352 | - name="<?php echo esc_attr( give_get_field_name( $field ) ); ?>[]" |
|
353 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
349 | + style="<?php echo esc_attr($field['style']); ?>" |
|
350 | + name="<?php echo esc_attr(give_get_field_name($field)); ?>[]" |
|
351 | + id="<?php echo esc_attr($field['id']); ?>" |
|
354 | 352 | <?php echo "{$type} {$allow_new_values} {$placeholder}"; ?> |
355 | 353 | > |
356 | 354 | <?php |
357 | - if ( is_array( $title_prefixes_value ) && count( $title_prefixes_value ) > 0 ) { |
|
358 | - foreach ( $title_prefixes_value as $key => $value ) { |
|
355 | + if (is_array($title_prefixes_value) && count($title_prefixes_value) > 0) { |
|
356 | + foreach ($title_prefixes_value as $key => $value) { |
|
359 | 357 | echo sprintf( |
360 | 358 | '<option %1$s value="%2$s">%2$s</option>', |
361 | - ( 'selected' === $value ) ? 'selected="selected"' : '', |
|
362 | - esc_attr( $key ) |
|
359 | + ('selected' === $value) ? 'selected="selected"' : '', |
|
360 | + esc_attr($key) |
|
363 | 361 | ); |
364 | 362 | } |
365 | 363 | } |
366 | 364 | ?> |
367 | 365 | </select> |
368 | - <?php echo esc_attr( $field['after_field'] ); ?> |
|
369 | - <?php echo give_get_field_description( $field ); ?> |
|
366 | + <?php echo esc_attr($field['after_field']); ?> |
|
367 | + <?php echo give_get_field_description($field); ?> |
|
370 | 368 | </p> |
371 | 369 | <?php |
372 | 370 | } |
@@ -397,107 +395,107 @@ discard block |
||
397 | 395 | * |
398 | 396 | * @return void |
399 | 397 | */ |
400 | -function give_donation_limit( $field ) { |
|
398 | +function give_donation_limit($field) { |
|
401 | 399 | global $thepostid, $post; |
402 | 400 | |
403 | 401 | // Get Give donation form ID. |
404 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
402 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
405 | 403 | |
406 | 404 | // Default arguments. |
407 | 405 | $default_options = array( |
408 | 406 | 'style' => '', |
409 | 407 | 'wrapper_class' => '', |
410 | - 'value' => give_get_field_value( $field, $thepostid ), |
|
408 | + 'value' => give_get_field_value($field, $thepostid), |
|
411 | 409 | 'data_type' => 'decimal', |
412 | 410 | 'before_field' => '', |
413 | 411 | 'after_field' => '', |
414 | 412 | ); |
415 | 413 | |
416 | 414 | // Field options. |
417 | - $field['options'] = ! empty( $field['options'] ) ? $field['options'] : array(); |
|
415 | + $field['options'] = ! empty($field['options']) ? $field['options'] : array(); |
|
418 | 416 | |
419 | 417 | // Default field option arguments. |
420 | - $field['options'] = wp_parse_args( $field['options'], array( |
|
418 | + $field['options'] = wp_parse_args($field['options'], array( |
|
421 | 419 | 'display_label' => '', |
422 | - 'minimum' => give_format_decimal( '1.00', false, false ), |
|
423 | - 'maximum' => give_format_decimal( '999999.99', false, false ), |
|
420 | + 'minimum' => give_format_decimal('1.00', false, false), |
|
421 | + 'maximum' => give_format_decimal('999999.99', false, false), |
|
424 | 422 | ) |
425 | 423 | ); |
426 | 424 | |
427 | 425 | // Set default field options. |
428 | - $field_options = wp_parse_args( $field, $default_options ); |
|
426 | + $field_options = wp_parse_args($field, $default_options); |
|
429 | 427 | |
430 | 428 | // Get default minimum value, if empty. |
431 | - $field_options['value']['minimum'] = ! empty( $field_options['value']['minimum'] ) |
|
429 | + $field_options['value']['minimum'] = ! empty($field_options['value']['minimum']) |
|
432 | 430 | ? $field_options['value']['minimum'] |
433 | 431 | : $field_options['options']['minimum']; |
434 | 432 | |
435 | 433 | // Get default maximum value, if empty. |
436 | - $field_options['value']['maximum'] = ! empty( $field_options['value']['maximum'] ) |
|
434 | + $field_options['value']['maximum'] = ! empty($field_options['value']['maximum']) |
|
437 | 435 | ? $field_options['value']['maximum'] |
438 | 436 | : $field_options['options']['maximum']; |
439 | 437 | ?> |
440 | - <p class="give-field-wrap <?php echo esc_attr( $field_options['id'] ); ?>_field <?php echo esc_attr( $field_options['wrapper_class'] ); ?>"> |
|
441 | - <label for="<?php echo give_get_field_name( $field_options ); ?>"><?php echo wp_kses_post( $field_options['name'] ); ?></label> |
|
438 | + <p class="give-field-wrap <?php echo esc_attr($field_options['id']); ?>_field <?php echo esc_attr($field_options['wrapper_class']); ?>"> |
|
439 | + <label for="<?php echo give_get_field_name($field_options); ?>"><?php echo wp_kses_post($field_options['name']); ?></label> |
|
442 | 440 | <span class="give_donation_limit_display"> |
443 | 441 | <?php |
444 | - foreach ( $field_options['value'] as $amount_range => $amount_value ) { |
|
442 | + foreach ($field_options['value'] as $amount_range => $amount_value) { |
|
445 | 443 | |
446 | - switch ( $field_options['data_type'] ) { |
|
444 | + switch ($field_options['data_type']) { |
|
447 | 445 | case 'price' : |
448 | - $currency_position = give_get_option( 'currency_position', 'before' ); |
|
449 | - $price_field_labels = 'minimum' === $amount_range ? __( 'Minimum amount', 'give' ) : __( 'Maximum amount', 'give' ); |
|
446 | + $currency_position = give_get_option('currency_position', 'before'); |
|
447 | + $price_field_labels = 'minimum' === $amount_range ? __('Minimum amount', 'give') : __('Maximum amount', 'give'); |
|
450 | 448 | |
451 | 449 | $tooltip_html = array( |
452 | - 'before' => Give()->tooltips->render_span( array( |
|
450 | + 'before' => Give()->tooltips->render_span(array( |
|
453 | 451 | 'label' => $price_field_labels, |
454 | - 'tag_content' => sprintf( '<span class="give-money-symbol give-money-symbol-before">%s</span>', give_currency_symbol() ), |
|
455 | - ) ), |
|
456 | - 'after' => Give()->tooltips->render_span( array( |
|
452 | + 'tag_content' => sprintf('<span class="give-money-symbol give-money-symbol-before">%s</span>', give_currency_symbol()), |
|
453 | + )), |
|
454 | + 'after' => Give()->tooltips->render_span(array( |
|
457 | 455 | 'label' => $price_field_labels, |
458 | - 'tag_content' => sprintf( '<span class="give-money-symbol give-money-symbol-after">%s</span>', give_currency_symbol() ), |
|
459 | - ) ), |
|
456 | + 'tag_content' => sprintf('<span class="give-money-symbol give-money-symbol-after">%s</span>', give_currency_symbol()), |
|
457 | + )), |
|
460 | 458 | ); |
461 | 459 | |
462 | - $before_html = ! empty( $field_options['before_field'] ) |
|
460 | + $before_html = ! empty($field_options['before_field']) |
|
463 | 461 | ? $field_options['before_field'] |
464 | - : ( 'before' === $currency_position ? $tooltip_html['before'] : '' ); |
|
462 | + : ('before' === $currency_position ? $tooltip_html['before'] : ''); |
|
465 | 463 | |
466 | - $after_html = ! empty( $field_options['after_field'] ) |
|
464 | + $after_html = ! empty($field_options['after_field']) |
|
467 | 465 | ? $field_options['after_field'] |
468 | - : ( 'after' === $currency_position ? $tooltip_html['after'] : '' ); |
|
466 | + : ('after' === $currency_position ? $tooltip_html['after'] : ''); |
|
469 | 467 | |
470 | - $field_options['attributes']['class'] .= ' give-text_small'; |
|
471 | - $field_options['value'][ $amount_range ] = $amount_value; |
|
468 | + $field_options['attributes']['class'] .= ' give-text_small'; |
|
469 | + $field_options['value'][$amount_range] = $amount_value; |
|
472 | 470 | break; |
473 | 471 | |
474 | 472 | case 'decimal' : |
475 | - $field_options['attributes']['class'] .= ' give_input_decimal give-text_small'; |
|
476 | - $field_options['value'][ $amount_range ] = $amount_value; |
|
473 | + $field_options['attributes']['class'] .= ' give_input_decimal give-text_small'; |
|
474 | + $field_options['value'][$amount_range] = $amount_value; |
|
477 | 475 | break; |
478 | 476 | } |
479 | 477 | |
480 | 478 | echo '<span class=give-minmax-wrap>'; |
481 | - printf( '<label for="%1$s_give_donation_limit_%2$s">%3$s</label>', esc_attr( $field_options['id'] ), esc_attr( $amount_range ), esc_html( $price_field_labels ) ); |
|
479 | + printf('<label for="%1$s_give_donation_limit_%2$s">%3$s</label>', esc_attr($field_options['id']), esc_attr($amount_range), esc_html($price_field_labels)); |
|
482 | 480 | |
483 | - echo isset( $before_html ) ? $before_html : ''; |
|
481 | + echo isset($before_html) ? $before_html : ''; |
|
484 | 482 | ?> |
485 | 483 | <input |
486 | - name="<?php echo give_get_field_name( $field_options ); ?>[<?php echo esc_attr( $amount_range ); ?>]" |
|
484 | + name="<?php echo give_get_field_name($field_options); ?>[<?php echo esc_attr($amount_range); ?>]" |
|
487 | 485 | type="text" |
488 | 486 | id="<?php echo $field_options['id']; ?>_give_donation_limit_<?php echo $amount_range; ?>" |
489 | - data-range_type="<?php echo esc_attr( $amount_range ); ?>" |
|
490 | - value="<?php echo give_format_decimal( esc_attr( $field_options['value'][ $amount_range ] ) ); ?>" |
|
491 | - placeholder="<?php echo give_format_decimal( $field_options['options'][ $amount_range ] ); ?>" |
|
492 | - <?php echo give_get_custom_attributes( $field_options ); ?> |
|
487 | + data-range_type="<?php echo esc_attr($amount_range); ?>" |
|
488 | + value="<?php echo give_format_decimal(esc_attr($field_options['value'][$amount_range])); ?>" |
|
489 | + placeholder="<?php echo give_format_decimal($field_options['options'][$amount_range]); ?>" |
|
490 | + <?php echo give_get_custom_attributes($field_options); ?> |
|
493 | 491 | /> |
494 | 492 | <?php |
495 | - echo isset( $after_html ) ? $after_html : ''; |
|
493 | + echo isset($after_html) ? $after_html : ''; |
|
496 | 494 | echo '</span>'; |
497 | 495 | } |
498 | 496 | ?> |
499 | 497 | </span> |
500 | - <?php echo give_get_field_description( $field_options ); ?> |
|
498 | + <?php echo give_get_field_description($field_options); ?> |
|
501 | 499 | </p> |
502 | 500 | <?php |
503 | 501 | } |
@@ -520,29 +518,29 @@ discard block |
||
520 | 518 | * } |
521 | 519 | * @return void |
522 | 520 | */ |
523 | -function give_hidden_input( $field ) { |
|
521 | +function give_hidden_input($field) { |
|
524 | 522 | global $thepostid, $post; |
525 | 523 | |
526 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
527 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
524 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
525 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
528 | 526 | |
529 | 527 | // Custom attribute handling |
530 | 528 | $custom_attributes = array(); |
531 | 529 | |
532 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
530 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
533 | 531 | |
534 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
535 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
532 | + foreach ($field['attributes'] as $attribute => $value) { |
|
533 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
536 | 534 | } |
537 | 535 | } |
538 | 536 | ?> |
539 | 537 | |
540 | 538 | <input |
541 | 539 | type="hidden" |
542 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
543 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
544 | - value="<?php echo esc_attr( $field['value'] ); ?>" |
|
545 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
540 | + name="<?php echo give_get_field_name($field); ?>" |
|
541 | + id="<?php echo esc_attr($field['id']); ?>" |
|
542 | + value="<?php echo esc_attr($field['value']); ?>" |
|
543 | + <?php echo give_get_custom_attributes($field); ?> |
|
546 | 544 | /> |
547 | 545 | <?php |
548 | 546 | } |
@@ -568,28 +566,28 @@ discard block |
||
568 | 566 | * } |
569 | 567 | * @return void |
570 | 568 | */ |
571 | -function give_textarea_input( $field ) { |
|
569 | +function give_textarea_input($field) { |
|
572 | 570 | global $thepostid, $post; |
573 | 571 | |
574 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
575 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
576 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
577 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
572 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
573 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
574 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
575 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
578 | 576 | $default_attributes = array( |
579 | 577 | 'cols' => 20, |
580 | 578 | 'rows' => 10 |
581 | 579 | ); |
582 | 580 | ?> |
583 | - <div class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
584 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
581 | + <div class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
582 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
585 | 583 | <textarea |
586 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
587 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
588 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
589 | - <?php echo give_get_attribute_str( $field, $default_attributes ); ?> |
|
590 | - ><?php echo esc_textarea( $field['value'] ); ?></textarea> |
|
584 | + style="<?php echo esc_attr($field['style']); ?>" |
|
585 | + name="<?php echo give_get_field_name($field); ?>" |
|
586 | + id="<?php echo esc_attr($field['id']); ?>" |
|
587 | + <?php echo give_get_attribute_str($field, $default_attributes); ?> |
|
588 | + ><?php echo esc_textarea($field['value']); ?></textarea> |
|
591 | 589 | <?php |
592 | - echo give_get_field_description( $field ); |
|
590 | + echo give_get_field_description($field); |
|
593 | 591 | echo '</div>'; |
594 | 592 | } |
595 | 593 | |
@@ -613,29 +611,29 @@ discard block |
||
613 | 611 | * } |
614 | 612 | * @return void |
615 | 613 | */ |
616 | -function give_wysiwyg( $field ) { |
|
614 | +function give_wysiwyg($field) { |
|
617 | 615 | global $thepostid, $post; |
618 | 616 | |
619 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
620 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
621 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
622 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
617 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
618 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
619 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
620 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
623 | 621 | |
624 | - $field['unique_field_id'] = give_get_field_name( $field ); |
|
622 | + $field['unique_field_id'] = give_get_field_name($field); |
|
625 | 623 | $editor_attributes = array( |
626 | - 'textarea_name' => isset( $field['repeatable_field_id'] ) ? $field['repeatable_field_id'] : $field['id'], |
|
624 | + 'textarea_name' => isset($field['repeatable_field_id']) ? $field['repeatable_field_id'] : $field['id'], |
|
627 | 625 | 'textarea_rows' => '10', |
628 | - 'editor_css' => esc_attr( $field['style'] ), |
|
626 | + 'editor_css' => esc_attr($field['style']), |
|
629 | 627 | 'editor_class' => $field['attributes']['class'], |
630 | 628 | ); |
631 | - $data_wp_editor = ' data-wp-editor="' . base64_encode( json_encode( array( |
|
629 | + $data_wp_editor = ' data-wp-editor="'.base64_encode(json_encode(array( |
|
632 | 630 | $field['value'], |
633 | 631 | $field['unique_field_id'], |
634 | 632 | $editor_attributes, |
635 | - ) ) ) . '"'; |
|
636 | - $data_wp_editor = isset( $field['repeatable_field_id'] ) ? $data_wp_editor : ''; |
|
633 | + ))).'"'; |
|
634 | + $data_wp_editor = isset($field['repeatable_field_id']) ? $data_wp_editor : ''; |
|
637 | 635 | |
638 | - echo '<div class="give-field-wrap ' . $field['unique_field_id'] . '_field ' . esc_attr( $field['wrapper_class'] ) . '"' . $data_wp_editor . '><label for="' . $field['unique_field_id'] . '">' . wp_kses_post( $field['name'] ) . '</label>'; |
|
636 | + echo '<div class="give-field-wrap '.$field['unique_field_id'].'_field '.esc_attr($field['wrapper_class']).'"'.$data_wp_editor.'><label for="'.$field['unique_field_id'].'">'.wp_kses_post($field['name']).'</label>'; |
|
639 | 637 | |
640 | 638 | wp_editor( |
641 | 639 | $field['value'], |
@@ -643,7 +641,7 @@ discard block |
||
643 | 641 | $editor_attributes |
644 | 642 | ); |
645 | 643 | |
646 | - echo give_get_field_description( $field ); |
|
644 | + echo give_get_field_description($field); |
|
647 | 645 | echo '</div>'; |
648 | 646 | } |
649 | 647 | |
@@ -668,29 +666,29 @@ discard block |
||
668 | 666 | * } |
669 | 667 | * @return void |
670 | 668 | */ |
671 | -function give_checkbox( $field ) { |
|
669 | +function give_checkbox($field) { |
|
672 | 670 | global $thepostid, $post; |
673 | 671 | |
674 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
675 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
676 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
677 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
678 | - $field['cbvalue'] = isset( $field['cbvalue'] ) ? $field['cbvalue'] : 'on'; |
|
679 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
672 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
673 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
674 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
675 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
676 | + $field['cbvalue'] = isset($field['cbvalue']) ? $field['cbvalue'] : 'on'; |
|
677 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
680 | 678 | ?> |
681 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
682 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
679 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
680 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
683 | 681 | <input |
684 | 682 | type="checkbox" |
685 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
686 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
687 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
688 | - value="<?php echo esc_attr( $field['cbvalue'] ); ?>" |
|
689 | - <?php echo checked( $field['value'], $field['cbvalue'], false ); ?> |
|
690 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
683 | + style="<?php echo esc_attr($field['style']); ?>" |
|
684 | + name="<?php echo give_get_field_name($field); ?>" |
|
685 | + id="<?php echo esc_attr($field['id']); ?>" |
|
686 | + value="<?php echo esc_attr($field['cbvalue']); ?>" |
|
687 | + <?php echo checked($field['value'], $field['cbvalue'], false); ?> |
|
688 | + <?php echo give_get_custom_attributes($field); ?> |
|
691 | 689 | /> |
692 | 690 | <?php |
693 | - echo give_get_field_description( $field ); |
|
691 | + echo give_get_field_description($field); |
|
694 | 692 | echo '</p>'; |
695 | 693 | } |
696 | 694 | |
@@ -716,29 +714,29 @@ discard block |
||
716 | 714 | * } |
717 | 715 | * @return void |
718 | 716 | */ |
719 | -function give_select( $field ) { |
|
717 | +function give_select($field) { |
|
720 | 718 | global $thepostid, $post; |
721 | 719 | |
722 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
723 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
724 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
725 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
726 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
720 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
721 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
722 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
723 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
724 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
727 | 725 | ?> |
728 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
729 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
726 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
727 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
730 | 728 | <select |
731 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
732 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
733 | - style="<?php echo esc_attr( $field['style'] ) ?>" |
|
734 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
729 | + id="<?php echo esc_attr($field['id']); ?>" |
|
730 | + name="<?php echo give_get_field_name($field); ?>" |
|
731 | + style="<?php echo esc_attr($field['style']) ?>" |
|
732 | + <?php echo give_get_custom_attributes($field); ?> |
|
735 | 733 | > |
736 | 734 | <?php |
737 | - foreach ( $field['options'] as $key => $value ) { |
|
738 | - echo '<option value="' . esc_attr( $key ) . '" ' . selected( esc_attr( $field['value'] ), esc_attr( $key ), false ) . '>' . esc_html( $value ) . '</option>'; |
|
735 | + foreach ($field['options'] as $key => $value) { |
|
736 | + echo '<option value="'.esc_attr($key).'" '.selected(esc_attr($field['value']), esc_attr($key), false).'>'.esc_html($value).'</option>'; |
|
739 | 737 | } |
740 | 738 | echo '</select>'; |
741 | - echo give_get_field_description( $field ); |
|
739 | + echo give_get_field_description($field); |
|
742 | 740 | echo '</p>'; |
743 | 741 | } |
744 | 742 | |
@@ -765,32 +763,32 @@ discard block |
||
765 | 763 | * } |
766 | 764 | * @return void |
767 | 765 | */ |
768 | -function give_radio( $field ) { |
|
766 | +function give_radio($field) { |
|
769 | 767 | global $thepostid, $post; |
770 | 768 | |
771 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
772 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
773 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
774 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
775 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
769 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
770 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
771 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
772 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
773 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
776 | 774 | |
777 | - echo '<fieldset class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><span class="give-field-label">' . wp_kses_post( $field['name'] ) . '</span><legend class="screen-reader-text">' . wp_kses_post( $field['name'] ) . '</legend><ul class="give-radios">'; |
|
775 | + echo '<fieldset class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><span class="give-field-label">'.wp_kses_post($field['name']).'</span><legend class="screen-reader-text">'.wp_kses_post($field['name']).'</legend><ul class="give-radios">'; |
|
778 | 776 | |
779 | - foreach ( $field['options'] as $key => $value ) { |
|
777 | + foreach ($field['options'] as $key => $value) { |
|
780 | 778 | |
781 | 779 | echo '<li><label><input |
782 | - name="' . give_get_field_name( $field ) . '" |
|
783 | - value="' . esc_attr( $key ) . '" |
|
780 | + name="' . give_get_field_name($field).'" |
|
781 | + value="' . esc_attr($key).'" |
|
784 | 782 | type="radio" |
785 | - style="' . esc_attr( $field['style'] ) . '" |
|
786 | - ' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' ' |
|
787 | - . give_get_custom_attributes( $field ) . ' |
|
788 | - /> ' . esc_html( $value ) . '</label> |
|
783 | + style="' . esc_attr($field['style']).'" |
|
784 | + ' . checked(esc_attr($field['value']), esc_attr($key), false).' ' |
|
785 | + . give_get_custom_attributes($field).' |
|
786 | + /> ' . esc_html($value).'</label> |
|
789 | 787 | </li>'; |
790 | 788 | } |
791 | 789 | echo '</ul>'; |
792 | 790 | |
793 | - echo give_get_field_description( $field ); |
|
791 | + echo give_get_field_description($field); |
|
794 | 792 | echo '</fieldset>'; |
795 | 793 | } |
796 | 794 | |
@@ -814,27 +812,27 @@ discard block |
||
814 | 812 | * } |
815 | 813 | * @return void |
816 | 814 | */ |
817 | -function give_colorpicker( $field ) { |
|
815 | +function give_colorpicker($field) { |
|
818 | 816 | global $thepostid, $post; |
819 | 817 | |
820 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
821 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
822 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
823 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
824 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
818 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
819 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
820 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
821 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
822 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
825 | 823 | $field['type'] = 'text'; |
826 | 824 | ?> |
827 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
828 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
825 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
826 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
829 | 827 | <input |
830 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
831 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
832 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
833 | - id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr( $field['value'] ); ?>" |
|
834 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
828 | + type="<?php echo esc_attr($field['type']); ?>" |
|
829 | + style="<?php echo esc_attr($field['style']); ?>" |
|
830 | + name="<?php echo give_get_field_name($field); ?>" |
|
831 | + id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr($field['value']); ?>" |
|
832 | + <?php echo give_get_custom_attributes($field); ?> |
|
835 | 833 | /> |
836 | 834 | <?php |
837 | - echo give_get_field_description( $field ); |
|
835 | + echo give_get_field_description($field); |
|
838 | 836 | echo '</p>'; |
839 | 837 | } |
840 | 838 | |
@@ -845,8 +843,8 @@ discard block |
||
845 | 843 | * |
846 | 844 | * @param array $field |
847 | 845 | */ |
848 | -function give_file( $field ) { |
|
849 | - give_media( $field ); |
|
846 | +function give_file($field) { |
|
847 | + give_media($field); |
|
850 | 848 | } |
851 | 849 | |
852 | 850 | |
@@ -857,37 +855,37 @@ discard block |
||
857 | 855 | * |
858 | 856 | * @param array $field |
859 | 857 | */ |
860 | -function give_media( $field ) { |
|
858 | +function give_media($field) { |
|
861 | 859 | global $thepostid, $post; |
862 | 860 | |
863 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
864 | - $button_label = sprintf( __( 'Add or Upload %s', 'give' ), ( 'file' === $field['type'] ? __( 'File', 'give' ) : __( 'Image', 'give' ) ) ); |
|
861 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
862 | + $button_label = sprintf(__('Add or Upload %s', 'give'), ('file' === $field['type'] ? __('File', 'give') : __('Image', 'give'))); |
|
865 | 863 | |
866 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
867 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
868 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
869 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
864 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
865 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
866 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
867 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
870 | 868 | $field['attributes']['class'] = "{$field['attributes']['class']} give-text-medium"; |
871 | 869 | |
872 | 870 | // Allow developer to save attachment ID or attachment url as metadata. |
873 | - $field['fvalue'] = isset( $field['fvalue'] ) ? $field['fvalue'] : 'url'; |
|
871 | + $field['fvalue'] = isset($field['fvalue']) ? $field['fvalue'] : 'url'; |
|
874 | 872 | |
875 | - $allow_media_preview_tags = array( 'jpg', 'jpeg', 'png', 'gif', 'ico' ); |
|
876 | - $preview_image_src = $field['value'] ? ( 'id' === $field['fvalue'] ? wp_get_attachment_url( $field['value'] ) : $field['value'] ) : '#'; |
|
877 | - $preview_image_extension = $preview_image_src ? pathinfo( $preview_image_src, PATHINFO_EXTENSION ) : ''; |
|
878 | - $is_show_preview = in_array( $preview_image_extension, $allow_media_preview_tags ); |
|
873 | + $allow_media_preview_tags = array('jpg', 'jpeg', 'png', 'gif', 'ico'); |
|
874 | + $preview_image_src = $field['value'] ? ('id' === $field['fvalue'] ? wp_get_attachment_url($field['value']) : $field['value']) : '#'; |
|
875 | + $preview_image_extension = $preview_image_src ? pathinfo($preview_image_src, PATHINFO_EXTENSION) : ''; |
|
876 | + $is_show_preview = in_array($preview_image_extension, $allow_media_preview_tags); |
|
879 | 877 | ?> |
880 | - <fieldset class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
881 | - <label for="<?php echo give_get_field_name( $field ) ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
878 | + <fieldset class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
879 | + <label for="<?php echo give_get_field_name($field) ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
882 | 880 | <input |
883 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
884 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
881 | + name="<?php echo give_get_field_name($field); ?>" |
|
882 | + id="<?php echo esc_attr($field['id']); ?>" |
|
885 | 883 | type="text" |
886 | 884 | value="<?php echo $field['value']; ?>" |
887 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
888 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
885 | + style="<?php echo esc_attr($field['style']); ?>" |
|
886 | + <?php echo give_get_custom_attributes($field); ?> |
|
889 | 887 | /> <input class="give-upload-button button" type="button" value="<?php echo $button_label; ?>" data-fvalue="<?php echo $field['fvalue']; ?>" data-field-type="<?php echo $field['type']; ?>"> |
890 | - <?php echo give_get_field_description( $field ); ?> |
|
888 | + <?php echo give_get_field_description($field); ?> |
|
891 | 889 | <div class="give-image-thumb<?php echo ! $field['value'] || ! $is_show_preview ? ' give-hidden' : ''; ?>"> |
892 | 890 | <span class="give-delete-image-thumb dashicons dashicons-no-alt"></span> |
893 | 891 | <img src="<?php echo $preview_image_src; ?>" alt=""> |
@@ -905,27 +903,27 @@ discard block |
||
905 | 903 | * |
906 | 904 | * @return void |
907 | 905 | */ |
908 | -function give_default_gateway( $field ) { |
|
906 | +function give_default_gateway($field) { |
|
909 | 907 | global $thepostid, $post; |
910 | 908 | |
911 | 909 | // get all active payment gateways. |
912 | - $gateways = give_get_enabled_payment_gateways( $thepostid ); |
|
910 | + $gateways = give_get_enabled_payment_gateways($thepostid); |
|
913 | 911 | $field['options'] = array(); |
914 | 912 | |
915 | 913 | // Set field option value. |
916 | - if ( ! empty( $gateways ) ) { |
|
917 | - foreach ( $gateways as $key => $option ) { |
|
918 | - $field['options'][ $key ] = $option['admin_label']; |
|
914 | + if ( ! empty($gateways)) { |
|
915 | + foreach ($gateways as $key => $option) { |
|
916 | + $field['options'][$key] = $option['admin_label']; |
|
919 | 917 | } |
920 | 918 | } |
921 | 919 | |
922 | 920 | // Add a field to the Give Form admin single post view of this field |
923 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
924 | - $field['options'] = array_merge( array( 'global' => esc_html__( 'Global Default', 'give' ) ), $field['options'] ); |
|
921 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
922 | + $field['options'] = array_merge(array('global' => esc_html__('Global Default', 'give')), $field['options']); |
|
925 | 923 | } |
926 | 924 | |
927 | 925 | // Render select field. |
928 | - give_select( $field ); |
|
926 | + give_select($field); |
|
929 | 927 | } |
930 | 928 | |
931 | 929 | /** |
@@ -947,13 +945,13 @@ discard block |
||
947 | 945 | * @return void |
948 | 946 | */ |
949 | 947 | |
950 | -function give_docs_link( $field ) { |
|
951 | - $field['url'] = isset( $field['url'] ) ? $field['url'] : 'https://givewp.com/documentation'; |
|
952 | - $field['title'] = isset( $field['title'] ) ? $field['title'] : 'Documentation'; |
|
948 | +function give_docs_link($field) { |
|
949 | + $field['url'] = isset($field['url']) ? $field['url'] : 'https://givewp.com/documentation'; |
|
950 | + $field['title'] = isset($field['title']) ? $field['title'] : 'Documentation'; |
|
953 | 951 | |
954 | - echo '<p class="give-docs-link"><a href="' . esc_url( $field['url'] ) |
|
952 | + echo '<p class="give-docs-link"><a href="'.esc_url($field['url']) |
|
955 | 953 | . '" target="_blank">' |
956 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $field['title'] ) |
|
954 | + . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $field['title']) |
|
957 | 955 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
958 | 956 | } |
959 | 957 | |
@@ -965,15 +963,15 @@ discard block |
||
965 | 963 | * |
966 | 964 | * @param $field |
967 | 965 | */ |
968 | -function give_email_preview_buttons( $field ) { |
|
966 | +function give_email_preview_buttons($field) { |
|
969 | 967 | /* @var WP_Post $post */ |
970 | 968 | global $post; |
971 | 969 | |
972 | - $field_id = str_replace( array( '_give_', '_preview_buttons' ), '', $field['id'] ); |
|
970 | + $field_id = str_replace(array('_give_', '_preview_buttons'), '', $field['id']); |
|
973 | 971 | |
974 | 972 | ob_start(); |
975 | 973 | |
976 | - echo '<p class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field"><label for="' . give_get_field_name( $field ) . '">' . wp_kses_post( $field['name'] ) . '</label>'; |
|
974 | + echo '<p class="give-field-wrap '.esc_attr($field['id']).'_field"><label for="'.give_get_field_name($field).'">'.wp_kses_post($field['name']).'</label>'; |
|
977 | 975 | |
978 | 976 | echo sprintf( |
979 | 977 | '<a href="%1$s" class="button-secondary" target="_blank">%2$s</a>', |
@@ -1001,12 +999,12 @@ discard block |
||
1001 | 999 | 'form_id' => $post->ID, |
1002 | 1000 | ) |
1003 | 1001 | ), 'give-send-preview-email' ), |
1004 | - esc_attr__( 'Send Test Email.', 'give' ), |
|
1005 | - esc_html__( 'Send Test Email', 'give' ) |
|
1002 | + esc_attr__('Send Test Email.', 'give'), |
|
1003 | + esc_html__('Send Test Email', 'give') |
|
1006 | 1004 | ); |
1007 | 1005 | |
1008 | - if ( ! empty( $field['description'] ) ) { |
|
1009 | - echo '<span class="give-field-description">' . wp_kses_post( $field['desc'] ) . '</span>'; |
|
1006 | + if ( ! empty($field['description'])) { |
|
1007 | + echo '<span class="give-field-description">'.wp_kses_post($field['desc']).'</span>'; |
|
1010 | 1008 | } |
1011 | 1009 | |
1012 | 1010 | echo '</p>'; |
@@ -1027,29 +1025,29 @@ discard block |
||
1027 | 1025 | * |
1028 | 1026 | * @return mixed |
1029 | 1027 | */ |
1030 | -function give_get_field_value( $field, $postid ) { |
|
1031 | - if ( isset( $field['attributes']['value'] ) ) { |
|
1028 | +function give_get_field_value($field, $postid) { |
|
1029 | + if (isset($field['attributes']['value'])) { |
|
1032 | 1030 | return $field['attributes']['value']; |
1033 | 1031 | } |
1034 | 1032 | |
1035 | 1033 | // If field is range slider. |
1036 | - if ( 'donation_limit' === $field['type'] ) { |
|
1034 | + if ('donation_limit' === $field['type']) { |
|
1037 | 1035 | |
1038 | 1036 | // Get minimum value. |
1039 | - $minimum = give_get_meta( $postid, $field['id'] . '_minimum', true ); |
|
1037 | + $minimum = give_get_meta($postid, $field['id'].'_minimum', true); |
|
1040 | 1038 | |
1041 | 1039 | // Give < 2.1 |
1042 | - if ( '_give_custom_amount_range' === $field['id'] && empty( $minimum ) ) { |
|
1043 | - $minimum = give_get_meta( $postid, '_give_custom_amount_minimum', true ); |
|
1040 | + if ('_give_custom_amount_range' === $field['id'] && empty($minimum)) { |
|
1041 | + $minimum = give_get_meta($postid, '_give_custom_amount_minimum', true); |
|
1044 | 1042 | } |
1045 | 1043 | |
1046 | 1044 | $field_value = array( |
1047 | 1045 | 'minimum' => $minimum, |
1048 | - 'maximum' => give_get_meta( $postid, $field['id'] . '_maximum', true ), |
|
1046 | + 'maximum' => give_get_meta($postid, $field['id'].'_maximum', true), |
|
1049 | 1047 | ); |
1050 | 1048 | } else { |
1051 | 1049 | // Get value from db. |
1052 | - $field_value = give_get_meta( $postid, $field['id'], true ); |
|
1050 | + $field_value = give_get_meta($postid, $field['id'], true); |
|
1053 | 1051 | } |
1054 | 1052 | |
1055 | 1053 | /** |
@@ -1059,10 +1057,10 @@ discard block |
||
1059 | 1057 | * |
1060 | 1058 | * @param mixed $field_value Field value. |
1061 | 1059 | */ |
1062 | - $field_value = apply_filters( "{$field['id']}_field_value", $field_value, $field, $postid ); |
|
1060 | + $field_value = apply_filters("{$field['id']}_field_value", $field_value, $field, $postid); |
|
1063 | 1061 | |
1064 | 1062 | // Set default value if no any data saved to db. |
1065 | - if ( ! $field_value && isset( $field['default'] ) ) { |
|
1063 | + if ( ! $field_value && isset($field['default'])) { |
|
1066 | 1064 | $field_value = $field['default']; |
1067 | 1065 | } |
1068 | 1066 | |
@@ -1079,20 +1077,20 @@ discard block |
||
1079 | 1077 | * |
1080 | 1078 | * @return string |
1081 | 1079 | */ |
1082 | -function give_get_field_description( $field ) { |
|
1080 | +function give_get_field_description($field) { |
|
1083 | 1081 | $field_desc_html = ''; |
1084 | 1082 | $description = ''; |
1085 | 1083 | |
1086 | 1084 | // Check for both `description` and `desc`. |
1087 | - if ( isset( $field['description'] ) ) { |
|
1085 | + if (isset($field['description'])) { |
|
1088 | 1086 | $description = $field['description']; |
1089 | - } elseif ( isset( $field['desc'] ) ) { |
|
1087 | + } elseif (isset($field['desc'])) { |
|
1090 | 1088 | $description = $field['desc']; |
1091 | 1089 | } |
1092 | 1090 | |
1093 | 1091 | // Set if there is a description. |
1094 | - if ( ! empty( $description ) ) { |
|
1095 | - $field_desc_html = '<span class="give-field-description">' . wp_kses_post( $description ) . '</span>'; |
|
1092 | + if ( ! empty($description)) { |
|
1093 | + $field_desc_html = '<span class="give-field-description">'.wp_kses_post($description).'</span>'; |
|
1096 | 1094 | } |
1097 | 1095 | |
1098 | 1096 | return $field_desc_html; |
@@ -1112,8 +1110,8 @@ discard block |
||
1112 | 1110 | * |
1113 | 1111 | * @return string |
1114 | 1112 | */ |
1115 | -function give_get_repeater_field_value( $field, $field_group, $fields ) { |
|
1116 | - $field_value = ( isset( $field_group[ $field['id'] ] ) ? $field_group[ $field['id'] ] : '' ); |
|
1113 | +function give_get_repeater_field_value($field, $field_group, $fields) { |
|
1114 | + $field_value = (isset($field_group[$field['id']]) ? $field_group[$field['id']] : ''); |
|
1117 | 1115 | |
1118 | 1116 | /** |
1119 | 1117 | * Filter the specific repeater field value |
@@ -1122,7 +1120,7 @@ discard block |
||
1122 | 1120 | * |
1123 | 1121 | * @param string $field_id |
1124 | 1122 | */ |
1125 | - $field_value = apply_filters( "give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields ); |
|
1123 | + $field_value = apply_filters("give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields); |
|
1126 | 1124 | |
1127 | 1125 | /** |
1128 | 1126 | * Filter the repeater field value |
@@ -1131,7 +1129,7 @@ discard block |
||
1131 | 1129 | * |
1132 | 1130 | * @param string $field_id |
1133 | 1131 | */ |
1134 | - $field_value = apply_filters( 'give_get_repeater_field_value', $field_value, $field, $field_group, $fields ); |
|
1132 | + $field_value = apply_filters('give_get_repeater_field_value', $field_value, $field, $field_group, $fields); |
|
1135 | 1133 | |
1136 | 1134 | return $field_value; |
1137 | 1135 | } |
@@ -1149,7 +1147,7 @@ discard block |
||
1149 | 1147 | * |
1150 | 1148 | * @return string |
1151 | 1149 | */ |
1152 | -function give_get_repeater_field_id( $field, $fields, $default = false ) { |
|
1150 | +function give_get_repeater_field_id($field, $fields, $default = false) { |
|
1153 | 1151 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
1154 | 1152 | |
1155 | 1153 | // Get field id. |
@@ -1162,7 +1160,7 @@ discard block |
||
1162 | 1160 | * |
1163 | 1161 | * @param string $field_id |
1164 | 1162 | */ |
1165 | - $field_id = apply_filters( "give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default ); |
|
1163 | + $field_id = apply_filters("give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default); |
|
1166 | 1164 | |
1167 | 1165 | /** |
1168 | 1166 | * Filter the repeater field id |
@@ -1171,7 +1169,7 @@ discard block |
||
1171 | 1169 | * |
1172 | 1170 | * @param string $field_id |
1173 | 1171 | */ |
1174 | - $field_id = apply_filters( 'give_get_repeater_field_id', $field_id, $field, $fields, $default ); |
|
1172 | + $field_id = apply_filters('give_get_repeater_field_id', $field_id, $field, $fields, $default); |
|
1175 | 1173 | |
1176 | 1174 | return $field_id; |
1177 | 1175 | } |
@@ -1186,8 +1184,8 @@ discard block |
||
1186 | 1184 | * |
1187 | 1185 | * @return string |
1188 | 1186 | */ |
1189 | -function give_get_field_name( $field ) { |
|
1190 | - $field_name = esc_attr( empty( $field['repeat'] ) ? $field['id'] : $field['repeatable_field_id'] ); |
|
1187 | +function give_get_field_name($field) { |
|
1188 | + $field_name = esc_attr(empty($field['repeat']) ? $field['id'] : $field['repeatable_field_id']); |
|
1191 | 1189 | |
1192 | 1190 | /** |
1193 | 1191 | * Filter the field name. |
@@ -1196,7 +1194,7 @@ discard block |
||
1196 | 1194 | * |
1197 | 1195 | * @param string $field_name |
1198 | 1196 | */ |
1199 | - $field_name = apply_filters( 'give_get_field_name', $field_name, $field ); |
|
1197 | + $field_name = apply_filters('give_get_field_name', $field_name, $field); |
|
1200 | 1198 | |
1201 | 1199 | return $field_name; |
1202 | 1200 | } |
@@ -1213,40 +1211,40 @@ discard block |
||
1213 | 1211 | * |
1214 | 1212 | * @return void |
1215 | 1213 | */ |
1216 | -function _give_metabox_form_data_repeater_fields( $fields ) { |
|
1214 | +function _give_metabox_form_data_repeater_fields($fields) { |
|
1217 | 1215 | global $thepostid, $post; |
1218 | 1216 | |
1219 | 1217 | // Bailout. |
1220 | - if ( ! isset( $fields['fields'] ) || empty( $fields['fields'] ) ) { |
|
1218 | + if ( ! isset($fields['fields']) || empty($fields['fields'])) { |
|
1221 | 1219 | return; |
1222 | 1220 | } |
1223 | 1221 | |
1224 | - $group_numbering = isset( $fields['options']['group_numbering'] ) ? (int) $fields['options']['group_numbering'] : 0; |
|
1225 | - $close_tabs = isset( $fields['options']['close_tabs'] ) ? (int) $fields['options']['close_tabs'] : 0; |
|
1226 | - $wrapper_class = isset( $fields['wrapper_class'] ) ? $fields['wrapper_class'] : ''; |
|
1222 | + $group_numbering = isset($fields['options']['group_numbering']) ? (int) $fields['options']['group_numbering'] : 0; |
|
1223 | + $close_tabs = isset($fields['options']['close_tabs']) ? (int) $fields['options']['close_tabs'] : 0; |
|
1224 | + $wrapper_class = isset($fields['wrapper_class']) ? $fields['wrapper_class'] : ''; |
|
1227 | 1225 | ?> |
1228 | - <div class="give-repeatable-field-section <?php echo esc_attr( $wrapper_class ); ?>" id="<?php echo "{$fields['id']}_field"; ?>" |
|
1226 | + <div class="give-repeatable-field-section <?php echo esc_attr($wrapper_class); ?>" id="<?php echo "{$fields['id']}_field"; ?>" |
|
1229 | 1227 | data-group-numbering="<?php echo $group_numbering; ?>" data-close-tabs="<?php echo $close_tabs; ?>"> |
1230 | - <?php if ( ! empty( $fields['name'] ) ) : ?> |
|
1228 | + <?php if ( ! empty($fields['name'])) : ?> |
|
1231 | 1229 | <p class="give-repeater-field-name"><?php echo $fields['name']; ?></p> |
1232 | 1230 | <?php endif; ?> |
1233 | 1231 | |
1234 | - <?php if ( ! empty( $fields['description'] ) ) : ?> |
|
1232 | + <?php if ( ! empty($fields['description'])) : ?> |
|
1235 | 1233 | <p class="give-repeater-field-description"><?php echo $fields['description']; ?></p> |
1236 | 1234 | <?php endif; ?> |
1237 | 1235 | |
1238 | 1236 | <table class="give-repeatable-fields-section-wrapper" cellspacing="0"> |
1239 | 1237 | <?php |
1240 | - $repeater_field_values = give_get_meta( $thepostid, $fields['id'], true ); |
|
1241 | - $header_title = isset( $fields['options']['header_title'] ) |
|
1238 | + $repeater_field_values = give_get_meta($thepostid, $fields['id'], true); |
|
1239 | + $header_title = isset($fields['options']['header_title']) |
|
1242 | 1240 | ? $fields['options']['header_title'] |
1243 | - : esc_attr__( 'Group', 'give' ); |
|
1241 | + : esc_attr__('Group', 'give'); |
|
1244 | 1242 | |
1245 | 1243 | $add_default_donation_field = false; |
1246 | 1244 | |
1247 | 1245 | // Check if level is not created or we have to add default level. |
1248 | - if ( is_array( $repeater_field_values ) && ( $fields_count = count( $repeater_field_values ) ) ) { |
|
1249 | - $repeater_field_values = array_values( $repeater_field_values ); |
|
1246 | + if (is_array($repeater_field_values) && ($fields_count = count($repeater_field_values))) { |
|
1247 | + $repeater_field_values = array_values($repeater_field_values); |
|
1250 | 1248 | } else { |
1251 | 1249 | $fields_count = 1; |
1252 | 1250 | $add_default_donation_field = true; |
@@ -1259,77 +1257,77 @@ discard block |
||
1259 | 1257 | <div class="give-row-head give-move"> |
1260 | 1258 | <button type="button" class="handlediv button-link"><span class="toggle-indicator"></span> |
1261 | 1259 | </button> |
1262 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-</span> |
|
1260 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">-</span> |
|
1263 | 1261 | <h2> |
1264 | 1262 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
1265 | 1263 | </h2> |
1266 | 1264 | </div> |
1267 | 1265 | <div class="give-row-body"> |
1268 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
1266 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
1269 | 1267 | <?php |
1270 | - if ( ! give_is_field_callback_exist( $field ) ) { |
|
1268 | + if ( ! give_is_field_callback_exist($field)) { |
|
1271 | 1269 | continue; |
1272 | 1270 | } |
1273 | 1271 | ?> |
1274 | 1272 | <?php |
1275 | 1273 | $field['repeat'] = true; |
1276 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields ); |
|
1274 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields); |
|
1277 | 1275 | $field['id'] = str_replace( |
1278 | - array( '[', ']' ), |
|
1279 | - array( '_', '', ), |
|
1276 | + array('[', ']'), |
|
1277 | + array('_', '',), |
|
1280 | 1278 | $field['repeatable_field_id'] |
1281 | 1279 | ); |
1282 | 1280 | ?> |
1283 | - <?php give_render_field( $field ); ?> |
|
1281 | + <?php give_render_field($field); ?> |
|
1284 | 1282 | <?php endforeach; ?> |
1285 | 1283 | </div> |
1286 | 1284 | </td> |
1287 | 1285 | </tr> |
1288 | 1286 | |
1289 | - <?php if ( ! empty( $repeater_field_values ) ) : ?> |
|
1287 | + <?php if ( ! empty($repeater_field_values)) : ?> |
|
1290 | 1288 | <!--Stored repeater field group--> |
1291 | - <?php foreach ( $repeater_field_values as $index => $field_group ) : ?> |
|
1289 | + <?php foreach ($repeater_field_values as $index => $field_group) : ?> |
|
1292 | 1290 | <tr class="give-row"> |
1293 | 1291 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
1294 | 1292 | <div class="give-row-head give-move"> |
1295 | 1293 | <button type="button" class="handlediv button-link"> |
1296 | 1294 | <span class="toggle-indicator"></span></button> |
1297 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
1295 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
1298 | 1296 | </span> |
1299 | 1297 | <h2> |
1300 | 1298 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
1301 | 1299 | </h2> |
1302 | 1300 | </div> |
1303 | 1301 | <div class="give-row-body"> |
1304 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
1305 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
1302 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
1303 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
1306 | 1304 | continue; |
1307 | 1305 | } ?> |
1308 | 1306 | <?php |
1309 | 1307 | $field['repeat'] = true; |
1310 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, $index ); |
|
1311 | - $field['attributes']['value'] = give_get_repeater_field_value( $field, $field_group, $fields ); |
|
1308 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, $index); |
|
1309 | + $field['attributes']['value'] = give_get_repeater_field_value($field, $field_group, $fields); |
|
1312 | 1310 | $field['id'] = str_replace( |
1313 | - array( '[', ']' ), |
|
1314 | - array( '_', '', ), |
|
1311 | + array('[', ']'), |
|
1312 | + array('_', '',), |
|
1315 | 1313 | $field['repeatable_field_id'] |
1316 | 1314 | ); |
1317 | 1315 | ?> |
1318 | - <?php give_render_field( $field ); ?> |
|
1316 | + <?php give_render_field($field); ?> |
|
1319 | 1317 | <?php endforeach; ?> |
1320 | 1318 | </div> |
1321 | 1319 | </td> |
1322 | 1320 | </tr> |
1323 | - <?php endforeach;; ?> |
|
1321 | + <?php endforeach; ; ?> |
|
1324 | 1322 | |
1325 | - <?php elseif ( $add_default_donation_field ) : ?> |
|
1323 | + <?php elseif ($add_default_donation_field) : ?> |
|
1326 | 1324 | <!--Default repeater field group--> |
1327 | 1325 | <tr class="give-row"> |
1328 | 1326 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
1329 | 1327 | <div class="give-row-head give-move"> |
1330 | 1328 | <button type="button" class="handlediv button-link"> |
1331 | 1329 | <span class="toggle-indicator"></span></button> |
1332 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
1330 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
1333 | 1331 | </span> |
1334 | 1332 | <h2> |
1335 | 1333 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
@@ -1337,25 +1335,25 @@ discard block |
||
1337 | 1335 | </div> |
1338 | 1336 | <div class="give-row-body"> |
1339 | 1337 | <?php |
1340 | - foreach ( $fields['fields'] as $field ) : |
|
1341 | - if ( ! give_is_field_callback_exist( $field ) ) { |
|
1338 | + foreach ($fields['fields'] as $field) : |
|
1339 | + if ( ! give_is_field_callback_exist($field)) { |
|
1342 | 1340 | continue; |
1343 | 1341 | } |
1344 | 1342 | |
1345 | 1343 | $field['repeat'] = true; |
1346 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, 0 ); |
|
1344 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, 0); |
|
1347 | 1345 | $field['attributes']['value'] = apply_filters( |
1348 | 1346 | "give_default_field_group_field_{$field['id']}_value", |
1349 | - ( ! empty( $field['default'] ) ? $field['default'] : '' ), |
|
1347 | + ( ! empty($field['default']) ? $field['default'] : ''), |
|
1350 | 1348 | $field, |
1351 | 1349 | $fields |
1352 | 1350 | ); |
1353 | - $field['id'] = str_replace( |
|
1354 | - array( '[', ']' ), |
|
1355 | - array( '_', '', ), |
|
1351 | + $field['id'] = str_replace( |
|
1352 | + array('[', ']'), |
|
1353 | + array('_', '',), |
|
1356 | 1354 | $field['repeatable_field_id'] |
1357 | 1355 | ); |
1358 | - give_render_field( $field ); |
|
1356 | + give_render_field($field); |
|
1359 | 1357 | |
1360 | 1358 | endforeach; |
1361 | 1359 | ?> |
@@ -1367,9 +1365,9 @@ discard block |
||
1367 | 1365 | <tfoot> |
1368 | 1366 | <tr> |
1369 | 1367 | <?php |
1370 | - $add_row_btn_title = isset( $fields['options']['add_button'] ) |
|
1368 | + $add_row_btn_title = isset($fields['options']['add_button']) |
|
1371 | 1369 | ? $add_row_btn_title = $fields['options']['add_button'] |
1372 | - : esc_html__( 'Add Row', 'give' ); |
|
1370 | + : esc_html__('Add Row', 'give'); |
|
1373 | 1371 | ?> |
1374 | 1372 | <td colspan="2" class="give-add-repeater-field-section-row-wrap"> |
1375 | 1373 | <span class="button button-primary give-add-repeater-field-section-row"><?php echo $add_row_btn_title; ?></span> |
@@ -1399,10 +1397,10 @@ discard block |
||
1399 | 1397 | * |
1400 | 1398 | * @param string |
1401 | 1399 | */ |
1402 | - $default_current_tab = apply_filters( "give_default_setting_tab_{$current_setting_page}", 'general' ); |
|
1400 | + $default_current_tab = apply_filters("give_default_setting_tab_{$current_setting_page}", 'general'); |
|
1403 | 1401 | |
1404 | 1402 | // Get current tab. |
1405 | - $current_tab = empty( $_GET['tab'] ) ? $default_current_tab : urldecode( $_GET['tab'] ); |
|
1403 | + $current_tab = empty($_GET['tab']) ? $default_current_tab : urldecode($_GET['tab']); |
|
1406 | 1404 | |
1407 | 1405 | // Output. |
1408 | 1406 | return $current_tab; |
@@ -1426,10 +1424,10 @@ discard block |
||
1426 | 1424 | * |
1427 | 1425 | * @param string |
1428 | 1426 | */ |
1429 | - $default_current_section = apply_filters( "give_default_setting_tab_section_{$current_tab}", '' ); |
|
1427 | + $default_current_section = apply_filters("give_default_setting_tab_section_{$current_tab}", ''); |
|
1430 | 1428 | |
1431 | 1429 | // Get current section. |
1432 | - $current_section = empty( $_REQUEST['section'] ) ? $default_current_section : urldecode( $_REQUEST['section'] ); |
|
1430 | + $current_section = empty($_REQUEST['section']) ? $default_current_section : urldecode($_REQUEST['section']); |
|
1433 | 1431 | |
1434 | 1432 | // Output. |
1435 | 1433 | return $current_section; |
@@ -1443,7 +1441,7 @@ discard block |
||
1443 | 1441 | */ |
1444 | 1442 | function give_get_current_setting_page() { |
1445 | 1443 | // Get current page. |
1446 | - $setting_page = ! empty( $_GET['page'] ) ? urldecode( $_GET['page'] ) : ''; |
|
1444 | + $setting_page = ! empty($_GET['page']) ? urldecode($_GET['page']) : ''; |
|
1447 | 1445 | |
1448 | 1446 | // Output. |
1449 | 1447 | return $setting_page; |
@@ -1463,13 +1461,13 @@ discard block |
||
1463 | 1461 | * |
1464 | 1462 | * @return string |
1465 | 1463 | */ |
1466 | -function _give_display_content_field_value( $field_value, $field, $postid ) { |
|
1467 | - $show_content = give_get_meta( $postid, '_give_content_option', true ); |
|
1464 | +function _give_display_content_field_value($field_value, $field, $postid) { |
|
1465 | + $show_content = give_get_meta($postid, '_give_content_option', true); |
|
1468 | 1466 | |
1469 | 1467 | if ( |
1470 | - ! give_get_meta( $postid, '_give_display_content', true ) |
|
1468 | + ! give_get_meta($postid, '_give_display_content', true) |
|
1471 | 1469 | && $show_content |
1472 | - && ( 'none' !== $show_content ) |
|
1470 | + && ('none' !== $show_content) |
|
1473 | 1471 | ) { |
1474 | 1472 | $field_value = 'enabled'; |
1475 | 1473 | } |
@@ -1477,7 +1475,7 @@ discard block |
||
1477 | 1475 | return $field_value; |
1478 | 1476 | } |
1479 | 1477 | |
1480 | -add_filter( '_give_display_content_field_value', '_give_display_content_field_value', 10, 3 ); |
|
1478 | +add_filter('_give_display_content_field_value', '_give_display_content_field_value', 10, 3); |
|
1481 | 1479 | |
1482 | 1480 | |
1483 | 1481 | /** |
@@ -1494,12 +1492,12 @@ discard block |
||
1494 | 1492 | * |
1495 | 1493 | * @return string |
1496 | 1494 | */ |
1497 | -function _give_content_placement_field_value( $field_value, $field, $postid ) { |
|
1498 | - $show_content = give_get_meta( $postid, '_give_content_option', true ); |
|
1495 | +function _give_content_placement_field_value($field_value, $field, $postid) { |
|
1496 | + $show_content = give_get_meta($postid, '_give_content_option', true); |
|
1499 | 1497 | |
1500 | 1498 | if ( |
1501 | - ! give_get_meta( $postid, '_give_content_placement', true ) |
|
1502 | - && ( 'none' !== $show_content ) |
|
1499 | + ! give_get_meta($postid, '_give_content_placement', true) |
|
1500 | + && ('none' !== $show_content) |
|
1503 | 1501 | ) { |
1504 | 1502 | $field_value = $show_content; |
1505 | 1503 | } |
@@ -1507,7 +1505,7 @@ discard block |
||
1507 | 1505 | return $field_value; |
1508 | 1506 | } |
1509 | 1507 | |
1510 | -add_filter( '_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3 ); |
|
1508 | +add_filter('_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3); |
|
1511 | 1509 | |
1512 | 1510 | |
1513 | 1511 | /** |
@@ -1523,17 +1521,17 @@ discard block |
||
1523 | 1521 | * |
1524 | 1522 | * @return string |
1525 | 1523 | */ |
1526 | -function _give_terms_option_field_value( $field_value, $field, $postid ) { |
|
1527 | - $term_option = give_get_meta( $postid, '_give_terms_option', true ); |
|
1524 | +function _give_terms_option_field_value($field_value, $field, $postid) { |
|
1525 | + $term_option = give_get_meta($postid, '_give_terms_option', true); |
|
1528 | 1526 | |
1529 | - if ( in_array( $term_option, array( 'none', 'yes' ) ) ) { |
|
1530 | - $field_value = ( 'yes' === $term_option ? 'enabled' : 'disabled' ); |
|
1527 | + if (in_array($term_option, array('none', 'yes'))) { |
|
1528 | + $field_value = ('yes' === $term_option ? 'enabled' : 'disabled'); |
|
1531 | 1529 | } |
1532 | 1530 | |
1533 | 1531 | return $field_value; |
1534 | 1532 | } |
1535 | 1533 | |
1536 | -add_filter( '_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3 ); |
|
1534 | +add_filter('_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3); |
|
1537 | 1535 | |
1538 | 1536 | |
1539 | 1537 | /** |
@@ -1550,17 +1548,17 @@ discard block |
||
1550 | 1548 | * |
1551 | 1549 | * @return string |
1552 | 1550 | */ |
1553 | -function _give_offline_donation_enable_billing_fields_single_field_value( $field_value, $field, $postid ) { |
|
1554 | - $offline_donation = give_get_meta( $postid, '_give_offline_donation_enable_billing_fields_single', true ); |
|
1551 | +function _give_offline_donation_enable_billing_fields_single_field_value($field_value, $field, $postid) { |
|
1552 | + $offline_donation = give_get_meta($postid, '_give_offline_donation_enable_billing_fields_single', true); |
|
1555 | 1553 | |
1556 | - if ( 'on' === $offline_donation ) { |
|
1554 | + if ('on' === $offline_donation) { |
|
1557 | 1555 | $field_value = 'enabled'; |
1558 | 1556 | } |
1559 | 1557 | |
1560 | 1558 | return $field_value; |
1561 | 1559 | } |
1562 | 1560 | |
1563 | -add_filter( '_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3 ); |
|
1561 | +add_filter('_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3); |
|
1564 | 1562 | |
1565 | 1563 | |
1566 | 1564 | /** |
@@ -1576,17 +1574,17 @@ discard block |
||
1576 | 1574 | * |
1577 | 1575 | * @return string |
1578 | 1576 | */ |
1579 | -function _give_custom_amount_field_value( $field_value, $field, $postid ) { |
|
1580 | - $custom_amount = give_get_meta( $postid, '_give_custom_amount', true ); |
|
1577 | +function _give_custom_amount_field_value($field_value, $field, $postid) { |
|
1578 | + $custom_amount = give_get_meta($postid, '_give_custom_amount', true); |
|
1581 | 1579 | |
1582 | - if ( in_array( $custom_amount, array( 'yes', 'no' ) ) ) { |
|
1583 | - $field_value = ( 'yes' === $custom_amount ? 'enabled' : 'disabled' ); |
|
1580 | + if (in_array($custom_amount, array('yes', 'no'))) { |
|
1581 | + $field_value = ('yes' === $custom_amount ? 'enabled' : 'disabled'); |
|
1584 | 1582 | } |
1585 | 1583 | |
1586 | 1584 | return $field_value; |
1587 | 1585 | } |
1588 | 1586 | |
1589 | -add_filter( '_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3 ); |
|
1587 | +add_filter('_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3); |
|
1590 | 1588 | |
1591 | 1589 | |
1592 | 1590 | /** |
@@ -1602,17 +1600,17 @@ discard block |
||
1602 | 1600 | * |
1603 | 1601 | * @return string |
1604 | 1602 | */ |
1605 | -function _give_goal_option_field_value( $field_value, $field, $postid ) { |
|
1606 | - $goal_option = give_get_meta( $postid, '_give_goal_option', true ); |
|
1603 | +function _give_goal_option_field_value($field_value, $field, $postid) { |
|
1604 | + $goal_option = give_get_meta($postid, '_give_goal_option', true); |
|
1607 | 1605 | |
1608 | - if ( in_array( $goal_option, array( 'yes', 'no' ) ) ) { |
|
1609 | - $field_value = ( 'yes' === $goal_option ? 'enabled' : 'disabled' ); |
|
1606 | + if (in_array($goal_option, array('yes', 'no'))) { |
|
1607 | + $field_value = ('yes' === $goal_option ? 'enabled' : 'disabled'); |
|
1610 | 1608 | } |
1611 | 1609 | |
1612 | 1610 | return $field_value; |
1613 | 1611 | } |
1614 | 1612 | |
1615 | -add_filter( '_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3 ); |
|
1613 | +add_filter('_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3); |
|
1616 | 1614 | |
1617 | 1615 | /** |
1618 | 1616 | * Set value for Donation Goal --> close Form. |
@@ -1628,17 +1626,17 @@ discard block |
||
1628 | 1626 | * |
1629 | 1627 | * @return string |
1630 | 1628 | */ |
1631 | -function _give_close_form_when_goal_achieved_value( $field_value, $field, $postid ) { |
|
1632 | - $close_form = give_get_meta( $postid, '_give_close_form_when_goal_achieved', true ); |
|
1629 | +function _give_close_form_when_goal_achieved_value($field_value, $field, $postid) { |
|
1630 | + $close_form = give_get_meta($postid, '_give_close_form_when_goal_achieved', true); |
|
1633 | 1631 | |
1634 | - if ( in_array( $close_form, array( 'yes', 'no' ) ) ) { |
|
1635 | - $field_value = ( 'yes' === $close_form ? 'enabled' : 'disabled' ); |
|
1632 | + if (in_array($close_form, array('yes', 'no'))) { |
|
1633 | + $field_value = ('yes' === $close_form ? 'enabled' : 'disabled'); |
|
1636 | 1634 | } |
1637 | 1635 | |
1638 | 1636 | return $field_value; |
1639 | 1637 | } |
1640 | 1638 | |
1641 | -add_filter( '_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3 ); |
|
1639 | +add_filter('_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3); |
|
1642 | 1640 | |
1643 | 1641 | |
1644 | 1642 | /** |
@@ -1654,17 +1652,17 @@ discard block |
||
1654 | 1652 | * |
1655 | 1653 | * @return string |
1656 | 1654 | */ |
1657 | -function _give_logged_in_only_value( $field_value, $field, $postid ) { |
|
1658 | - $guest_donation = give_get_meta( $postid, '_give_logged_in_only', true ); |
|
1655 | +function _give_logged_in_only_value($field_value, $field, $postid) { |
|
1656 | + $guest_donation = give_get_meta($postid, '_give_logged_in_only', true); |
|
1659 | 1657 | |
1660 | - if ( in_array( $guest_donation, array( 'yes', 'no' ) ) ) { |
|
1661 | - $field_value = ( 'yes' === $guest_donation ? 'enabled' : 'disabled' ); |
|
1658 | + if (in_array($guest_donation, array('yes', 'no'))) { |
|
1659 | + $field_value = ('yes' === $guest_donation ? 'enabled' : 'disabled'); |
|
1662 | 1660 | } |
1663 | 1661 | |
1664 | 1662 | return $field_value; |
1665 | 1663 | } |
1666 | 1664 | |
1667 | -add_filter( '_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3 ); |
|
1665 | +add_filter('_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3); |
|
1668 | 1666 | |
1669 | 1667 | /** |
1670 | 1668 | * Set value for Offline Donations --> Offline Donations. |
@@ -1680,17 +1678,17 @@ discard block |
||
1680 | 1678 | * |
1681 | 1679 | * @return string |
1682 | 1680 | */ |
1683 | -function _give_customize_offline_donations_value( $field_value, $field, $postid ) { |
|
1684 | - $customize_offline_text = give_get_meta( $postid, '_give_customize_offline_donations', true ); |
|
1681 | +function _give_customize_offline_donations_value($field_value, $field, $postid) { |
|
1682 | + $customize_offline_text = give_get_meta($postid, '_give_customize_offline_donations', true); |
|
1685 | 1683 | |
1686 | - if ( in_array( $customize_offline_text, array( 'yes', 'no' ) ) ) { |
|
1687 | - $field_value = ( 'yes' === $customize_offline_text ? 'enabled' : 'disabled' ); |
|
1684 | + if (in_array($customize_offline_text, array('yes', 'no'))) { |
|
1685 | + $field_value = ('yes' === $customize_offline_text ? 'enabled' : 'disabled'); |
|
1688 | 1686 | } |
1689 | 1687 | |
1690 | 1688 | return $field_value; |
1691 | 1689 | } |
1692 | 1690 | |
1693 | -add_filter( '_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3 ); |
|
1691 | +add_filter('_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3); |
|
1694 | 1692 | |
1695 | 1693 | |
1696 | 1694 | /** |
@@ -1705,14 +1703,14 @@ discard block |
||
1705 | 1703 | * |
1706 | 1704 | * @return mixed |
1707 | 1705 | */ |
1708 | -function _give_set_multi_level_repeater_field_id( $field_id, $field, $fields, $default ) { |
|
1706 | +function _give_set_multi_level_repeater_field_id($field_id, $field, $fields, $default) { |
|
1709 | 1707 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
1710 | 1708 | $field_id = "{$fields['id']}[{$row_placeholder}][{$field['id']}][level_id]"; |
1711 | 1709 | |
1712 | 1710 | return $field_id; |
1713 | 1711 | } |
1714 | 1712 | |
1715 | -add_filter( 'give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4 ); |
|
1713 | +add_filter('give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4); |
|
1716 | 1714 | |
1717 | 1715 | /** |
1718 | 1716 | * Set repeater field value for multi donation form. |
@@ -1726,13 +1724,13 @@ discard block |
||
1726 | 1724 | * |
1727 | 1725 | * @return mixed |
1728 | 1726 | */ |
1729 | -function _give_set_multi_level_repeater_field_value( $field_value, $field, $field_group, $fields ) { |
|
1730 | - $field_value = $field_group[ $field['id'] ]['level_id']; |
|
1727 | +function _give_set_multi_level_repeater_field_value($field_value, $field, $field_group, $fields) { |
|
1728 | + $field_value = $field_group[$field['id']]['level_id']; |
|
1731 | 1729 | |
1732 | 1730 | return $field_value; |
1733 | 1731 | } |
1734 | 1732 | |
1735 | -add_filter( 'give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4 ); |
|
1733 | +add_filter('give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4); |
|
1736 | 1734 | |
1737 | 1735 | /** |
1738 | 1736 | * Set default value for _give_id field. |
@@ -1743,11 +1741,11 @@ discard block |
||
1743 | 1741 | * |
1744 | 1742 | * @return string |
1745 | 1743 | */ |
1746 | -function _give_set_field_give_id_default_value( $field ) { |
|
1744 | +function _give_set_field_give_id_default_value($field) { |
|
1747 | 1745 | return 0; |
1748 | 1746 | } |
1749 | 1747 | |
1750 | -add_filter( 'give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value' ); |
|
1748 | +add_filter('give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value'); |
|
1751 | 1749 | |
1752 | 1750 | /** |
1753 | 1751 | * Set default value for _give_default field. |
@@ -1758,11 +1756,11 @@ discard block |
||
1758 | 1756 | * |
1759 | 1757 | * @return string |
1760 | 1758 | */ |
1761 | -function _give_set_field_give_default_default_value( $field ) { |
|
1759 | +function _give_set_field_give_default_default_value($field) { |
|
1762 | 1760 | return 'default'; |
1763 | 1761 | } |
1764 | 1762 | |
1765 | -add_filter( 'give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value' ); |
|
1763 | +add_filter('give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value'); |
|
1766 | 1764 | |
1767 | 1765 | /** |
1768 | 1766 | * Set repeater field editor id for field type wysiwyg. |
@@ -1774,15 +1772,15 @@ discard block |
||
1774 | 1772 | * |
1775 | 1773 | * @return string |
1776 | 1774 | */ |
1777 | -function give_repeater_field_set_editor_id( $field_name, $field ) { |
|
1778 | - if ( isset( $field['repeatable_field_id'] ) && 'wysiwyg' == $field['type'] ) { |
|
1779 | - $field_name = '_give_repeater_' . uniqid() . '_wysiwyg'; |
|
1775 | +function give_repeater_field_set_editor_id($field_name, $field) { |
|
1776 | + if (isset($field['repeatable_field_id']) && 'wysiwyg' == $field['type']) { |
|
1777 | + $field_name = '_give_repeater_'.uniqid().'_wysiwyg'; |
|
1780 | 1778 | } |
1781 | 1779 | |
1782 | 1780 | return $field_name; |
1783 | 1781 | } |
1784 | 1782 | |
1785 | -add_filter( 'give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2 ); |
|
1783 | +add_filter('give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2); |
|
1786 | 1784 | |
1787 | 1785 | /** |
1788 | 1786 | * Output Donation form radio input box. |
@@ -1807,45 +1805,45 @@ discard block |
||
1807 | 1805 | * } |
1808 | 1806 | * @return void |
1809 | 1807 | */ |
1810 | -function give_donation_form_goal( $field ) { |
|
1808 | +function give_donation_form_goal($field) { |
|
1811 | 1809 | global $thepostid, $post; |
1812 | 1810 | |
1813 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
1814 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
1815 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
1816 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
1817 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
1811 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
1812 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
1813 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
1814 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
1815 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
1818 | 1816 | |
1819 | 1817 | |
1820 | 1818 | printf( |
1821 | 1819 | '<fieldset class="give-field-wrap %s_field %s">', |
1822 | - esc_attr( $field['id'] ), |
|
1823 | - esc_attr( $field['wrapper_class'] ) |
|
1820 | + esc_attr($field['id']), |
|
1821 | + esc_attr($field['wrapper_class']) |
|
1824 | 1822 | ); |
1825 | 1823 | |
1826 | 1824 | printf( |
1827 | 1825 | '<span class="give-field-label">%s</span>', |
1828 | - esc_html( $field['name'] ) |
|
1826 | + esc_html($field['name']) |
|
1829 | 1827 | ); |
1830 | 1828 | |
1831 | 1829 | printf( |
1832 | 1830 | '<legend class="screen-reader-text">%s</legend>', |
1833 | - esc_html( $field['name'] ) |
|
1831 | + esc_html($field['name']) |
|
1834 | 1832 | ); |
1835 | 1833 | ?> |
1836 | 1834 | |
1837 | 1835 | <ul class="give-radios"> |
1838 | 1836 | <?php |
1839 | - foreach ( $field['options'] as $key => $value ) { |
|
1840 | - $attributes = empty( $field['attributes'] ) ? '' : give_get_attribute_str( $field['attributes'] ); |
|
1837 | + foreach ($field['options'] as $key => $value) { |
|
1838 | + $attributes = empty($field['attributes']) ? '' : give_get_attribute_str($field['attributes']); |
|
1841 | 1839 | printf( |
1842 | 1840 | '<li><label><input name="%s" value="%s" type="radio" style="%s" %s %s /> %s </label></li>', |
1843 | - give_get_field_name( $field ), |
|
1844 | - esc_attr( $key ), |
|
1845 | - esc_attr( $field['style'] ), |
|
1846 | - checked( esc_attr( $field['value'] ), esc_attr( $key ), false ), |
|
1841 | + give_get_field_name($field), |
|
1842 | + esc_attr($key), |
|
1843 | + esc_attr($field['style']), |
|
1844 | + checked(esc_attr($field['value']), esc_attr($key), false), |
|
1847 | 1845 | $attributes, |
1848 | - esc_html( $value ) |
|
1846 | + esc_html($value) |
|
1849 | 1847 | ); |
1850 | 1848 | } |
1851 | 1849 | ?> |
@@ -1859,9 +1857,9 @@ discard block |
||
1859 | 1857 | * |
1860 | 1858 | * @param array $field Array of radio field arguments. |
1861 | 1859 | */ |
1862 | - do_action( 'give_donation_form_goal_before_description', $field ); |
|
1860 | + do_action('give_donation_form_goal_before_description', $field); |
|
1863 | 1861 | |
1864 | - echo give_get_field_description( $field ); |
|
1862 | + echo give_get_field_description($field); |
|
1865 | 1863 | |
1866 | 1864 | echo '</fieldset>'; |
1867 | 1865 | } |
@@ -586,9 +586,9 @@ |
||
586 | 586 | } |
587 | 587 | |
588 | 588 | echo ' – ' |
589 | - . sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) |
|
590 | - . ' – ' |
|
591 | - . esc_html( $plugin_data['Version'] ); |
|
589 | + . sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) |
|
590 | + . ' – ' |
|
591 | + . esc_html( $plugin_data['Version'] ); |
|
592 | 592 | ?> |
593 | 593 | </td> |
594 | 594 | </tr> |
@@ -60,7 +60,12 @@ discard block |
||
60 | 60 | <tr> |
61 | 61 | <td data-export-label="WP Multisite"><?php _e( 'WP Multisite', 'give' ); ?>:</td> |
62 | 62 | <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether or not you have WordPress Multisite enabled.', 'give' ) ); ?></td> |
63 | - <td><?php if ( is_multisite() ) echo '<span class="dashicons dashicons-yes"></span>'; else echo '–'; ?></td> |
|
63 | + <td><?php if ( is_multisite() ) { |
|
64 | + echo '<span class="dashicons dashicons-yes"></span>'; |
|
65 | +} else { |
|
66 | + echo '–'; |
|
67 | +} |
|
68 | +?></td> |
|
64 | 69 | |
65 | 70 | </tr> |
66 | 71 | <tr> |
@@ -89,9 +94,12 @@ discard block |
||
89 | 94 | <td> |
90 | 95 | <?php if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) : ?> |
91 | 96 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
92 | - <?php else : ?> |
|
97 | + <?php else { |
|
98 | + : ?> |
|
93 | 99 | <mark class="no">–</mark> |
94 | - <?php endif; ?> |
|
100 | + <?php endif; |
|
101 | +} |
|
102 | +?> |
|
95 | 103 | </td> |
96 | 104 | </tr> |
97 | 105 | <tr> |
@@ -100,9 +108,12 @@ discard block |
||
100 | 108 | <td> |
101 | 109 | <?php if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) : ?> |
102 | 110 | <mark class="no">–</mark> |
103 | - <?php else : ?> |
|
111 | + <?php else { |
|
112 | + : ?> |
|
104 | 113 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
105 | - <?php endif; ?> |
|
114 | + <?php endif; |
|
115 | +} |
|
116 | +?> |
|
106 | 117 | </td> |
107 | 118 | </tr> |
108 | 119 | <tr> |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | * Admin View: System Info |
4 | 4 | */ |
5 | 5 | |
6 | -if ( ! defined( 'ABSPATH' ) ) { |
|
6 | +if ( ! defined('ABSPATH')) { |
|
7 | 7 | exit; |
8 | 8 | } |
9 | 9 | |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | ?> |
26 | 26 | |
27 | 27 | <div class="give-debug-report-wrapper"> |
28 | - <p class="give-debug-report-text"><?php echo sprintf(__( 'Please copy and paste this information in your ticket when contacting support:', 'give' )); ?> </p> |
|
28 | + <p class="give-debug-report-text"><?php echo sprintf(__('Please copy and paste this information in your ticket when contacting support:', 'give')); ?> </p> |
|
29 | 29 | <div class="give-debug-report-actions"> |
30 | - <a class="button-primary js-give-debug-report-button" href="#"><?php _e( 'Get System Report', 'give' ); ?></a> |
|
31 | - <a class="button-secondary docs" href="http://docs.givewp.com/settings-system-info" target="_blank"><?php _e( 'Understanding the System Report', 'give' ); ?> <span class="dashicons dashicons-external"></span></a> |
|
30 | + <a class="button-primary js-give-debug-report-button" href="#"><?php _e('Get System Report', 'give'); ?></a> |
|
31 | + <a class="button-secondary docs" href="http://docs.givewp.com/settings-system-info" target="_blank"><?php _e('Understanding the System Report', 'give'); ?> <span class="dashicons dashicons-external"></span></a> |
|
32 | 32 | </div> |
33 | 33 | <div class="give-debug-report js-give-debug-report"> |
34 | 34 | <textarea readonly="readonly"></textarea> |
@@ -38,56 +38,56 @@ discard block |
||
38 | 38 | <table class="give-status-table widefat" cellspacing="0" id="status"> |
39 | 39 | <thead> |
40 | 40 | <tr> |
41 | - <th colspan="3" data-export-label="WordPress Environment"><h2><?php _e( 'WordPress Environment', 'give' ); ?></h2></th> |
|
41 | + <th colspan="3" data-export-label="WordPress Environment"><h2><?php _e('WordPress Environment', 'give'); ?></h2></th> |
|
42 | 42 | </tr> |
43 | 43 | </thead> |
44 | 44 | <tbody> |
45 | 45 | <tr> |
46 | - <td data-export-label="Home URL"><?php _e( 'Home URL', 'give' ); ?>:</td> |
|
47 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The URL of your site\'s homepage.', 'give' ) ); ?></td> |
|
48 | - <td><?php form_option( 'home' ); ?></td> |
|
46 | + <td data-export-label="Home URL"><?php _e('Home URL', 'give'); ?>:</td> |
|
47 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The URL of your site\'s homepage.', 'give')); ?></td> |
|
48 | + <td><?php form_option('home'); ?></td> |
|
49 | 49 | </tr> |
50 | 50 | <tr> |
51 | - <td data-export-label="Site URL"><?php _e( 'Site URL', 'give' ); ?>:</td> |
|
52 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The root URL of your site.', 'give' ) ); ?></td> |
|
53 | - <td><?php form_option( 'siteurl' ); ?></td> |
|
51 | + <td data-export-label="Site URL"><?php _e('Site URL', 'give'); ?>:</td> |
|
52 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The root URL of your site.', 'give')); ?></td> |
|
53 | + <td><?php form_option('siteurl'); ?></td> |
|
54 | 54 | </tr> |
55 | 55 | <tr> |
56 | - <td data-export-label="WP Version"><?php _e( 'WP Version', 'give' ); ?>:</td> |
|
57 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of WordPress installed on your site.', 'give' ) ); ?></td> |
|
58 | - <td><?php bloginfo( 'version' ); ?></td> |
|
56 | + <td data-export-label="WP Version"><?php _e('WP Version', 'give'); ?>:</td> |
|
57 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of WordPress installed on your site.', 'give')); ?></td> |
|
58 | + <td><?php bloginfo('version'); ?></td> |
|
59 | 59 | </tr> |
60 | 60 | <tr> |
61 | - <td data-export-label="WP Multisite"><?php _e( 'WP Multisite', 'give' ); ?>:</td> |
|
62 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether or not you have WordPress Multisite enabled.', 'give' ) ); ?></td> |
|
63 | - <td><?php if ( is_multisite() ) echo '<span class="dashicons dashicons-yes"></span>'; else echo '–'; ?></td> |
|
61 | + <td data-export-label="WP Multisite"><?php _e('WP Multisite', 'give'); ?>:</td> |
|
62 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether or not you have WordPress Multisite enabled.', 'give')); ?></td> |
|
63 | + <td><?php if (is_multisite()) echo '<span class="dashicons dashicons-yes"></span>'; else echo '–'; ?></td> |
|
64 | 64 | |
65 | 65 | </tr> |
66 | 66 | <tr> |
67 | - <td data-export-label="WP Memory Limit"><?php _e( 'WP Memory Limit', 'give' ); ?>:</td> |
|
68 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The maximum amount of memory (RAM) that your site can use at one time.', 'give' ) ); ?></td> |
|
67 | + <td data-export-label="WP Memory Limit"><?php _e('WP Memory Limit', 'give'); ?>:</td> |
|
68 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The maximum amount of memory (RAM) that your site can use at one time.', 'give')); ?></td> |
|
69 | 69 | <td> |
70 | 70 | <?php |
71 | - $memory = give_let_to_num( WP_MEMORY_LIMIT ); |
|
71 | + $memory = give_let_to_num(WP_MEMORY_LIMIT); |
|
72 | 72 | |
73 | - if ( function_exists( 'memory_get_usage' ) ) { |
|
74 | - $system_memory = give_let_to_num( @ini_get( 'memory_limit' ) ); |
|
75 | - $memory = max( $memory, $system_memory ); |
|
73 | + if (function_exists('memory_get_usage')) { |
|
74 | + $system_memory = give_let_to_num(@ini_get('memory_limit')); |
|
75 | + $memory = max($memory, $system_memory); |
|
76 | 76 | } |
77 | 77 | |
78 | - if ( $memory < 67108864 ) { |
|
79 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend setting memory to at least 64 MB. See: %s', 'give' ), size_format( $memory ), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">' . __( 'Increasing memory allocated to PHP', 'give' ) . '</a>' ) . '</mark>'; |
|
78 | + if ($memory < 67108864) { |
|
79 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend setting memory to at least 64 MB. See: %s', 'give'), size_format($memory), '<a href="https://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP" target="_blank">'.__('Increasing memory allocated to PHP', 'give').'</a>').'</mark>'; |
|
80 | 80 | } else { |
81 | - echo '<mark class="yes">' . size_format( $memory ) . '</mark>'; |
|
81 | + echo '<mark class="yes">'.size_format($memory).'</mark>'; |
|
82 | 82 | } |
83 | 83 | ?> |
84 | 84 | </td> |
85 | 85 | </tr> |
86 | 86 | <tr> |
87 | - <td data-export-label="WP Debug Mode"><?php _e( 'WP Debug Mode', 'give' ); ?>:</td> |
|
88 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Displays whether or not WordPress is in Debug Mode.', 'give' ) ); ?></td> |
|
87 | + <td data-export-label="WP Debug Mode"><?php _e('WP Debug Mode', 'give'); ?>:</td> |
|
88 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Displays whether or not WordPress is in Debug Mode.', 'give')); ?></td> |
|
89 | 89 | <td> |
90 | - <?php if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) : ?> |
|
90 | + <?php if (defined('WP_DEBUG') && WP_DEBUG) : ?> |
|
91 | 91 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
92 | 92 | <?php else : ?> |
93 | 93 | <mark class="no">–</mark> |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | </td> |
96 | 96 | </tr> |
97 | 97 | <tr> |
98 | - <td data-export-label="WP Cron"><?php _e( 'WP Cron', 'give' ); ?>:</td> |
|
99 | - <td class="help"><?php echo Give()->tooltips->render( __( 'Displays whether or not WP Cron Jobs are enabled.', 'give' ) ); ?></td> |
|
98 | + <td data-export-label="WP Cron"><?php _e('WP Cron', 'give'); ?>:</td> |
|
99 | + <td class="help"><?php echo Give()->tooltips->render(__('Displays whether or not WP Cron Jobs are enabled.', 'give')); ?></td> |
|
100 | 100 | <td> |
101 | - <?php if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) : ?> |
|
101 | + <?php if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON) : ?> |
|
102 | 102 | <mark class="no">–</mark> |
103 | 103 | <?php else : ?> |
104 | 104 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
@@ -106,60 +106,60 @@ discard block |
||
106 | 106 | </td> |
107 | 107 | </tr> |
108 | 108 | <tr> |
109 | - <td data-export-label="Language"><?php _e( 'Language', 'give' ); ?>:</td> |
|
110 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The current language used by WordPress. Default = English', 'give' ) ); ?></td> |
|
109 | + <td data-export-label="Language"><?php _e('Language', 'give'); ?>:</td> |
|
110 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The current language used by WordPress. Default = English', 'give')); ?></td> |
|
111 | 111 | <td><?php echo get_locale(); ?></td> |
112 | 112 | </tr> |
113 | 113 | <tr> |
114 | - <td data-export-label="Permalink Structure"><?php _e( 'Permalink Structure', 'give' ); ?>:</td> |
|
115 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The permalink structure as defined in Settings.', 'give' ) ); ?></td> |
|
116 | - <td><?php echo esc_html( get_option( 'permalink_structure', __( 'Default', 'give' ) ) ); ?></td> |
|
114 | + <td data-export-label="Permalink Structure"><?php _e('Permalink Structure', 'give'); ?>:</td> |
|
115 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The permalink structure as defined in Settings.', 'give')); ?></td> |
|
116 | + <td><?php echo esc_html(get_option('permalink_structure', __('Default', 'give'))); ?></td> |
|
117 | 117 | </tr> |
118 | 118 | <tr> |
119 | - <td data-export-label="Show on Front"><?php _e( 'Show on Front', 'give' ); ?>:</td> |
|
120 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether your front page is set to show posts or a static page.', 'give' ) ); ?></td> |
|
121 | - <td><?php echo esc_html( get_option( 'show_on_front', '–' ) ); ?></td> |
|
119 | + <td data-export-label="Show on Front"><?php _e('Show on Front', 'give'); ?>:</td> |
|
120 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether your front page is set to show posts or a static page.', 'give')); ?></td> |
|
121 | + <td><?php echo esc_html(get_option('show_on_front', '–')); ?></td> |
|
122 | 122 | </tr> |
123 | - <?php if ( 'page' === get_option( 'show_on_front' ) ) : ?> |
|
123 | + <?php if ('page' === get_option('show_on_front')) : ?> |
|
124 | 124 | <?php |
125 | - $front_page_id = absint( get_option( 'page_on_front' ) ); |
|
126 | - $blog_page_id = absint( get_option( 'page_for_posts' ) ); |
|
125 | + $front_page_id = absint(get_option('page_on_front')); |
|
126 | + $blog_page_id = absint(get_option('page_for_posts')); |
|
127 | 127 | ?> |
128 | 128 | <tr> |
129 | - <td data-export-label="Page on Front"><?php _e( 'Page on Front', 'give' ); ?>:</td> |
|
130 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The page set to display as your front page.', 'give' ) ); ?></td> |
|
131 | - <td><?php echo 0 !== $front_page_id ? esc_html( get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' ) : __( 'Unset', 'give' ); ?></td> |
|
129 | + <td data-export-label="Page on Front"><?php _e('Page on Front', 'give'); ?>:</td> |
|
130 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The page set to display as your front page.', 'give')); ?></td> |
|
131 | + <td><?php echo 0 !== $front_page_id ? esc_html(get_the_title($front_page_id).' (#'.$front_page_id.')') : __('Unset', 'give'); ?></td> |
|
132 | 132 | </tr> |
133 | 133 | <tr> |
134 | - <td data-export-label="Page for Posts"><?php _e( 'Page for Posts', 'give' ); ?>:</td> |
|
135 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The page set to display your posts.', 'give' ) ); ?></td> |
|
136 | - <td><?php echo 0 !== $blog_page_id ? esc_html( get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' ) : __( 'Unset', 'give' ); ?></td> |
|
134 | + <td data-export-label="Page for Posts"><?php _e('Page for Posts', 'give'); ?>:</td> |
|
135 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The page set to display your posts.', 'give')); ?></td> |
|
136 | + <td><?php echo 0 !== $blog_page_id ? esc_html(get_the_title($blog_page_id).' (#'.$blog_page_id.')') : __('Unset', 'give'); ?></td> |
|
137 | 137 | </tr> |
138 | - <?php endif;?> |
|
138 | + <?php endif; ?> |
|
139 | 139 | <tr> |
140 | - <td data-export-label="Table Prefix Length"><?php _e( 'Table Prefix', 'give' ); ?>:</td> |
|
141 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The table prefix used in your WordPress database.', 'give' ) ); ?></td> |
|
142 | - <td><?php echo esc_html( $wpdb->prefix ); ?></td> |
|
140 | + <td data-export-label="Table Prefix Length"><?php _e('Table Prefix', 'give'); ?>:</td> |
|
141 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The table prefix used in your WordPress database.', 'give')); ?></td> |
|
142 | + <td><?php echo esc_html($wpdb->prefix); ?></td> |
|
143 | 143 | </tr> |
144 | 144 | <tr> |
145 | - <td data-export-label="Table Prefix Length"><?php _e( 'Table Prefix Length', 'give' ); ?>:</td> |
|
146 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The length of the table prefix used in your WordPress database.', 'give' ) ); ?></td> |
|
147 | - <td><?php echo esc_html( strlen( $wpdb->prefix ) ); ?></td> |
|
145 | + <td data-export-label="Table Prefix Length"><?php _e('Table Prefix Length', 'give'); ?>:</td> |
|
146 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The length of the table prefix used in your WordPress database.', 'give')); ?></td> |
|
147 | + <td><?php echo esc_html(strlen($wpdb->prefix)); ?></td> |
|
148 | 148 | </tr> |
149 | 149 | <tr> |
150 | - <td data-export-label="Table Prefix Status"><?php _e( 'Table Prefix Status', 'give' ); ?>:</td> |
|
151 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The status of the table prefix used in your WordPress database.', 'give' ) ); ?></td> |
|
152 | - <td><?php echo strlen( $wpdb->prefix ) > 16 ? esc_html( 'Error: Too long', 'give' ) : esc_html( 'Acceptable', 'give' ); ?></td> |
|
150 | + <td data-export-label="Table Prefix Status"><?php _e('Table Prefix Status', 'give'); ?>:</td> |
|
151 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The status of the table prefix used in your WordPress database.', 'give')); ?></td> |
|
152 | + <td><?php echo strlen($wpdb->prefix) > 16 ? esc_html('Error: Too long', 'give') : esc_html('Acceptable', 'give'); ?></td> |
|
153 | 153 | </tr> |
154 | 154 | <tr> |
155 | - <td data-export-label="Admin AJAX"><?php _e( 'Admin AJAX', 'give' ); ?>:</td> |
|
156 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether Admin AJAX is accessible.', 'give' ) ); ?></td> |
|
157 | - <td><?php echo give_test_ajax_works() ? __( 'Accessible', 'give' ) : __( 'Inaccessible', 'give' ); ?></td> |
|
155 | + <td data-export-label="Admin AJAX"><?php _e('Admin AJAX', 'give'); ?>:</td> |
|
156 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether Admin AJAX is accessible.', 'give')); ?></td> |
|
157 | + <td><?php echo give_test_ajax_works() ? __('Accessible', 'give') : __('Inaccessible', 'give'); ?></td> |
|
158 | 158 | </tr> |
159 | 159 | <tr> |
160 | - <td data-export-label="Registered Post Statuses"><?php _e( 'Registered Post Statuses', 'give' ); ?>:</td> |
|
161 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'A list of all registered post statuses.', 'give' ) ); ?></td> |
|
162 | - <td><?php echo esc_html( implode( ', ', get_post_stati() ) ); ?></td> |
|
160 | + <td data-export-label="Registered Post Statuses"><?php _e('Registered Post Statuses', 'give'); ?>:</td> |
|
161 | + <td class="help"><?php echo Give()->tooltips->render_help(__('A list of all registered post statuses.', 'give')); ?></td> |
|
162 | + <td><?php echo esc_html(implode(', ', get_post_stati())); ?></td> |
|
163 | 163 | </tr> |
164 | 164 | </tbody> |
165 | 165 | </table> |
@@ -167,103 +167,103 @@ discard block |
||
167 | 167 | <table class="give-status-table widefat" cellspacing="0"> |
168 | 168 | <thead> |
169 | 169 | <tr> |
170 | - <th colspan="3" data-export-label="Server Environment"><h2><?php _e( 'Server Environment', 'give' ); ?></h2></th> |
|
170 | + <th colspan="3" data-export-label="Server Environment"><h2><?php _e('Server Environment', 'give'); ?></h2></th> |
|
171 | 171 | </tr> |
172 | 172 | </thead> |
173 | 173 | <tbody> |
174 | 174 | <tr> |
175 | - <td data-export-label="Hosting Provider"><?php _e( 'Hosting Provider', 'give' ); ?>:</td> |
|
176 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The hosting provider for this WordPress installation.', 'give' ) ); ?></td> |
|
177 | - <td><?php echo give_get_host() ? esc_html( give_get_host() ) : __( 'Unknown', 'give' ); ?></td> |
|
175 | + <td data-export-label="Hosting Provider"><?php _e('Hosting Provider', 'give'); ?>:</td> |
|
176 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The hosting provider for this WordPress installation.', 'give')); ?></td> |
|
177 | + <td><?php echo give_get_host() ? esc_html(give_get_host()) : __('Unknown', 'give'); ?></td> |
|
178 | 178 | </tr> |
179 | 179 | <tr> |
180 | - <td data-export-label="TLS Connection"><?php _e( 'TLS Connection', 'give' ); ?>:</td> |
|
181 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Most payment gateway APIs only support connections using the TLS 1.2 security protocol.', 'give' ) ); ?></td> |
|
180 | + <td data-export-label="TLS Connection"><?php _e('TLS Connection', 'give'); ?>:</td> |
|
181 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Most payment gateway APIs only support connections using the TLS 1.2 security protocol.', 'give')); ?></td> |
|
182 | 182 | <td> |
183 | 183 | <?php |
184 | 184 | $tls_check = false; |
185 | 185 | |
186 | 186 | // Get the SSL status. |
187 | - if ( ini_get( 'allow_url_fopen' ) ) { |
|
188 | - $tls_check = file_get_contents( 'https://www.howsmyssl.com/a/check' ); |
|
187 | + if (ini_get('allow_url_fopen')) { |
|
188 | + $tls_check = file_get_contents('https://www.howsmyssl.com/a/check'); |
|
189 | 189 | } |
190 | 190 | |
191 | - if ( false !== $tls_check ) { |
|
192 | - $tls_check = json_decode( $tls_check ); |
|
191 | + if (false !== $tls_check) { |
|
192 | + $tls_check = json_decode($tls_check); |
|
193 | 193 | /* translators: %s: SSL connection response */ |
194 | - printf( __( 'Connection uses %s', 'give' ), esc_html( $tls_check->tls_version ) ); |
|
194 | + printf(__('Connection uses %s', 'give'), esc_html($tls_check->tls_version)); |
|
195 | 195 | } |
196 | 196 | ?> |
197 | 197 | </td> |
198 | 198 | </tr> |
199 | 199 | <tr> |
200 | - <td data-export-label="TLS Connection"><?php _e( 'TLS Rating', 'give' ); ?>:</td> |
|
201 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The server\'s connection as rated by https://www.howsmyssl.com/', 'give' ) ); ?></td> |
|
200 | + <td data-export-label="TLS Connection"><?php _e('TLS Rating', 'give'); ?>:</td> |
|
201 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The server\'s connection as rated by https://www.howsmyssl.com/', 'give')); ?></td> |
|
202 | 202 | <td> |
203 | 203 | <?php |
204 | - if ( false !== $tls_check ) { |
|
205 | - esc_html_e( property_exists( $tls_check, 'rating' ) ? $tls_check->rating : $tls_check->tls_version ); |
|
204 | + if (false !== $tls_check) { |
|
205 | + esc_html_e(property_exists($tls_check, 'rating') ? $tls_check->rating : $tls_check->tls_version); |
|
206 | 206 | } |
207 | 207 | ?> |
208 | 208 | </td> |
209 | 209 | </tr> |
210 | 210 | <tr> |
211 | - <td data-export-label="Server Info"><?php _e( 'Server Info', 'give' ); ?>:</td> |
|
212 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Information about the web server that is currently hosting your site.', 'give' ) ); ?></td> |
|
213 | - <td><?php echo esc_html( $_SERVER['SERVER_SOFTWARE'] ); ?></td> |
|
211 | + <td data-export-label="Server Info"><?php _e('Server Info', 'give'); ?>:</td> |
|
212 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Information about the web server that is currently hosting your site.', 'give')); ?></td> |
|
213 | + <td><?php echo esc_html($_SERVER['SERVER_SOFTWARE']); ?></td> |
|
214 | 214 | </tr> |
215 | 215 | <tr> |
216 | - <td data-export-label="PHP Version"><?php _e( 'PHP Version', 'give' ); ?>:</td> |
|
217 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of PHP installed on your hosting server.', 'give' ) ); ?></td> |
|
216 | + <td data-export-label="PHP Version"><?php _e('PHP Version', 'give'); ?>:</td> |
|
217 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of PHP installed on your hosting server.', 'give')); ?></td> |
|
218 | 218 | <td> |
219 | 219 | <?php |
220 | 220 | // Check if phpversion function exists. |
221 | - if ( function_exists( 'phpversion' ) ) { |
|
221 | + if (function_exists('phpversion')) { |
|
222 | 222 | $php_version = phpversion(); |
223 | 223 | |
224 | - if ( version_compare( $php_version, '5.6', '<' ) ) { |
|
225 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend a minimum PHP version of 5.6. See: %s', 'give' ), esc_html( $php_version ), '<a href="http://docs.givewp.com/settings-system-info" target="_blank">' . __( 'PHP Requirements in Give', 'give' ) . '</a>' ) . '</mark>'; |
|
224 | + if (version_compare($php_version, '5.6', '<')) { |
|
225 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend a minimum PHP version of 5.6. See: %s', 'give'), esc_html($php_version), '<a href="http://docs.givewp.com/settings-system-info" target="_blank">'.__('PHP Requirements in Give', 'give').'</a>').'</mark>'; |
|
226 | 226 | } else { |
227 | - echo '<mark class="yes">' . esc_html( $php_version ) . '</mark>'; |
|
227 | + echo '<mark class="yes">'.esc_html($php_version).'</mark>'; |
|
228 | 228 | } |
229 | 229 | } else { |
230 | - _e( "Couldn't determine PHP version because phpversion() doesn't exist.", 'give' ); |
|
230 | + _e("Couldn't determine PHP version because phpversion() doesn't exist.", 'give'); |
|
231 | 231 | } |
232 | 232 | ?></td> |
233 | 233 | </tr> |
234 | - <?php if ( function_exists( 'ini_get' ) ) : ?> |
|
234 | + <?php if (function_exists('ini_get')) : ?> |
|
235 | 235 | <tr> |
236 | - <td data-export-label="PHP Post Max Size"><?php _e( 'PHP Post Max Size', 'give' ); ?>:</td> |
|
237 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The largest filesize that can be contained in one post.', 'give' ) ); ?></td> |
|
238 | - <td><?php echo size_format( give_let_to_num( ini_get( 'post_max_size' ) ) ); ?></td> |
|
236 | + <td data-export-label="PHP Post Max Size"><?php _e('PHP Post Max Size', 'give'); ?>:</td> |
|
237 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The largest filesize that can be contained in one post.', 'give')); ?></td> |
|
238 | + <td><?php echo size_format(give_let_to_num(ini_get('post_max_size'))); ?></td> |
|
239 | 239 | </tr> |
240 | 240 | <tr> |
241 | - <td data-export-label="PHP Time Limit"><?php _e( 'PHP Time Limit', 'give' ); ?>:</td> |
|
242 | - <td class="help"><?php echo Give() ->tooltips->render_help( __( 'The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups).', 'give' ) ); ?></td> |
|
243 | - <td><?php echo ini_get( 'max_execution_time' ); ?></td> |
|
241 | + <td data-export-label="PHP Time Limit"><?php _e('PHP Time Limit', 'give'); ?>:</td> |
|
242 | + <td class="help"><?php echo Give() ->tooltips->render_help(__('The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups).', 'give')); ?></td> |
|
243 | + <td><?php echo ini_get('max_execution_time'); ?></td> |
|
244 | 244 | </tr> |
245 | 245 | <tr> |
246 | - <td data-export-label="PHP Max Input Vars"><?php _e( 'PHP Max Input Vars', 'give' ); ?>:</td> |
|
247 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The maximum number of variables your server can use for a single function to avoid overloads.', 'give' ) ); ?></td> |
|
248 | - <td><?php echo ini_get( 'max_input_vars' ); ?></td> |
|
246 | + <td data-export-label="PHP Max Input Vars"><?php _e('PHP Max Input Vars', 'give'); ?>:</td> |
|
247 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The maximum number of variables your server can use for a single function to avoid overloads.', 'give')); ?></td> |
|
248 | + <td><?php echo ini_get('max_input_vars'); ?></td> |
|
249 | 249 | </tr> |
250 | 250 | <tr> |
251 | - <td data-export-label="PHP Max Upload Size"><?php _e( 'PHP Max Upload Size', 'give' ); ?>:</td> |
|
252 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The largest filesize that can be uploaded to your WordPress installation.', 'give' ) ); ?></td> |
|
253 | - <td><?php echo size_format( wp_max_upload_size() ); ?></td> |
|
251 | + <td data-export-label="PHP Max Upload Size"><?php _e('PHP Max Upload Size', 'give'); ?>:</td> |
|
252 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The largest filesize that can be uploaded to your WordPress installation.', 'give')); ?></td> |
|
253 | + <td><?php echo size_format(wp_max_upload_size()); ?></td> |
|
254 | 254 | </tr> |
255 | 255 | <tr> |
256 | - <td data-export-label="cURL Version"><?php _e( 'cURL Version', 'give' ); ?>:</td> |
|
257 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of cURL installed on your server.', 'give' ) ); ?></td> |
|
256 | + <td data-export-label="cURL Version"><?php _e('cURL Version', 'give'); ?>:</td> |
|
257 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of cURL installed on your server.', 'give')); ?></td> |
|
258 | 258 | <td> |
259 | 259 | <?php |
260 | - if ( function_exists( 'curl_version' ) ) { |
|
260 | + if (function_exists('curl_version')) { |
|
261 | 261 | $curl_version = curl_version(); |
262 | 262 | |
263 | - if ( version_compare( $curl_version['version'], '7.40', '<' ) ) { |
|
264 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend a minimum cURL version of 7.40.', 'give' ), esc_html( $curl_version['version'] . ', ' . $curl_version['ssl_version'] ) ) . '</mark>'; |
|
263 | + if (version_compare($curl_version['version'], '7.40', '<')) { |
|
264 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend a minimum cURL version of 7.40.', 'give'), esc_html($curl_version['version'].', '.$curl_version['ssl_version'])).'</mark>'; |
|
265 | 265 | } else { |
266 | - echo '<mark class="yes">' . esc_html( $curl_version['version'] . ', ' . $curl_version['ssl_version'] ) . '</mark>'; |
|
266 | + echo '<mark class="yes">'.esc_html($curl_version['version'].', '.$curl_version['ssl_version']).'</mark>'; |
|
267 | 267 | } |
268 | 268 | } else { |
269 | 269 | echo '&ndash'; |
@@ -272,42 +272,42 @@ discard block |
||
272 | 272 | </td> |
273 | 273 | </tr> |
274 | 274 | <tr> |
275 | - <td data-export-label="SUHOSIN Installed"><?php _e( 'SUHOSIN Installed', 'give' ); ?>:</td> |
|
276 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Suhosin is an advanced protection system for PHP installations. It was designed to protect your servers on the one hand against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself. If enabled on your server, Suhosin may need to be configured to increase its data submission limits.', 'give' ) ); ?></td> |
|
277 | - <td><?php echo extension_loaded( 'suhosin' ) ? '<span class="dashicons dashicons-yes"></span>' : '–'; ?></td> |
|
275 | + <td data-export-label="SUHOSIN Installed"><?php _e('SUHOSIN Installed', 'give'); ?>:</td> |
|
276 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Suhosin is an advanced protection system for PHP installations. It was designed to protect your servers on the one hand against a number of well known problems in PHP applications and on the other hand against potential unknown vulnerabilities within these applications or the PHP core itself. If enabled on your server, Suhosin may need to be configured to increase its data submission limits.', 'give')); ?></td> |
|
277 | + <td><?php echo extension_loaded('suhosin') ? '<span class="dashicons dashicons-yes"></span>' : '–'; ?></td> |
|
278 | 278 | </tr> |
279 | 279 | <?php endif; |
280 | 280 | |
281 | - if ( $wpdb->use_mysqli ) { |
|
282 | - $ver = mysqli_get_server_info( $wpdb->dbh ); |
|
281 | + if ($wpdb->use_mysqli) { |
|
282 | + $ver = mysqli_get_server_info($wpdb->dbh); |
|
283 | 283 | } else { |
284 | 284 | $ver = mysql_get_server_info(); |
285 | 285 | } |
286 | 286 | |
287 | - if ( ! empty( $wpdb->is_mysql ) && ! stristr( $ver, 'MariaDB' ) ) : ?> |
|
287 | + if ( ! empty($wpdb->is_mysql) && ! stristr($ver, 'MariaDB')) : ?> |
|
288 | 288 | <tr> |
289 | - <td data-export-label="MySQL Version"><?php _e( 'MySQL Version', 'give' ); ?>:</td> |
|
290 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of MySQL installed on your hosting server.', 'give' ) ); ?></td> |
|
289 | + <td data-export-label="MySQL Version"><?php _e('MySQL Version', 'give'); ?>:</td> |
|
290 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of MySQL installed on your hosting server.', 'give')); ?></td> |
|
291 | 291 | <td> |
292 | 292 | <?php |
293 | 293 | $mysql_version = $wpdb->db_version(); |
294 | 294 | |
295 | - if ( version_compare( $mysql_version, '5.6', '<' ) ) { |
|
296 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( '%s - We recommend a minimum MySQL version of 5.6. See: %s', 'give' ), esc_html( $mysql_version ), '<a href="https://wordpress.org/about/requirements/" target="_blank">' . __( 'WordPress Requirements', 'give' ) . '</a>' ) . '</mark>'; |
|
295 | + if (version_compare($mysql_version, '5.6', '<')) { |
|
296 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('%s - We recommend a minimum MySQL version of 5.6. See: %s', 'give'), esc_html($mysql_version), '<a href="https://wordpress.org/about/requirements/" target="_blank">'.__('WordPress Requirements', 'give').'</a>').'</mark>'; |
|
297 | 297 | } else { |
298 | - echo '<mark class="yes">' . esc_html( $mysql_version ) . '</mark>'; |
|
298 | + echo '<mark class="yes">'.esc_html($mysql_version).'</mark>'; |
|
299 | 299 | } |
300 | 300 | ?> |
301 | 301 | </td> |
302 | 302 | </tr> |
303 | 303 | <?php endif; ?> |
304 | 304 | <tr> |
305 | - <td data-export-label="Default Timezone is UTC"><?php _e( 'Default Timezone is UTC', 'give' ); ?>:</td> |
|
306 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The default timezone for your server.', 'give' ) ); ?></td> |
|
305 | + <td data-export-label="Default Timezone is UTC"><?php _e('Default Timezone is UTC', 'give'); ?>:</td> |
|
306 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The default timezone for your server.', 'give')); ?></td> |
|
307 | 307 | <td><?php |
308 | 308 | $default_timezone = date_default_timezone_get(); |
309 | - if ( 'UTC' !== $default_timezone ) { |
|
310 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Default timezone is %s - it should be UTC', 'give' ), $default_timezone ) . '</mark>'; |
|
309 | + if ('UTC' !== $default_timezone) { |
|
310 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('Default timezone is %s - it should be UTC', 'give'), $default_timezone).'</mark>'; |
|
311 | 311 | } else { |
312 | 312 | echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>'; |
313 | 313 | } ?> |
@@ -318,119 +318,119 @@ discard block |
||
318 | 318 | |
319 | 319 | // fsockopen/cURL. |
320 | 320 | $posting['fsockopen_curl']['name'] = 'fsockopen/cURL'; |
321 | - $posting['fsockopen_curl']['help'] = __( 'Payment gateways can use cURL to communicate with remote servers to authorize payments, other plugins may also use it when communicating with remote services.', 'give' ); |
|
321 | + $posting['fsockopen_curl']['help'] = __('Payment gateways can use cURL to communicate with remote servers to authorize payments, other plugins may also use it when communicating with remote services.', 'give'); |
|
322 | 322 | |
323 | - if ( function_exists( 'fsockopen' ) || function_exists( 'curl_init' ) ) { |
|
323 | + if (function_exists('fsockopen') || function_exists('curl_init')) { |
|
324 | 324 | $posting['fsockopen_curl']['success'] = true; |
325 | 325 | } else { |
326 | 326 | $posting['fsockopen_curl']['success'] = false; |
327 | - $posting['fsockopen_curl']['note'] = __( 'Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'give' ); |
|
327 | + $posting['fsockopen_curl']['note'] = __('Your server does not have fsockopen or cURL enabled - PayPal IPN and other scripts which communicate with other servers will not work. Contact your hosting provider.', 'give'); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | // SOAP. |
331 | 331 | $posting['soap_client']['name'] = 'SoapClient'; |
332 | - $posting['soap_client']['help'] = __( 'Some webservices like shipping use SOAP to get information from remote servers, for example, live shipping quotes from FedEx require SOAP to be installed.', 'give' ); |
|
332 | + $posting['soap_client']['help'] = __('Some webservices like shipping use SOAP to get information from remote servers, for example, live shipping quotes from FedEx require SOAP to be installed.', 'give'); |
|
333 | 333 | |
334 | - if ( class_exists( 'SoapClient' ) ) { |
|
334 | + if (class_exists('SoapClient')) { |
|
335 | 335 | $posting['soap_client']['success'] = true; |
336 | 336 | } else { |
337 | 337 | $posting['soap_client']['success'] = false; |
338 | - $posting['soap_client']['note'] = sprintf( __( 'Your server does not have the %s class enabled - some gateway plugins which use SOAP may not work as expected.', 'give' ), '<a href="https://php.net/manual/en/class.soapclient.php">SoapClient</a>' ); |
|
338 | + $posting['soap_client']['note'] = sprintf(__('Your server does not have the %s class enabled - some gateway plugins which use SOAP may not work as expected.', 'give'), '<a href="https://php.net/manual/en/class.soapclient.php">SoapClient</a>'); |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | // DOMDocument. |
342 | 342 | $posting['dom_document']['name'] = 'DOMDocument'; |
343 | - $posting['dom_document']['help'] = __( 'HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', 'give' ); |
|
343 | + $posting['dom_document']['help'] = __('HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', 'give'); |
|
344 | 344 | |
345 | - if ( class_exists( 'DOMDocument' ) ) { |
|
345 | + if (class_exists('DOMDocument')) { |
|
346 | 346 | $posting['dom_document']['success'] = true; |
347 | 347 | } else { |
348 | 348 | $posting['dom_document']['success'] = false; |
349 | - $posting['dom_document']['note'] = sprintf( __( 'Your server does not have the %s class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'give' ), '<a href="https://php.net/manual/en/class.domdocument.php">DOMDocument</a>' ); |
|
349 | + $posting['dom_document']['note'] = sprintf(__('Your server does not have the %s class enabled - HTML/Multipart emails, and also some extensions, will not work without DOMDocument.', 'give'), '<a href="https://php.net/manual/en/class.domdocument.php">DOMDocument</a>'); |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | // gzip. |
353 | 353 | $posting['gzip']['name'] = 'gzip'; |
354 | - $posting['gzip']['help'] = __( 'gzip is used for file compression and decompression.', 'give' ); |
|
354 | + $posting['gzip']['help'] = __('gzip is used for file compression and decompression.', 'give'); |
|
355 | 355 | |
356 | - if ( is_callable( 'gzopen' ) ) { |
|
356 | + if (is_callable('gzopen')) { |
|
357 | 357 | $posting['gzip']['success'] = true; |
358 | 358 | } else { |
359 | 359 | $posting['gzip']['success'] = false; |
360 | - $posting['gzip']['note'] = sprintf( __( 'Your server does not support the %s function - this is used for file compression and decompression.', 'give' ), '<a href="https://php.net/manual/en/zlib.installation.php">gzopen</a>' ); |
|
360 | + $posting['gzip']['note'] = sprintf(__('Your server does not support the %s function - this is used for file compression and decompression.', 'give'), '<a href="https://php.net/manual/en/zlib.installation.php">gzopen</a>'); |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | |
364 | 364 | // GD Graphics Library. |
365 | 365 | $posting['gd']['name'] = 'GD Graphics Library'; |
366 | - $posting['gd']['help'] = __( 'GD Graphics Library is used for dynamically manipulating images.', 'give' ); |
|
367 | - $posting['gd']['success'] = extension_loaded( 'gd' ) && function_exists( 'gd_info' ) ? true : false; |
|
366 | + $posting['gd']['help'] = __('GD Graphics Library is used for dynamically manipulating images.', 'give'); |
|
367 | + $posting['gd']['success'] = extension_loaded('gd') && function_exists('gd_info') ? true : false; |
|
368 | 368 | |
369 | 369 | // Multibyte String. |
370 | 370 | $posting['mbstring']['name'] = 'Multibyte String'; |
371 | - $posting['mbstring']['help'] = __( 'Multibyte String (mbstring) is used to convert character encoding, like for emails or converting characters to lowercase.', 'give' ); |
|
371 | + $posting['mbstring']['help'] = __('Multibyte String (mbstring) is used to convert character encoding, like for emails or converting characters to lowercase.', 'give'); |
|
372 | 372 | |
373 | - if ( extension_loaded( 'mbstring' ) ) { |
|
373 | + if (extension_loaded('mbstring')) { |
|
374 | 374 | $posting['mbstring']['success'] = true; |
375 | 375 | } else { |
376 | 376 | $posting['mbstring']['success'] = false; |
377 | - $posting['mbstring']['note'] = sprintf( __( 'Your server does not support the %s functions - this is required for better character encoding. Some fallbacks will be used instead for it.', 'give' ), '<a href="https://php.net/manual/en/mbstring.installation.php">mbstring</a>' ); |
|
377 | + $posting['mbstring']['note'] = sprintf(__('Your server does not support the %s functions - this is required for better character encoding. Some fallbacks will be used instead for it.', 'give'), '<a href="https://php.net/manual/en/mbstring.installation.php">mbstring</a>'); |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | // WP Remote Post Check. |
381 | - $posting['wp_remote_post']['name'] = __( 'Remote Post', 'give' ); |
|
382 | - $posting['wp_remote_post']['help'] = __( 'PayPal uses this method of communicating when sending back transaction information.', 'give' ); |
|
381 | + $posting['wp_remote_post']['name'] = __('Remote Post', 'give'); |
|
382 | + $posting['wp_remote_post']['help'] = __('PayPal uses this method of communicating when sending back transaction information.', 'give'); |
|
383 | 383 | |
384 | - $response = wp_safe_remote_post( 'https://www.paypal.com/cgi-bin/webscr', array( |
|
384 | + $response = wp_safe_remote_post('https://www.paypal.com/cgi-bin/webscr', array( |
|
385 | 385 | 'timeout' => 60, |
386 | - 'user-agent' => 'Give/' . GIVE_VERSION, |
|
386 | + 'user-agent' => 'Give/'.GIVE_VERSION, |
|
387 | 387 | 'httpversion' => '1.1', |
388 | 388 | 'body' => array( |
389 | 389 | 'cmd' => '_notify-validate', |
390 | 390 | ), |
391 | - ) ); |
|
391 | + )); |
|
392 | 392 | |
393 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
393 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
394 | 394 | $posting['wp_remote_post']['success'] = true; |
395 | 395 | } else { |
396 | - $posting['wp_remote_post']['note'] = __( 'wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider.', 'give' ); |
|
397 | - if ( is_wp_error( $response ) ) { |
|
398 | - $posting['wp_remote_post']['note'] .= ' ' . sprintf( __( 'Error: %s', 'give' ), sanitize_text_field( $response->get_error_message() ) ); |
|
396 | + $posting['wp_remote_post']['note'] = __('wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider.', 'give'); |
|
397 | + if (is_wp_error($response)) { |
|
398 | + $posting['wp_remote_post']['note'] .= ' '.sprintf(__('Error: %s', 'give'), sanitize_text_field($response->get_error_message())); |
|
399 | 399 | } else { |
400 | - $posting['wp_remote_post']['note'] .= ' ' . sprintf( __( 'Status code: %s', 'give' ), sanitize_text_field( $response['response']['code'] ) ); |
|
400 | + $posting['wp_remote_post']['note'] .= ' '.sprintf(__('Status code: %s', 'give'), sanitize_text_field($response['response']['code'])); |
|
401 | 401 | } |
402 | 402 | $posting['wp_remote_post']['success'] = false; |
403 | 403 | } |
404 | 404 | |
405 | 405 | // WP Remote Get Check. |
406 | - $posting['wp_remote_get']['name'] = __( 'Remote Get', 'give' ); |
|
407 | - $posting['wp_remote_get']['help'] = __( 'Give plugins may use this method of communication when checking for plugin updates.', 'give' ); |
|
406 | + $posting['wp_remote_get']['name'] = __('Remote Get', 'give'); |
|
407 | + $posting['wp_remote_get']['help'] = __('Give plugins may use this method of communication when checking for plugin updates.', 'give'); |
|
408 | 408 | |
409 | - $response = wp_safe_remote_get( 'https://woocommerce.com/wc-api/product-key-api?request=ping&network=' . ( is_multisite() ? '1' : '0' ) ); |
|
409 | + $response = wp_safe_remote_get('https://woocommerce.com/wc-api/product-key-api?request=ping&network='.(is_multisite() ? '1' : '0')); |
|
410 | 410 | |
411 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
411 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
412 | 412 | $posting['wp_remote_get']['success'] = true; |
413 | 413 | } else { |
414 | - $posting['wp_remote_get']['note'] = __( 'wp_remote_get() failed. The Give plugin updater won\'t work with your server. Contact your hosting provider.', 'give' ); |
|
415 | - if ( is_wp_error( $response ) ) { |
|
416 | - $posting['wp_remote_get']['note'] .= ' ' . sprintf( __( 'Error: %s', 'give' ), give_clean( $response->get_error_message() ) ); |
|
414 | + $posting['wp_remote_get']['note'] = __('wp_remote_get() failed. The Give plugin updater won\'t work with your server. Contact your hosting provider.', 'give'); |
|
415 | + if (is_wp_error($response)) { |
|
416 | + $posting['wp_remote_get']['note'] .= ' '.sprintf(__('Error: %s', 'give'), give_clean($response->get_error_message())); |
|
417 | 417 | } else { |
418 | - $posting['wp_remote_get']['note'] .= ' ' . sprintf( __( 'Status code: %s', 'give' ), give_clean( $response['response']['code'] ) ); |
|
418 | + $posting['wp_remote_get']['note'] .= ' '.sprintf(__('Status code: %s', 'give'), give_clean($response['response']['code'])); |
|
419 | 419 | } |
420 | 420 | $posting['wp_remote_get']['success'] = false; |
421 | 421 | } |
422 | 422 | |
423 | - $posting = apply_filters( 'give_debug_posting', $posting ); |
|
423 | + $posting = apply_filters('give_debug_posting', $posting); |
|
424 | 424 | |
425 | - foreach ( $posting as $post ) { |
|
426 | - $mark = ! empty( $post['success'] ) ? 'yes' : 'error'; |
|
425 | + foreach ($posting as $post) { |
|
426 | + $mark = ! empty($post['success']) ? 'yes' : 'error'; |
|
427 | 427 | ?> |
428 | 428 | <tr> |
429 | - <td data-export-label="<?php echo esc_html( $post['name'] ); ?>"><?php echo esc_html( $post['name'] ); ?>:</td> |
|
430 | - <td class="help"><?php echo Give()->tooltips->render_help( esc_attr( isset( $post['help'] ) ? $post['help'] : '' ) ); ?></td> |
|
429 | + <td data-export-label="<?php echo esc_html($post['name']); ?>"><?php echo esc_html($post['name']); ?>:</td> |
|
430 | + <td class="help"><?php echo Give()->tooltips->render_help(esc_attr(isset($post['help']) ? $post['help'] : '')); ?></td> |
|
431 | 431 | <td> |
432 | 432 | <mark class="<?php echo $mark; ?>"> |
433 | - <?php echo ! empty( $post['success'] ) ? '<span class="dashicons dashicons-yes"></span>' : '<span class="dashicons dashicons-no-alt"></span>'; ?> <?php echo ! empty( $post['note'] ) ? wp_kses_data( $post['note'] ) : ''; ?> |
|
433 | + <?php echo ! empty($post['success']) ? '<span class="dashicons dashicons-yes"></span>' : '<span class="dashicons dashicons-no-alt"></span>'; ?> <?php echo ! empty($post['note']) ? wp_kses_data($post['note']) : ''; ?> |
|
434 | 434 | </mark> |
435 | 435 | </td> |
436 | 436 | </tr> |
@@ -443,47 +443,47 @@ discard block |
||
443 | 443 | <table class="give-status-table widefat" cellspacing="0"> |
444 | 444 | <thead> |
445 | 445 | <tr> |
446 | - <th colspan="3" data-export-label="Give Configuration"><h2><?php _e( 'Give Configuration', 'give' ); ?></h2></th> |
|
446 | + <th colspan="3" data-export-label="Give Configuration"><h2><?php _e('Give Configuration', 'give'); ?></h2></th> |
|
447 | 447 | </tr> |
448 | 448 | </thead> |
449 | 449 | <tbody> |
450 | 450 | <tr> |
451 | - <td data-export-label="Give Version"><?php _e( 'Give Version', 'give' ); ?>:</td> |
|
452 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of Give installed on your site.', 'give' ) ); ?></td> |
|
453 | - <td><?php echo esc_html( GIVE_VERSION ); ?></td> |
|
451 | + <td data-export-label="Give Version"><?php _e('Give Version', 'give'); ?>:</td> |
|
452 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of Give installed on your site.', 'give')); ?></td> |
|
453 | + <td><?php echo esc_html(GIVE_VERSION); ?></td> |
|
454 | 454 | </tr> |
455 | 455 | <tr> |
456 | - <td data-export-label="Give Cache"><?php _e( 'Give Cache', 'give' ); ?>:</td> |
|
457 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether cache is enabled in Give settings.', 'give' ) ); ?></td> |
|
458 | - <td><?php echo give_is_setting_enabled( give_get_option('cache', 'enabled' ) ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
456 | + <td data-export-label="Give Cache"><?php _e('Give Cache', 'give'); ?>:</td> |
|
457 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether cache is enabled in Give settings.', 'give')); ?></td> |
|
458 | + <td><?php echo give_is_setting_enabled(give_get_option('cache', 'enabled')) ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
459 | 459 | </tr> |
460 | 460 | <tr> |
461 | - <td data-export-label="Database Updates"><?php _e( 'Database Updates', 'give' ); ?>:</td> |
|
462 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'This will show the number of pending database updates.', 'give' ) ); ?></td> |
|
461 | + <td data-export-label="Database Updates"><?php _e('Database Updates', 'give'); ?>:</td> |
|
462 | + <td class="help"><?php echo Give()->tooltips->render_help(__('This will show the number of pending database updates.', 'give')); ?></td> |
|
463 | 463 | <td> |
464 | 464 | <?php |
465 | - $updates_text = __( 'All DB Updates Completed.', 'give' ); |
|
465 | + $updates_text = __('All DB Updates Completed.', 'give'); |
|
466 | 466 | $pending_updates = $give_updates->get_total_new_db_update_count(); |
467 | 467 | $total_updates = $give_updates->get_total_db_update_count(); |
468 | 468 | |
469 | - if( Give_Updates::$background_updater->is_paused_process() ) { |
|
469 | + if (Give_Updates::$background_updater->is_paused_process()) { |
|
470 | 470 | // When all the db updates are pending. |
471 | 471 | $updates_text = sprintf( |
472 | - __( '%1$s updates still need to run. (Paused) ', 'give' ), |
|
473 | - count( $give_updates->get_updates('database', 'new' ) ) |
|
472 | + __('%1$s updates still need to run. (Paused) ', 'give'), |
|
473 | + count($give_updates->get_updates('database', 'new')) |
|
474 | 474 | ); |
475 | - } elseif( $pending_updates === $total_updates ) { |
|
475 | + } elseif ($pending_updates === $total_updates) { |
|
476 | 476 | |
477 | 477 | // When all the db updates are pending. |
478 | 478 | $updates_text = sprintf( |
479 | - __( '%1$s updates still need to run.', 'give' ), |
|
479 | + __('%1$s updates still need to run.', 'give'), |
|
480 | 480 | $total_updates |
481 | 481 | ); |
482 | - } elseif( $pending_updates > 0 ) { |
|
482 | + } elseif ($pending_updates > 0) { |
|
483 | 483 | |
484 | 484 | // When some of the db updates are completed and some are pending. |
485 | 485 | $updates_text = sprintf( |
486 | - __( '%1$s of %2$s updates still need to run.', 'give' ), |
|
486 | + __('%1$s of %2$s updates still need to run.', 'give'), |
|
487 | 487 | $pending_updates, |
488 | 488 | $total_updates |
489 | 489 | ); |
@@ -494,148 +494,147 @@ discard block |
||
494 | 494 | </td> |
495 | 495 | </tr> |
496 | 496 | <tr> |
497 | - <td data-export-label="Give Cache"><?php _e( 'Give Cache', 'give' ); ?>:</td> |
|
498 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether cache is enabled in Give settings.', 'give' ) ); ?></td> |
|
499 | - <td><?php echo give_is_setting_enabled( give_get_option('cache', 'enabled' ) ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
497 | + <td data-export-label="Give Cache"><?php _e('Give Cache', 'give'); ?>:</td> |
|
498 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether cache is enabled in Give settings.', 'give')); ?></td> |
|
499 | + <td><?php echo give_is_setting_enabled(give_get_option('cache', 'enabled')) ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
500 | 500 | </tr> |
501 | 501 | <tr> |
502 | - <td data-export-label="Give Cache"><?php _e( 'Give Emails', 'give' ); ?>:</td> |
|
503 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether emails is enabled in Give settings.', 'give' ) ); ?></td> |
|
502 | + <td data-export-label="Give Cache"><?php _e('Give Emails', 'give'); ?>:</td> |
|
503 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether emails is enabled in Give settings.', 'give')); ?></td> |
|
504 | 504 | <td> |
505 | 505 | <?php |
506 | 506 | /* @var Give_Email_Notification $email_notification */ |
507 | - if( $email_notifications = Give_Email_Notifications::get_instance()->get_email_notifications() ) { |
|
507 | + if ($email_notifications = Give_Email_Notifications::get_instance()->get_email_notifications()) { |
|
508 | 508 | ob_start(); |
509 | 509 | |
510 | - foreach ( Give_Email_Notifications::get_instance()->get_email_notifications() as $email_notification ) { |
|
511 | - $status = Give_Email_Notification_Util::is_email_notification_active( $email_notification ) ? |
|
512 | - 'yes' : |
|
513 | - 'error'; |
|
510 | + foreach (Give_Email_Notifications::get_instance()->get_email_notifications() as $email_notification) { |
|
511 | + $status = Give_Email_Notification_Util::is_email_notification_active($email_notification) ? |
|
512 | + 'yes' : 'error'; |
|
514 | 513 | |
515 | 514 | echo sprintf( |
516 | 515 | '<li><mark class="%1$s"><span class="dashicons dashicons-%2$s"></mark></span>%3$s</li>', |
517 | - Give_Email_Notification_Util::is_email_notification_active( $email_notification ) ? 'yes' : 'error', |
|
518 | - Give_Email_Notification_Util::is_email_notification_active( $email_notification ) ? 'yes' : 'no-alt', |
|
516 | + Give_Email_Notification_Util::is_email_notification_active($email_notification) ? 'yes' : 'error', |
|
517 | + Give_Email_Notification_Util::is_email_notification_active($email_notification) ? 'yes' : 'no-alt', |
|
519 | 518 | $email_notification->config['label'] |
520 | 519 | ); |
521 | 520 | } |
522 | 521 | |
523 | - echo sprintf( '<ul>%s</ul>', ob_get_clean() ); |
|
522 | + echo sprintf('<ul>%s</ul>', ob_get_clean()); |
|
524 | 523 | } |
525 | 524 | ?> |
526 | 525 | </td> |
527 | 526 | </tr> |
528 | 527 | <tr> |
529 | - <td data-export-label="Upgraded From"><?php _e( 'Upgraded From', 'give' ); ?>:</td> |
|
530 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The version of Give installed prior to the last update.', 'give' ) ); ?></td> |
|
531 | - <td><?php echo esc_html( get_option( 'give_version_upgraded_from', '–' ) ); ?></td> |
|
528 | + <td data-export-label="Upgraded From"><?php _e('Upgraded From', 'give'); ?>:</td> |
|
529 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The version of Give installed prior to the last update.', 'give')); ?></td> |
|
530 | + <td><?php echo esc_html(get_option('give_version_upgraded_from', '–')); ?></td> |
|
532 | 531 | </tr> |
533 | 532 | <tr> |
534 | - <td data-export-label="Test Mode"><?php _e( 'Test Mode', 'give' ); ?>:</td> |
|
535 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether Test Mode is enabled in Give settings.', 'give' ) ); ?></td> |
|
536 | - <td><?php echo give_is_test_mode() ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
533 | + <td data-export-label="Test Mode"><?php _e('Test Mode', 'give'); ?>:</td> |
|
534 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether Test Mode is enabled in Give settings.', 'give')); ?></td> |
|
535 | + <td><?php echo give_is_test_mode() ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
537 | 536 | </tr> |
538 | 537 | <tr> |
539 | - <td data-export-label="Currency Code"><?php _e( 'Currency Code', 'give' ); ?>:</td> |
|
540 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The currency code selected in Give settings.', 'give' ) ); ?></td> |
|
541 | - <td><?php echo esc_html( give_get_currency() ); ?></td> |
|
538 | + <td data-export-label="Currency Code"><?php _e('Currency Code', 'give'); ?>:</td> |
|
539 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The currency code selected in Give settings.', 'give')); ?></td> |
|
540 | + <td><?php echo esc_html(give_get_currency()); ?></td> |
|
542 | 541 | </tr> |
543 | 542 | <tr> |
544 | - <td data-export-label="Currency Position"><?php _e( 'Currency Position', 'give' ); ?>:</td> |
|
545 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The currency position selected in Give settings.', 'give' ) ); ?></td> |
|
546 | - <td><?php echo 'before' === give_get_option( 'currency_position' ) ? __( 'Before', 'give' ) : __( 'After', 'give' ); ?></td> |
|
543 | + <td data-export-label="Currency Position"><?php _e('Currency Position', 'give'); ?>:</td> |
|
544 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The currency position selected in Give settings.', 'give')); ?></td> |
|
545 | + <td><?php echo 'before' === give_get_option('currency_position') ? __('Before', 'give') : __('After', 'give'); ?></td> |
|
547 | 546 | </tr> |
548 | 547 | <tr> |
549 | - <td data-export-label="Decimal Separator"><?php _e( 'Decimal Separator', 'give' ); ?>:</td> |
|
550 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The decimal separator defined in Give settings.', 'give' ) ); ?></td> |
|
551 | - <td><?php echo esc_html( give_get_price_decimal_separator() ); ?></td> |
|
548 | + <td data-export-label="Decimal Separator"><?php _e('Decimal Separator', 'give'); ?>:</td> |
|
549 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The decimal separator defined in Give settings.', 'give')); ?></td> |
|
550 | + <td><?php echo esc_html(give_get_price_decimal_separator()); ?></td> |
|
552 | 551 | </tr> |
553 | 552 | <tr> |
554 | - <td data-export-label="Thousands Separator"><?php _e( 'Thousands Separator', 'give' ); ?>:</td> |
|
555 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The thousands separator defined in Give settings.', 'give' ) ); ?></td> |
|
556 | - <td><?php echo esc_html( give_get_price_thousand_separator() ); ?></td> |
|
553 | + <td data-export-label="Thousands Separator"><?php _e('Thousands Separator', 'give'); ?>:</td> |
|
554 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The thousands separator defined in Give settings.', 'give')); ?></td> |
|
555 | + <td><?php echo esc_html(give_get_price_thousand_separator()); ?></td> |
|
557 | 556 | </tr> |
558 | 557 | <tr> |
559 | - <td data-export-label="Success Page"><?php _e( 'Success Page', 'give' ); ?>:</td> |
|
560 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The page where donors land following a successful transaction.', 'give' ) ); ?></td> |
|
561 | - <td><?php echo ! empty( $give_options['success_page'] ) ? esc_url( get_permalink( $give_options['success_page'] ) ) : '–'; ?></td> |
|
558 | + <td data-export-label="Success Page"><?php _e('Success Page', 'give'); ?>:</td> |
|
559 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The page where donors land following a successful transaction.', 'give')); ?></td> |
|
560 | + <td><?php echo ! empty($give_options['success_page']) ? esc_url(get_permalink($give_options['success_page'])) : '–'; ?></td> |
|
562 | 561 | </tr> |
563 | 562 | <tr> |
564 | - <td data-export-label="Failure Page"><?php _e( 'Failure Page', 'give' ); ?>:</td> |
|
565 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The page where donors land following a failed transaction.', 'give' ) ); ?></td> |
|
566 | - <td><?php echo ! empty( $give_options['failure_page'] ) ? esc_url( get_permalink( $give_options['failure_page'] ) ) : '–'; ?></td> |
|
563 | + <td data-export-label="Failure Page"><?php _e('Failure Page', 'give'); ?>:</td> |
|
564 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The page where donors land following a failed transaction.', 'give')); ?></td> |
|
565 | + <td><?php echo ! empty($give_options['failure_page']) ? esc_url(get_permalink($give_options['failure_page'])) : '–'; ?></td> |
|
567 | 566 | </tr> |
568 | 567 | <tr> |
569 | - <td data-export-label="Donation History Page"><?php _e( 'Donation History Page', 'give' ); ?>:</td> |
|
570 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The page where past donations are listed.', 'give' ) ); ?></td> |
|
571 | - <td><?php echo ! empty( $give_options['history_page'] ) ? esc_url( get_permalink( $give_options['history_page'] ) ) : '–'; ?></td> |
|
568 | + <td data-export-label="Donation History Page"><?php _e('Donation History Page', 'give'); ?>:</td> |
|
569 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The page where past donations are listed.', 'give')); ?></td> |
|
570 | + <td><?php echo ! empty($give_options['history_page']) ? esc_url(get_permalink($give_options['history_page'])) : '–'; ?></td> |
|
572 | 571 | </tr> |
573 | 572 | <tr> |
574 | - <td data-export-label="Give Forms Slug"><?php _e( 'Give Forms Slug', 'give' ); ?>:</td> |
|
575 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The slug used for Give donation forms.', 'give' ) ); ?></td> |
|
576 | - <td><?php echo esc_html( defined( 'GIVE_SLUG' ) ? '/' . GIVE_SLUG . '/' : '/donations/' ); ?></td> |
|
573 | + <td data-export-label="Give Forms Slug"><?php _e('Give Forms Slug', 'give'); ?>:</td> |
|
574 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The slug used for Give donation forms.', 'give')); ?></td> |
|
575 | + <td><?php echo esc_html(defined('GIVE_SLUG') ? '/'.GIVE_SLUG.'/' : '/donations/'); ?></td> |
|
577 | 576 | </tr> |
578 | 577 | <?php |
579 | 578 | $active_gateways = give_get_enabled_payment_gateways(); |
580 | 579 | $enabled_gateways = $default_gateway = ''; |
581 | 580 | |
582 | - if ( $active_gateways ) { |
|
583 | - $default_gateway_is_active = give_is_gateway_active( give_get_default_gateway( null ) ); |
|
581 | + if ($active_gateways) { |
|
582 | + $default_gateway_is_active = give_is_gateway_active(give_get_default_gateway(null)); |
|
584 | 583 | |
585 | - if ( $default_gateway_is_active ) { |
|
586 | - $default_gateway = give_get_default_gateway( null ); |
|
587 | - $default_gateway = $active_gateways[ $default_gateway ]['admin_label']; |
|
584 | + if ($default_gateway_is_active) { |
|
585 | + $default_gateway = give_get_default_gateway(null); |
|
586 | + $default_gateway = $active_gateways[$default_gateway]['admin_label']; |
|
588 | 587 | } else { |
589 | - $default_gateway = __( 'Test Donation', 'give' ); |
|
588 | + $default_gateway = __('Test Donation', 'give'); |
|
590 | 589 | } |
591 | 590 | |
592 | 591 | $gateways = array(); |
593 | 592 | |
594 | - foreach ( $active_gateways as $gateway ) { |
|
593 | + foreach ($active_gateways as $gateway) { |
|
595 | 594 | $gateways[] = $gateway['admin_label']; |
596 | 595 | } |
597 | 596 | |
598 | - $enabled_gateways = implode( ', ', $gateways ); |
|
597 | + $enabled_gateways = implode(', ', $gateways); |
|
599 | 598 | } |
600 | 599 | ?> |
601 | 600 | <tr> |
602 | - <td data-export-label="Enabled Payment Gateways"><?php _e( 'Enabled Payment Gateways', 'give' ); ?>:</td> |
|
603 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'All payment gateways enabled in Give settings.', 'give' ) ); ?></td> |
|
604 | - <td><?php echo esc_html( ! empty( $enabled_gateways ) ? $enabled_gateways : '–' ); ?></td> |
|
601 | + <td data-export-label="Enabled Payment Gateways"><?php _e('Enabled Payment Gateways', 'give'); ?>:</td> |
|
602 | + <td class="help"><?php echo Give()->tooltips->render_help(__('All payment gateways enabled in Give settings.', 'give')); ?></td> |
|
603 | + <td><?php echo esc_html( ! empty($enabled_gateways) ? $enabled_gateways : '–'); ?></td> |
|
605 | 604 | </tr> |
606 | 605 | <tr> |
607 | - <td data-export-label="Default Payment Gateway"><?php _e( 'Default Payment Gateway', 'give' ); ?>:</td> |
|
608 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The default payment gateway selected in Give settings.', 'give' ) ); ?></td> |
|
609 | - <td><?php echo esc_html( ! empty( $default_gateway ) ? $default_gateway : '–' ); ?></td> |
|
606 | + <td data-export-label="Default Payment Gateway"><?php _e('Default Payment Gateway', 'give'); ?>:</td> |
|
607 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The default payment gateway selected in Give settings.', 'give')); ?></td> |
|
608 | + <td><?php echo esc_html( ! empty($default_gateway) ? $default_gateway : '–'); ?></td> |
|
610 | 609 | </tr> |
611 | 610 | <tr> |
612 | - <td data-export-label="PayPal IPN Verification"><?php _e( 'PayPal IPN Verification', 'give' ); ?>:</td> |
|
613 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether admins requires verification of IPN notifications with PayPal.', 'give' ) ); ?></td> |
|
614 | - <td><?php echo 'enabled' === give_get_option( 'paypal_verification' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
611 | + <td data-export-label="PayPal IPN Verification"><?php _e('PayPal IPN Verification', 'give'); ?>:</td> |
|
612 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether admins requires verification of IPN notifications with PayPal.', 'give')); ?></td> |
|
613 | + <td><?php echo 'enabled' === give_get_option('paypal_verification') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
615 | 614 | </tr> |
616 | 615 | <tr> |
617 | - <td data-export-label="PayPal IPN Notifications"><?php _e( 'PayPal IPN Notifications', 'give' ); ?>:</td> |
|
618 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Displays whether when last PayPal IPN is received with which donation or transaction.', 'give' ) ); ?></td> |
|
616 | + <td data-export-label="PayPal IPN Notifications"><?php _e('PayPal IPN Notifications', 'give'); ?>:</td> |
|
617 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Displays whether when last PayPal IPN is received with which donation or transaction.', 'give')); ?></td> |
|
619 | 618 | <td> |
620 | 619 | <?php |
621 | - $last_paypal_ipn_received = get_option( 'give_last_paypal_ipn_received' ); |
|
620 | + $last_paypal_ipn_received = get_option('give_last_paypal_ipn_received'); |
|
622 | 621 | $donation_id = $last_paypal_ipn_received['payment_id']; |
623 | 622 | if ( |
624 | - is_array( $last_paypal_ipn_received ) |
|
625 | - && count( $last_paypal_ipn_received ) > 0 |
|
626 | - && get_post( $donation_id ) instanceof WP_Post |
|
623 | + is_array($last_paypal_ipn_received) |
|
624 | + && count($last_paypal_ipn_received) > 0 |
|
625 | + && get_post($donation_id) instanceof WP_Post |
|
627 | 626 | ) { |
628 | - $ipn_timestamp = give_get_meta( $donation_id, 'give_last_paypal_ipn_received', true ); |
|
629 | - $transaction_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=' . $last_paypal_ipn_received['transaction_id']; |
|
630 | - $donation_url = site_url() . '/wp-admin/edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $donation_id; |
|
627 | + $ipn_timestamp = give_get_meta($donation_id, 'give_last_paypal_ipn_received', true); |
|
628 | + $transaction_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id='.$last_paypal_ipn_received['transaction_id']; |
|
629 | + $donation_url = site_url().'/wp-admin/edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$donation_id; |
|
631 | 630 | echo sprintf( |
632 | - __( 'IPN received for <a href="%s">#%s</a> ( <a href="%s" target="_blank">%s</a> ) on %s at %s. Status %s', 'give' ), |
|
631 | + __('IPN received for <a href="%s">#%s</a> ( <a href="%s" target="_blank">%s</a> ) on %s at %s. Status %s', 'give'), |
|
633 | 632 | $donation_url, |
634 | 633 | $donation_id, |
635 | 634 | $transaction_url, |
636 | 635 | $last_paypal_ipn_received['transaction_id'], |
637 | - date_i18n( 'm/d/Y', $ipn_timestamp ), |
|
638 | - date_i18n( 'H:i', $ipn_timestamp ), |
|
636 | + date_i18n('m/d/Y', $ipn_timestamp), |
|
637 | + date_i18n('H:i', $ipn_timestamp), |
|
639 | 638 | $last_paypal_ipn_received['auth_status'] |
640 | 639 | ); |
641 | 640 | } else { |
@@ -645,9 +644,9 @@ discard block |
||
645 | 644 | </td> |
646 | 645 | </tr> |
647 | 646 | <tr> |
648 | - <td data-export-label="Donor Email Access"><?php _e( 'Donor Email Access', 'give' ); ?>:</td> |
|
649 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether donors can access their donation history using only email.', 'give' ) ); ?></td> |
|
650 | - <td><?php echo 'enabled' === give_get_option( 'email_access' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
647 | + <td data-export-label="Donor Email Access"><?php _e('Donor Email Access', 'give'); ?>:</td> |
|
648 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether donors can access their donation history using only email.', 'give')); ?></td> |
|
649 | + <td><?php echo 'enabled' === give_get_option('email_access') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
651 | 650 | </tr> |
652 | 651 | </tbody> |
653 | 652 | </table> |
@@ -655,13 +654,13 @@ discard block |
||
655 | 654 | <table class="give-status-table widefat" cellspacing="0"> |
656 | 655 | <thead> |
657 | 656 | <tr> |
658 | - <th colspan="3" data-export-label="Active Give Add-ons"><h2><?php _e( 'Active Give Add-ons', 'give' ); ?></h2></th> |
|
657 | + <th colspan="3" data-export-label="Active Give Add-ons"><h2><?php _e('Active Give Add-ons', 'give'); ?></h2></th> |
|
659 | 658 | </tr> |
660 | 659 | </thead> |
661 | 660 | <tbody> |
662 | 661 | <?php |
663 | - foreach ( $plugins as $plugin_data ) { |
|
664 | - if ( 'active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type'] ) { |
|
662 | + foreach ($plugins as $plugin_data) { |
|
663 | + if ('active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type']) { |
|
665 | 664 | continue; |
666 | 665 | } |
667 | 666 | |
@@ -669,40 +668,40 @@ discard block |
||
669 | 668 | $author_name = $plugin_data['Author']; |
670 | 669 | |
671 | 670 | // Link the plugin name to the plugin URL if available. |
672 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
671 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
673 | 672 | $plugin_name = sprintf( |
674 | 673 | '<a href="%s" title="%s">%s</a>', |
675 | - esc_url( $plugin_data['PluginURI'] ), |
|
676 | - esc_attr__( 'Visit plugin homepage', 'give' ), |
|
674 | + esc_url($plugin_data['PluginURI']), |
|
675 | + esc_attr__('Visit plugin homepage', 'give'), |
|
677 | 676 | $plugin_name |
678 | 677 | ); |
679 | 678 | } |
680 | 679 | |
681 | 680 | // Link the author name to the author URL if available. |
682 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
681 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
683 | 682 | $author_name = sprintf( |
684 | 683 | '<a href="%s" title="%s">%s</a>', |
685 | - esc_url( $plugin_data['AuthorURI'] ), |
|
686 | - esc_attr__( 'Visit author homepage', 'give' ), |
|
684 | + esc_url($plugin_data['AuthorURI']), |
|
685 | + esc_attr__('Visit author homepage', 'give'), |
|
687 | 686 | $author_name |
688 | 687 | ); |
689 | 688 | } |
690 | 689 | ?> |
691 | 690 | <tr> |
692 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
691 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
693 | 692 | <td class="help"> </td> |
694 | 693 | <td> |
695 | 694 | <?php |
696 | - if ( true === $plugin_data['License'] ) { |
|
697 | - echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark> ' . __( 'Licensed', 'give' ); |
|
695 | + if (true === $plugin_data['License']) { |
|
696 | + echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark> '.__('Licensed', 'give'); |
|
698 | 697 | } else { |
699 | - echo '<mark class="error"><span class="dashicons dashicons-no-alt"></span></mark> ' . __( 'Unlicensed', 'give' ); |
|
698 | + echo '<mark class="error"><span class="dashicons dashicons-no-alt"></span></mark> '.__('Unlicensed', 'give'); |
|
700 | 699 | } |
701 | 700 | |
702 | 701 | echo ' – ' |
703 | - . sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) |
|
702 | + . sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))) |
|
704 | 703 | . ' – ' |
705 | - . esc_html( $plugin_data['Version'] ); |
|
704 | + . esc_html($plugin_data['Version']); |
|
706 | 705 | ?> |
707 | 706 | </td> |
708 | 707 | </tr> |
@@ -715,18 +714,18 @@ discard block |
||
715 | 714 | <table class="give-status-table widefat" cellspacing="0"> |
716 | 715 | <thead> |
717 | 716 | <tr> |
718 | - <th colspan="3" data-export-label="Other Active Plugins"><h2><?php _e( 'Other Active Plugins', 'give' ); ?></h2></th> |
|
717 | + <th colspan="3" data-export-label="Other Active Plugins"><h2><?php _e('Other Active Plugins', 'give'); ?></h2></th> |
|
719 | 718 | </tr> |
720 | 719 | </thead> |
721 | 720 | <tbody> |
722 | 721 | <?php |
723 | - foreach ( $plugins as $plugin_data ) { |
|
724 | - if ( 'active' != $plugin_data['Status'] || 'other' != $plugin_data['Type'] ) { |
|
722 | + foreach ($plugins as $plugin_data) { |
|
723 | + if ('active' != $plugin_data['Status'] || 'other' != $plugin_data['Type']) { |
|
725 | 724 | continue; |
726 | 725 | } |
727 | 726 | |
728 | 727 | // Do not show Give core plugin. |
729 | - if ( 'Give - Donation Plugin' === $plugin_data['Name'] ) { |
|
728 | + if ('Give - Donation Plugin' === $plugin_data['Name']) { |
|
730 | 729 | continue; |
731 | 730 | } |
732 | 731 | |
@@ -734,29 +733,29 @@ discard block |
||
734 | 733 | $author_name = $plugin_data['Author']; |
735 | 734 | |
736 | 735 | // Link the plugin name to the plugin URL if available. |
737 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
736 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
738 | 737 | $plugin_name = sprintf( |
739 | 738 | '<a href="%s" title="%s">%s</a>', |
740 | - esc_url( $plugin_data['PluginURI'] ), |
|
741 | - esc_attr__( 'Visit plugin homepage', 'give' ), |
|
739 | + esc_url($plugin_data['PluginURI']), |
|
740 | + esc_attr__('Visit plugin homepage', 'give'), |
|
742 | 741 | $plugin_name |
743 | 742 | ); |
744 | 743 | } |
745 | 744 | |
746 | 745 | // Link the author name to the author URL if available. |
747 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
746 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
748 | 747 | $author_name = sprintf( |
749 | 748 | '<a href="%s" title="%s">%s</a>', |
750 | - esc_url( $plugin_data['AuthorURI'] ), |
|
751 | - esc_attr__( 'Visit author homepage', 'give' ), |
|
749 | + esc_url($plugin_data['AuthorURI']), |
|
750 | + esc_attr__('Visit author homepage', 'give'), |
|
752 | 751 | $author_name |
753 | 752 | ); |
754 | 753 | } |
755 | 754 | ?> |
756 | 755 | <tr> |
757 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
756 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
758 | 757 | <td class="help"> </td> |
759 | - <td><?php echo sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) . ' – ' . esc_html( $plugin_data['Version'] ); ?></td> |
|
758 | + <td><?php echo sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))).' – '.esc_html($plugin_data['Version']); ?></td> |
|
760 | 759 | </tr> |
761 | 760 | <?php |
762 | 761 | } |
@@ -767,13 +766,13 @@ discard block |
||
767 | 766 | <table class="give-status-table widefat" cellspacing="0"> |
768 | 767 | <thead> |
769 | 768 | <tr> |
770 | - <th colspan="3" data-export-label="Inactive Plugins"><h2><?php _e( 'Inactive Plugins', 'give' ); ?></h2></th> |
|
769 | + <th colspan="3" data-export-label="Inactive Plugins"><h2><?php _e('Inactive Plugins', 'give'); ?></h2></th> |
|
771 | 770 | </tr> |
772 | 771 | </thead> |
773 | 772 | <tbody> |
774 | 773 | <?php |
775 | - foreach ( $plugins as $plugin_data ) { |
|
776 | - if ( 'inactive' != $plugin_data['Status'] ) { |
|
774 | + foreach ($plugins as $plugin_data) { |
|
775 | + if ('inactive' != $plugin_data['Status']) { |
|
777 | 776 | continue; |
778 | 777 | } |
779 | 778 | |
@@ -781,29 +780,29 @@ discard block |
||
781 | 780 | $author_name = $plugin_data['Author']; |
782 | 781 | |
783 | 782 | // Link the plugin name to the plugin URL if available. |
784 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
783 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
785 | 784 | $plugin_name = sprintf( |
786 | 785 | '<a href="%s" title="%s">%s</a>', |
787 | - esc_url( $plugin_data['PluginURI'] ), |
|
788 | - esc_attr__( 'Visit plugin homepage', 'give' ), |
|
786 | + esc_url($plugin_data['PluginURI']), |
|
787 | + esc_attr__('Visit plugin homepage', 'give'), |
|
789 | 788 | $plugin_name |
790 | 789 | ); |
791 | 790 | } |
792 | 791 | |
793 | 792 | // Link the author name to the author URL if available. |
794 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
793 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
795 | 794 | $author_name = sprintf( |
796 | 795 | '<a href="%s" title="%s">%s</a>', |
797 | - esc_url( $plugin_data['AuthorURI'] ), |
|
798 | - esc_attr__( 'Visit author homepage', 'give' ), |
|
796 | + esc_url($plugin_data['AuthorURI']), |
|
797 | + esc_attr__('Visit author homepage', 'give'), |
|
799 | 798 | $author_name |
800 | 799 | ); |
801 | 800 | } |
802 | 801 | ?> |
803 | 802 | <tr> |
804 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
803 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
805 | 804 | <td class="help"> </td> |
806 | - <td><?php echo sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) . ' – ' . esc_html( $plugin_data['Version'] ); ?></td> |
|
805 | + <td><?php echo sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))).' – '.esc_html($plugin_data['Version']); ?></td> |
|
807 | 806 | </tr> |
808 | 807 | <?php |
809 | 808 | } |
@@ -813,38 +812,38 @@ discard block |
||
813 | 812 | |
814 | 813 | <?php |
815 | 814 | $active_mu_plugins = (array) get_mu_plugins(); |
816 | -if ( ! empty( $active_mu_plugins ) ) { |
|
815 | +if ( ! empty($active_mu_plugins)) { |
|
817 | 816 | ?> |
818 | 817 | <table class="give-status-table widefat" cellspacing="0"> |
819 | 818 | <thead> |
820 | 819 | <tr> |
821 | - <th colspan="3" data-export-label="Active MU Plugins"><h2><?php _e( 'Active MU Plugins', 'give' ); ?></h2></th> |
|
820 | + <th colspan="3" data-export-label="Active MU Plugins"><h2><?php _e('Active MU Plugins', 'give'); ?></h2></th> |
|
822 | 821 | </tr> |
823 | 822 | </thead> |
824 | 823 | <tbody> |
825 | 824 | <?php |
826 | 825 | |
827 | - foreach ( $active_mu_plugins as $mu_plugin_data ) { |
|
828 | - if ( ! empty( $mu_plugin_data['Name'] ) ) { |
|
826 | + foreach ($active_mu_plugins as $mu_plugin_data) { |
|
827 | + if ( ! empty($mu_plugin_data['Name'])) { |
|
829 | 828 | // Link the plugin name to the plugin URL if available. |
830 | - $plugin_name = esc_html( $mu_plugin_data['Name'] ); |
|
829 | + $plugin_name = esc_html($mu_plugin_data['Name']); |
|
831 | 830 | |
832 | - if ( ! empty( $mu_plugin_data['PluginURI'] ) ) { |
|
831 | + if ( ! empty($mu_plugin_data['PluginURI'])) { |
|
833 | 832 | $plugin_name = sprintf( |
834 | 833 | '<a href="%s" title="%s">%s</a>', |
835 | - esc_url( $mu_plugin_data['PluginURI'] ), |
|
836 | - esc_attr__( 'Visit plugin homepage', 'give' ), |
|
834 | + esc_url($mu_plugin_data['PluginURI']), |
|
835 | + esc_attr__('Visit plugin homepage', 'give'), |
|
837 | 836 | $plugin_name |
838 | 837 | ); |
839 | 838 | } |
840 | 839 | |
841 | 840 | // Link the author name to the author URL if available. |
842 | - $author_name = esc_html( $mu_plugin_data['Author'] ); |
|
841 | + $author_name = esc_html($mu_plugin_data['Author']); |
|
843 | 842 | |
844 | - if ( ! empty( $mu_plugin_data['AuthorURI'] ) ) { |
|
843 | + if ( ! empty($mu_plugin_data['AuthorURI'])) { |
|
845 | 844 | $author_name = sprintf( |
846 | 845 | '<a href="%s">%s</a>', |
847 | - esc_url( $mu_plugin_data['AuthorURI'] ), |
|
846 | + esc_url($mu_plugin_data['AuthorURI']), |
|
848 | 847 | $author_name |
849 | 848 | ); |
850 | 849 | } |
@@ -852,7 +851,7 @@ discard block |
||
852 | 851 | <tr> |
853 | 852 | <td><?php echo $plugin_name; ?></td> |
854 | 853 | <td class="help"> </td> |
855 | - <td><?php echo sprintf( _x( 'by %s', 'by author', 'give' ), $author_name ) . ' – ' . esc_html( $mu_plugin_data['Version'] ); ?></td> |
|
854 | + <td><?php echo sprintf(_x('by %s', 'by author', 'give'), $author_name).' – '.esc_html($mu_plugin_data['Version']); ?></td> |
|
856 | 855 | </tr> |
857 | 856 | <?php |
858 | 857 | } |
@@ -865,53 +864,53 @@ discard block |
||
865 | 864 | <table class="give-status-table widefat" cellspacing="0"> |
866 | 865 | <thead> |
867 | 866 | <tr> |
868 | - <th colspan="3" data-export-label="Theme"><h2><?php _e( 'Theme', 'give' ); ?></h2></th> |
|
867 | + <th colspan="3" data-export-label="Theme"><h2><?php _e('Theme', 'give'); ?></h2></th> |
|
869 | 868 | </tr> |
870 | 869 | </thead> |
871 | 870 | <?php |
872 | - include_once( ABSPATH . 'wp-admin/includes/theme-install.php' ); |
|
871 | + include_once(ABSPATH.'wp-admin/includes/theme-install.php'); |
|
873 | 872 | $active_theme = wp_get_theme(); |
874 | 873 | ?> |
875 | 874 | <tbody> |
876 | 875 | <tr> |
877 | - <td data-export-label="Name"><?php _e( 'Name', 'give' ); ?>:</td> |
|
878 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The name of the current active theme.', 'give' ) ); ?></td> |
|
879 | - <td><?php echo esc_html( $active_theme->Name ); ?></td> |
|
876 | + <td data-export-label="Name"><?php _e('Name', 'give'); ?>:</td> |
|
877 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The name of the current active theme.', 'give')); ?></td> |
|
878 | + <td><?php echo esc_html($active_theme->Name); ?></td> |
|
880 | 879 | </tr> |
881 | 880 | <tr> |
882 | - <td data-export-label="Version"><?php _e( 'Version', 'give' ); ?>:</td> |
|
883 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The installed version of the current active theme.', 'give' ) ); ?></td> |
|
884 | - <td><?php echo esc_html( $active_theme->Version ); ?></td> |
|
881 | + <td data-export-label="Version"><?php _e('Version', 'give'); ?>:</td> |
|
882 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The installed version of the current active theme.', 'give')); ?></td> |
|
883 | + <td><?php echo esc_html($active_theme->Version); ?></td> |
|
885 | 884 | </tr> |
886 | 885 | <tr> |
887 | - <td data-export-label="Author URL"><?php _e( 'Author URL', 'give' ); ?>:</td> |
|
888 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The theme developer\'s URL.', 'give' ) ); ?></td> |
|
886 | + <td data-export-label="Author URL"><?php _e('Author URL', 'give'); ?>:</td> |
|
887 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The theme developer\'s URL.', 'give')); ?></td> |
|
889 | 888 | <td><?php echo $active_theme->{'Author URI'}; ?></td> |
890 | 889 | </tr> |
891 | 890 | <tr> |
892 | - <td data-export-label="Child Theme"><?php _e( 'Child Theme', 'give' ); ?>:</td> |
|
893 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'Whether the current theme is a child theme.', 'give' ) ); ?></td> |
|
891 | + <td data-export-label="Child Theme"><?php _e('Child Theme', 'give'); ?>:</td> |
|
892 | + <td class="help"><?php echo Give()->tooltips->render_help(__('Whether the current theme is a child theme.', 'give')); ?></td> |
|
894 | 893 | <td><?php |
895 | - echo is_child_theme() ? __( 'Yes', 'give' ) : __( 'No', 'give' ) . ' – ' . sprintf( __( 'If you\'re modifying Give on a parent theme you didn\'t build personally, then we recommend using a child theme. See: <a href="%s" target="_blank">How to Create a Child Theme</a>', 'give' ), 'https://codex.wordpress.org/Child_Themes' ); |
|
894 | + echo is_child_theme() ? __('Yes', 'give') : __('No', 'give').' – '.sprintf(__('If you\'re modifying Give on a parent theme you didn\'t build personally, then we recommend using a child theme. See: <a href="%s" target="_blank">How to Create a Child Theme</a>', 'give'), 'https://codex.wordpress.org/Child_Themes'); |
|
896 | 895 | ?></td> |
897 | 896 | </tr> |
898 | 897 | <?php |
899 | - if( is_child_theme() ) { |
|
900 | - $parent_theme = wp_get_theme( $active_theme->Template ); |
|
898 | + if (is_child_theme()) { |
|
899 | + $parent_theme = wp_get_theme($active_theme->Template); |
|
901 | 900 | ?> |
902 | 901 | <tr> |
903 | - <td data-export-label="Parent Theme Name"><?php _e( 'Parent Theme Name', 'give' ); ?>:</td> |
|
904 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The name of the parent theme.', 'give' ) ); ?></td> |
|
905 | - <td><?php echo esc_html( $parent_theme->Name ); ?></td> |
|
902 | + <td data-export-label="Parent Theme Name"><?php _e('Parent Theme Name', 'give'); ?>:</td> |
|
903 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The name of the parent theme.', 'give')); ?></td> |
|
904 | + <td><?php echo esc_html($parent_theme->Name); ?></td> |
|
906 | 905 | </tr> |
907 | 906 | <tr> |
908 | - <td data-export-label="Parent Theme Version"><?php _e( 'Parent Theme Version', 'give' ); ?>:</td> |
|
909 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The installed version of the parent theme.', 'give' ) ); ?></td> |
|
910 | - <td><?php echo esc_html( $parent_theme->Version ); ?></td> |
|
907 | + <td data-export-label="Parent Theme Version"><?php _e('Parent Theme Version', 'give'); ?>:</td> |
|
908 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The installed version of the parent theme.', 'give')); ?></td> |
|
909 | + <td><?php echo esc_html($parent_theme->Version); ?></td> |
|
911 | 910 | </tr> |
912 | 911 | <tr> |
913 | - <td data-export-label="Parent Theme Author URL"><?php _e( 'Parent Theme Author URL', 'give' ); ?>:</td> |
|
914 | - <td class="help"><?php echo Give()->tooltips->render_help( __( 'The parent theme developers URL.', 'give' ) ); ?></td> |
|
912 | + <td data-export-label="Parent Theme Author URL"><?php _e('Parent Theme Author URL', 'give'); ?>:</td> |
|
913 | + <td class="help"><?php echo Give()->tooltips->render_help(__('The parent theme developers URL.', 'give')); ?></td> |
|
915 | 914 | <td><?php echo $parent_theme->{'Author URI'}; ?></td> |
916 | 915 | </tr> |
917 | 916 | <?php } ?> |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | * |
566 | 566 | * @since 1.6.3 |
567 | 567 | * |
568 | - * @param $pending_reason |
|
568 | + * @param string $pending_reason |
|
569 | 569 | * |
570 | 570 | * @return string |
571 | 571 | */ |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | * @param int $payment_id Payment ID |
643 | 643 | * @param array $payment_data Array of payment data. |
644 | 644 | * |
645 | - * @return mixed|string |
|
645 | + * @return string |
|
646 | 646 | */ |
647 | 647 | function give_build_paypal_url( $payment_id, $payment_data ) { |
648 | 648 | // Only send to PayPal if the pending payment is created successfully. |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.0 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | * |
23 | 23 | * @return bool |
24 | 24 | */ |
25 | -function give_paypal_standard_billing_fields( $form_id ) { |
|
25 | +function give_paypal_standard_billing_fields($form_id) { |
|
26 | 26 | |
27 | - if ( give_is_setting_enabled( give_get_option( 'paypal_standard_billing_details' ) ) ) { |
|
28 | - give_default_cc_address_fields( $form_id ); |
|
27 | + if (give_is_setting_enabled(give_get_option('paypal_standard_billing_details'))) { |
|
28 | + give_default_cc_address_fields($form_id); |
|
29 | 29 | |
30 | 30 | return true; |
31 | 31 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | } |
36 | 36 | |
37 | -add_action( 'give_paypal_cc_form', 'give_paypal_standard_billing_fields' ); |
|
37 | +add_action('give_paypal_cc_form', 'give_paypal_standard_billing_fields'); |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Process PayPal Payment. |
@@ -45,28 +45,28 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @return void |
47 | 47 | */ |
48 | -function give_process_paypal_payment( $payment_data ) { |
|
48 | +function give_process_paypal_payment($payment_data) { |
|
49 | 49 | |
50 | 50 | // Validate nonce. |
51 | - give_validate_nonce( $payment_data['gateway_nonce'], 'give-gateway' ); |
|
51 | + give_validate_nonce($payment_data['gateway_nonce'], 'give-gateway'); |
|
52 | 52 | |
53 | - $payment_id = give_create_payment( $payment_data ); |
|
53 | + $payment_id = give_create_payment($payment_data); |
|
54 | 54 | |
55 | 55 | // Check payment. |
56 | - if ( empty( $payment_id ) ) { |
|
56 | + if (empty($payment_id)) { |
|
57 | 57 | // Record the error. |
58 | - give_record_gateway_error( __( 'Payment Error', 'give' ), sprintf( /* translators: %s: payment data */ |
|
59 | - __( 'Payment creation failed before sending donor to PayPal. Payment data: %s', 'give' ), json_encode( $payment_data ) ), $payment_id ); |
|
58 | + give_record_gateway_error(__('Payment Error', 'give'), sprintf( /* translators: %s: payment data */ |
|
59 | + __('Payment creation failed before sending donor to PayPal. Payment data: %s', 'give'), json_encode($payment_data) ), $payment_id); |
|
60 | 60 | // Problems? Send back. |
61 | - give_send_back_to_checkout( '?payment-mode=' . $payment_data['post_data']['give-gateway'] ); |
|
61 | + give_send_back_to_checkout('?payment-mode='.$payment_data['post_data']['give-gateway']); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | // Redirect to PayPal. |
65 | - wp_redirect( give_build_paypal_url( $payment_id, $payment_data ) ); |
|
65 | + wp_redirect(give_build_paypal_url($payment_id, $payment_data)); |
|
66 | 66 | exit; |
67 | 67 | } |
68 | 68 | |
69 | -add_action( 'give_gateway_paypal', 'give_process_paypal_payment' ); |
|
69 | +add_action('give_gateway_paypal', 'give_process_paypal_payment'); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Listens for a PayPal IPN requests and then sends to the processing function. |
@@ -77,17 +77,17 @@ discard block |
||
77 | 77 | function give_listen_for_paypal_ipn() { |
78 | 78 | |
79 | 79 | // Regular PayPal IPN. |
80 | - if ( isset( $_GET['give-listener'] ) && 'IPN' === $_GET['give-listener'] ) { |
|
80 | + if (isset($_GET['give-listener']) && 'IPN' === $_GET['give-listener']) { |
|
81 | 81 | /** |
82 | 82 | * Fires while verifying PayPal IPN |
83 | 83 | * |
84 | 84 | * @since 1.0 |
85 | 85 | */ |
86 | - do_action( 'give_verify_paypal_ipn' ); |
|
86 | + do_action('give_verify_paypal_ipn'); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | -add_action( 'init', 'give_listen_for_paypal_ipn' ); |
|
90 | +add_action('init', 'give_listen_for_paypal_ipn'); |
|
91 | 91 | |
92 | 92 | /** |
93 | 93 | * Process PayPal IPN |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | function give_process_paypal_ipn() { |
99 | 99 | |
100 | 100 | // Check the request method is POST. |
101 | - if ( isset( $_SERVER['REQUEST_METHOD'] ) && 'POST' !== $_SERVER['REQUEST_METHOD'] ) { |
|
101 | + if (isset($_SERVER['REQUEST_METHOD']) && 'POST' !== $_SERVER['REQUEST_METHOD']) { |
|
102 | 102 | return; |
103 | 103 | } |
104 | 104 | |
@@ -106,11 +106,11 @@ discard block |
||
106 | 106 | $post_data = ''; |
107 | 107 | |
108 | 108 | // Fallback just in case post_max_size is lower than needed. |
109 | - if ( ini_get( 'allow_url_fopen' ) ) { |
|
110 | - $post_data = file_get_contents( 'php://input' ); |
|
109 | + if (ini_get('allow_url_fopen')) { |
|
110 | + $post_data = file_get_contents('php://input'); |
|
111 | 111 | } else { |
112 | 112 | // If allow_url_fopen is not enabled, then make sure that post_max_size is large enough. |
113 | - ini_set( 'post_max_size', '12M' ); |
|
113 | + ini_set('post_max_size', '12M'); |
|
114 | 114 | } |
115 | 115 | // Start the encoded data collection with notification command. |
116 | 116 | $encoded_data = 'cmd=_notify-validate'; |
@@ -119,41 +119,41 @@ discard block |
||
119 | 119 | $arg_separator = give_get_php_arg_separator_output(); |
120 | 120 | |
121 | 121 | // Verify there is a post_data. |
122 | - if ( $post_data || strlen( $post_data ) > 0 ) { |
|
122 | + if ($post_data || strlen($post_data) > 0) { |
|
123 | 123 | // Append the data. |
124 | - $encoded_data .= $arg_separator . $post_data; |
|
124 | + $encoded_data .= $arg_separator.$post_data; |
|
125 | 125 | } else { |
126 | 126 | // Check if POST is empty. |
127 | - if ( empty( $_POST ) ) { |
|
127 | + if (empty($_POST)) { |
|
128 | 128 | // Nothing to do. |
129 | 129 | return; |
130 | 130 | } else { |
131 | 131 | // Loop through each POST. |
132 | - foreach ( $_POST as $key => $value ) { |
|
132 | + foreach ($_POST as $key => $value) { |
|
133 | 133 | // Encode the value and append the data. |
134 | - $encoded_data .= $arg_separator . "$key=" . urlencode( $value ); |
|
134 | + $encoded_data .= $arg_separator."$key=".urlencode($value); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
139 | 139 | // Convert collected post data to an array. |
140 | - parse_str( $encoded_data, $encoded_data_array ); |
|
140 | + parse_str($encoded_data, $encoded_data_array); |
|
141 | 141 | |
142 | - foreach ( $encoded_data_array as $key => $value ) { |
|
142 | + foreach ($encoded_data_array as $key => $value) { |
|
143 | 143 | |
144 | - if ( false !== strpos( $key, 'amp;' ) ) { |
|
145 | - $new_key = str_replace( '&', '&', $key ); |
|
146 | - $new_key = str_replace( 'amp;', '&', $new_key ); |
|
144 | + if (false !== strpos($key, 'amp;')) { |
|
145 | + $new_key = str_replace('&', '&', $key); |
|
146 | + $new_key = str_replace('amp;', '&', $new_key); |
|
147 | 147 | |
148 | - unset( $encoded_data_array[ $key ] ); |
|
149 | - $encoded_data_array[ $new_key ] = $value; |
|
148 | + unset($encoded_data_array[$key]); |
|
149 | + $encoded_data_array[$new_key] = $value; |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
153 | 153 | $api_response = false; |
154 | 154 | |
155 | 155 | // Validate IPN request w/ PayPal if user hasn't disabled this security measure. |
156 | - if ( give_is_setting_enabled( give_get_option( 'paypal_verification' ) ) ) { |
|
156 | + if (give_is_setting_enabled(give_get_option('paypal_verification'))) { |
|
157 | 157 | |
158 | 158 | $remote_post_vars = array( |
159 | 159 | 'method' => 'POST', |
@@ -173,25 +173,25 @@ discard block |
||
173 | 173 | ); |
174 | 174 | |
175 | 175 | // Validate the IPN. |
176 | - $api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars ); |
|
176 | + $api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars); |
|
177 | 177 | |
178 | - if ( is_wp_error( $api_response ) ) { |
|
179 | - give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */ |
|
180 | - __( 'Invalid IPN verification response. IPN data: %s', 'give' ), json_encode( $api_response ) ) ); |
|
178 | + if (is_wp_error($api_response)) { |
|
179 | + give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */ |
|
180 | + __('Invalid IPN verification response. IPN data: %s', 'give'), json_encode($api_response) )); |
|
181 | 181 | |
182 | 182 | return; // Something went wrong. |
183 | 183 | } |
184 | 184 | |
185 | - if ( 'VERIFIED' !== $api_response['body'] ) { |
|
186 | - give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */ |
|
187 | - __( 'Invalid IPN verification response. IPN data: %s', 'give' ), json_encode( $api_response ) ) ); |
|
185 | + if ('VERIFIED' !== $api_response['body']) { |
|
186 | + give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */ |
|
187 | + __('Invalid IPN verification response. IPN data: %s', 'give'), json_encode($api_response) )); |
|
188 | 188 | |
189 | 189 | return; // Response not okay. |
190 | 190 | } |
191 | 191 | }// End if(). |
192 | 192 | |
193 | 193 | // Check if $post_data_array has been populated. |
194 | - if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) { |
|
194 | + if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) { |
|
195 | 195 | return; |
196 | 196 | } |
197 | 197 | |
@@ -200,28 +200,28 @@ discard block |
||
200 | 200 | 'payment_status' => '', |
201 | 201 | ); |
202 | 202 | |
203 | - $encoded_data_array = wp_parse_args( $encoded_data_array, $defaults ); |
|
203 | + $encoded_data_array = wp_parse_args($encoded_data_array, $defaults); |
|
204 | 204 | |
205 | - $payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0; |
|
205 | + $payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0; |
|
206 | 206 | $txn_type = $encoded_data_array['txn_type']; |
207 | 207 | |
208 | 208 | // Check for PayPal IPN Notifications and update data based on it. |
209 | - $current_timestamp = current_time( 'timestamp' ); |
|
209 | + $current_timestamp = current_time('timestamp'); |
|
210 | 210 | $paypal_ipn_vars = array( |
211 | - 'auth_status' => isset( $api_response['body'] ) ? $api_response['body'] : 'N/A', |
|
212 | - 'transaction_id' => isset( $encoded_data_array['txn_id'] ) ? $encoded_data_array['txn_id'] : 'N/A', |
|
211 | + 'auth_status' => isset($api_response['body']) ? $api_response['body'] : 'N/A', |
|
212 | + 'transaction_id' => isset($encoded_data_array['txn_id']) ? $encoded_data_array['txn_id'] : 'N/A', |
|
213 | 213 | 'payment_id' => $payment_id, |
214 | 214 | ); |
215 | - update_option( 'give_last_paypal_ipn_received', $paypal_ipn_vars, false ); |
|
216 | - give_insert_payment_note( $payment_id, sprintf( |
|
217 | - __( 'IPN received on %s at %s', 'give' ), |
|
218 | - date_i18n( 'm/d/Y', $current_timestamp ), |
|
219 | - date_i18n( 'H:i', $current_timestamp ) |
|
215 | + update_option('give_last_paypal_ipn_received', $paypal_ipn_vars, false); |
|
216 | + give_insert_payment_note($payment_id, sprintf( |
|
217 | + __('IPN received on %s at %s', 'give'), |
|
218 | + date_i18n('m/d/Y', $current_timestamp), |
|
219 | + date_i18n('H:i', $current_timestamp) |
|
220 | 220 | ) |
221 | 221 | ); |
222 | - give_update_meta( $payment_id, 'give_last_paypal_ipn_received', $current_timestamp ); |
|
222 | + give_update_meta($payment_id, 'give_last_paypal_ipn_received', $current_timestamp); |
|
223 | 223 | |
224 | - if ( has_action( 'give_paypal_' . $txn_type ) ) { |
|
224 | + if (has_action('give_paypal_'.$txn_type)) { |
|
225 | 225 | /** |
226 | 226 | * Fires while processing PayPal IPN $txn_type. |
227 | 227 | * |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @param array $encoded_data_array Encoded data. |
233 | 233 | * @param int $payment_id Payment id. |
234 | 234 | */ |
235 | - do_action( "give_paypal_{$txn_type}", $encoded_data_array, $payment_id ); |
|
235 | + do_action("give_paypal_{$txn_type}", $encoded_data_array, $payment_id); |
|
236 | 236 | } else { |
237 | 237 | /** |
238 | 238 | * Fires while process PayPal IPN. |
@@ -244,12 +244,12 @@ discard block |
||
244 | 244 | * @param array $encoded_data_array Encoded data. |
245 | 245 | * @param int $payment_id Payment id. |
246 | 246 | */ |
247 | - do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id ); |
|
247 | + do_action('give_paypal_web_accept', $encoded_data_array, $payment_id); |
|
248 | 248 | } |
249 | 249 | exit; |
250 | 250 | } |
251 | 251 | |
252 | -add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' ); |
|
252 | +add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn'); |
|
253 | 253 | |
254 | 254 | /** |
255 | 255 | * Process web accept (one time) payment IPNs. |
@@ -261,99 +261,99 @@ discard block |
||
261 | 261 | * |
262 | 262 | * @return void |
263 | 263 | */ |
264 | -function give_process_paypal_web_accept( $data, $payment_id ) { |
|
264 | +function give_process_paypal_web_accept($data, $payment_id) { |
|
265 | 265 | |
266 | 266 | // Only allow through these transaction types. |
267 | - if ( 'web_accept' !== $data['txn_type'] && 'cart' !== $data['txn_type'] && 'refunded' !== strtolower( $data['payment_status'] ) ) { |
|
267 | + if ('web_accept' !== $data['txn_type'] && 'cart' !== $data['txn_type'] && 'refunded' !== strtolower($data['payment_status'])) { |
|
268 | 268 | return; |
269 | 269 | } |
270 | 270 | |
271 | 271 | // Need $payment_id to continue. |
272 | - if ( empty( $payment_id ) ) { |
|
272 | + if (empty($payment_id)) { |
|
273 | 273 | return; |
274 | 274 | } |
275 | 275 | |
276 | 276 | // Collect donation payment details. |
277 | 277 | $paypal_amount = $data['mc_gross']; |
278 | - $payment_status = strtolower( $data['payment_status'] ); |
|
279 | - $currency_code = strtolower( $data['mc_currency'] ); |
|
280 | - $business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] ); |
|
281 | - $payment_meta = give_get_payment_meta( $payment_id ); |
|
278 | + $payment_status = strtolower($data['payment_status']); |
|
279 | + $currency_code = strtolower($data['mc_currency']); |
|
280 | + $business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']); |
|
281 | + $payment_meta = give_get_payment_meta($payment_id); |
|
282 | 282 | |
283 | 283 | // Must be a PayPal standard IPN. |
284 | - if ( 'paypal' !== give_get_payment_gateway( $payment_id ) ) { |
|
284 | + if ('paypal' !== give_get_payment_gateway($payment_id)) { |
|
285 | 285 | return; |
286 | 286 | } |
287 | 287 | |
288 | 288 | // Verify payment recipient. |
289 | - if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) !== 0 ) { |
|
289 | + if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) !== 0) { |
|
290 | 290 | |
291 | - give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */ |
|
292 | - __( 'Invalid business email in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id ); |
|
293 | - give_update_payment_status( $payment_id, 'failed' ); |
|
294 | - give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid PayPal business email.', 'give' ) ); |
|
291 | + give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */ |
|
292 | + __('Invalid business email in IPN response. IPN data: %s', 'give'), json_encode($data) ), $payment_id); |
|
293 | + give_update_payment_status($payment_id, 'failed'); |
|
294 | + give_insert_payment_note($payment_id, __('Payment failed due to invalid PayPal business email.', 'give')); |
|
295 | 295 | |
296 | 296 | return; |
297 | 297 | } |
298 | 298 | |
299 | 299 | // Verify payment currency. |
300 | - if ( $currency_code !== strtolower( $payment_meta['currency'] ) ) { |
|
300 | + if ($currency_code !== strtolower($payment_meta['currency'])) { |
|
301 | 301 | |
302 | - give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */ |
|
303 | - __( 'Invalid currency in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id ); |
|
304 | - give_update_payment_status( $payment_id, 'failed' ); |
|
305 | - give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) ); |
|
302 | + give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */ |
|
303 | + __('Invalid currency in IPN response. IPN data: %s', 'give'), json_encode($data) ), $payment_id); |
|
304 | + give_update_payment_status($payment_id, 'failed'); |
|
305 | + give_insert_payment_note($payment_id, __('Payment failed due to invalid currency in PayPal IPN.', 'give')); |
|
306 | 306 | |
307 | 307 | return; |
308 | 308 | } |
309 | 309 | |
310 | 310 | // Process refunds & reversed. |
311 | - if ( 'refunded' === $payment_status || 'reversed' === $payment_status ) { |
|
312 | - give_process_paypal_refund( $data, $payment_id ); |
|
311 | + if ('refunded' === $payment_status || 'reversed' === $payment_status) { |
|
312 | + give_process_paypal_refund($data, $payment_id); |
|
313 | 313 | |
314 | 314 | return; |
315 | 315 | } |
316 | 316 | |
317 | 317 | // Only complete payments once. |
318 | - if ( 'publish' === get_post_status( $payment_id ) ) { |
|
318 | + if ('publish' === get_post_status($payment_id)) { |
|
319 | 319 | return; |
320 | 320 | } |
321 | 321 | |
322 | 322 | // Retrieve the total donation amount (before PayPal). |
323 | - $payment_amount = give_donation_amount( $payment_id ); |
|
323 | + $payment_amount = give_donation_amount($payment_id); |
|
324 | 324 | |
325 | 325 | // Check that the donation PP and local db amounts match. |
326 | - if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) { |
|
326 | + if (number_format((float) $paypal_amount, 2) < number_format((float) $payment_amount, 2)) { |
|
327 | 327 | // The prices don't match |
328 | - give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */ |
|
329 | - __( 'Invalid payment amount in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id ); |
|
330 | - give_update_payment_status( $payment_id, 'failed' ); |
|
331 | - give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid amount in PayPal IPN.', 'give' ) ); |
|
328 | + give_record_gateway_error(__('IPN Error', 'give'), sprintf( /* translators: %s: Paypal IPN response */ |
|
329 | + __('Invalid payment amount in IPN response. IPN data: %s', 'give'), json_encode($data) ), $payment_id); |
|
330 | + give_update_payment_status($payment_id, 'failed'); |
|
331 | + give_insert_payment_note($payment_id, __('Payment failed due to invalid amount in PayPal IPN.', 'give')); |
|
332 | 332 | |
333 | 333 | return; |
334 | 334 | } |
335 | 335 | |
336 | 336 | // Process completed donations. |
337 | - if ( 'completed' === $payment_status || give_is_test_mode() ) { |
|
337 | + if ('completed' === $payment_status || give_is_test_mode()) { |
|
338 | 338 | |
339 | - give_insert_payment_note( $payment_id, sprintf( /* translators: %s: Paypal transaction ID */ |
|
340 | - __( 'PayPal Transaction ID: %s', 'give' ), $data['txn_id'] ) ); |
|
341 | - give_set_payment_transaction_id( $payment_id, $data['txn_id'] ); |
|
342 | - give_update_payment_status( $payment_id, 'publish' ); |
|
339 | + give_insert_payment_note($payment_id, sprintf( /* translators: %s: Paypal transaction ID */ |
|
340 | + __('PayPal Transaction ID: %s', 'give'), $data['txn_id'] )); |
|
341 | + give_set_payment_transaction_id($payment_id, $data['txn_id']); |
|
342 | + give_update_payment_status($payment_id, 'publish'); |
|
343 | 343 | |
344 | - } elseif ( 'pending' === $payment_status && isset( $data['pending_reason'] ) ) { |
|
344 | + } elseif ('pending' === $payment_status && isset($data['pending_reason'])) { |
|
345 | 345 | |
346 | 346 | // Look for possible pending reasons, such as an echeck. |
347 | - $note = give_paypal_get_pending_donation_note( strtolower( $data['pending_reason'] ) ); |
|
347 | + $note = give_paypal_get_pending_donation_note(strtolower($data['pending_reason'])); |
|
348 | 348 | |
349 | - if ( ! empty( $note ) ) { |
|
350 | - give_insert_payment_note( $payment_id, $note ); |
|
349 | + if ( ! empty($note)) { |
|
350 | + give_insert_payment_note($payment_id, $note); |
|
351 | 351 | } |
352 | 352 | } |
353 | 353 | |
354 | 354 | } |
355 | 355 | |
356 | -add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept', 10, 2 ); |
|
356 | +add_action('give_paypal_web_accept', 'give_process_paypal_web_accept', 10, 2); |
|
357 | 357 | |
358 | 358 | /** |
359 | 359 | * Process PayPal IPN Refunds |
@@ -365,35 +365,35 @@ discard block |
||
365 | 365 | * |
366 | 366 | * @return void |
367 | 367 | */ |
368 | -function give_process_paypal_refund( $data, $payment_id = 0 ) { |
|
368 | +function give_process_paypal_refund($data, $payment_id = 0) { |
|
369 | 369 | |
370 | 370 | // Collect payment details. |
371 | - if ( empty( $payment_id ) ) { |
|
371 | + if (empty($payment_id)) { |
|
372 | 372 | return; |
373 | 373 | } |
374 | 374 | |
375 | 375 | // Only refund payments once. |
376 | - if ( 'refunded' === get_post_status( $payment_id ) ) { |
|
376 | + if ('refunded' === get_post_status($payment_id)) { |
|
377 | 377 | return; |
378 | 378 | } |
379 | 379 | |
380 | - $payment_amount = give_donation_amount( $payment_id ); |
|
380 | + $payment_amount = give_donation_amount($payment_id); |
|
381 | 381 | $refund_amount = $data['payment_gross'] * - 1; |
382 | 382 | |
383 | - if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) { |
|
383 | + if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) { |
|
384 | 384 | |
385 | - give_insert_payment_note( $payment_id, sprintf( /* translators: %s: Paypal parent transaction ID */ |
|
386 | - __( 'Partial PayPal refund processed: %s', 'give' ), $data['parent_txn_id'] ) ); |
|
385 | + give_insert_payment_note($payment_id, sprintf( /* translators: %s: Paypal parent transaction ID */ |
|
386 | + __('Partial PayPal refund processed: %s', 'give'), $data['parent_txn_id'] )); |
|
387 | 387 | |
388 | 388 | return; // This is a partial refund |
389 | 389 | |
390 | 390 | } |
391 | 391 | |
392 | - give_insert_payment_note( $payment_id, sprintf( /* translators: 1: Paypal parent transaction ID 2. Paypal reason code */ |
|
393 | - __( 'PayPal Payment #%1$s Refunded for reason: %2$s', 'give' ), $data['parent_txn_id'], $data['reason_code'] ) ); |
|
394 | - give_insert_payment_note( $payment_id, sprintf( /* translators: %s: Paypal transaction ID */ |
|
395 | - __( 'PayPal Refund Transaction ID: %s', 'give' ), $data['txn_id'] ) ); |
|
396 | - give_update_payment_status( $payment_id, 'refunded' ); |
|
392 | + give_insert_payment_note($payment_id, sprintf( /* translators: 1: Paypal parent transaction ID 2. Paypal reason code */ |
|
393 | + __('PayPal Payment #%1$s Refunded for reason: %2$s', 'give'), $data['parent_txn_id'], $data['reason_code'] )); |
|
394 | + give_insert_payment_note($payment_id, sprintf( /* translators: %s: Paypal transaction ID */ |
|
395 | + __('PayPal Refund Transaction ID: %s', 'give'), $data['txn_id'] )); |
|
396 | + give_update_payment_status($payment_id, 'refunded'); |
|
397 | 397 | } |
398 | 398 | |
399 | 399 | /** |
@@ -405,24 +405,24 @@ discard block |
||
405 | 405 | * |
406 | 406 | * @return string |
407 | 407 | */ |
408 | -function give_get_paypal_redirect( $ssl_check = false ) { |
|
408 | +function give_get_paypal_redirect($ssl_check = false) { |
|
409 | 409 | |
410 | - if ( is_ssl() || ! $ssl_check ) { |
|
410 | + if (is_ssl() || ! $ssl_check) { |
|
411 | 411 | $protocol = 'https://'; |
412 | 412 | } else { |
413 | 413 | $protocol = 'http://'; |
414 | 414 | } |
415 | 415 | |
416 | 416 | // Check the current payment mode |
417 | - if ( give_is_test_mode() ) { |
|
417 | + if (give_is_test_mode()) { |
|
418 | 418 | // Test mode |
419 | - $paypal_uri = $protocol . 'www.sandbox.paypal.com/cgi-bin/webscr'; |
|
419 | + $paypal_uri = $protocol.'www.sandbox.paypal.com/cgi-bin/webscr'; |
|
420 | 420 | } else { |
421 | 421 | // Live mode |
422 | - $paypal_uri = $protocol . 'www.paypal.com/cgi-bin/webscr'; |
|
422 | + $paypal_uri = $protocol.'www.paypal.com/cgi-bin/webscr'; |
|
423 | 423 | } |
424 | 424 | |
425 | - return apply_filters( 'give_paypal_uri', $paypal_uri ); |
|
425 | + return apply_filters('give_paypal_uri', $paypal_uri); |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | /** |
@@ -432,9 +432,9 @@ discard block |
||
432 | 432 | * @return string |
433 | 433 | */ |
434 | 434 | function give_get_paypal_page_style() { |
435 | - $page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) ); |
|
435 | + $page_style = trim(give_get_option('paypal_page_style', 'PayPal')); |
|
436 | 436 | |
437 | - return apply_filters( 'give_paypal_page_style', $page_style ); |
|
437 | + return apply_filters('give_paypal_page_style', $page_style); |
|
438 | 438 | } |
439 | 439 | |
440 | 440 | /** |
@@ -448,26 +448,26 @@ discard block |
||
448 | 448 | * |
449 | 449 | * @return string |
450 | 450 | */ |
451 | -function give_paypal_success_page_content( $content ) { |
|
451 | +function give_paypal_success_page_content($content) { |
|
452 | 452 | |
453 | - if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) { |
|
453 | + if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) { |
|
454 | 454 | return $content; |
455 | 455 | } |
456 | 456 | |
457 | - $payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false; |
|
457 | + $payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false; |
|
458 | 458 | |
459 | - if ( ! $payment_id ) { |
|
459 | + if ( ! $payment_id) { |
|
460 | 460 | $session = give_get_purchase_session(); |
461 | - $payment_id = give_get_donation_id_by_key( $session['purchase_key'] ); |
|
461 | + $payment_id = give_get_donation_id_by_key($session['purchase_key']); |
|
462 | 462 | } |
463 | 463 | |
464 | - $payment = get_post( $payment_id ); |
|
465 | - if ( $payment && 'pending' === $payment->post_status ) { |
|
464 | + $payment = get_post($payment_id); |
|
465 | + if ($payment && 'pending' === $payment->post_status) { |
|
466 | 466 | |
467 | 467 | // Payment is still pending so show processing indicator to fix the race condition. |
468 | 468 | ob_start(); |
469 | 469 | |
470 | - give_get_template_part( 'payment', 'processing' ); |
|
470 | + give_get_template_part('payment', 'processing'); |
|
471 | 471 | |
472 | 472 | $content = ob_get_clean(); |
473 | 473 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | |
478 | 478 | } |
479 | 479 | |
480 | -add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' ); |
|
480 | +add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content'); |
|
481 | 481 | |
482 | 482 | /** |
483 | 483 | * Given a transaction ID, generate a link to the PayPal transaction ID details |
@@ -489,16 +489,16 @@ discard block |
||
489 | 489 | * |
490 | 490 | * @return string A link to the PayPal transaction details |
491 | 491 | */ |
492 | -function give_paypal_link_transaction_id( $transaction_id, $payment_id ) { |
|
492 | +function give_paypal_link_transaction_id($transaction_id, $payment_id) { |
|
493 | 493 | |
494 | 494 | $paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id='; |
495 | - $transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>'; |
|
495 | + $transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>'; |
|
496 | 496 | |
497 | - return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url ); |
|
497 | + return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url); |
|
498 | 498 | |
499 | 499 | } |
500 | 500 | |
501 | -add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 ); |
|
501 | +add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2); |
|
502 | 502 | |
503 | 503 | |
504 | 504 | /** |
@@ -510,64 +510,64 @@ discard block |
||
510 | 510 | * |
511 | 511 | * @return string |
512 | 512 | */ |
513 | -function give_paypal_get_pending_donation_note( $pending_reason ) { |
|
513 | +function give_paypal_get_pending_donation_note($pending_reason) { |
|
514 | 514 | |
515 | 515 | $note = ''; |
516 | 516 | |
517 | - switch ( $pending_reason ) { |
|
517 | + switch ($pending_reason) { |
|
518 | 518 | |
519 | 519 | case 'echeck' : |
520 | 520 | |
521 | - $note = __( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' ); |
|
521 | + $note = __('Payment made via eCheck and will clear automatically in 5-8 days.', 'give'); |
|
522 | 522 | |
523 | 523 | break; |
524 | 524 | |
525 | 525 | case 'address' : |
526 | 526 | |
527 | - $note = __( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' ); |
|
527 | + $note = __('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give'); |
|
528 | 528 | |
529 | 529 | break; |
530 | 530 | |
531 | 531 | case 'intl' : |
532 | 532 | |
533 | - $note = __( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' ); |
|
533 | + $note = __('Payment must be accepted manually through PayPal due to international account regulations.', 'give'); |
|
534 | 534 | |
535 | 535 | break; |
536 | 536 | |
537 | 537 | case 'multi-currency' : |
538 | 538 | |
539 | - $note = __( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' ); |
|
539 | + $note = __('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give'); |
|
540 | 540 | |
541 | 541 | break; |
542 | 542 | |
543 | 543 | case 'paymentreview' : |
544 | 544 | case 'regulatory_review' : |
545 | 545 | |
546 | - $note = __( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' ); |
|
546 | + $note = __('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give'); |
|
547 | 547 | |
548 | 548 | break; |
549 | 549 | |
550 | 550 | case 'unilateral' : |
551 | 551 | |
552 | - $note = __( 'Payment was sent to non-confirmed or non-registered email address.', 'give' ); |
|
552 | + $note = __('Payment was sent to non-confirmed or non-registered email address.', 'give'); |
|
553 | 553 | |
554 | 554 | break; |
555 | 555 | |
556 | 556 | case 'upgrade' : |
557 | 557 | |
558 | - $note = __( 'PayPal account must be upgraded before this payment can be accepted.', 'give' ); |
|
558 | + $note = __('PayPal account must be upgraded before this payment can be accepted.', 'give'); |
|
559 | 559 | |
560 | 560 | break; |
561 | 561 | |
562 | 562 | case 'verify' : |
563 | 563 | |
564 | - $note = __( 'PayPal account is not verified. Verify account in order to accept this donation.', 'give' ); |
|
564 | + $note = __('PayPal account is not verified. Verify account in order to accept this donation.', 'give'); |
|
565 | 565 | |
566 | 566 | break; |
567 | 567 | |
568 | 568 | case 'other' : |
569 | 569 | |
570 | - $note = __( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' ); |
|
570 | + $note = __('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give'); |
|
571 | 571 | |
572 | 572 | break; |
573 | 573 | |
@@ -585,49 +585,49 @@ discard block |
||
585 | 585 | * |
586 | 586 | * @return mixed|string |
587 | 587 | */ |
588 | -function give_build_paypal_url( $payment_id, $payment_data ) { |
|
588 | +function give_build_paypal_url($payment_id, $payment_data) { |
|
589 | 589 | // Only send to PayPal if the pending payment is created successfully. |
590 | - $listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) ); |
|
590 | + $listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php')); |
|
591 | 591 | |
592 | 592 | // Get the success url. |
593 | - $return_url = add_query_arg( array( |
|
593 | + $return_url = add_query_arg(array( |
|
594 | 594 | 'payment-confirmation' => 'paypal', |
595 | 595 | 'payment-id' => $payment_id, |
596 | 596 | |
597 | - ), get_permalink( give_get_option( 'success_page' ) ) ); |
|
597 | + ), get_permalink(give_get_option('success_page'))); |
|
598 | 598 | |
599 | 599 | // Get the PayPal redirect uri. |
600 | - $paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?'; |
|
600 | + $paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?'; |
|
601 | 601 | |
602 | 602 | // Item name. |
603 | - $item_name = give_payment_gateway_item_title( $payment_data ); |
|
603 | + $item_name = give_payment_gateway_item_title($payment_data); |
|
604 | 604 | |
605 | 605 | // Setup PayPal API params. |
606 | 606 | $paypal_args = array( |
607 | - 'business' => give_get_option( 'paypal_email', false ), |
|
607 | + 'business' => give_get_option('paypal_email', false), |
|
608 | 608 | 'first_name' => $payment_data['user_info']['first_name'], |
609 | 609 | 'last_name' => $payment_data['user_info']['last_name'], |
610 | 610 | 'email' => $payment_data['user_email'], |
611 | 611 | 'invoice' => $payment_data['purchase_key'], |
612 | 612 | 'amount' => $payment_data['price'], |
613 | - 'item_name' => stripslashes( $item_name ), |
|
613 | + 'item_name' => stripslashes($item_name), |
|
614 | 614 | 'no_shipping' => '1', |
615 | 615 | 'shipping' => '0', |
616 | 616 | 'no_note' => '1', |
617 | - 'currency_code' => give_get_currency( $payment_id, $payment_data ), |
|
618 | - 'charset' => get_bloginfo( 'charset' ), |
|
617 | + 'currency_code' => give_get_currency($payment_id, $payment_data), |
|
618 | + 'charset' => get_bloginfo('charset'), |
|
619 | 619 | 'custom' => $payment_id, |
620 | 620 | 'rm' => '2', |
621 | 621 | 'return' => $return_url, |
622 | - 'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment_id ), |
|
622 | + 'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment_id), |
|
623 | 623 | 'notify_url' => $listener_url, |
624 | 624 | 'page_style' => give_get_paypal_page_style(), |
625 | - 'cbt' => get_bloginfo( 'name' ), |
|
625 | + 'cbt' => get_bloginfo('name'), |
|
626 | 626 | 'bn' => 'givewp_SP', |
627 | 627 | ); |
628 | 628 | |
629 | 629 | // Add user address if present. |
630 | - if ( ! empty( $payment_data['user_info']['address'] ) ) { |
|
630 | + if ( ! empty($payment_data['user_info']['address'])) { |
|
631 | 631 | $default_address = array( |
632 | 632 | 'line1' => '', |
633 | 633 | 'line2' => '', |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | 'country' => '', |
638 | 638 | ); |
639 | 639 | |
640 | - $address = wp_parse_args( $payment_data['user_info']['address'], $default_address ); |
|
640 | + $address = wp_parse_args($payment_data['user_info']['address'], $default_address); |
|
641 | 641 | |
642 | 642 | $paypal_args['address1'] = $address['line1']; |
643 | 643 | $paypal_args['address2'] = $address['line2']; |
@@ -658,13 +658,13 @@ discard block |
||
658 | 658 | * |
659 | 659 | * @since 1.8 |
660 | 660 | */ |
661 | - $paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $payment_data ); |
|
661 | + $paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $payment_data); |
|
662 | 662 | |
663 | 663 | // Build query. |
664 | - $paypal_redirect .= http_build_query( $paypal_args ); |
|
664 | + $paypal_redirect .= http_build_query($paypal_args); |
|
665 | 665 | |
666 | 666 | // Fix for some sites that encode the entities. |
667 | - $paypal_redirect = str_replace( '&', '&', $paypal_redirect ); |
|
667 | + $paypal_redirect = str_replace('&', '&', $paypal_redirect); |
|
668 | 668 | |
669 | 669 | return $paypal_redirect; |
670 | 670 | } |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | function give_get_paypal_button_type() { |
680 | 680 | // paypal_button_type can be donation or standard. |
681 | 681 | $paypal_button_type = '_donations'; |
682 | - if ( 'standard' === give_get_option( 'paypal_button_type' ) ) { |
|
682 | + if ('standard' === give_get_option('paypal_button_type')) { |
|
683 | 683 | $paypal_button_type = '_xclick'; |
684 | 684 | } |
685 | 685 | |
@@ -697,14 +697,14 @@ discard block |
||
697 | 697 | * |
698 | 698 | * @return string |
699 | 699 | */ |
700 | -function give_paypal_purchase_key( $custom_purchase_key, $gateway, $purchase_key ) { |
|
700 | +function give_paypal_purchase_key($custom_purchase_key, $gateway, $purchase_key) { |
|
701 | 701 | |
702 | - if ( 'paypal' === $gateway ) { |
|
703 | - $invoice_id_prefix = give_get_option( 'paypal_invoice_prefix', 'GIVE-' ); |
|
704 | - $custom_purchase_key = $invoice_id_prefix . $purchase_key; |
|
702 | + if ('paypal' === $gateway) { |
|
703 | + $invoice_id_prefix = give_get_option('paypal_invoice_prefix', 'GIVE-'); |
|
704 | + $custom_purchase_key = $invoice_id_prefix.$purchase_key; |
|
705 | 705 | } |
706 | 706 | |
707 | 707 | return $custom_purchase_key; |
708 | 708 | } |
709 | 709 | |
710 | -add_filter( 'give_donation_purchase_key', 'give_paypal_purchase_key', 10, 3 ); |
|
710 | +add_filter('give_donation_purchase_key', 'give_paypal_purchase_key', 10, 3); |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_Addon' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Addon')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Addon. |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function __construct() { |
28 | 28 | $this->id = 'addons'; |
29 | - $this->label = esc_html__( 'Add-ons', 'give' ); |
|
29 | + $this->label = esc_html__('Add-ons', 'give'); |
|
30 | 30 | |
31 | 31 | parent::__construct(); |
32 | 32 | } |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | * @param $setting_tab |
39 | 39 | * @return string |
40 | 40 | */ |
41 | - function set_default_setting_tab( $setting_tab ) { |
|
41 | + function set_default_setting_tab($setting_tab) { |
|
42 | 42 | $default_tab = ''; |
43 | 43 | |
44 | 44 | // Set default tab to first setting tab. |
45 | - if( $sections = array_keys( $this->get_sections() ) ) { |
|
46 | - $default_tab = current( $sections ); |
|
45 | + if ($sections = array_keys($this->get_sections())) { |
|
46 | + $default_tab = current($sections); |
|
47 | 47 | } |
48 | 48 | return $default_tab; |
49 | 49 | } |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | * @param array $pages Lst of pages. |
56 | 56 | * @return array |
57 | 57 | */ |
58 | - public function add_settings_page( $pages ) { |
|
58 | + public function add_settings_page($pages) { |
|
59 | 59 | $setting = $this->get_settings(); |
60 | 60 | // Bailout: Do not add addons setting tab if it does not contain any setting fields. |
61 | - if( ! empty( $setting ) ) { |
|
62 | - $pages[ $this->id ] = $this->label; |
|
61 | + if ( ! empty($setting)) { |
|
62 | + $pages[$this->id] = $this->label; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | return $pages; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * Filter the addons settings. |
79 | 79 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
80 | 80 | */ |
81 | - $settings = apply_filters( 'give_settings_addons', $settings ); |
|
81 | + $settings = apply_filters('give_settings_addons', $settings); |
|
82 | 82 | |
83 | 83 | /** |
84 | 84 | * Filter the settings. |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @since 1.8 |
87 | 87 | * @param array $settings |
88 | 88 | */ |
89 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
89 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
90 | 90 | |
91 | 91 | // Output. |
92 | 92 | return $settings; |
@@ -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 | |
@@ -22,19 +22,19 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_add_shortcode_to_publish_metabox() { |
24 | 24 | |
25 | - if ( 'give_forms' !== get_post_type() ) { |
|
25 | + if ('give_forms' !== get_post_type()) { |
|
26 | 26 | return false; |
27 | 27 | } |
28 | 28 | global $post; |
29 | 29 | |
30 | 30 | //Only enqueue scripts for CPT on post type screen |
31 | - if ( 'give_forms' === $post->post_type ) { |
|
31 | + if ('give_forms' === $post->post_type) { |
|
32 | 32 | //Shortcode column with select all input |
33 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
34 | - echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">' . esc_html__( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
33 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]'); |
|
34 | + echo '<div class="shortcode-wrap box-sizing"><label for="shortcode-input">'.esc_html__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" name="shortcode-input" id="shortcode-input" class="shortcode-input" readonly value="'.$shortcode.'"></div>'; |
|
35 | 35 | |
36 | 36 | } |
37 | 37 | |
38 | 38 | } |
39 | 39 | |
40 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
40 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox'); |