@@ -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; |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | type="radio" |
556 | 556 | style="' . esc_attr( $field['style'] ) . '" |
557 | 557 | ' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' ' |
558 | - . give_get_custom_attributes( $field ) . ' |
|
558 | + . give_get_custom_attributes( $field ) . ' |
|
559 | 559 | /> ' . esc_html( $value ) . '</label> |
560 | 560 | </li>'; |
561 | 561 | } |
@@ -704,9 +704,9 @@ discard block |
||
704 | 704 | $field['title'] = isset( $field['title'] ) ? $field['title'] : 'Documentation'; |
705 | 705 | |
706 | 706 | echo '<p class="give-docs-link"><a href="' . esc_url( $field['url'] ) |
707 | - . '" target="_blank">' |
|
708 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $field['title'] ) |
|
709 | - . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
707 | + . '" target="_blank">' |
|
708 | + . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $field['title'] ) |
|
709 | + . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
|
710 | 710 | } |
711 | 711 | |
712 | 712 | /** |
@@ -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; |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | default: |
77 | 77 | |
78 | 78 | if ( |
79 | - array_key_exists( 'callback', $field ) |
|
80 | - && ! empty( $field['callback'] ) |
|
79 | + array_key_exists('callback', $field) |
|
80 | + && ! empty($field['callback']) |
|
81 | 81 | ) { |
82 | 82 | $func_name = $field['callback']; |
83 | 83 | } else { |
@@ -90,15 +90,15 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @since 1.8 |
92 | 92 | */ |
93 | - $func_name = apply_filters( 'give_get_field_callback', $func_name, $field ); |
|
93 | + $func_name = apply_filters('give_get_field_callback', $func_name, $field); |
|
94 | 94 | |
95 | 95 | // Exit if not any function exist. |
96 | 96 | // Check if render callback exist or not. |
97 | - if ( empty( $func_name ) ) { |
|
97 | + if (empty($func_name)) { |
|
98 | 98 | return false; |
99 | - } elseif ( is_string( $func_name ) && ! function_exists( "$func_name" ) ) { |
|
99 | + } elseif (is_string($func_name) && ! function_exists("$func_name")) { |
|
100 | 100 | return false; |
101 | - } elseif ( is_array( $func_name ) && ! method_exists( $func_name[0], "$func_name[1]" ) ) { |
|
101 | + } elseif (is_array($func_name) && ! method_exists($func_name[0], "$func_name[1]")) { |
|
102 | 102 | return false; |
103 | 103 | } |
104 | 104 | |
@@ -114,35 +114,35 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @return bool |
116 | 116 | */ |
117 | -function give_render_field( $field ) { |
|
117 | +function give_render_field($field) { |
|
118 | 118 | |
119 | 119 | // Check if render callback exist or not. |
120 | - if ( ! ( $func_name = give_get_field_callback( $field ) ) ) { |
|
120 | + if ( ! ($func_name = give_get_field_callback($field))) { |
|
121 | 121 | return false; |
122 | 122 | } |
123 | 123 | |
124 | 124 | // CMB2 compatibility: Push all classes to attributes's class key |
125 | - if ( empty( $field['class'] ) ) { |
|
125 | + if (empty($field['class'])) { |
|
126 | 126 | $field['class'] = ''; |
127 | 127 | } |
128 | 128 | |
129 | - if ( empty( $field['attributes']['class'] ) ) { |
|
129 | + if (empty($field['attributes']['class'])) { |
|
130 | 130 | $field['attributes']['class'] = ''; |
131 | 131 | } |
132 | 132 | |
133 | - $field['attributes']['class'] = trim( "give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}" ); |
|
134 | - unset( $field['class'] ); |
|
133 | + $field['attributes']['class'] = trim("give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}"); |
|
134 | + unset($field['class']); |
|
135 | 135 | |
136 | 136 | // CMB2 compatibility: Set wrapper class if any. |
137 | - if ( ! empty( $field['row_classes'] ) ) { |
|
137 | + if ( ! empty($field['row_classes'])) { |
|
138 | 138 | $field['wrapper_class'] = $field['row_classes']; |
139 | - unset( $field['row_classes'] ); |
|
139 | + unset($field['row_classes']); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | // Set field params on basis of cmb2 field name. |
143 | - switch ( $field['type'] ) { |
|
143 | + switch ($field['type']) { |
|
144 | 144 | case 'radio_inline': |
145 | - if ( empty( $field['wrapper_class'] ) ) { |
|
145 | + if (empty($field['wrapper_class'])) { |
|
146 | 146 | $field['wrapper_class'] = ''; |
147 | 147 | } |
148 | 148 | $field['wrapper_class'] .= ' give-inline-radio-fields'; |
@@ -155,15 +155,15 @@ discard block |
||
155 | 155 | case 'text-small' : |
156 | 156 | case 'text_small' : |
157 | 157 | // CMB2 compatibility: Set field type to text. |
158 | - $field['type'] = isset( $field['attributes']['type'] ) ? $field['attributes']['type'] : 'text'; |
|
158 | + $field['type'] = isset($field['attributes']['type']) ? $field['attributes']['type'] : 'text'; |
|
159 | 159 | |
160 | 160 | // CMB2 compatibility: Set data type to price. |
161 | 161 | if ( |
162 | - empty( $field['data_type'] ) |
|
163 | - && ! empty( $field['attributes']['class'] ) |
|
162 | + empty($field['data_type']) |
|
163 | + && ! empty($field['attributes']['class']) |
|
164 | 164 | && ( |
165 | - false !== strpos( $field['attributes']['class'], 'money' ) |
|
166 | - || false !== strpos( $field['attributes']['class'], 'amount' ) |
|
165 | + false !== strpos($field['attributes']['class'], 'money') |
|
166 | + || false !== strpos($field['attributes']['class'], 'amount') |
|
167 | 167 | ) |
168 | 168 | ) { |
169 | 169 | $field['data_type'] = 'decimal'; |
@@ -182,22 +182,22 @@ discard block |
||
182 | 182 | case 'give_default_radio_inline': |
183 | 183 | $field['type'] = 'radio'; |
184 | 184 | $field['options'] = array( |
185 | - 'default' => __( 'Default' ), |
|
185 | + 'default' => __('Default'), |
|
186 | 186 | ); |
187 | 187 | break; |
188 | 188 | } |
189 | 189 | |
190 | 190 | // CMB2 compatibility: Add support to define field description by desc & description param. |
191 | 191 | // We encourage you to use description param. |
192 | - $field['description'] = ( ! empty( $field['description'] ) |
|
192 | + $field['description'] = ( ! empty($field['description']) |
|
193 | 193 | ? $field['description'] |
194 | - : ( ! empty( $field['desc'] ) ? $field['desc'] : '' ) ); |
|
194 | + : ( ! empty($field['desc']) ? $field['desc'] : '')); |
|
195 | 195 | |
196 | 196 | // Call render function. |
197 | - if ( is_array( $func_name ) ) { |
|
198 | - $func_name[0]->{$func_name[1]}( $field ); |
|
197 | + if (is_array($func_name)) { |
|
198 | + $func_name[0]->{$func_name[1]}($field); |
|
199 | 199 | } else { |
200 | - $func_name( $field ); |
|
200 | + $func_name($field); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | return true; |
@@ -227,29 +227,29 @@ discard block |
||
227 | 227 | * } |
228 | 228 | * @return void |
229 | 229 | */ |
230 | -function give_text_input( $field ) { |
|
230 | +function give_text_input($field) { |
|
231 | 231 | global $thepostid, $post; |
232 | 232 | |
233 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
234 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
235 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
236 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
237 | - $field['type'] = isset( $field['type'] ) ? $field['type'] : 'text'; |
|
233 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
234 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
235 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
236 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
237 | + $field['type'] = isset($field['type']) ? $field['type'] : 'text'; |
|
238 | 238 | $field['before_field'] = ''; |
239 | 239 | $field['after_field'] = ''; |
240 | - $data_type = empty( $field['data_type'] ) ? '' : $field['data_type']; |
|
240 | + $data_type = empty($field['data_type']) ? '' : $field['data_type']; |
|
241 | 241 | |
242 | - switch ( $data_type ) { |
|
242 | + switch ($data_type) { |
|
243 | 243 | case 'price' : |
244 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_amount( $field['value'] ) : $field['value'] ); |
|
244 | + $field['value'] = ( ! empty($field['value']) ? give_format_amount($field['value']) : $field['value']); |
|
245 | 245 | |
246 | - $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>' : '' ); |
|
247 | - $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>' : '' ); |
|
246 | + $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>' : ''); |
|
247 | + $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>' : ''); |
|
248 | 248 | break; |
249 | 249 | |
250 | 250 | case 'decimal' : |
251 | 251 | $field['attributes']['class'] .= ' give_input_decimal'; |
252 | - $field['value'] = ( ! empty( $field['value'] ) ? give_format_decimal( $field['value'] ) : $field['value'] ); |
|
252 | + $field['value'] = ( ! empty($field['value']) ? give_format_decimal($field['value']) : $field['value']); |
|
253 | 253 | break; |
254 | 254 | |
255 | 255 | default : |
@@ -257,20 +257,20 @@ discard block |
||
257 | 257 | } |
258 | 258 | |
259 | 259 | ?> |
260 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
261 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
260 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
261 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
262 | 262 | <?php echo $field['before_field']; ?> |
263 | 263 | <input |
264 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
265 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
266 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
267 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
268 | - value="<?php echo esc_attr( $field['value'] ); ?>" |
|
269 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
264 | + type="<?php echo esc_attr($field['type']); ?>" |
|
265 | + style="<?php echo esc_attr($field['style']); ?>" |
|
266 | + name="<?php echo give_get_field_name($field); ?>" |
|
267 | + id="<?php echo esc_attr($field['id']); ?>" |
|
268 | + value="<?php echo esc_attr($field['value']); ?>" |
|
269 | + <?php echo give_get_custom_attributes($field); ?> |
|
270 | 270 | /> |
271 | 271 | <?php echo $field['after_field']; ?> |
272 | 272 | <?php |
273 | - echo give_get_field_description( $field ); |
|
273 | + echo give_get_field_description($field); |
|
274 | 274 | echo '</p>'; |
275 | 275 | } |
276 | 276 | |
@@ -292,29 +292,29 @@ discard block |
||
292 | 292 | * } |
293 | 293 | * @return void |
294 | 294 | */ |
295 | -function give_hidden_input( $field ) { |
|
295 | +function give_hidden_input($field) { |
|
296 | 296 | global $thepostid, $post; |
297 | 297 | |
298 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
299 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
298 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
299 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
300 | 300 | |
301 | 301 | // Custom attribute handling |
302 | 302 | $custom_attributes = array(); |
303 | 303 | |
304 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
304 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
305 | 305 | |
306 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
307 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
306 | + foreach ($field['attributes'] as $attribute => $value) { |
|
307 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
308 | 308 | } |
309 | 309 | } |
310 | 310 | ?> |
311 | 311 | |
312 | 312 | <input |
313 | 313 | type="hidden" |
314 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
315 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
316 | - value="<?php echo esc_attr( $field['value'] ); ?>" |
|
317 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
314 | + name="<?php echo give_get_field_name($field); ?>" |
|
315 | + id="<?php echo esc_attr($field['id']); ?>" |
|
316 | + value="<?php echo esc_attr($field['value']); ?>" |
|
317 | + <?php echo give_get_custom_attributes($field); ?> |
|
318 | 318 | /> |
319 | 319 | <?php |
320 | 320 | } |
@@ -340,27 +340,27 @@ discard block |
||
340 | 340 | * } |
341 | 341 | * @return void |
342 | 342 | */ |
343 | -function give_textarea_input( $field ) { |
|
343 | +function give_textarea_input($field) { |
|
344 | 344 | global $thepostid, $post; |
345 | 345 | |
346 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
347 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
348 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
349 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
346 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
347 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
348 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
349 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
350 | 350 | |
351 | 351 | ?> |
352 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
353 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
352 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
353 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
354 | 354 | <textarea |
355 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
356 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
357 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
355 | + style="<?php echo esc_attr($field['style']); ?>" |
|
356 | + name="<?php echo give_get_field_name($field); ?>" |
|
357 | + id="<?php echo esc_attr($field['id']); ?>" |
|
358 | 358 | rows="10" |
359 | 359 | cols="20" |
360 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
361 | - ><?php echo esc_textarea( $field['value'] ); ?></textarea> |
|
360 | + <?php echo give_get_custom_attributes($field); ?> |
|
361 | + ><?php echo esc_textarea($field['value']); ?></textarea> |
|
362 | 362 | <?php |
363 | - echo give_get_field_description( $field ); |
|
363 | + echo give_get_field_description($field); |
|
364 | 364 | echo '</p>'; |
365 | 365 | } |
366 | 366 | |
@@ -384,29 +384,29 @@ discard block |
||
384 | 384 | * } |
385 | 385 | * @return void |
386 | 386 | */ |
387 | -function give_wysiwyg( $field ) { |
|
387 | +function give_wysiwyg($field) { |
|
388 | 388 | global $thepostid, $post; |
389 | 389 | |
390 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
391 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
392 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
393 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
390 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
391 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
392 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
393 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
394 | 394 | |
395 | - $field['unique_field_id'] = give_get_field_name( $field ); |
|
395 | + $field['unique_field_id'] = give_get_field_name($field); |
|
396 | 396 | $editor_attributes = array( |
397 | - 'textarea_name' => isset( $field['repeatable_field_id'] ) ? $field['repeatable_field_id'] : $field['id'], |
|
397 | + 'textarea_name' => isset($field['repeatable_field_id']) ? $field['repeatable_field_id'] : $field['id'], |
|
398 | 398 | 'textarea_rows' => '10', |
399 | - 'editor_css' => esc_attr( $field['style'] ), |
|
399 | + 'editor_css' => esc_attr($field['style']), |
|
400 | 400 | 'editor_class' => $field['attributes']['class'], |
401 | 401 | ); |
402 | - $data_wp_editor = ' data-wp-editor="' . base64_encode( json_encode( array( |
|
402 | + $data_wp_editor = ' data-wp-editor="'.base64_encode(json_encode(array( |
|
403 | 403 | $field['value'], |
404 | 404 | $field['unique_field_id'], |
405 | 405 | $editor_attributes, |
406 | - ) ) ) . '"'; |
|
407 | - $data_wp_editor = isset( $field['repeatable_field_id'] ) ? $data_wp_editor : ''; |
|
406 | + ))).'"'; |
|
407 | + $data_wp_editor = isset($field['repeatable_field_id']) ? $data_wp_editor : ''; |
|
408 | 408 | |
409 | - 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>'; |
|
409 | + 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>'; |
|
410 | 410 | |
411 | 411 | wp_editor( |
412 | 412 | $field['value'], |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | $editor_attributes |
415 | 415 | ); |
416 | 416 | |
417 | - echo give_get_field_description( $field ); |
|
417 | + echo give_get_field_description($field); |
|
418 | 418 | echo '</div>'; |
419 | 419 | } |
420 | 420 | |
@@ -439,29 +439,29 @@ discard block |
||
439 | 439 | * } |
440 | 440 | * @return void |
441 | 441 | */ |
442 | -function give_checkbox( $field ) { |
|
442 | +function give_checkbox($field) { |
|
443 | 443 | global $thepostid, $post; |
444 | 444 | |
445 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
446 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
447 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
448 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
449 | - $field['cbvalue'] = isset( $field['cbvalue'] ) ? $field['cbvalue'] : 'on'; |
|
450 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
445 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
446 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
447 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
448 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
449 | + $field['cbvalue'] = isset($field['cbvalue']) ? $field['cbvalue'] : 'on'; |
|
450 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
451 | 451 | ?> |
452 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
453 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
452 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
453 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
454 | 454 | <input |
455 | 455 | type="checkbox" |
456 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
457 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
458 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
459 | - value="<?php echo esc_attr( $field['cbvalue'] ); ?>" |
|
460 | - <?php echo checked( $field['value'], $field['cbvalue'], false ); ?> |
|
461 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
456 | + style="<?php echo esc_attr($field['style']); ?>" |
|
457 | + name="<?php echo give_get_field_name($field); ?>" |
|
458 | + id="<?php echo esc_attr($field['id']); ?>" |
|
459 | + value="<?php echo esc_attr($field['cbvalue']); ?>" |
|
460 | + <?php echo checked($field['value'], $field['cbvalue'], false); ?> |
|
461 | + <?php echo give_get_custom_attributes($field); ?> |
|
462 | 462 | /> |
463 | 463 | <?php |
464 | - echo give_get_field_description( $field ); |
|
464 | + echo give_get_field_description($field); |
|
465 | 465 | echo '</p>'; |
466 | 466 | } |
467 | 467 | |
@@ -487,29 +487,29 @@ discard block |
||
487 | 487 | * } |
488 | 488 | * @return void |
489 | 489 | */ |
490 | -function give_select( $field ) { |
|
490 | +function give_select($field) { |
|
491 | 491 | global $thepostid, $post; |
492 | 492 | |
493 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
494 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
495 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
496 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
497 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
493 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
494 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
495 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
496 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
497 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
498 | 498 | ?> |
499 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
500 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
499 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
500 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
501 | 501 | <select |
502 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
503 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
504 | - style="<?php echo esc_attr( $field['style'] ) ?>" |
|
505 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
502 | + id="<?php echo esc_attr($field['id']); ?>" |
|
503 | + name="<?php echo give_get_field_name($field); ?>" |
|
504 | + style="<?php echo esc_attr($field['style']) ?>" |
|
505 | + <?php echo give_get_custom_attributes($field); ?> |
|
506 | 506 | > |
507 | 507 | <?php |
508 | - foreach ( $field['options'] as $key => $value ) { |
|
509 | - echo '<option value="' . esc_attr( $key ) . '" ' . selected( esc_attr( $field['value'] ), esc_attr( $key ), false ) . '>' . esc_html( $value ) . '</option>'; |
|
508 | + foreach ($field['options'] as $key => $value) { |
|
509 | + echo '<option value="'.esc_attr($key).'" '.selected(esc_attr($field['value']), esc_attr($key), false).'>'.esc_html($value).'</option>'; |
|
510 | 510 | } |
511 | 511 | echo '</select>'; |
512 | - echo give_get_field_description( $field ); |
|
512 | + echo give_get_field_description($field); |
|
513 | 513 | echo '</p>'; |
514 | 514 | } |
515 | 515 | |
@@ -536,32 +536,32 @@ discard block |
||
536 | 536 | * } |
537 | 537 | * @return void |
538 | 538 | */ |
539 | -function give_radio( $field ) { |
|
539 | +function give_radio($field) { |
|
540 | 540 | global $thepostid, $post; |
541 | 541 | |
542 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
543 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
544 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
545 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
546 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
542 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
543 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
544 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
545 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
546 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
547 | 547 | |
548 | - 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">'; |
|
548 | + 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">'; |
|
549 | 549 | |
550 | - foreach ( $field['options'] as $key => $value ) { |
|
550 | + foreach ($field['options'] as $key => $value) { |
|
551 | 551 | |
552 | 552 | echo '<li><label><input |
553 | - name="' . give_get_field_name( $field ) . '" |
|
554 | - value="' . esc_attr( $key ) . '" |
|
553 | + name="' . give_get_field_name($field).'" |
|
554 | + value="' . esc_attr($key).'" |
|
555 | 555 | type="radio" |
556 | - style="' . esc_attr( $field['style'] ) . '" |
|
557 | - ' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' ' |
|
558 | - . give_get_custom_attributes( $field ) . ' |
|
559 | - /> ' . esc_html( $value ) . '</label> |
|
556 | + style="' . esc_attr($field['style']).'" |
|
557 | + ' . checked(esc_attr($field['value']), esc_attr($key), false).' ' |
|
558 | + . give_get_custom_attributes($field).' |
|
559 | + /> ' . esc_html($value).'</label> |
|
560 | 560 | </li>'; |
561 | 561 | } |
562 | 562 | echo '</ul>'; |
563 | 563 | |
564 | - echo give_get_field_description( $field ); |
|
564 | + echo give_get_field_description($field); |
|
565 | 565 | echo '</fieldset>'; |
566 | 566 | } |
567 | 567 | |
@@ -585,27 +585,27 @@ discard block |
||
585 | 585 | * } |
586 | 586 | * @return void |
587 | 587 | */ |
588 | -function give_colorpicker( $field ) { |
|
588 | +function give_colorpicker($field) { |
|
589 | 589 | global $thepostid, $post; |
590 | 590 | |
591 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
592 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
593 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
594 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
595 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
591 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
592 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
593 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
594 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
595 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
596 | 596 | $field['type'] = 'text'; |
597 | 597 | ?> |
598 | - <p class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
599 | - <label for="<?php echo give_get_field_name( $field ); ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
598 | + <p class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
599 | + <label for="<?php echo give_get_field_name($field); ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
600 | 600 | <input |
601 | - type="<?php echo esc_attr( $field['type'] ); ?>" |
|
602 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
603 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
604 | - id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr( $field['value'] ); ?>" |
|
605 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
601 | + type="<?php echo esc_attr($field['type']); ?>" |
|
602 | + style="<?php echo esc_attr($field['style']); ?>" |
|
603 | + name="<?php echo give_get_field_name($field); ?>" |
|
604 | + id="' . esc_attr( $field['id'] ) . '" value="<?php echo esc_attr($field['value']); ?>" |
|
605 | + <?php echo give_get_custom_attributes($field); ?> |
|
606 | 606 | /> |
607 | 607 | <?php |
608 | - echo give_get_field_description( $field ); |
|
608 | + echo give_get_field_description($field); |
|
609 | 609 | echo '</p>'; |
610 | 610 | } |
611 | 611 | |
@@ -616,8 +616,8 @@ discard block |
||
616 | 616 | * |
617 | 617 | * @param array $field |
618 | 618 | */ |
619 | -function give_file( $field ) { |
|
620 | - give_media( $field ); |
|
619 | +function give_file($field) { |
|
620 | + give_media($field); |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | |
@@ -628,40 +628,40 @@ discard block |
||
628 | 628 | * |
629 | 629 | * @param array $field |
630 | 630 | */ |
631 | -function give_media( $field ) { |
|
631 | +function give_media($field) { |
|
632 | 632 | global $thepostid, $post; |
633 | 633 | |
634 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
635 | - $button_label = esc_html__( sprintf( 'Add or Upload %s', ( 'file' === $field['type'] ? 'File' : 'Image' ) ), 'give' ); |
|
634 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
635 | + $button_label = esc_html__(sprintf('Add or Upload %s', ('file' === $field['type'] ? 'File' : 'Image')), 'give'); |
|
636 | 636 | |
637 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
638 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
639 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
640 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
637 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
638 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
639 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
640 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
641 | 641 | $field['attributes']['class'] = "{$field['attributes']['class']} give-text-medium"; |
642 | 642 | |
643 | 643 | // Allow developer to save attachment ID or attachment url as metadata. |
644 | - $field['fvalue'] = isset( $field['fvalue'] ) ? $field['fvalue'] : 'url'; |
|
644 | + $field['fvalue'] = isset($field['fvalue']) ? $field['fvalue'] : 'url'; |
|
645 | 645 | |
646 | - $allow_media_preview_tags = array( 'jpg', 'jpeg', 'png', 'gif', 'ico' ); |
|
647 | - $preview_image_src = $field['value'] ? ( 'id' === $field['fvalue'] ? wp_get_attachment_url( $field['value'] ) : $field['value'] ) : '#'; |
|
648 | - $preview_image_extension = $preview_image_src ? pathinfo( $preview_image_src, PATHINFO_EXTENSION ) : ''; |
|
649 | - $is_show_preview = in_array( $preview_image_extension, $allow_media_preview_tags ); |
|
646 | + $allow_media_preview_tags = array('jpg', 'jpeg', 'png', 'gif', 'ico'); |
|
647 | + $preview_image_src = $field['value'] ? ('id' === $field['fvalue'] ? wp_get_attachment_url($field['value']) : $field['value']) : '#'; |
|
648 | + $preview_image_extension = $preview_image_src ? pathinfo($preview_image_src, PATHINFO_EXTENSION) : ''; |
|
649 | + $is_show_preview = in_array($preview_image_extension, $allow_media_preview_tags); |
|
650 | 650 | ?> |
651 | - <fieldset class="give-field-wrap <?php echo esc_attr( $field['id'] ); ?>_field <?php echo esc_attr( $field['wrapper_class'] ); ?>"> |
|
652 | - <label for="<?php echo give_get_field_name( $field ) ?>"><?php echo wp_kses_post( $field['name'] ); ?></label> |
|
651 | + <fieldset class="give-field-wrap <?php echo esc_attr($field['id']); ?>_field <?php echo esc_attr($field['wrapper_class']); ?>"> |
|
652 | + <label for="<?php echo give_get_field_name($field) ?>"><?php echo wp_kses_post($field['name']); ?></label> |
|
653 | 653 | <input |
654 | - name="<?php echo give_get_field_name( $field ); ?>" |
|
655 | - id="<?php echo esc_attr( $field['id'] ); ?>" |
|
654 | + name="<?php echo give_get_field_name($field); ?>" |
|
655 | + id="<?php echo esc_attr($field['id']); ?>" |
|
656 | 656 | type="text" |
657 | 657 | value="<?php echo $field['value']; ?>" |
658 | - style="<?php echo esc_attr( $field['style'] ); ?>" |
|
659 | - <?php echo give_get_custom_attributes( $field ); ?> |
|
658 | + style="<?php echo esc_attr($field['style']); ?>" |
|
659 | + <?php echo give_get_custom_attributes($field); ?> |
|
660 | 660 | /> <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']; ?>"> |
661 | - <?php echo give_get_field_description( $field ); ?> |
|
661 | + <?php echo give_get_field_description($field); ?> |
|
662 | 662 | <div class="give-image-thumb<?php echo ! $field['value'] || ! $is_show_preview ? ' give-hidden' : ''; ?>"> |
663 | 663 | <span class="give-delete-image-thumb dashicons dashicons-no-alt"></span> |
664 | - <img src="<?php echo $preview_image_src ; ?>" alt=""> |
|
664 | + <img src="<?php echo $preview_image_src; ?>" alt=""> |
|
665 | 665 | </div> |
666 | 666 | </fieldset> |
667 | 667 | <?php |
@@ -676,27 +676,27 @@ discard block |
||
676 | 676 | * |
677 | 677 | * @return void |
678 | 678 | */ |
679 | -function give_default_gateway( $field ) { |
|
679 | +function give_default_gateway($field) { |
|
680 | 680 | global $thepostid, $post; |
681 | 681 | |
682 | 682 | // get all active payment gateways. |
683 | - $gateways = give_get_enabled_payment_gateways( $thepostid ); |
|
683 | + $gateways = give_get_enabled_payment_gateways($thepostid); |
|
684 | 684 | $field['options'] = array(); |
685 | 685 | |
686 | 686 | // Set field option value. |
687 | - if ( ! empty( $gateways ) ) { |
|
688 | - foreach ( $gateways as $key => $option ) { |
|
689 | - $field['options'][ $key ] = $option['admin_label']; |
|
687 | + if ( ! empty($gateways)) { |
|
688 | + foreach ($gateways as $key => $option) { |
|
689 | + $field['options'][$key] = $option['admin_label']; |
|
690 | 690 | } |
691 | 691 | } |
692 | 692 | |
693 | 693 | // Add a field to the Give Form admin single post view of this field |
694 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
695 | - $field['options'] = array_merge( array( 'global' => esc_html__( 'Global Default', 'give' ) ), $field['options'] ); |
|
694 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
695 | + $field['options'] = array_merge(array('global' => esc_html__('Global Default', 'give')), $field['options']); |
|
696 | 696 | } |
697 | 697 | |
698 | 698 | // Render select field. |
699 | - give_select( $field ); |
|
699 | + give_select($field); |
|
700 | 700 | } |
701 | 701 | |
702 | 702 | /** |
@@ -718,13 +718,13 @@ discard block |
||
718 | 718 | * @return void |
719 | 719 | */ |
720 | 720 | |
721 | -function give_docs_link( $field ) { |
|
722 | - $field['url'] = isset( $field['url'] ) ? $field['url'] : 'https://givewp.com/documentation'; |
|
723 | - $field['title'] = isset( $field['title'] ) ? $field['title'] : 'Documentation'; |
|
721 | +function give_docs_link($field) { |
|
722 | + $field['url'] = isset($field['url']) ? $field['url'] : 'https://givewp.com/documentation'; |
|
723 | + $field['title'] = isset($field['title']) ? $field['title'] : 'Documentation'; |
|
724 | 724 | |
725 | - echo '<p class="give-docs-link"><a href="' . esc_url( $field['url'] ) |
|
725 | + echo '<p class="give-docs-link"><a href="'.esc_url($field['url']) |
|
726 | 726 | . '" target="_blank">' |
727 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"', 'give' ), $field['title'] ) |
|
727 | + . sprintf(esc_html__('Need Help? See docs on "%s"', 'give'), $field['title']) |
|
728 | 728 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
729 | 729 | } |
730 | 730 | |
@@ -740,13 +740,13 @@ discard block |
||
740 | 740 | * |
741 | 741 | * @return mixed |
742 | 742 | */ |
743 | -function give_get_field_value( $field, $postid ) { |
|
744 | - if ( isset( $field['attributes']['value'] ) ) { |
|
743 | +function give_get_field_value($field, $postid) { |
|
744 | + if (isset($field['attributes']['value'])) { |
|
745 | 745 | return $field['attributes']['value']; |
746 | 746 | } |
747 | 747 | |
748 | 748 | // Get value from db. |
749 | - $field_value = give_get_meta( $postid, $field['id'], true ); |
|
749 | + $field_value = give_get_meta($postid, $field['id'], true); |
|
750 | 750 | |
751 | 751 | /** |
752 | 752 | * Filter the field value before apply default value. |
@@ -755,10 +755,10 @@ discard block |
||
755 | 755 | * |
756 | 756 | * @param mixed $field_value Field value. |
757 | 757 | */ |
758 | - $field_value = apply_filters( "{$field['id']}_field_value", $field_value, $field, $postid ); |
|
758 | + $field_value = apply_filters("{$field['id']}_field_value", $field_value, $field, $postid); |
|
759 | 759 | |
760 | 760 | // Set default value if no any data saved to db. |
761 | - if ( ! $field_value && isset( $field['default'] ) ) { |
|
761 | + if ( ! $field_value && isset($field['default'])) { |
|
762 | 762 | $field_value = $field['default']; |
763 | 763 | } |
764 | 764 | |
@@ -775,20 +775,20 @@ discard block |
||
775 | 775 | * |
776 | 776 | * @return string |
777 | 777 | */ |
778 | -function give_get_field_description( $field ) { |
|
778 | +function give_get_field_description($field) { |
|
779 | 779 | $field_desc_html = ''; |
780 | 780 | $description = ''; |
781 | 781 | |
782 | 782 | // Check for both `description` and `desc`. |
783 | - if ( isset( $field['description'] ) ) { |
|
783 | + if (isset($field['description'])) { |
|
784 | 784 | $description = $field['description']; |
785 | - } elseif ( isset( $field['desc'] ) ) { |
|
785 | + } elseif (isset($field['desc'])) { |
|
786 | 786 | $description = $field['desc']; |
787 | 787 | } |
788 | 788 | |
789 | 789 | // Set if there is a description. |
790 | - if ( ! empty( $description ) ) { |
|
791 | - $field_desc_html = '<span class="give-field-description">' . wp_kses_post( $description ) . '</span>'; |
|
790 | + if ( ! empty($description)) { |
|
791 | + $field_desc_html = '<span class="give-field-description">'.wp_kses_post($description).'</span>'; |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | return $field_desc_html; |
@@ -804,18 +804,18 @@ discard block |
||
804 | 804 | * |
805 | 805 | * @return string |
806 | 806 | */ |
807 | -function give_get_custom_attributes( $field ) { |
|
807 | +function give_get_custom_attributes($field) { |
|
808 | 808 | // Custom attribute handling |
809 | 809 | $custom_attributes = array(); |
810 | 810 | |
811 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
811 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
812 | 812 | |
813 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
814 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
813 | + foreach ($field['attributes'] as $attribute => $value) { |
|
814 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
815 | 815 | } |
816 | 816 | } |
817 | 817 | |
818 | - return implode( ' ', $custom_attributes ); |
|
818 | + return implode(' ', $custom_attributes); |
|
819 | 819 | } |
820 | 820 | |
821 | 821 | /** |
@@ -831,8 +831,8 @@ discard block |
||
831 | 831 | * |
832 | 832 | * @return string |
833 | 833 | */ |
834 | -function give_get_repeater_field_value( $field, $field_group, $fields ) { |
|
835 | - $field_value = ( isset( $field_group[ $field['id'] ] ) ? $field_group[ $field['id'] ] : '' ); |
|
834 | +function give_get_repeater_field_value($field, $field_group, $fields) { |
|
835 | + $field_value = (isset($field_group[$field['id']]) ? $field_group[$field['id']] : ''); |
|
836 | 836 | |
837 | 837 | /** |
838 | 838 | * Filter the specific repeater field value |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | * |
842 | 842 | * @param string $field_id |
843 | 843 | */ |
844 | - $field_value = apply_filters( "give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields ); |
|
844 | + $field_value = apply_filters("give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields); |
|
845 | 845 | |
846 | 846 | /** |
847 | 847 | * Filter the repeater field value |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | * |
851 | 851 | * @param string $field_id |
852 | 852 | */ |
853 | - $field_value = apply_filters( 'give_get_repeater_field_value', $field_value, $field, $field_group, $fields ); |
|
853 | + $field_value = apply_filters('give_get_repeater_field_value', $field_value, $field, $field_group, $fields); |
|
854 | 854 | |
855 | 855 | return $field_value; |
856 | 856 | } |
@@ -868,7 +868,7 @@ discard block |
||
868 | 868 | * |
869 | 869 | * @return string |
870 | 870 | */ |
871 | -function give_get_repeater_field_id( $field, $fields, $default = false ) { |
|
871 | +function give_get_repeater_field_id($field, $fields, $default = false) { |
|
872 | 872 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
873 | 873 | |
874 | 874 | // Get field id. |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | * |
882 | 882 | * @param string $field_id |
883 | 883 | */ |
884 | - $field_id = apply_filters( "give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default ); |
|
884 | + $field_id = apply_filters("give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default); |
|
885 | 885 | |
886 | 886 | /** |
887 | 887 | * Filter the repeater field id |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | * |
891 | 891 | * @param string $field_id |
892 | 892 | */ |
893 | - $field_id = apply_filters( 'give_get_repeater_field_id', $field_id, $field, $fields, $default ); |
|
893 | + $field_id = apply_filters('give_get_repeater_field_id', $field_id, $field, $fields, $default); |
|
894 | 894 | |
895 | 895 | return $field_id; |
896 | 896 | } |
@@ -905,8 +905,8 @@ discard block |
||
905 | 905 | * |
906 | 906 | * @return string |
907 | 907 | */ |
908 | -function give_get_field_name( $field ) { |
|
909 | - $field_name = esc_attr( empty( $field['repeat'] ) ? $field['id'] : $field['repeatable_field_id'] ); |
|
908 | +function give_get_field_name($field) { |
|
909 | + $field_name = esc_attr(empty($field['repeat']) ? $field['id'] : $field['repeatable_field_id']); |
|
910 | 910 | |
911 | 911 | /** |
912 | 912 | * Filter the field name. |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | * |
916 | 916 | * @param string $field_name |
917 | 917 | */ |
918 | - $field_name = apply_filters( 'give_get_field_name', $field_name, $field ); |
|
918 | + $field_name = apply_filters('give_get_field_name', $field_name, $field); |
|
919 | 919 | |
920 | 920 | return $field_name; |
921 | 921 | } |
@@ -932,39 +932,39 @@ discard block |
||
932 | 932 | * |
933 | 933 | * @return void |
934 | 934 | */ |
935 | -function _give_metabox_form_data_repeater_fields( $fields ) { |
|
935 | +function _give_metabox_form_data_repeater_fields($fields) { |
|
936 | 936 | global $thepostid, $post; |
937 | 937 | |
938 | 938 | // Bailout. |
939 | - if ( ! isset( $fields['fields'] ) || empty( $fields['fields'] ) ) { |
|
939 | + if ( ! isset($fields['fields']) || empty($fields['fields'])) { |
|
940 | 940 | return; |
941 | 941 | } |
942 | 942 | |
943 | - $group_numbering = isset( $fields['options']['group_numbering'] ) ? (int) $fields['options']['group_numbering'] : 0; |
|
944 | - $close_tabs = isset( $fields['options']['close_tabs'] ) ? (int) $fields['options']['close_tabs'] : 0; |
|
943 | + $group_numbering = isset($fields['options']['group_numbering']) ? (int) $fields['options']['group_numbering'] : 0; |
|
944 | + $close_tabs = isset($fields['options']['close_tabs']) ? (int) $fields['options']['close_tabs'] : 0; |
|
945 | 945 | ?> |
946 | 946 | <div class="give-repeatable-field-section" id="<?php echo "{$fields['id']}_field"; ?>" |
947 | 947 | data-group-numbering="<?php echo $group_numbering; ?>" data-close-tabs="<?php echo $close_tabs; ?>"> |
948 | - <?php if ( ! empty( $fields['name'] ) ) : ?> |
|
948 | + <?php if ( ! empty($fields['name'])) : ?> |
|
949 | 949 | <p class="give-repeater-field-name"><?php echo $fields['name']; ?></p> |
950 | 950 | <?php endif; ?> |
951 | 951 | |
952 | - <?php if ( ! empty( $fields['description'] ) ) : ?> |
|
952 | + <?php if ( ! empty($fields['description'])) : ?> |
|
953 | 953 | <p class="give-repeater-field-description"><?php echo $fields['description']; ?></p> |
954 | 954 | <?php endif; ?> |
955 | 955 | |
956 | 956 | <table class="give-repeatable-fields-section-wrapper" cellspacing="0"> |
957 | 957 | <?php |
958 | - $repeater_field_values = give_get_meta( $thepostid, $fields['id'], true ); |
|
959 | - $header_title = isset( $fields['options']['header_title'] ) |
|
958 | + $repeater_field_values = give_get_meta($thepostid, $fields['id'], true); |
|
959 | + $header_title = isset($fields['options']['header_title']) |
|
960 | 960 | ? $fields['options']['header_title'] |
961 | - : esc_attr__( 'Group', 'give' ); |
|
961 | + : esc_attr__('Group', 'give'); |
|
962 | 962 | |
963 | 963 | $add_default_donation_field = false; |
964 | 964 | |
965 | 965 | // Check if level is not created or we have to add default level. |
966 | - if ( is_array( $repeater_field_values ) && ( $fields_count = count( $repeater_field_values ) ) ) { |
|
967 | - $repeater_field_values = array_values( $repeater_field_values ); |
|
966 | + if (is_array($repeater_field_values) && ($fields_count = count($repeater_field_values))) { |
|
967 | + $repeater_field_values = array_values($repeater_field_values); |
|
968 | 968 | } else { |
969 | 969 | $fields_count = 1; |
970 | 970 | $add_default_donation_field = true; |
@@ -977,59 +977,59 @@ discard block |
||
977 | 977 | <div class="give-row-head give-move"> |
978 | 978 | <button type="button" class="handlediv button-link"><span class="toggle-indicator"></span> |
979 | 979 | </button> |
980 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-</span> |
|
980 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">-</span> |
|
981 | 981 | <h2> |
982 | 982 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
983 | 983 | </h2> |
984 | 984 | </div> |
985 | 985 | <div class="give-row-body"> |
986 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
987 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
986 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
987 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
988 | 988 | continue; |
989 | 989 | } ?> |
990 | 990 | <?php |
991 | 991 | $field['repeat'] = true; |
992 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields ); |
|
993 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
992 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields); |
|
993 | + $field['id'] = str_replace(array('[', ']'), array( |
|
994 | 994 | '_', |
995 | 995 | '', |
996 | - ), $field['repeatable_field_id'] ); |
|
996 | + ), $field['repeatable_field_id']); |
|
997 | 997 | ?> |
998 | - <?php give_render_field( $field ); ?> |
|
998 | + <?php give_render_field($field); ?> |
|
999 | 999 | <?php endforeach; ?> |
1000 | 1000 | </div> |
1001 | 1001 | </td> |
1002 | 1002 | </tr> |
1003 | 1003 | |
1004 | - <?php if ( ! empty( $repeater_field_values ) ) : ?> |
|
1004 | + <?php if ( ! empty($repeater_field_values)) : ?> |
|
1005 | 1005 | <!--Stored repeater field group--> |
1006 | - <?php foreach ( $repeater_field_values as $index => $field_group ) : ?> |
|
1006 | + <?php foreach ($repeater_field_values as $index => $field_group) : ?> |
|
1007 | 1007 | <tr class="give-row"> |
1008 | 1008 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
1009 | 1009 | <div class="give-row-head give-move"> |
1010 | 1010 | <button type="button" class="handlediv button-link"> |
1011 | 1011 | <span class="toggle-indicator"></span></button> |
1012 | - <sapn class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
1012 | + <sapn class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
1013 | 1013 | </sapn> |
1014 | 1014 | <h2> |
1015 | 1015 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
1016 | 1016 | </h2> |
1017 | 1017 | </div> |
1018 | 1018 | <div class="give-row-body"> |
1019 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
1020 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
1019 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
1020 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
1021 | 1021 | continue; |
1022 | 1022 | } ?> |
1023 | 1023 | <?php |
1024 | 1024 | $field['repeat'] = true; |
1025 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, $index ); |
|
1026 | - $field['attributes']['value'] = give_get_repeater_field_value( $field, $field_group, $fields ); |
|
1027 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
1025 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, $index); |
|
1026 | + $field['attributes']['value'] = give_get_repeater_field_value($field, $field_group, $fields); |
|
1027 | + $field['id'] = str_replace(array('[', ']'), array( |
|
1028 | 1028 | '_', |
1029 | 1029 | '', |
1030 | - ), $field['repeatable_field_id'] ); |
|
1030 | + ), $field['repeatable_field_id']); |
|
1031 | 1031 | ?> |
1032 | - <?php give_render_field( $field ); ?> |
|
1032 | + <?php give_render_field($field); ?> |
|
1033 | 1033 | <?php endforeach; ?> |
1034 | 1034 | </div> |
1035 | 1035 | </td> |
@@ -1037,14 +1037,14 @@ discard block |
||
1037 | 1037 | <?php endforeach; |
1038 | 1038 | ; ?> |
1039 | 1039 | |
1040 | - <?php elseif ( $add_default_donation_field ) : ?> |
|
1040 | + <?php elseif ($add_default_donation_field) : ?> |
|
1041 | 1041 | <!--Default repeater field group--> |
1042 | 1042 | <tr class="give-row"> |
1043 | 1043 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
1044 | 1044 | <div class="give-row-head give-move"> |
1045 | 1045 | <button type="button" class="handlediv button-link"> |
1046 | 1046 | <span class="toggle-indicator"></span></button> |
1047 | - <sapn class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
1047 | + <sapn class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
1048 | 1048 | </sapn> |
1049 | 1049 | <h2> |
1050 | 1050 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
@@ -1052,19 +1052,19 @@ discard block |
||
1052 | 1052 | </div> |
1053 | 1053 | <div class="give-row-body"> |
1054 | 1054 | <?php |
1055 | - foreach ( $fields['fields'] as $field ) : |
|
1056 | - if ( ! give_is_field_callback_exist( $field ) ) { |
|
1055 | + foreach ($fields['fields'] as $field) : |
|
1056 | + if ( ! give_is_field_callback_exist($field)) { |
|
1057 | 1057 | continue; |
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | $field['repeat'] = true; |
1061 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, 0 ); |
|
1062 | - $field['attributes']['value'] = apply_filters( "give_default_field_group_field_{$field['id']}_value", ( ! empty( $field['default'] ) ? $field['default'] : '' ), $field ); |
|
1063 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
1061 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, 0); |
|
1062 | + $field['attributes']['value'] = apply_filters("give_default_field_group_field_{$field['id']}_value", ( ! empty($field['default']) ? $field['default'] : ''), $field); |
|
1063 | + $field['id'] = str_replace(array('[', ']'), array( |
|
1064 | 1064 | '_', |
1065 | 1065 | '', |
1066 | - ), $field['repeatable_field_id'] ); |
|
1067 | - give_render_field( $field ); |
|
1066 | + ), $field['repeatable_field_id']); |
|
1067 | + give_render_field($field); |
|
1068 | 1068 | endforeach; |
1069 | 1069 | ?> |
1070 | 1070 | </div> |
@@ -1075,9 +1075,9 @@ discard block |
||
1075 | 1075 | <tfoot> |
1076 | 1076 | <tr> |
1077 | 1077 | <?php |
1078 | - $add_row_btn_title = isset( $fields['options']['add_button'] ) |
|
1078 | + $add_row_btn_title = isset($fields['options']['add_button']) |
|
1079 | 1079 | ? $add_row_btn_title = $fields['options']['add_button'] |
1080 | - : esc_html__( 'Add Row', 'give' ); |
|
1080 | + : esc_html__('Add Row', 'give'); |
|
1081 | 1081 | ?> |
1082 | 1082 | <td colspan="2" class="give-add-repeater-field-section-row-wrap"> |
1083 | 1083 | <span class="button button-primary give-add-repeater-field-section-row"><?php echo $add_row_btn_title; ?></span> |
@@ -1107,10 +1107,10 @@ discard block |
||
1107 | 1107 | * |
1108 | 1108 | * @param string |
1109 | 1109 | */ |
1110 | - $default_current_tab = apply_filters( "give_default_setting_tab_{$current_setting_page}", 'general' ); |
|
1110 | + $default_current_tab = apply_filters("give_default_setting_tab_{$current_setting_page}", 'general'); |
|
1111 | 1111 | |
1112 | 1112 | // Get current tab. |
1113 | - $current_tab = empty( $_GET['tab'] ) ? $default_current_tab : urldecode( $_GET['tab'] ); |
|
1113 | + $current_tab = empty($_GET['tab']) ? $default_current_tab : urldecode($_GET['tab']); |
|
1114 | 1114 | |
1115 | 1115 | // Output. |
1116 | 1116 | return $current_tab; |
@@ -1134,10 +1134,10 @@ discard block |
||
1134 | 1134 | * |
1135 | 1135 | * @param string |
1136 | 1136 | */ |
1137 | - $default_current_section = apply_filters( "give_default_setting_tab_section_{$current_tab}", '' ); |
|
1137 | + $default_current_section = apply_filters("give_default_setting_tab_section_{$current_tab}", ''); |
|
1138 | 1138 | |
1139 | 1139 | // Get current section. |
1140 | - $current_section = empty( $_REQUEST['section'] ) ? $default_current_section : urldecode( $_REQUEST['section'] ); |
|
1140 | + $current_section = empty($_REQUEST['section']) ? $default_current_section : urldecode($_REQUEST['section']); |
|
1141 | 1141 | |
1142 | 1142 | // Output. |
1143 | 1143 | return $current_section; |
@@ -1151,7 +1151,7 @@ discard block |
||
1151 | 1151 | */ |
1152 | 1152 | function give_get_current_setting_page() { |
1153 | 1153 | // Get current page. |
1154 | - $setting_page = ! empty( $_GET['page'] ) ? urldecode( $_GET['page'] ) : ''; |
|
1154 | + $setting_page = ! empty($_GET['page']) ? urldecode($_GET['page']) : ''; |
|
1155 | 1155 | |
1156 | 1156 | // Output. |
1157 | 1157 | return $setting_page; |
@@ -1171,13 +1171,13 @@ discard block |
||
1171 | 1171 | * |
1172 | 1172 | * @return string |
1173 | 1173 | */ |
1174 | -function _give_display_content_field_value( $field_value, $field, $postid ) { |
|
1175 | - $show_content = give_get_meta( $postid, '_give_content_option', true ); |
|
1174 | +function _give_display_content_field_value($field_value, $field, $postid) { |
|
1175 | + $show_content = give_get_meta($postid, '_give_content_option', true); |
|
1176 | 1176 | |
1177 | 1177 | if ( |
1178 | - ! give_get_meta( $postid, '_give_display_content', true ) |
|
1178 | + ! give_get_meta($postid, '_give_display_content', true) |
|
1179 | 1179 | && $show_content |
1180 | - && ( 'none' !== $show_content ) |
|
1180 | + && ('none' !== $show_content) |
|
1181 | 1181 | ) { |
1182 | 1182 | $field_value = 'enabled'; |
1183 | 1183 | } |
@@ -1185,7 +1185,7 @@ discard block |
||
1185 | 1185 | return $field_value; |
1186 | 1186 | } |
1187 | 1187 | |
1188 | -add_filter( '_give_display_content_field_value', '_give_display_content_field_value', 10, 3 ); |
|
1188 | +add_filter('_give_display_content_field_value', '_give_display_content_field_value', 10, 3); |
|
1189 | 1189 | |
1190 | 1190 | |
1191 | 1191 | /** |
@@ -1202,12 +1202,12 @@ discard block |
||
1202 | 1202 | * |
1203 | 1203 | * @return string |
1204 | 1204 | */ |
1205 | -function _give_content_placement_field_value( $field_value, $field, $postid ) { |
|
1206 | - $show_content = give_get_meta( $postid, '_give_content_option', true ); |
|
1205 | +function _give_content_placement_field_value($field_value, $field, $postid) { |
|
1206 | + $show_content = give_get_meta($postid, '_give_content_option', true); |
|
1207 | 1207 | |
1208 | 1208 | if ( |
1209 | - ! give_get_meta( $postid, '_give_content_placement', true ) |
|
1210 | - && ( 'none' !== $show_content ) |
|
1209 | + ! give_get_meta($postid, '_give_content_placement', true) |
|
1210 | + && ('none' !== $show_content) |
|
1211 | 1211 | ) { |
1212 | 1212 | $field_value = $show_content; |
1213 | 1213 | } |
@@ -1215,7 +1215,7 @@ discard block |
||
1215 | 1215 | return $field_value; |
1216 | 1216 | } |
1217 | 1217 | |
1218 | -add_filter( '_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3 ); |
|
1218 | +add_filter('_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3); |
|
1219 | 1219 | |
1220 | 1220 | |
1221 | 1221 | /** |
@@ -1231,17 +1231,17 @@ discard block |
||
1231 | 1231 | * |
1232 | 1232 | * @return string |
1233 | 1233 | */ |
1234 | -function _give_terms_option_field_value( $field_value, $field, $postid ) { |
|
1235 | - $term_option = give_get_meta( $postid, '_give_terms_option', true ); |
|
1234 | +function _give_terms_option_field_value($field_value, $field, $postid) { |
|
1235 | + $term_option = give_get_meta($postid, '_give_terms_option', true); |
|
1236 | 1236 | |
1237 | - if ( in_array( $term_option, array( 'none', 'yes' ) ) ) { |
|
1238 | - $field_value = ( 'yes' === $term_option ? 'enabled' : 'disabled' ); |
|
1237 | + if (in_array($term_option, array('none', 'yes'))) { |
|
1238 | + $field_value = ('yes' === $term_option ? 'enabled' : 'disabled'); |
|
1239 | 1239 | } |
1240 | 1240 | |
1241 | 1241 | return $field_value; |
1242 | 1242 | } |
1243 | 1243 | |
1244 | -add_filter( '_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3 ); |
|
1244 | +add_filter('_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3); |
|
1245 | 1245 | |
1246 | 1246 | |
1247 | 1247 | /** |
@@ -1258,17 +1258,17 @@ discard block |
||
1258 | 1258 | * |
1259 | 1259 | * @return string |
1260 | 1260 | */ |
1261 | -function _give_offline_donation_enable_billing_fields_single_field_value( $field_value, $field, $postid ) { |
|
1262 | - $offline_donation = give_get_meta( $postid, '_give_offline_donation_enable_billing_fields_single', true ); |
|
1261 | +function _give_offline_donation_enable_billing_fields_single_field_value($field_value, $field, $postid) { |
|
1262 | + $offline_donation = give_get_meta($postid, '_give_offline_donation_enable_billing_fields_single', true); |
|
1263 | 1263 | |
1264 | - if ( 'on' === $offline_donation ) { |
|
1264 | + if ('on' === $offline_donation) { |
|
1265 | 1265 | $field_value = 'enabled'; |
1266 | 1266 | } |
1267 | 1267 | |
1268 | 1268 | return $field_value; |
1269 | 1269 | } |
1270 | 1270 | |
1271 | -add_filter( '_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3 ); |
|
1271 | +add_filter('_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3); |
|
1272 | 1272 | |
1273 | 1273 | |
1274 | 1274 | /** |
@@ -1284,17 +1284,17 @@ discard block |
||
1284 | 1284 | * |
1285 | 1285 | * @return string |
1286 | 1286 | */ |
1287 | -function _give_custom_amount_field_value( $field_value, $field, $postid ) { |
|
1288 | - $custom_amount = give_get_meta( $postid, '_give_custom_amount', true ); |
|
1287 | +function _give_custom_amount_field_value($field_value, $field, $postid) { |
|
1288 | + $custom_amount = give_get_meta($postid, '_give_custom_amount', true); |
|
1289 | 1289 | |
1290 | - if ( in_array( $custom_amount, array( 'yes', 'no' ) ) ) { |
|
1291 | - $field_value = ( 'yes' === $custom_amount ? 'enabled' : 'disabled' ); |
|
1290 | + if (in_array($custom_amount, array('yes', 'no'))) { |
|
1291 | + $field_value = ('yes' === $custom_amount ? 'enabled' : 'disabled'); |
|
1292 | 1292 | } |
1293 | 1293 | |
1294 | 1294 | return $field_value; |
1295 | 1295 | } |
1296 | 1296 | |
1297 | -add_filter( '_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3 ); |
|
1297 | +add_filter('_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3); |
|
1298 | 1298 | |
1299 | 1299 | |
1300 | 1300 | /** |
@@ -1310,17 +1310,17 @@ discard block |
||
1310 | 1310 | * |
1311 | 1311 | * @return string |
1312 | 1312 | */ |
1313 | -function _give_goal_option_field_value( $field_value, $field, $postid ) { |
|
1314 | - $goal_option = give_get_meta( $postid, '_give_goal_option', true ); |
|
1313 | +function _give_goal_option_field_value($field_value, $field, $postid) { |
|
1314 | + $goal_option = give_get_meta($postid, '_give_goal_option', true); |
|
1315 | 1315 | |
1316 | - if ( in_array( $goal_option, array( 'yes', 'no' ) ) ) { |
|
1317 | - $field_value = ( 'yes' === $goal_option ? 'enabled' : 'disabled' ); |
|
1316 | + if (in_array($goal_option, array('yes', 'no'))) { |
|
1317 | + $field_value = ('yes' === $goal_option ? 'enabled' : 'disabled'); |
|
1318 | 1318 | } |
1319 | 1319 | |
1320 | 1320 | return $field_value; |
1321 | 1321 | } |
1322 | 1322 | |
1323 | -add_filter( '_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3 ); |
|
1323 | +add_filter('_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3); |
|
1324 | 1324 | |
1325 | 1325 | /** |
1326 | 1326 | * Set value for Donation Goal --> close Form. |
@@ -1336,17 +1336,17 @@ discard block |
||
1336 | 1336 | * |
1337 | 1337 | * @return string |
1338 | 1338 | */ |
1339 | -function _give_close_form_when_goal_achieved_value( $field_value, $field, $postid ) { |
|
1340 | - $close_form = give_get_meta( $postid, '_give_close_form_when_goal_achieved', true ); |
|
1339 | +function _give_close_form_when_goal_achieved_value($field_value, $field, $postid) { |
|
1340 | + $close_form = give_get_meta($postid, '_give_close_form_when_goal_achieved', true); |
|
1341 | 1341 | |
1342 | - if ( in_array( $close_form, array( 'yes', 'no' ) ) ) { |
|
1343 | - $field_value = ( 'yes' === $close_form ? 'enabled' : 'disabled' ); |
|
1342 | + if (in_array($close_form, array('yes', 'no'))) { |
|
1343 | + $field_value = ('yes' === $close_form ? 'enabled' : 'disabled'); |
|
1344 | 1344 | } |
1345 | 1345 | |
1346 | 1346 | return $field_value; |
1347 | 1347 | } |
1348 | 1348 | |
1349 | -add_filter( '_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3 ); |
|
1349 | +add_filter('_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3); |
|
1350 | 1350 | |
1351 | 1351 | |
1352 | 1352 | /** |
@@ -1362,17 +1362,17 @@ discard block |
||
1362 | 1362 | * |
1363 | 1363 | * @return string |
1364 | 1364 | */ |
1365 | -function _give_logged_in_only_value( $field_value, $field, $postid ) { |
|
1366 | - $guest_donation = give_get_meta( $postid, '_give_logged_in_only', true ); |
|
1365 | +function _give_logged_in_only_value($field_value, $field, $postid) { |
|
1366 | + $guest_donation = give_get_meta($postid, '_give_logged_in_only', true); |
|
1367 | 1367 | |
1368 | - if ( in_array( $guest_donation, array( 'yes', 'no' ) ) ) { |
|
1369 | - $field_value = ( 'yes' === $guest_donation ? 'enabled' : 'disabled' ); |
|
1368 | + if (in_array($guest_donation, array('yes', 'no'))) { |
|
1369 | + $field_value = ('yes' === $guest_donation ? 'enabled' : 'disabled'); |
|
1370 | 1370 | } |
1371 | 1371 | |
1372 | 1372 | return $field_value; |
1373 | 1373 | } |
1374 | 1374 | |
1375 | -add_filter( '_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3 ); |
|
1375 | +add_filter('_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3); |
|
1376 | 1376 | |
1377 | 1377 | /** |
1378 | 1378 | * Set value for Offline Donations --> Offline Donations. |
@@ -1388,17 +1388,17 @@ discard block |
||
1388 | 1388 | * |
1389 | 1389 | * @return string |
1390 | 1390 | */ |
1391 | -function _give_customize_offline_donations_value( $field_value, $field, $postid ) { |
|
1392 | - $customize_offline_text = give_get_meta( $postid, '_give_customize_offline_donations', true ); |
|
1391 | +function _give_customize_offline_donations_value($field_value, $field, $postid) { |
|
1392 | + $customize_offline_text = give_get_meta($postid, '_give_customize_offline_donations', true); |
|
1393 | 1393 | |
1394 | - if ( in_array( $customize_offline_text, array( 'yes', 'no' ) ) ) { |
|
1395 | - $field_value = ( 'yes' === $customize_offline_text ? 'enabled' : 'disabled' ); |
|
1394 | + if (in_array($customize_offline_text, array('yes', 'no'))) { |
|
1395 | + $field_value = ('yes' === $customize_offline_text ? 'enabled' : 'disabled'); |
|
1396 | 1396 | } |
1397 | 1397 | |
1398 | 1398 | return $field_value; |
1399 | 1399 | } |
1400 | 1400 | |
1401 | -add_filter( '_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3 ); |
|
1401 | +add_filter('_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3); |
|
1402 | 1402 | |
1403 | 1403 | |
1404 | 1404 | /** |
@@ -1413,14 +1413,14 @@ discard block |
||
1413 | 1413 | * |
1414 | 1414 | * @return mixed |
1415 | 1415 | */ |
1416 | -function _give_set_multi_level_repeater_field_id( $field_id, $field, $fields, $default ) { |
|
1416 | +function _give_set_multi_level_repeater_field_id($field_id, $field, $fields, $default) { |
|
1417 | 1417 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
1418 | 1418 | $field_id = "{$fields['id']}[{$row_placeholder}][{$field['id']}][level_id]"; |
1419 | 1419 | |
1420 | 1420 | return $field_id; |
1421 | 1421 | } |
1422 | 1422 | |
1423 | -add_filter( 'give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4 ); |
|
1423 | +add_filter('give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4); |
|
1424 | 1424 | |
1425 | 1425 | /** |
1426 | 1426 | * Set repeater field value for multi donation form. |
@@ -1434,13 +1434,13 @@ discard block |
||
1434 | 1434 | * |
1435 | 1435 | * @return mixed |
1436 | 1436 | */ |
1437 | -function _give_set_multi_level_repeater_field_value( $field_value, $field, $field_group, $fields ) { |
|
1438 | - $field_value = $field_group[ $field['id'] ]['level_id']; |
|
1437 | +function _give_set_multi_level_repeater_field_value($field_value, $field, $field_group, $fields) { |
|
1438 | + $field_value = $field_group[$field['id']]['level_id']; |
|
1439 | 1439 | |
1440 | 1440 | return $field_value; |
1441 | 1441 | } |
1442 | 1442 | |
1443 | -add_filter( 'give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4 ); |
|
1443 | +add_filter('give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4); |
|
1444 | 1444 | |
1445 | 1445 | /** |
1446 | 1446 | * Set default value for _give_id field. |
@@ -1451,11 +1451,11 @@ discard block |
||
1451 | 1451 | * |
1452 | 1452 | * @return string |
1453 | 1453 | */ |
1454 | -function _give_set_field_give_id_default_value( $field ) { |
|
1454 | +function _give_set_field_give_id_default_value($field) { |
|
1455 | 1455 | return 0; |
1456 | 1456 | } |
1457 | 1457 | |
1458 | -add_filter( 'give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value' ); |
|
1458 | +add_filter('give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value'); |
|
1459 | 1459 | |
1460 | 1460 | /** |
1461 | 1461 | * Set default value for _give_default field. |
@@ -1466,11 +1466,11 @@ discard block |
||
1466 | 1466 | * |
1467 | 1467 | * @return string |
1468 | 1468 | */ |
1469 | -function _give_set_field_give_default_default_value( $field ) { |
|
1469 | +function _give_set_field_give_default_default_value($field) { |
|
1470 | 1470 | return 'default'; |
1471 | 1471 | } |
1472 | 1472 | |
1473 | -add_filter( 'give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value' ); |
|
1473 | +add_filter('give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value'); |
|
1474 | 1474 | |
1475 | 1475 | /** |
1476 | 1476 | * Set repeater field editor id for field type wysiwyg. |
@@ -1482,12 +1482,12 @@ discard block |
||
1482 | 1482 | * |
1483 | 1483 | * @return string |
1484 | 1484 | */ |
1485 | -function give_repeater_field_set_editor_id( $field_name, $field ) { |
|
1486 | - if ( isset( $field['repeatable_field_id'] ) && 'wysiwyg' == $field['type'] ) { |
|
1487 | - $field_name = '_give_repeater_' . uniqid() . '_wysiwyg'; |
|
1485 | +function give_repeater_field_set_editor_id($field_name, $field) { |
|
1486 | + if (isset($field['repeatable_field_id']) && 'wysiwyg' == $field['type']) { |
|
1487 | + $field_name = '_give_repeater_'.uniqid().'_wysiwyg'; |
|
1488 | 1488 | } |
1489 | 1489 | |
1490 | 1490 | return $field_name; |
1491 | 1491 | } |
1492 | 1492 | |
1493 | -add_filter( 'give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2 ); |
|
1493 | +add_filter('give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2); |
@@ -113,7 +113,7 @@ |
||
113 | 113 | /** |
114 | 114 | * Adds the "Donation Form" button above the TinyMCE Editor on add/edit screens. |
115 | 115 | * |
116 | - * @return string|bool |
|
116 | + * @return false|null |
|
117 | 117 | * |
118 | 118 | * @since 1.0 |
119 | 119 | */ |
@@ -138,8 +138,8 @@ |
||
138 | 138 | |
139 | 139 | // Only run in admin post/page creation and edit screens |
140 | 140 | if ( in_array( $screen->parent_file, $shortcode_button_pages ) |
141 | - && apply_filters( 'give_shortcode_button_condition', true ) |
|
142 | - && ! empty( self::$shortcodes ) |
|
141 | + && apply_filters( 'give_shortcode_button_condition', true ) |
|
142 | + && ! empty( self::$shortcodes ) |
|
143 | 143 | ) { |
144 | 144 | |
145 | 145 | $shortcodes = array(); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -33,16 +33,16 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function __construct() { |
35 | 35 | |
36 | - if ( is_admin() ) { |
|
37 | - add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins' ), 15 ); |
|
36 | + if (is_admin()) { |
|
37 | + add_filter('mce_external_plugins', array($this, 'mce_external_plugins'), 15); |
|
38 | 38 | |
39 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_assets' ) ); |
|
40 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_localize_scripts' ), 13 ); |
|
41 | - add_action( 'media_buttons', array( $this, 'shortcode_button' ) ); |
|
39 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_assets')); |
|
40 | + add_action('admin_enqueue_scripts', array($this, 'admin_localize_scripts'), 13); |
|
41 | + add_action('media_buttons', array($this, 'shortcode_button')); |
|
42 | 42 | } |
43 | 43 | |
44 | - add_action( "wp_ajax_give_shortcode", array( $this, 'shortcode_ajax' ) ); |
|
45 | - add_action( "wp_ajax_nopriv_give_shortcode", array( $this, 'shortcode_ajax' ) ); |
|
44 | + add_action("wp_ajax_give_shortcode", array($this, 'shortcode_ajax')); |
|
45 | + add_action("wp_ajax_nopriv_give_shortcode", array($this, 'shortcode_ajax')); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -54,15 +54,15 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @since 1.0 |
56 | 56 | */ |
57 | - public function mce_external_plugins( $plugin_array ) { |
|
57 | + public function mce_external_plugins($plugin_array) { |
|
58 | 58 | |
59 | - if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) { |
|
59 | + if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages')) { |
|
60 | 60 | return false; |
61 | 61 | } |
62 | 62 | |
63 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
63 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
64 | 64 | |
65 | - $plugin_array['give_shortcode'] = GIVE_PLUGIN_URL . 'assets/js/admin/tinymce/mce-plugin' . $suffix . '.js'; |
|
65 | + $plugin_array['give_shortcode'] = GIVE_PLUGIN_URL.'assets/js/admin/tinymce/mce-plugin'.$suffix.'.js'; |
|
66 | 66 | |
67 | 67 | return $plugin_array; |
68 | 68 | } |
@@ -76,12 +76,12 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function admin_enqueue_assets() { |
78 | 78 | |
79 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
79 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
80 | 80 | |
81 | 81 | wp_enqueue_script( |
82 | 82 | 'give_shortcode', |
83 | - GIVE_PLUGIN_URL . 'assets/js/admin/admin-shortcodes' . $suffix . '.js', |
|
84 | - array( 'jquery' ), |
|
83 | + GIVE_PLUGIN_URL.'assets/js/admin/admin-shortcodes'.$suffix.'.js', |
|
84 | + array('jquery'), |
|
85 | 85 | GIVE_VERSION, |
86 | 86 | true |
87 | 87 | ); |
@@ -96,17 +96,17 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function admin_localize_scripts() { |
98 | 98 | |
99 | - if ( ! empty( self::$shortcodes ) ) { |
|
99 | + if ( ! empty(self::$shortcodes)) { |
|
100 | 100 | |
101 | 101 | $variables = array(); |
102 | 102 | |
103 | - foreach ( self::$shortcodes as $shortcode => $values ) { |
|
104 | - if ( ! empty( $values['required'] ) ) { |
|
105 | - $variables[ $shortcode ] = $values['required']; |
|
103 | + foreach (self::$shortcodes as $shortcode => $values) { |
|
104 | + if ( ! empty($values['required'])) { |
|
105 | + $variables[$shortcode] = $values['required']; |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | - wp_localize_script( 'give_shortcode', 'scShortcodes', $variables ); |
|
109 | + wp_localize_script('give_shortcode', 'scShortcodes', $variables); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
@@ -123,37 +123,37 @@ discard block |
||
123 | 123 | |
124 | 124 | // If we load wp editor by ajax then $screen will be empty which generate notice if we treat $screen as WP_Screen object. |
125 | 125 | // For example we are loading wp editor by ajax in repeater field. |
126 | - if ( ! ( $screen instanceof WP_Screen ) ) { |
|
126 | + if ( ! ($screen instanceof WP_Screen)) { |
|
127 | 127 | return false; |
128 | 128 | } |
129 | 129 | |
130 | - $shortcode_button_pages = apply_filters( 'give_shortcode_button_pages', array( |
|
130 | + $shortcode_button_pages = apply_filters('give_shortcode_button_pages', array( |
|
131 | 131 | 'post.php', |
132 | 132 | 'page.php', |
133 | 133 | 'post-new.php', |
134 | 134 | 'post-edit.php', |
135 | 135 | 'edit.php', |
136 | 136 | 'edit.php?post_type=page', |
137 | - ) ); |
|
137 | + )); |
|
138 | 138 | |
139 | 139 | // Only run in admin post/page creation and edit screens |
140 | - if ( in_array( $screen->parent_file, $shortcode_button_pages ) |
|
141 | - && apply_filters( 'give_shortcode_button_condition', true ) |
|
142 | - && ! empty( self::$shortcodes ) |
|
140 | + if (in_array($screen->parent_file, $shortcode_button_pages) |
|
141 | + && apply_filters('give_shortcode_button_condition', true) |
|
142 | + && ! empty(self::$shortcodes) |
|
143 | 143 | ) { |
144 | 144 | |
145 | 145 | $shortcodes = array(); |
146 | 146 | |
147 | - foreach ( self::$shortcodes as $shortcode => $values ) { |
|
147 | + foreach (self::$shortcodes as $shortcode => $values) { |
|
148 | 148 | |
149 | 149 | /** |
150 | 150 | * Filters the condition for including the current shortcode |
151 | 151 | * |
152 | 152 | * @since 1.0 |
153 | 153 | */ |
154 | - if ( apply_filters( sanitize_title( $shortcode ) . '_condition', true ) ) { |
|
154 | + if (apply_filters(sanitize_title($shortcode).'_condition', true)) { |
|
155 | 155 | |
156 | - $shortcodes[ $shortcode ] = sprintf( |
|
156 | + $shortcodes[$shortcode] = sprintf( |
|
157 | 157 | '<div class="sc-shortcode mce-menu-item give-shortcode-item-%1$s" data-shortcode="%2$s">%3$s</div>', |
158 | 158 | $shortcode, |
159 | 159 | $shortcode, |
@@ -162,37 +162,37 @@ discard block |
||
162 | 162 | } |
163 | 163 | } |
164 | 164 | |
165 | - if ( ! empty( $shortcodes ) ) { |
|
165 | + if ( ! empty($shortcodes)) { |
|
166 | 166 | |
167 | 167 | // check current WP version |
168 | - $img = ( version_compare( get_bloginfo( 'version' ), '3.5', '<' ) ) |
|
169 | - ? '<img src="' . GIVE_PLUGIN_URL . 'assets/images/give-media.png" />' |
|
170 | - : '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url(' . give_svg_icons( 'give_grey' ) . ');"></span>'; |
|
168 | + $img = (version_compare(get_bloginfo('version'), '3.5', '<')) |
|
169 | + ? '<img src="'.GIVE_PLUGIN_URL.'assets/images/give-media.png" />' |
|
170 | + : '<span class="wp-media-buttons-icon" id="give-media-button" style="background-image: url('.give_svg_icons('give_grey').');"></span>'; |
|
171 | 171 | |
172 | - reset( $shortcodes ); |
|
172 | + reset($shortcodes); |
|
173 | 173 | |
174 | - if ( count( $shortcodes ) == 1 ) { |
|
174 | + if (count($shortcodes) == 1) { |
|
175 | 175 | |
176 | - $shortcode = key( $shortcodes ); |
|
176 | + $shortcode = key($shortcodes); |
|
177 | 177 | |
178 | 178 | printf( |
179 | 179 | '<button class="button sc-shortcode" data-shortcode="%s">%s</button>', |
180 | 180 | $shortcode, |
181 | - sprintf( '%s %s %s', |
|
181 | + sprintf('%s %s %s', |
|
182 | 182 | $img, |
183 | - esc_html__( 'Insert', 'give' ), |
|
184 | - self::$shortcodes[ $shortcode ]['label'] |
|
183 | + esc_html__('Insert', 'give'), |
|
184 | + self::$shortcodes[$shortcode]['label'] |
|
185 | 185 | ) |
186 | 186 | ); |
187 | 187 | } else { |
188 | 188 | printf( |
189 | - '<div class="sc-wrap">' . |
|
190 | - '<button class="button sc-button">%s %s</button>' . |
|
191 | - '<div class="sc-menu mce-menu">%s</div>' . |
|
189 | + '<div class="sc-wrap">'. |
|
190 | + '<button class="button sc-button">%s %s</button>'. |
|
191 | + '<div class="sc-menu mce-menu">%s</div>'. |
|
192 | 192 | '</div>', |
193 | 193 | $img, |
194 | - esc_html__( 'Give Shortcodes', 'give' ), |
|
195 | - implode( '', array_values( $shortcodes ) ) |
|
194 | + esc_html__('Give Shortcodes', 'give'), |
|
195 | + implode('', array_values($shortcodes)) |
|
196 | 196 | ); |
197 | 197 | } |
198 | 198 | } |
@@ -208,15 +208,15 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function shortcode_ajax() { |
210 | 210 | |
211 | - $shortcode = isset( $_POST['shortcode'] ) ? $_POST['shortcode'] : false; |
|
211 | + $shortcode = isset($_POST['shortcode']) ? $_POST['shortcode'] : false; |
|
212 | 212 | $response = false; |
213 | 213 | |
214 | - if ( $shortcode && array_key_exists( $shortcode, self::$shortcodes ) ) { |
|
214 | + if ($shortcode && array_key_exists($shortcode, self::$shortcodes)) { |
|
215 | 215 | |
216 | - $data = self::$shortcodes[ $shortcode ]; |
|
216 | + $data = self::$shortcodes[$shortcode]; |
|
217 | 217 | |
218 | - if ( ! empty( $data['errors'] ) ) { |
|
219 | - $data['btn_okay'] = array( esc_html__( 'Okay', 'give' ) ); |
|
218 | + if ( ! empty($data['errors'])) { |
|
219 | + $data['btn_okay'] = array(esc_html__('Okay', 'give')); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | $response = array( |
@@ -228,10 +228,10 @@ discard block |
||
228 | 228 | ); |
229 | 229 | } else { |
230 | 230 | // todo: handle error |
231 | - error_log( print_r( 'AJAX error!', 1 ) ); |
|
231 | + error_log(print_r('AJAX error!', 1)); |
|
232 | 232 | } |
233 | 233 | |
234 | - wp_send_json( $response ); |
|
234 | + wp_send_json($response); |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 |
@@ -464,7 +464,7 @@ |
||
464 | 464 | * |
465 | 465 | * @param WP_Post $payment |
466 | 466 | * |
467 | - * @return mixed |
|
467 | + * @return false|null |
|
468 | 468 | */ |
469 | 469 | function give_offline_payment_receipt_after( $payment ) { |
470 | 470 | // Get payment object. |
@@ -249,10 +249,10 @@ |
||
249 | 249 | $admin_message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n"; |
250 | 250 | |
251 | 251 | $admin_message .= sprintf( |
252 | - '<a href="%1$s">%2$s</a>', |
|
253 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ), |
|
254 | - __( 'View Donation Details »', 'give' ) |
|
255 | - ) . "\n\n"; |
|
252 | + '<a href="%1$s">%2$s</a>', |
|
253 | + admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ), |
|
254 | + __( 'View Donation Details »', 'give' ) |
|
255 | + ) . "\n\n"; |
|
256 | 256 | |
257 | 257 | $admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id ); |
258 | 258 | $admin_message = give_do_email_tags( $admin_message, $payment_id ); |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return array |
20 | 20 | */ |
21 | -function give_offline_register_gateway( $gateways ) { |
|
21 | +function give_offline_register_gateway($gateways) { |
|
22 | 22 | // Format: ID => Name |
23 | 23 | $gateways['offline'] = array( |
24 | - 'admin_label' => esc_attr__( 'Offline Donation', 'give' ), |
|
25 | - 'checkout_label' => esc_attr__( 'Offline Donation', 'give' ) |
|
24 | + 'admin_label' => esc_attr__('Offline Donation', 'give'), |
|
25 | + 'checkout_label' => esc_attr__('Offline Donation', 'give') |
|
26 | 26 | ); |
27 | 27 | |
28 | 28 | return $gateways; |
29 | 29 | } |
30 | 30 | |
31 | -add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 ); |
|
31 | +add_filter('give_payment_gateways', 'give_offline_register_gateway', 1); |
|
32 | 32 | |
33 | 33 | |
34 | 34 | /** |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return void |
42 | 42 | */ |
43 | -function give_offline_payment_cc_form( $form_id ) { |
|
43 | +function give_offline_payment_cc_form($form_id) { |
|
44 | 44 | // Get offline payment instruction. |
45 | - $offline_instructions = give_get_offline_payment_instruction( $form_id, true ); |
|
45 | + $offline_instructions = give_get_offline_payment_instruction($form_id, true); |
|
46 | 46 | |
47 | 47 | ob_start(); |
48 | 48 | |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @param int $form_id Give form id. |
55 | 55 | */ |
56 | - do_action( 'give_before_offline_info_fields', $form_id ); |
|
56 | + do_action('give_before_offline_info_fields', $form_id); |
|
57 | 57 | ?> |
58 | 58 | <fieldset id="give_offline_payment_info"> |
59 | - <?php echo stripslashes( $offline_instructions ); ?> |
|
59 | + <?php echo stripslashes($offline_instructions); ?> |
|
60 | 60 | </fieldset> |
61 | 61 | <?php |
62 | 62 | /** |
@@ -66,35 +66,35 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @param int $form_id Give form id. |
68 | 68 | */ |
69 | - do_action( 'give_after_offline_info_fields', $form_id ); |
|
69 | + do_action('give_after_offline_info_fields', $form_id); |
|
70 | 70 | |
71 | 71 | echo ob_get_clean(); |
72 | 72 | } |
73 | 73 | |
74 | -add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' ); |
|
74 | +add_action('give_offline_cc_form', 'give_offline_payment_cc_form'); |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Give Offline Billing Field |
78 | 78 | * |
79 | 79 | * @param $form_id |
80 | 80 | */ |
81 | -function give_offline_billing_fields( $form_id ) { |
|
81 | +function give_offline_billing_fields($form_id) { |
|
82 | 82 | //Enable Default CC fields (billing info) |
83 | - $post_offline_cc_fields = give_get_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true ); |
|
84 | - $post_offline_customize_option = give_get_meta( $form_id, '_give_customize_offline_donations', true ); |
|
83 | + $post_offline_cc_fields = give_get_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true); |
|
84 | + $post_offline_customize_option = give_get_meta($form_id, '_give_customize_offline_donations', true); |
|
85 | 85 | |
86 | - $global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' ); |
|
86 | + $global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields'); |
|
87 | 87 | |
88 | 88 | //Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options |
89 | 89 | if ( |
90 | - ( give_is_setting_enabled( $post_offline_customize_option, 'global' ) && give_is_setting_enabled( $global_offline_cc_fields ) ) |
|
91 | - || ( give_is_setting_enabled( $post_offline_customize_option, 'enabled' ) && give_is_setting_enabled( $post_offline_cc_fields ) ) |
|
90 | + (give_is_setting_enabled($post_offline_customize_option, 'global') && give_is_setting_enabled($global_offline_cc_fields)) |
|
91 | + || (give_is_setting_enabled($post_offline_customize_option, 'enabled') && give_is_setting_enabled($post_offline_cc_fields)) |
|
92 | 92 | ) { |
93 | - give_default_cc_address_fields( $form_id ); |
|
93 | + give_default_cc_address_fields($form_id); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | -add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 ); |
|
97 | +add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1); |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Process the payment |
@@ -105,16 +105,16 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return void |
107 | 107 | */ |
108 | -function give_offline_process_payment( $purchase_data ) { |
|
108 | +function give_offline_process_payment($purchase_data) { |
|
109 | 109 | |
110 | - $purchase_summary = give_get_purchase_summary( $purchase_data ); |
|
110 | + $purchase_summary = give_get_purchase_summary($purchase_data); |
|
111 | 111 | |
112 | 112 | // setup the payment details |
113 | 113 | $payment_data = array( |
114 | 114 | 'price' => $purchase_data['price'], |
115 | 115 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
116 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
117 | - 'give_price_id' => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '', |
|
116 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
117 | + 'give_price_id' => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '', |
|
118 | 118 | 'date' => $purchase_data['date'], |
119 | 119 | 'user_email' => $purchase_data['user_email'], |
120 | 120 | 'purchase_key' => $purchase_data['purchase_key'], |
@@ -126,20 +126,20 @@ discard block |
||
126 | 126 | |
127 | 127 | |
128 | 128 | // record the pending payment |
129 | - $payment = give_insert_payment( $payment_data ); |
|
129 | + $payment = give_insert_payment($payment_data); |
|
130 | 130 | |
131 | - if ( $payment ) { |
|
132 | - give_offline_send_admin_notice( $payment ); |
|
133 | - give_offline_send_donor_instructions( $payment ); |
|
131 | + if ($payment) { |
|
132 | + give_offline_send_admin_notice($payment); |
|
133 | + give_offline_send_donor_instructions($payment); |
|
134 | 134 | give_send_to_success_page(); |
135 | 135 | } else { |
136 | 136 | // if errors are present, send the user back to the donation form so they can be corrected |
137 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
137 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | } |
141 | 141 | |
142 | -add_action( 'give_gateway_offline', 'give_offline_process_payment' ); |
|
142 | +add_action('give_gateway_offline', 'give_offline_process_payment'); |
|
143 | 143 | |
144 | 144 | |
145 | 145 | /** |
@@ -152,59 +152,59 @@ discard block |
||
152 | 152 | * @since 1.0 |
153 | 153 | * @return void |
154 | 154 | */ |
155 | -function give_offline_send_donor_instructions( $payment_id = 0 ) { |
|
155 | +function give_offline_send_donor_instructions($payment_id = 0) { |
|
156 | 156 | |
157 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
158 | - $post_offline_customization_option = give_get_meta( $payment_data['form_id'], '_give_customize_offline_donations', true ); |
|
157 | + $payment_data = give_get_payment_meta($payment_id); |
|
158 | + $post_offline_customization_option = give_get_meta($payment_data['form_id'], '_give_customize_offline_donations', true); |
|
159 | 159 | |
160 | 160 | //Customize email content depending on whether the single form has been customized |
161 | - $email_content = give_get_option( 'global_offline_donation_email' ); |
|
161 | + $email_content = give_get_option('global_offline_donation_email'); |
|
162 | 162 | |
163 | - if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) { |
|
164 | - $email_content = give_get_meta( $payment_data['form_id'], '_give_offline_donation_email', true ); |
|
163 | + if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) { |
|
164 | + $email_content = give_get_meta($payment_data['form_id'], '_give_offline_donation_email', true); |
|
165 | 165 | } |
166 | 166 | |
167 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
167 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
168 | 168 | |
169 | 169 | /** |
170 | 170 | * Filters the from name. |
171 | 171 | * |
172 | 172 | * @since 1.7 |
173 | 173 | */ |
174 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data ); |
|
174 | + $from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data); |
|
175 | 175 | |
176 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
176 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
177 | 177 | |
178 | 178 | /** |
179 | 179 | * Filters the from email. |
180 | 180 | * |
181 | 181 | * @since 1.7 |
182 | 182 | */ |
183 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data ); |
|
183 | + $from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data); |
|
184 | 184 | |
185 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
185 | + $to_email = give_get_payment_user_email($payment_id); |
|
186 | 186 | |
187 | - $subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) ); |
|
188 | - if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) { |
|
189 | - $subject = give_get_meta( $payment_data['form_id'], '_give_offline_donation_subject', true ); |
|
187 | + $subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give')); |
|
188 | + if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) { |
|
189 | + $subject = give_get_meta($payment_data['form_id'], '_give_offline_donation_subject', true); |
|
190 | 190 | } |
191 | 191 | |
192 | - $subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
193 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
192 | + $subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
193 | + $subject = give_do_email_tags($subject, $payment_id); |
|
194 | 194 | |
195 | - $attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data ); |
|
196 | - $message = give_do_email_tags( $email_content, $payment_id ); |
|
195 | + $attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data); |
|
196 | + $message = give_do_email_tags($email_content, $payment_id); |
|
197 | 197 | |
198 | 198 | $emails = Give()->emails; |
199 | 199 | |
200 | - $emails->__set( 'from_name', $from_name ); |
|
201 | - $emails->__set( 'from_email', $from_email ); |
|
202 | - $emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) ); |
|
200 | + $emails->__set('from_name', $from_name); |
|
201 | + $emails->__set('from_email', $from_email); |
|
202 | + $emails->__set('heading', __('Offline Donation Instructions', 'give')); |
|
203 | 203 | |
204 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
205 | - $emails->__set( 'headers', $headers ); |
|
204 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
205 | + $emails->__set('headers', $headers); |
|
206 | 206 | |
207 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
207 | + $emails->send($to_email, $subject, $message, $attachments); |
|
208 | 208 | |
209 | 209 | } |
210 | 210 | |
@@ -221,54 +221,54 @@ discard block |
||
221 | 221 | * @return void |
222 | 222 | * |
223 | 223 | */ |
224 | -function give_offline_send_admin_notice( $payment_id = 0 ) { |
|
224 | +function give_offline_send_admin_notice($payment_id = 0) { |
|
225 | 225 | |
226 | 226 | /* Send an email notification to the admin */ |
227 | 227 | $admin_email = give_get_admin_notice_emails(); |
228 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
228 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
229 | 229 | |
230 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
231 | - $user_data = get_userdata( $user_info['id'] ); |
|
230 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
231 | + $user_data = get_userdata($user_info['id']); |
|
232 | 232 | $name = $user_data->display_name; |
233 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
234 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
233 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
234 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
235 | 235 | } else { |
236 | 236 | $name = $user_info['email']; |
237 | 237 | } |
238 | 238 | |
239 | - $amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ); |
|
239 | + $amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))); |
|
240 | 240 | |
241 | - $admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', __( 'New Pending Donation', 'give' ), $payment_id ); |
|
241 | + $admin_subject = apply_filters('give_offline_admin_donation_notification_subject', __('New Pending Donation', 'give'), $payment_id); |
|
242 | 242 | |
243 | - $admin_message = __( 'Dear Admin,', 'give' ) . "\n\n"; |
|
244 | - $admin_message .= sprintf(__( 'A new offline donation has been made on your website for %s.', 'give' ), $amount) . "\n\n"; |
|
245 | - $admin_message .= __( 'The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n"; |
|
243 | + $admin_message = __('Dear Admin,', 'give')."\n\n"; |
|
244 | + $admin_message .= sprintf(__('A new offline donation has been made on your website for %s.', 'give'), $amount)."\n\n"; |
|
245 | + $admin_message .= __('The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n"; |
|
246 | 246 | |
247 | 247 | |
248 | - $admin_message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
249 | - $admin_message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n"; |
|
248 | + $admin_message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
249 | + $admin_message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n"; |
|
250 | 250 | |
251 | 251 | $admin_message .= sprintf( |
252 | 252 | '<a href="%1$s">%2$s</a>', |
253 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id=' . $payment_id ), |
|
254 | - __( 'View Donation Details »', 'give' ) |
|
255 | - ) . "\n\n"; |
|
253 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-payment-details&id='.$payment_id), |
|
254 | + __('View Donation Details »', 'give') |
|
255 | + )."\n\n"; |
|
256 | 256 | |
257 | - $admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id ); |
|
258 | - $admin_message = give_do_email_tags( $admin_message, $payment_id ); |
|
257 | + $admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id); |
|
258 | + $admin_message = give_do_email_tags($admin_message, $payment_id); |
|
259 | 259 | |
260 | - $attachments = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id ); |
|
261 | - $admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id ); |
|
260 | + $attachments = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id); |
|
261 | + $admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id); |
|
262 | 262 | |
263 | 263 | //Send Email |
264 | 264 | $emails = Give()->emails; |
265 | - $emails->__set( 'heading', __( 'New Offline Donation', 'give' ) ); |
|
265 | + $emails->__set('heading', __('New Offline Donation', 'give')); |
|
266 | 266 | |
267 | - if ( ! empty( $admin_headers ) ) { |
|
268 | - $emails->__set( 'headers', $admin_headers ); |
|
267 | + if ( ! empty($admin_headers)) { |
|
268 | + $emails->__set('headers', $admin_headers); |
|
269 | 269 | } |
270 | 270 | |
271 | - $emails->send( $admin_email, $admin_subject, $admin_message, $attachments ); |
|
271 | + $emails->send($admin_email, $admin_subject, $admin_message, $attachments); |
|
272 | 272 | |
273 | 273 | } |
274 | 274 | |
@@ -280,20 +280,20 @@ discard block |
||
280 | 280 | * |
281 | 281 | * @return array |
282 | 282 | */ |
283 | -function give_offline_add_settings( $settings ) { |
|
283 | +function give_offline_add_settings($settings) { |
|
284 | 284 | |
285 | 285 | // Bailout: Do not show offline gateways setting in to metabox if its disabled globally. |
286 | - if ( in_array( 'offline', give_get_option( 'gateways' ) ) ) { |
|
286 | + if (in_array('offline', give_get_option('gateways'))) { |
|
287 | 287 | return $settings; |
288 | 288 | } |
289 | 289 | |
290 | 290 | //Vars |
291 | 291 | $prefix = '_give_'; |
292 | 292 | |
293 | - $is_gateway_active = give_is_gateway_active( 'offline' ); |
|
293 | + $is_gateway_active = give_is_gateway_active('offline'); |
|
294 | 294 | |
295 | 295 | //this gateway isn't active |
296 | - if ( ! $is_gateway_active ) { |
|
296 | + if ( ! $is_gateway_active) { |
|
297 | 297 | //return settings and bounce |
298 | 298 | return $settings; |
299 | 299 | } |
@@ -302,34 +302,34 @@ discard block |
||
302 | 302 | $check_settings = array( |
303 | 303 | |
304 | 304 | array( |
305 | - 'name' => __( 'Offline Donations', 'give' ), |
|
306 | - 'desc' => __( 'Do you want to customize the donation instructions for this form?', 'give' ), |
|
307 | - 'id' => $prefix . 'customize_offline_donations', |
|
305 | + 'name' => __('Offline Donations', 'give'), |
|
306 | + 'desc' => __('Do you want to customize the donation instructions for this form?', 'give'), |
|
307 | + 'id' => $prefix.'customize_offline_donations', |
|
308 | 308 | 'type' => 'radio_inline', |
309 | 309 | 'default' => 'global', |
310 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
311 | - 'global' => __( 'Global Option', 'give' ), |
|
312 | - 'enabled' => __( 'Customize', 'give' ), |
|
313 | - 'disabled' => __( 'Disable', 'give' ), |
|
310 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
311 | + 'global' => __('Global Option', 'give'), |
|
312 | + 'enabled' => __('Customize', 'give'), |
|
313 | + 'disabled' => __('Disable', 'give'), |
|
314 | 314 | ) |
315 | 315 | ), |
316 | 316 | ), |
317 | 317 | array( |
318 | - 'name' => __( 'Billing Fields', 'give' ), |
|
319 | - 'desc' => __( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ), |
|
320 | - 'id' => $prefix . 'offline_donation_enable_billing_fields_single', |
|
318 | + 'name' => __('Billing Fields', 'give'), |
|
319 | + 'desc' => __('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'), |
|
320 | + 'id' => $prefix.'offline_donation_enable_billing_fields_single', |
|
321 | 321 | 'row_classes' => 'give-subfield', |
322 | 322 | 'type' => 'radio_inline', |
323 | 323 | 'default' => 'disabled', |
324 | 324 | 'options' => array( |
325 | - 'enabled' => __( 'Enabled', 'give' ), |
|
326 | - 'disabled' => __( 'Disabled', 'give' ), |
|
325 | + 'enabled' => __('Enabled', 'give'), |
|
326 | + 'disabled' => __('Disabled', 'give'), |
|
327 | 327 | ), |
328 | 328 | ), |
329 | 329 | array( |
330 | - 'id' => $prefix . 'offline_checkout_notes', |
|
331 | - 'name' => __( 'Donation Instructions', 'give' ), |
|
332 | - 'desc' => __( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
330 | + 'id' => $prefix.'offline_checkout_notes', |
|
331 | + 'name' => __('Donation Instructions', 'give'), |
|
332 | + 'desc' => __('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
333 | 333 | 'default' => give_get_default_offline_donation_content(), |
334 | 334 | 'type' => 'wysiwyg', |
335 | 335 | 'row_classes' => 'give-subfield', |
@@ -338,17 +338,17 @@ discard block |
||
338 | 338 | ) |
339 | 339 | ), |
340 | 340 | array( |
341 | - 'id' => $prefix . 'offline_donation_subject', |
|
342 | - 'name' => __( 'Email Subject', 'give' ), |
|
343 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
344 | - 'default' => __( '{form_title} - Offline Donation Instructions', 'give' ), |
|
341 | + 'id' => $prefix.'offline_donation_subject', |
|
342 | + 'name' => __('Email Subject', 'give'), |
|
343 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
344 | + 'default' => __('{form_title} - Offline Donation Instructions', 'give'), |
|
345 | 345 | 'row_classes' => 'give-subfield', |
346 | 346 | 'type' => 'text' |
347 | 347 | ), |
348 | 348 | array( |
349 | - 'id' => $prefix . 'offline_donation_email', |
|
350 | - 'name' => __( 'Email Instructions', 'give' ), |
|
351 | - 'desc' => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ) . ' ' . __( 'Available template tags:', 'give' ) . give_get_emails_tags_list(), |
|
349 | + 'id' => $prefix.'offline_donation_email', |
|
350 | + 'name' => __('Email Instructions', 'give'), |
|
351 | + 'desc' => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give').' '.__('Available template tags:', 'give').give_get_emails_tags_list(), |
|
352 | 352 | 'default' => give_get_default_offline_donation_email_content(), |
353 | 353 | 'type' => 'wysiwyg', |
354 | 354 | 'row_classes' => 'give-subfield', |
@@ -360,14 +360,14 @@ discard block |
||
360 | 360 | 'name' => 'offline_docs', |
361 | 361 | 'type' => 'docs_link', |
362 | 362 | 'url' => 'http://docs.givewp.com/settings-gateway-offline-donations', |
363 | - 'title' => __( 'Offline Donations', 'give' ), |
|
363 | + 'title' => __('Offline Donations', 'give'), |
|
364 | 364 | ), |
365 | 365 | ); |
366 | 366 | |
367 | - return array_merge( $settings, $check_settings ); |
|
367 | + return array_merge($settings, $check_settings); |
|
368 | 368 | } |
369 | 369 | |
370 | -add_filter( 'give_forms_offline_donations_metabox_fields', 'give_offline_add_settings' ); |
|
370 | +add_filter('give_forms_offline_donations_metabox_fields', 'give_offline_add_settings'); |
|
371 | 371 | |
372 | 372 | |
373 | 373 | /** |
@@ -379,32 +379,32 @@ discard block |
||
379 | 379 | */ |
380 | 380 | function give_get_default_offline_donation_content() { |
381 | 381 | |
382 | - $sitename = get_bloginfo( 'sitename' ); |
|
382 | + $sitename = get_bloginfo('sitename'); |
|
383 | 383 | |
384 | - $default_text = '<p>' . __( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>'; |
|
384 | + $default_text = '<p>'.__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>'; |
|
385 | 385 | $default_text .= '<ol>'; |
386 | 386 | $default_text .= '<li>'; |
387 | 387 | $default_text .= sprintf( |
388 | 388 | /* translators: %s: site name */ |
389 | - __( 'Make a check payable to "%s"', 'give' ), |
|
389 | + __('Make a check payable to "%s"', 'give'), |
|
390 | 390 | $sitename |
391 | 391 | ); |
392 | 392 | $default_text .= '</li>'; |
393 | 393 | $default_text .= '<li>'; |
394 | 394 | $default_text .= sprintf( |
395 | 395 | /* translators: %s: site name */ |
396 | - __( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
396 | + __('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
397 | 397 | $sitename |
398 | 398 | ); |
399 | 399 | $default_text .= '</li>'; |
400 | - $default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>'; |
|
400 | + $default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>'; |
|
401 | 401 | $default_text .= '</ol>'; |
402 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
402 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
403 | 403 | $default_text .= ' <em>111 Not A Real St.</em><br>'; |
404 | 404 | $default_text .= ' <em>Anytown, CA 12345 </em><br>'; |
405 | - $default_text .= '<p>' . __( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>'; |
|
405 | + $default_text .= '<p>'.__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>'; |
|
406 | 406 | |
407 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
407 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
408 | 408 | |
409 | 409 | } |
410 | 410 | |
@@ -417,34 +417,34 @@ discard block |
||
417 | 417 | */ |
418 | 418 | function give_get_default_offline_donation_email_content() { |
419 | 419 | |
420 | - $sitename = get_bloginfo( 'sitename' ); |
|
421 | - $default_text = '<p>' . __( 'Dear {name},', 'give' ) . '</p>'; |
|
422 | - $default_text .= '<p>' . __( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give' ) . '</p>'; |
|
420 | + $sitename = get_bloginfo('sitename'); |
|
421 | + $default_text = '<p>'.__('Dear {name},', 'give').'</p>'; |
|
422 | + $default_text .= '<p>'.__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give').'</p>'; |
|
423 | 423 | $default_text .= '<ol>'; |
424 | 424 | $default_text .= '<li>'; |
425 | 425 | $default_text .= sprintf( |
426 | 426 | /* translators: %s: site name */ |
427 | - __( 'Make a check payable to "%s"', 'give' ), |
|
427 | + __('Make a check payable to "%s"', 'give'), |
|
428 | 428 | $sitename |
429 | 429 | ); |
430 | 430 | $default_text .= '</li>'; |
431 | 431 | $default_text .= '<li>'; |
432 | 432 | $default_text .= sprintf( |
433 | 433 | /* translators: %s: site name */ |
434 | - __( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
434 | + __('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
435 | 435 | $sitename |
436 | 436 | ); |
437 | 437 | $default_text .= '</li>'; |
438 | - $default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>'; |
|
438 | + $default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>'; |
|
439 | 439 | $default_text .= '</ol>'; |
440 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
440 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
441 | 441 | $default_text .= ' <em>111 Not A Real St.</em><br>'; |
442 | 442 | $default_text .= ' <em>Anytown, CA 12345 </em><br>'; |
443 | - $default_text .= '<p>' . __( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>'; |
|
444 | - $default_text .= '<p>' . __( 'Sincerely,', 'give' ) . '</p>'; |
|
445 | - $default_text .= '<p>' . $sitename . '</p>'; |
|
443 | + $default_text .= '<p>'.__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>'; |
|
444 | + $default_text .= '<p>'.__('Sincerely,', 'give').'</p>'; |
|
445 | + $default_text .= '<p>'.$sitename.'</p>'; |
|
446 | 446 | |
447 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
447 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
448 | 448 | |
449 | 449 | } |
450 | 450 | |
@@ -458,17 +458,17 @@ discard block |
||
458 | 458 | * |
459 | 459 | * @return string |
460 | 460 | */ |
461 | -function give_offline_donation_receipt_status_notice( $notice, $id ) { |
|
462 | - $payment = new Give_Payment( $id ); |
|
461 | +function give_offline_donation_receipt_status_notice($notice, $id) { |
|
462 | + $payment = new Give_Payment($id); |
|
463 | 463 | |
464 | - if ( 'offline' !== $payment->gateway || $payment->is_completed() ) { |
|
464 | + if ('offline' !== $payment->gateway || $payment->is_completed()) { |
|
465 | 465 | return $notice; |
466 | 466 | } |
467 | 467 | |
468 | - return Give()->notices->print_frontend_notice( __( 'Payment Pending: Please follow the instructions below to complete your donation.', 'give' ), false, 'warning' ); |
|
468 | + return Give()->notices->print_frontend_notice(__('Payment Pending: Please follow the instructions below to complete your donation.', 'give'), false, 'warning'); |
|
469 | 469 | } |
470 | 470 | |
471 | -add_filter( 'give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2 ); |
|
471 | +add_filter('give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2); |
|
472 | 472 | |
473 | 473 | /** |
474 | 474 | * Add offline payment instruction on payment receipt. |
@@ -479,26 +479,26 @@ discard block |
||
479 | 479 | * |
480 | 480 | * @return mixed |
481 | 481 | */ |
482 | -function give_offline_payment_receipt_after( $payment ) { |
|
482 | +function give_offline_payment_receipt_after($payment) { |
|
483 | 483 | // Get payment object. |
484 | - $payment = new Give_Payment( $payment->ID ); |
|
484 | + $payment = new Give_Payment($payment->ID); |
|
485 | 485 | |
486 | 486 | // Bailout. |
487 | - if ( 'offline' !== $payment->gateway ) { |
|
487 | + if ('offline' !== $payment->gateway) { |
|
488 | 488 | return false; |
489 | 489 | } |
490 | 490 | |
491 | 491 | ?> |
492 | 492 | <tr> |
493 | - <td scope="row"><strong><?php esc_html_e( 'Offline Payment Instruction:', 'give' ); ?></strong></td> |
|
493 | + <td scope="row"><strong><?php esc_html_e('Offline Payment Instruction:', 'give'); ?></strong></td> |
|
494 | 494 | <td> |
495 | - <?php echo give_get_offline_payment_instruction( $payment->form_id, true ); ?> |
|
495 | + <?php echo give_get_offline_payment_instruction($payment->form_id, true); ?> |
|
496 | 496 | </td> |
497 | 497 | </tr> |
498 | 498 | <?php |
499 | 499 | } |
500 | 500 | |
501 | -add_filter( 'give_payment_receipt_after', 'give_offline_payment_receipt_after' ); |
|
501 | +add_filter('give_payment_receipt_after', 'give_offline_payment_receipt_after'); |
|
502 | 502 | |
503 | 503 | /** |
504 | 504 | * Get offline payment instructions. |
@@ -510,27 +510,27 @@ discard block |
||
510 | 510 | * |
511 | 511 | * @return string |
512 | 512 | */ |
513 | -function give_get_offline_payment_instruction( $form_id, $wpautop = false ) { |
|
513 | +function give_get_offline_payment_instruction($form_id, $wpautop = false) { |
|
514 | 514 | // Bailout. |
515 | - if ( ! $form_id ) { |
|
515 | + if ( ! $form_id) { |
|
516 | 516 | return ''; |
517 | 517 | } |
518 | 518 | |
519 | - $post_offline_customization_option = give_get_meta( $form_id, '_give_customize_offline_donations', true ); |
|
520 | - $post_offline_instructions = give_get_meta( $form_id, '_give_offline_checkout_notes', true ); |
|
521 | - $global_offline_instruction = give_get_option( 'global_offline_donation_content' ); |
|
519 | + $post_offline_customization_option = give_get_meta($form_id, '_give_customize_offline_donations', true); |
|
520 | + $post_offline_instructions = give_get_meta($form_id, '_give_offline_checkout_notes', true); |
|
521 | + $global_offline_instruction = give_get_option('global_offline_donation_content'); |
|
522 | 522 | $offline_instructions = $global_offline_instruction; |
523 | 523 | |
524 | - if ( give_is_setting_enabled( $post_offline_customization_option ) ) { |
|
524 | + if (give_is_setting_enabled($post_offline_customization_option)) { |
|
525 | 525 | $offline_instructions = $post_offline_instructions; |
526 | 526 | } |
527 | 527 | |
528 | - $settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' ); |
|
528 | + $settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1'); |
|
529 | 529 | |
530 | 530 | /* translators: %s: form settings url */ |
531 | - $offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( __( 'Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give' ), $settings_url ); |
|
531 | + $offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(__('Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give'), $settings_url); |
|
532 | 532 | |
533 | - return ( $wpautop ? wpautop( $offline_instructions ) : $offline_instructions ); |
|
533 | + return ($wpautop ? wpautop($offline_instructions) : $offline_instructions); |
|
534 | 534 | } |
535 | 535 | |
536 | 536 | |
@@ -544,24 +544,24 @@ discard block |
||
544 | 544 | * |
545 | 545 | * @return array |
546 | 546 | */ |
547 | -function give_filter_offline_gateway( $gateway_list, $form_id ) { |
|
547 | +function give_filter_offline_gateway($gateway_list, $form_id) { |
|
548 | 548 | if ( |
549 | 549 | // Show offline payment gateway if enable for new donation form. |
550 | - ( false === strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms' ) ) |
|
550 | + (false === strpos($_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms')) |
|
551 | 551 | && $form_id |
552 | - && ! give_is_setting_enabled( give_get_meta( $form_id, '_give_customize_offline_donations', true ), array( |
|
552 | + && ! give_is_setting_enabled(give_get_meta($form_id, '_give_customize_offline_donations', true), array( |
|
553 | 553 | 'enabled', |
554 | 554 | 'global', |
555 | - ) ) |
|
555 | + )) |
|
556 | 556 | ) { |
557 | - unset( $gateway_list['offline'] ); |
|
557 | + unset($gateway_list['offline']); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | // Output. |
561 | 561 | return $gateway_list; |
562 | 562 | } |
563 | 563 | |
564 | -add_filter( 'give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2 ); |
|
564 | +add_filter('give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2); |
|
565 | 565 | |
566 | 566 | /** |
567 | 567 | * Set default gateway to global default payment gateway |
@@ -575,10 +575,10 @@ discard block |
||
575 | 575 | * |
576 | 576 | * @return void |
577 | 577 | */ |
578 | -function _give_customize_offline_donations_on_save_callback( $meta_key, $meta_value, $postid ) { |
|
579 | - if ( ! give_is_setting_enabled( $meta_value ) && ( 'offline' === give_get_meta( $postid, '_give_default_gateway', true ) ) ) { |
|
580 | - give_update_meta( $postid, '_give_default_gateway', 'global' ); |
|
578 | +function _give_customize_offline_donations_on_save_callback($meta_key, $meta_value, $postid) { |
|
579 | + if ( ! give_is_setting_enabled($meta_value) && ('offline' === give_get_meta($postid, '_give_default_gateway', true))) { |
|
580 | + give_update_meta($postid, '_give_default_gateway', 'global'); |
|
581 | 581 | } |
582 | 582 | } |
583 | 583 | |
584 | -add_filter( 'give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3 ); |
|
584 | +add_filter('give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3); |
@@ -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 | |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_email_donation_receipt( $payment_id, $admin_notice = true ) { |
|
29 | +function give_email_donation_receipt($payment_id, $admin_notice = true) { |
|
30 | 30 | |
31 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
31 | + $payment_data = give_get_payment_meta($payment_id); |
|
32 | 32 | |
33 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
33 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Filters the from name. |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @since 1.0 |
42 | 42 | */ |
43 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data ); |
|
43 | + $from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data); |
|
44 | 44 | |
45 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
45 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Filters the from email. |
@@ -52,19 +52,19 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @since 1.0 |
54 | 54 | */ |
55 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data ); |
|
55 | + $from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data); |
|
56 | 56 | |
57 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
57 | + $to_email = give_get_payment_user_email($payment_id); |
|
58 | 58 | |
59 | - $subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) ); |
|
59 | + $subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give')); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Filters the donation email receipt subject. |
63 | 63 | * |
64 | 64 | * @since 1.0 |
65 | 65 | */ |
66 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
67 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
66 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
67 | + $subject = give_do_email_tags($subject, $payment_id); |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * Filters the donation email receipt attachments. By default, there is no attachment but plugins can hook in to provide one more multiple for the donor. Examples would be a printable ticket or PDF receipt. |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @since 1.0 |
76 | 76 | */ |
77 | - $attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data ); |
|
78 | - $message = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id ); |
|
77 | + $attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data); |
|
78 | + $message = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id); |
|
79 | 79 | |
80 | 80 | $emails = Give()->emails; |
81 | 81 | |
82 | - $emails->__set( 'from_name', $from_name ); |
|
83 | - $emails->__set( 'from_email', $from_email ); |
|
84 | - $emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) ); |
|
82 | + $emails->__set('from_name', $from_name); |
|
83 | + $emails->__set('from_email', $from_email); |
|
84 | + $emails->__set('heading', esc_html__('Donation Receipt', 'give')); |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * Filters the donation receipt's email headers. |
@@ -91,14 +91,14 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @since 1.0 |
93 | 93 | */ |
94 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
95 | - $emails->__set( 'headers', $headers ); |
|
94 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
95 | + $emails->__set('headers', $headers); |
|
96 | 96 | |
97 | 97 | //Send the donation receipt. |
98 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
98 | + $emails->send($to_email, $subject, $message, $attachments); |
|
99 | 99 | |
100 | 100 | //If admin notifications are on, send the admin notice. |
101 | - if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) { |
|
101 | + if ($admin_notice && ! give_admin_notices_disabled($payment_id)) { |
|
102 | 102 | /** |
103 | 103 | * Fires in the donation email receipt. |
104 | 104 | * |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @param int $payment_id Payment id. |
110 | 110 | * @param mixed $payment_data Payment meta data. |
111 | 111 | */ |
112 | - do_action( 'give_admin_donation_email', $payment_id, $payment_data ); |
|
112 | + do_action('give_admin_donation_email', $payment_id, $payment_data); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
@@ -122,41 +122,41 @@ discard block |
||
122 | 122 | */ |
123 | 123 | function give_email_test_donation_receipt() { |
124 | 124 | |
125 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
125 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Filters the from name. |
129 | 129 | * |
130 | 130 | * @since 1.7 |
131 | 131 | */ |
132 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, 0, array() ); |
|
132 | + $from_name = apply_filters('give_donation_from_name', $from_name, 0, array()); |
|
133 | 133 | |
134 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
134 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
135 | 135 | |
136 | 136 | /** |
137 | 137 | * Filters the from email. |
138 | 138 | * |
139 | 139 | * @since 1.7 |
140 | 140 | */ |
141 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, 0, array() ); |
|
141 | + $from_email = apply_filters('give_donation_from_address', $from_email, 0, array()); |
|
142 | 142 | |
143 | - $subject = give_get_option( 'donation_subject', esc_html__( 'Donation Receipt', 'give' ) ); |
|
144 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 ); |
|
145 | - $subject = give_do_email_tags( $subject, 0 ); |
|
143 | + $subject = give_get_option('donation_subject', esc_html__('Donation Receipt', 'give')); |
|
144 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0); |
|
145 | + $subject = give_do_email_tags($subject, 0); |
|
146 | 146 | |
147 | - $attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() ); |
|
147 | + $attachments = apply_filters('give_receipt_attachments', array(), 0, array()); |
|
148 | 148 | |
149 | - $message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
149 | + $message = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
150 | 150 | |
151 | 151 | $emails = Give()->emails; |
152 | - $emails->__set( 'from_name', $from_name ); |
|
153 | - $emails->__set( 'from_email', $from_email ); |
|
154 | - $emails->__set( 'heading', esc_html__( 'Donation Receipt', 'give' ) ); |
|
152 | + $emails->__set('from_name', $from_name); |
|
153 | + $emails->__set('from_email', $from_email); |
|
154 | + $emails->__set('heading', esc_html__('Donation Receipt', 'give')); |
|
155 | 155 | |
156 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() ); |
|
157 | - $emails->__set( 'headers', $headers ); |
|
156 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array()); |
|
157 | + $emails->__set('headers', $headers); |
|
158 | 158 | |
159 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
159 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
160 | 160 | |
161 | 161 | } |
162 | 162 | |
@@ -170,49 +170,49 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @return void |
172 | 172 | */ |
173 | -function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) { |
|
173 | +function give_admin_email_notice($payment_id = 0, $payment_data = array()) { |
|
174 | 174 | |
175 | - $payment_id = absint( $payment_id ); |
|
175 | + $payment_id = absint($payment_id); |
|
176 | 176 | |
177 | - if ( empty( $payment_id ) ) { |
|
177 | + if (empty($payment_id)) { |
|
178 | 178 | return; |
179 | 179 | } |
180 | 180 | |
181 | - if ( ! give_get_payment_by( 'id', $payment_id ) ) { |
|
181 | + if ( ! give_get_payment_by('id', $payment_id)) { |
|
182 | 182 | return; |
183 | 183 | } |
184 | 184 | |
185 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
185 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Filters the from name. |
189 | 189 | * |
190 | 190 | * @since 1.0 |
191 | 191 | */ |
192 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data ); |
|
192 | + $from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data); |
|
193 | 193 | |
194 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
194 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
195 | 195 | |
196 | 196 | /** |
197 | 197 | * Filters the from email. |
198 | 198 | * |
199 | 199 | * @since 1.0 |
200 | 200 | */ |
201 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data ); |
|
201 | + $from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data); |
|
202 | 202 | |
203 | 203 | /* translators: %s: payment id */ |
204 | - $subject = give_get_option( 'donation_notification_subject', sprintf( esc_html__( 'New Donation - Payment #%s', 'give' ), $payment_id ) ); |
|
204 | + $subject = give_get_option('donation_notification_subject', sprintf(esc_html__('New Donation - Payment #%s', 'give'), $payment_id)); |
|
205 | 205 | |
206 | 206 | /** |
207 | 207 | * Filters the donation notification subject. |
208 | 208 | * |
209 | 209 | * @since 1.0 |
210 | 210 | */ |
211 | - $subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
212 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
211 | + $subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id); |
|
212 | + $subject = give_do_email_tags($subject, $payment_id); |
|
213 | 213 | |
214 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
215 | - $headers .= "Reply-To: " . $from_email . "\r\n"; |
|
214 | + $headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n"; |
|
215 | + $headers .= "Reply-To: ".$from_email."\r\n"; |
|
216 | 216 | //$headers .= "MIME-Version: 1.0\r\n"; |
217 | 217 | $headers .= "Content-Type: text/html; charset=utf-8\r\n"; |
218 | 218 | |
@@ -221,28 +221,28 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @since 1.0 |
223 | 223 | */ |
224 | - $headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data ); |
|
224 | + $headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data); |
|
225 | 225 | |
226 | 226 | /** |
227 | 227 | * Filters the donation notification email attachments. By default, there is no attachment but plugins can hook in to provide one more multiple. |
228 | 228 | * |
229 | 229 | * @since 1.0 |
230 | 230 | */ |
231 | - $attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data ); |
|
231 | + $attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data); |
|
232 | 232 | |
233 | - $message = give_get_donation_notification_body_content( $payment_id, $payment_data ); |
|
233 | + $message = give_get_donation_notification_body_content($payment_id, $payment_data); |
|
234 | 234 | |
235 | 235 | $emails = Give()->emails; |
236 | - $emails->__set( 'from_name', $from_name ); |
|
237 | - $emails->__set( 'from_email', $from_email ); |
|
238 | - $emails->__set( 'headers', $headers ); |
|
239 | - $emails->__set( 'heading', esc_html__( 'New Donation!', 'give' ) ); |
|
236 | + $emails->__set('from_name', $from_name); |
|
237 | + $emails->__set('from_email', $from_email); |
|
238 | + $emails->__set('headers', $headers); |
|
239 | + $emails->__set('heading', esc_html__('New Donation!', 'give')); |
|
240 | 240 | |
241 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
241 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
242 | 242 | |
243 | 243 | } |
244 | 244 | |
245 | -add_action( 'give_admin_donation_email', 'give_admin_email_notice', 10, 2 ); |
|
245 | +add_action('give_admin_donation_email', 'give_admin_email_notice', 10, 2); |
|
246 | 246 | |
247 | 247 | /** |
248 | 248 | * Retrieves the emails for which admin notifications are sent to (these can be changed in the Give Settings). |
@@ -252,12 +252,12 @@ discard block |
||
252 | 252 | */ |
253 | 253 | function give_get_admin_notice_emails() { |
254 | 254 | |
255 | - $email_option = give_get_option( 'admin_notice_emails' ); |
|
255 | + $email_option = give_get_option('admin_notice_emails'); |
|
256 | 256 | |
257 | - $emails = ! empty( $email_option ) && strlen( trim( $email_option ) ) > 0 ? $email_option : get_bloginfo( 'admin_email' ); |
|
258 | - $emails = array_map( 'trim', explode( "\n", $emails ) ); |
|
257 | + $emails = ! empty($email_option) && strlen(trim($email_option)) > 0 ? $email_option : get_bloginfo('admin_email'); |
|
258 | + $emails = array_map('trim', explode("\n", $emails)); |
|
259 | 259 | |
260 | - return apply_filters( 'give_admin_notice_emails', $emails ); |
|
260 | + return apply_filters('give_admin_notice_emails', $emails); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return mixed |
271 | 271 | */ |
272 | -function give_admin_notices_disabled( $payment_id = 0 ) { |
|
272 | +function give_admin_notices_disabled($payment_id = 0) { |
|
273 | 273 | |
274 | 274 | return apply_filters( |
275 | 275 | 'give_admin_notices_disabled', |
276 | - ! give_is_setting_enabled( give_get_option( 'admin_notices' ) ), |
|
276 | + ! give_is_setting_enabled(give_get_option('admin_notices')), |
|
277 | 277 | $payment_id |
278 | 278 | ); |
279 | 279 | } |
@@ -288,19 +288,19 @@ discard block |
||
288 | 288 | */ |
289 | 289 | function give_get_default_donation_notification_email() { |
290 | 290 | |
291 | - $default_email_body = esc_html__( 'Hi there,', 'give' ) . "\n\n"; |
|
292 | - $default_email_body .= esc_html__( 'This email is to inform you that a new donation has been made on your website:', 'give' ) . ' <a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n"; |
|
293 | - $default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {name}' . "\n"; |
|
294 | - $default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n"; |
|
295 | - $default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {amount}' . "\n"; |
|
296 | - $default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n\n"; |
|
297 | - $default_email_body .= esc_html__( 'Thank you,', 'give' ) . "\n\n"; |
|
298 | - $default_email_body .= '{sitename}' . "\n"; |
|
291 | + $default_email_body = esc_html__('Hi there,', 'give')."\n\n"; |
|
292 | + $default_email_body .= esc_html__('This email is to inform you that a new donation has been made on your website:', 'give').' <a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n"; |
|
293 | + $default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {name}'."\n"; |
|
294 | + $default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n"; |
|
295 | + $default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {amount}'."\n"; |
|
296 | + $default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n\n"; |
|
297 | + $default_email_body .= esc_html__('Thank you,', 'give')."\n\n"; |
|
298 | + $default_email_body .= '{sitename}'."\n"; |
|
299 | 299 | |
300 | - $custom_message = give_get_option( 'donation_notification' ); |
|
301 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
300 | + $custom_message = give_get_option('donation_notification'); |
|
301 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
302 | 302 | |
303 | - return apply_filters( 'give_default_donation_notification_email', $message ); |
|
303 | + return apply_filters('give_default_donation_notification_email', $message); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | |
@@ -314,25 +314,25 @@ discard block |
||
314 | 314 | */ |
315 | 315 | function give_get_default_donation_receipt_email() { |
316 | 316 | |
317 | - $default_email_body = esc_html__( 'Dear', 'give' ) . " {name},\n\n"; |
|
318 | - $default_email_body .= esc_html__( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n"; |
|
319 | - $default_email_body .= '<strong>' . esc_html__( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
320 | - $default_email_body .= '<strong>' . esc_html__( 'Donation:', 'give' ) . '</strong> {donation}' . "\n"; |
|
321 | - $default_email_body .= '<strong>' . esc_html__( 'Donation Date:', 'give' ) . '</strong> {date}' . "\n"; |
|
322 | - $default_email_body .= '<strong>' . esc_html__( 'Amount:', 'give' ) . '</strong> {amount}' . "\n"; |
|
323 | - $default_email_body .= '<strong>' . esc_html__( 'Payment Method:', 'give' ) . '</strong> {payment_method}' . "\n"; |
|
324 | - $default_email_body .= '<strong>' . esc_html__( 'Payment ID:', 'give' ) . '</strong> {payment_id}' . "\n"; |
|
325 | - $default_email_body .= '<strong>' . esc_html__( 'Receipt ID:', 'give' ) . '</strong> {receipt_id}' . "\n\n"; |
|
326 | - $default_email_body .= '{receipt_link}' . "\n\n"; |
|
317 | + $default_email_body = esc_html__('Dear', 'give')." {name},\n\n"; |
|
318 | + $default_email_body .= esc_html__('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n"; |
|
319 | + $default_email_body .= '<strong>'.esc_html__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
320 | + $default_email_body .= '<strong>'.esc_html__('Donation:', 'give').'</strong> {donation}'."\n"; |
|
321 | + $default_email_body .= '<strong>'.esc_html__('Donation Date:', 'give').'</strong> {date}'."\n"; |
|
322 | + $default_email_body .= '<strong>'.esc_html__('Amount:', 'give').'</strong> {amount}'."\n"; |
|
323 | + $default_email_body .= '<strong>'.esc_html__('Payment Method:', 'give').'</strong> {payment_method}'."\n"; |
|
324 | + $default_email_body .= '<strong>'.esc_html__('Payment ID:', 'give').'</strong> {payment_id}'."\n"; |
|
325 | + $default_email_body .= '<strong>'.esc_html__('Receipt ID:', 'give').'</strong> {receipt_id}'."\n\n"; |
|
326 | + $default_email_body .= '{receipt_link}'."\n\n"; |
|
327 | 327 | $default_email_body .= "\n\n"; |
328 | - $default_email_body .= esc_html__( 'Sincerely,', 'give' ) . "\n"; |
|
329 | - $default_email_body .= '{sitename}' . "\n"; |
|
328 | + $default_email_body .= esc_html__('Sincerely,', 'give')."\n"; |
|
329 | + $default_email_body .= '{sitename}'."\n"; |
|
330 | 330 | |
331 | - $custom_message = give_get_option( 'donation_receipt' ); |
|
331 | + $custom_message = give_get_option('donation_receipt'); |
|
332 | 332 | |
333 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
333 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
334 | 334 | |
335 | - return apply_filters( 'give_default_donation_receipt_email', $message ); |
|
335 | + return apply_filters('give_default_donation_receipt_email', $message); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
@@ -344,19 +344,19 @@ discard block |
||
344 | 344 | * |
345 | 345 | * @return array $email_names |
346 | 346 | */ |
347 | -function give_get_email_names( $user_info ) { |
|
347 | +function give_get_email_names($user_info) { |
|
348 | 348 | $email_names = array(); |
349 | - $user_info = maybe_unserialize( $user_info ); |
|
349 | + $user_info = maybe_unserialize($user_info); |
|
350 | 350 | |
351 | 351 | $email_names['fullname'] = ''; |
352 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) { |
|
353 | - $user_data = get_userdata( $user_info['id'] ); |
|
352 | + if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) { |
|
353 | + $user_data = get_userdata($user_info['id']); |
|
354 | 354 | $email_names['name'] = $user_info['first_name']; |
355 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
355 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
356 | 356 | $email_names['username'] = $user_data->user_login; |
357 | - } elseif ( isset( $user_info['first_name'] ) ) { |
|
357 | + } elseif (isset($user_info['first_name'])) { |
|
358 | 358 | $email_names['name'] = $user_info['first_name']; |
359 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
359 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
360 | 360 | $email_names['username'] = $user_info['first_name']; |
361 | 361 | } else { |
362 | 362 | $email_names['name'] = $user_info['email']; |
@@ -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_System_Info' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_System_Info')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_System_Info. |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'system-info'; |
46 | - $this->label = esc_html__( 'System Info', 'give' ); |
|
46 | + $this->label = esc_html__('System Info', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
48 | + add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-tools_settings_{$this->id}_page", array($this, 'output')); |
|
50 | 50 | |
51 | 51 | // Do not use main form for this tab. |
52 | - if( give_get_current_setting_tab() === $this->id ) { |
|
53 | - add_action( "give-tools_open_form", '__return_empty_string' ); |
|
54 | - add_action( "give-tools_close_form", '__return_empty_string' ); |
|
52 | + if (give_get_current_setting_tab() === $this->id) { |
|
53 | + add_action("give-tools_open_form", '__return_empty_string'); |
|
54 | + add_action("give-tools_close_form", '__return_empty_string'); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * @param array $pages Lst of pages. |
63 | 63 | * @return array |
64 | 64 | */ |
65 | - public function add_settings_page( $pages ) { |
|
66 | - $pages[ $this->id ] = $this->label; |
|
65 | + public function add_settings_page($pages) { |
|
66 | + $pages[$this->id] = $this->label; |
|
67 | 67 | |
68 | 68 | return $pages; |
69 | 69 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function output() { |
78 | 78 | $GLOBALS['give_hide_save_button'] = true; |
79 | - include_once( 'views/html-admin-page-system-info.php' ); |
|
79 | + include_once('views/html-admin-page-system-info.php'); |
|
80 | 80 | } |
81 | 81 | } |
82 | 82 |
@@ -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> |
@@ -57,7 +57,12 @@ discard block |
||
57 | 57 | <tr> |
58 | 58 | <td data-export-label="WP Multisite"><?php _e( 'WP Multisite', 'give' ); ?>:</td> |
59 | 59 | <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether or not you have WordPress Multisite enabled.', 'give' ) ); ?>"></span></td> |
60 | - <td><?php if ( is_multisite() ) echo '<span class="dashicons dashicons-yes"></span>'; else echo '–'; ?></td> |
|
60 | + <td><?php if ( is_multisite() ) { |
|
61 | + echo '<span class="dashicons dashicons-yes"></span>'; |
|
62 | +} else { |
|
63 | + echo '–'; |
|
64 | +} |
|
65 | +?></td> |
|
61 | 66 | </tr> |
62 | 67 | <tr> |
63 | 68 | <td data-export-label="WP Memory Limit"><?php _e( 'WP Memory Limit', 'give' ); ?>:</td> |
@@ -85,9 +90,12 @@ discard block |
||
85 | 90 | <td> |
86 | 91 | <?php if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) : ?> |
87 | 92 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
88 | - <?php else : ?> |
|
93 | + <?php else { |
|
94 | + : ?> |
|
89 | 95 | <mark class="no">–</mark> |
90 | - <?php endif; ?> |
|
96 | + <?php endif; |
|
97 | +} |
|
98 | +?> |
|
91 | 99 | </td> |
92 | 100 | </tr> |
93 | 101 | <tr> |
@@ -96,9 +104,12 @@ discard block |
||
96 | 104 | <td> |
97 | 105 | <?php if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) : ?> |
98 | 106 | <mark class="no">–</mark> |
99 | - <?php else : ?> |
|
107 | + <?php else { |
|
108 | + : ?> |
|
100 | 109 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
101 | - <?php endif; ?> |
|
110 | + <?php endif; |
|
111 | +} |
|
112 | +?> |
|
102 | 113 | </td> |
103 | 114 | </tr> |
104 | 115 | <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 | |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | ?> |
23 | 23 | |
24 | 24 | <div class="give-debug-report-wrapper updated"> |
25 | - <p><?php _e( 'Please copy and paste this information in your ticket when contacting support:', 'give' ); ?> </p> |
|
25 | + <p><?php _e('Please copy and paste this information in your ticket when contacting support:', 'give'); ?> </p> |
|
26 | 26 | <p class="submit"> |
27 | - <a class="button-primary js-give-debug-report-button" href="#"><?php _e( 'Get System Report', 'give' ); ?></a> |
|
28 | - <a class="button-secondary docs" href="http://docs.givewp.com/settings-system-info" target="_blank"><?php _e( 'Understanding the System Report', 'give' ); ?></a> |
|
27 | + <a class="button-primary js-give-debug-report-button" href="#"><?php _e('Get System Report', 'give'); ?></a> |
|
28 | + <a class="button-secondary docs" href="http://docs.givewp.com/settings-system-info" target="_blank"><?php _e('Understanding the System Report', 'give'); ?></a> |
|
29 | 29 | </p> |
30 | 30 | <div class="give-debug-report js-give-debug-report"> |
31 | 31 | <textarea readonly="readonly"></textarea> |
@@ -35,55 +35,55 @@ discard block |
||
35 | 35 | <table class="give-status-table widefat" cellspacing="0" id="status"> |
36 | 36 | <thead> |
37 | 37 | <tr> |
38 | - <th colspan="3" data-export-label="WordPress Environment"><h2><?php _e( 'WordPress Environment', 'give' ); ?></h2></th> |
|
38 | + <th colspan="3" data-export-label="WordPress Environment"><h2><?php _e('WordPress Environment', 'give'); ?></h2></th> |
|
39 | 39 | </tr> |
40 | 40 | </thead> |
41 | 41 | <tbody> |
42 | 42 | <tr> |
43 | - <td data-export-label="Home URL"><?php _e( 'Home URL', 'give' ); ?>:</td> |
|
44 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The URL of your site\'s homepage.', 'give' ) ); ?>"></span></td> |
|
45 | - <td><?php form_option( 'home' ); ?></td> |
|
43 | + <td data-export-label="Home URL"><?php _e('Home URL', 'give'); ?>:</td> |
|
44 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The URL of your site\'s homepage.', 'give')); ?>"></span></td> |
|
45 | + <td><?php form_option('home'); ?></td> |
|
46 | 46 | </tr> |
47 | 47 | <tr> |
48 | - <td data-export-label="Site URL"><?php _e( 'Site URL', 'give' ); ?>:</td> |
|
49 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The root URL of your site.', 'give' ) ); ?>"></span></td> |
|
50 | - <td><?php form_option( 'siteurl' ); ?></td> |
|
48 | + <td data-export-label="Site URL"><?php _e('Site URL', 'give'); ?>:</td> |
|
49 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The root URL of your site.', 'give')); ?>"></span></td> |
|
50 | + <td><?php form_option('siteurl'); ?></td> |
|
51 | 51 | </tr> |
52 | 52 | <tr> |
53 | - <td data-export-label="WP Version"><?php _e( 'WP Version', 'give' ); ?>:</td> |
|
54 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of WordPress installed on your site.', 'give' ) ); ?>"></span></td> |
|
53 | + <td data-export-label="WP Version"><?php _e('WP Version', 'give'); ?>:</td> |
|
54 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of WordPress installed on your site.', 'give')); ?>"></span></td> |
|
55 | 55 | <td><?php bloginfo('version'); ?></td> |
56 | 56 | </tr> |
57 | 57 | <tr> |
58 | - <td data-export-label="WP Multisite"><?php _e( 'WP Multisite', 'give' ); ?>:</td> |
|
59 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether or not you have WordPress Multisite enabled.', 'give' ) ); ?>"></span></td> |
|
60 | - <td><?php if ( is_multisite() ) echo '<span class="dashicons dashicons-yes"></span>'; else echo '–'; ?></td> |
|
58 | + <td data-export-label="WP Multisite"><?php _e('WP Multisite', 'give'); ?>:</td> |
|
59 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether or not you have WordPress Multisite enabled.', 'give')); ?>"></span></td> |
|
60 | + <td><?php if (is_multisite()) echo '<span class="dashicons dashicons-yes"></span>'; else echo '–'; ?></td> |
|
61 | 61 | </tr> |
62 | 62 | <tr> |
63 | - <td data-export-label="WP Memory Limit"><?php _e( 'WP Memory Limit', 'give' ); ?>:</td> |
|
64 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The maximum amount of memory (RAM) that your site can use at one time.', 'give' ) ); ?>"></span></td> |
|
63 | + <td data-export-label="WP Memory Limit"><?php _e('WP Memory Limit', 'give'); ?>:</td> |
|
64 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The maximum amount of memory (RAM) that your site can use at one time.', 'give')); ?>"></span></td> |
|
65 | 65 | <td> |
66 | 66 | <?php |
67 | - $memory = give_let_to_num( WP_MEMORY_LIMIT ); |
|
67 | + $memory = give_let_to_num(WP_MEMORY_LIMIT); |
|
68 | 68 | |
69 | - if ( function_exists( 'memory_get_usage' ) ) { |
|
70 | - $system_memory = give_let_to_num( @ini_get( 'memory_limit' ) ); |
|
71 | - $memory = max( $memory, $system_memory ); |
|
69 | + if (function_exists('memory_get_usage')) { |
|
70 | + $system_memory = give_let_to_num(@ini_get('memory_limit')); |
|
71 | + $memory = max($memory, $system_memory); |
|
72 | 72 | } |
73 | 73 | |
74 | - if ( $memory < 67108864 ) { |
|
75 | - 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>'; |
|
74 | + if ($memory < 67108864) { |
|
75 | + 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>'; |
|
76 | 76 | } else { |
77 | - echo '<mark class="yes">' . size_format( $memory ) . '</mark>'; |
|
77 | + echo '<mark class="yes">'.size_format($memory).'</mark>'; |
|
78 | 78 | } |
79 | 79 | ?> |
80 | 80 | </td> |
81 | 81 | </tr> |
82 | 82 | <tr> |
83 | - <td data-export-label="WP Debug Mode"><?php _e( 'WP Debug Mode', 'give' ); ?>:</td> |
|
84 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Displays whether or not WordPress is in Debug Mode.', 'give' ) ); ?>"></span></td> |
|
83 | + <td data-export-label="WP Debug Mode"><?php _e('WP Debug Mode', 'give'); ?>:</td> |
|
84 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Displays whether or not WordPress is in Debug Mode.', 'give')); ?>"></span></td> |
|
85 | 85 | <td> |
86 | - <?php if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) : ?> |
|
86 | + <?php if (defined('WP_DEBUG') && WP_DEBUG) : ?> |
|
87 | 87 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
88 | 88 | <?php else : ?> |
89 | 89 | <mark class="no">–</mark> |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | </td> |
92 | 92 | </tr> |
93 | 93 | <tr> |
94 | - <td data-export-label="WP Cron"><?php _e( 'WP Cron', 'give' ); ?>:</td> |
|
95 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Displays whether or not WP Cron Jobs are enabled.', 'give' ) ); ?>"></span></td> |
|
94 | + <td data-export-label="WP Cron"><?php _e('WP Cron', 'give'); ?>:</td> |
|
95 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Displays whether or not WP Cron Jobs are enabled.', 'give')); ?>"></span></td> |
|
96 | 96 | <td> |
97 | - <?php if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) : ?> |
|
97 | + <?php if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON) : ?> |
|
98 | 98 | <mark class="no">–</mark> |
99 | 99 | <?php else : ?> |
100 | 100 | <mark class="yes"><span class="dashicons dashicons-yes"></span></mark> |
@@ -102,55 +102,55 @@ discard block |
||
102 | 102 | </td> |
103 | 103 | </tr> |
104 | 104 | <tr> |
105 | - <td data-export-label="Language"><?php _e( 'Language', 'give' ); ?>:</td> |
|
106 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The current language used by WordPress. Default = English', 'give' ) ); ?>"></span></td> |
|
105 | + <td data-export-label="Language"><?php _e('Language', 'give'); ?>:</td> |
|
106 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The current language used by WordPress. Default = English', 'give')); ?>"></span></td> |
|
107 | 107 | <td><?php echo get_locale(); ?></td> |
108 | 108 | </tr> |
109 | 109 | <tr> |
110 | - <td data-export-label="Permalink Structure"><?php _e( 'Permalink Structure', 'give' ); ?>:</td> |
|
111 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The permalink structure as defined in Settings.', 'give' ) ); ?>"></span></td> |
|
112 | - <td><?php echo esc_html( get_option( 'permalink_structure', __( 'Default', 'give' ) ) ); ?></td> |
|
110 | + <td data-export-label="Permalink Structure"><?php _e('Permalink Structure', 'give'); ?>:</td> |
|
111 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The permalink structure as defined in Settings.', 'give')); ?>"></span></td> |
|
112 | + <td><?php echo esc_html(get_option('permalink_structure', __('Default', 'give'))); ?></td> |
|
113 | 113 | </tr> |
114 | 114 | <tr> |
115 | - <td data-export-label="Show on Front"><?php _e( 'Show on Front', 'give' ); ?>:</td> |
|
116 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether your front page is set to show posts or a static page.', 'give' ) ); ?>"></span></td> |
|
117 | - <td><?php echo esc_html( get_option( 'show_on_front', '–' ) ); ?></td> |
|
115 | + <td data-export-label="Show on Front"><?php _e('Show on Front', 'give'); ?>:</td> |
|
116 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether your front page is set to show posts or a static page.', 'give')); ?>"></span></td> |
|
117 | + <td><?php echo esc_html(get_option('show_on_front', '–')); ?></td> |
|
118 | 118 | </tr> |
119 | - <?php if ( 'page' === get_option( 'show_on_front' ) ) : ?> |
|
119 | + <?php if ('page' === get_option('show_on_front')) : ?> |
|
120 | 120 | <?php |
121 | - $front_page_id = absint( get_option( 'page_on_front' ) ); |
|
122 | - $blog_page_id = absint( get_option( 'page_for_posts' ) ); |
|
121 | + $front_page_id = absint(get_option('page_on_front')); |
|
122 | + $blog_page_id = absint(get_option('page_for_posts')); |
|
123 | 123 | ?> |
124 | 124 | <tr> |
125 | - <td data-export-label="Page on Front"><?php _e( 'Page on Front', 'give' ); ?>:</td> |
|
126 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The page set to display as your front page.', 'give' ) ); ?>"></span></td> |
|
127 | - <td><?php echo 0 !== $front_page_id ? esc_html( get_the_title( $front_page_id ) . ' (#' . $front_page_id . ')' ) : __( 'Unset', 'give' ); ?></td> |
|
125 | + <td data-export-label="Page on Front"><?php _e('Page on Front', 'give'); ?>:</td> |
|
126 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The page set to display as your front page.', 'give')); ?>"></span></td> |
|
127 | + <td><?php echo 0 !== $front_page_id ? esc_html(get_the_title($front_page_id).' (#'.$front_page_id.')') : __('Unset', 'give'); ?></td> |
|
128 | 128 | </tr> |
129 | 129 | <tr> |
130 | - <td data-export-label="Page for Posts"><?php _e( 'Page for Posts', 'give' ); ?>:</td> |
|
131 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The page set to display your posts.', 'give' ) ); ?>"></span></td> |
|
132 | - <td><?php echo 0 !== $blog_page_id ? esc_html( get_the_title( $blog_page_id ) . ' (#' . $blog_page_id . ')' ) : __( 'Unset', 'give' ); ?></td> |
|
130 | + <td data-export-label="Page for Posts"><?php _e('Page for Posts', 'give'); ?>:</td> |
|
131 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The page set to display your posts.', 'give')); ?>"></span></td> |
|
132 | + <td><?php echo 0 !== $blog_page_id ? esc_html(get_the_title($blog_page_id).' (#'.$blog_page_id.')') : __('Unset', 'give'); ?></td> |
|
133 | 133 | </tr> |
134 | - <?php endif;?> |
|
134 | + <?php endif; ?> |
|
135 | 135 | <tr> |
136 | - <td data-export-label="Table Prefix Length"><?php _e( 'Table Prefix Length', 'give' ); ?>:</td> |
|
137 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The length of the table prefix used in your WordPress database.', 'give' ) ); ?>"></span></td> |
|
138 | - <td><?php echo esc_html( strlen( $wpdb->prefix ) ); ?></td> |
|
136 | + <td data-export-label="Table Prefix Length"><?php _e('Table Prefix Length', 'give'); ?>:</td> |
|
137 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The length of the table prefix used in your WordPress database.', 'give')); ?>"></span></td> |
|
138 | + <td><?php echo esc_html(strlen($wpdb->prefix)); ?></td> |
|
139 | 139 | </tr> |
140 | 140 | <tr> |
141 | - <td data-export-label="Table Prefix Status"><?php _e( 'Table Prefix Status', 'give' ); ?>:</td> |
|
142 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The status of the table prefix used in your WordPress database.', 'give' ) ); ?>"></span></td> |
|
143 | - <td><?php echo strlen( $wpdb->prefix ) > 16 ? esc_html( 'Error: Too long', 'give' ) : esc_html( 'Acceptable', 'give' ); ?></td> |
|
141 | + <td data-export-label="Table Prefix Status"><?php _e('Table Prefix Status', 'give'); ?>:</td> |
|
142 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The status of the table prefix used in your WordPress database.', 'give')); ?>"></span></td> |
|
143 | + <td><?php echo strlen($wpdb->prefix) > 16 ? esc_html('Error: Too long', 'give') : esc_html('Acceptable', 'give'); ?></td> |
|
144 | 144 | </tr> |
145 | 145 | <tr> |
146 | - <td data-export-label="Admin AJAX"><?php _e( 'Admin AJAX', 'give' ); ?>:</td> |
|
147 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether Admin AJAX is accessible.', 'give' ) ); ?>"></span></td> |
|
148 | - <td><?php echo give_test_ajax_works() ? __( 'Accessible', 'give' ) : __( 'Inaccessible', 'give' ); ?></td> |
|
146 | + <td data-export-label="Admin AJAX"><?php _e('Admin AJAX', 'give'); ?>:</td> |
|
147 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether Admin AJAX is accessible.', 'give')); ?>"></span></td> |
|
148 | + <td><?php echo give_test_ajax_works() ? __('Accessible', 'give') : __('Inaccessible', 'give'); ?></td> |
|
149 | 149 | </tr> |
150 | 150 | <tr> |
151 | - <td data-export-label="Registered Post Stati"><?php _e( 'Registered Post Stati', 'give' ); ?>:</td> |
|
152 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'A list of all registered post stati.', 'give' ) ); ?>"></span></td> |
|
153 | - <td><?php echo esc_html( implode( ', ', get_post_stati() ) ); ?></td> |
|
151 | + <td data-export-label="Registered Post Stati"><?php _e('Registered Post Stati', 'give'); ?>:</td> |
|
152 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('A list of all registered post stati.', 'give')); ?>"></span></td> |
|
153 | + <td><?php echo esc_html(implode(', ', get_post_stati())); ?></td> |
|
154 | 154 | </tr> |
155 | 155 | </tbody> |
156 | 156 | </table> |
@@ -158,71 +158,71 @@ discard block |
||
158 | 158 | <table class="give-status-table widefat" cellspacing="0"> |
159 | 159 | <thead> |
160 | 160 | <tr> |
161 | - <th colspan="3" data-export-label="Server Environment"><h2><?php _e( 'Server Environment', 'give' ); ?></h2></th> |
|
161 | + <th colspan="3" data-export-label="Server Environment"><h2><?php _e('Server Environment', 'give'); ?></h2></th> |
|
162 | 162 | </tr> |
163 | 163 | </thead> |
164 | 164 | <tbody> |
165 | 165 | <tr> |
166 | - <td data-export-label="Hosting Provider"><?php _e( 'Hosting Provider', 'give' ); ?>:</td> |
|
167 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The hosting provider for this WordPress installation.', 'give' ) ); ?>"></span></td> |
|
168 | - <td><?php echo give_get_host() ? esc_html( give_get_host() ) : __( 'Unknown', 'give' ); ?></td> |
|
166 | + <td data-export-label="Hosting Provider"><?php _e('Hosting Provider', 'give'); ?>:</td> |
|
167 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The hosting provider for this WordPress installation.', 'give')); ?>"></span></td> |
|
168 | + <td><?php echo give_get_host() ? esc_html(give_get_host()) : __('Unknown', 'give'); ?></td> |
|
169 | 169 | </tr> |
170 | 170 | <tr> |
171 | - <td data-export-label="Server Info"><?php _e( 'Server Info', 'give' ); ?>:</td> |
|
172 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Information about the web server that is currently hosting your site.', 'give' ) ); ?>"></span></td> |
|
173 | - <td><?php echo esc_html( $_SERVER['SERVER_SOFTWARE'] ); ?></td> |
|
171 | + <td data-export-label="Server Info"><?php _e('Server Info', 'give'); ?>:</td> |
|
172 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Information about the web server that is currently hosting your site.', 'give')); ?>"></span></td> |
|
173 | + <td><?php echo esc_html($_SERVER['SERVER_SOFTWARE']); ?></td> |
|
174 | 174 | </tr> |
175 | 175 | <tr> |
176 | - <td data-export-label="PHP Version"><?php _e( 'PHP Version', 'give' ); ?>:</td> |
|
177 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of PHP installed on your hosting server.', 'give' ) ); ?>"></span></td> |
|
176 | + <td data-export-label="PHP Version"><?php _e('PHP Version', 'give'); ?>:</td> |
|
177 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of PHP installed on your hosting server.', 'give')); ?>"></span></td> |
|
178 | 178 | <td><?php |
179 | 179 | // Check if phpversion function exists. |
180 | - if ( function_exists( 'phpversion' ) ) { |
|
180 | + if (function_exists('phpversion')) { |
|
181 | 181 | $php_version = phpversion(); |
182 | 182 | |
183 | - if ( version_compare( $php_version, '5.6', '<' ) ) { |
|
184 | - 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>'; |
|
183 | + if (version_compare($php_version, '5.6', '<')) { |
|
184 | + 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>'; |
|
185 | 185 | } else { |
186 | - echo '<mark class="yes">' . esc_html( $php_version ) . '</mark>'; |
|
186 | + echo '<mark class="yes">'.esc_html($php_version).'</mark>'; |
|
187 | 187 | } |
188 | 188 | } else { |
189 | - _e( "Couldn't determine PHP version because phpversion() doesn't exist.", 'give' ); |
|
189 | + _e("Couldn't determine PHP version because phpversion() doesn't exist.", 'give'); |
|
190 | 190 | } |
191 | 191 | ?></td> |
192 | 192 | </tr> |
193 | - <?php if ( function_exists( 'ini_get' ) ) : ?> |
|
193 | + <?php if (function_exists('ini_get')) : ?> |
|
194 | 194 | <tr> |
195 | - <td data-export-label="PHP Post Max Size"><?php _e( 'PHP Post Max Size', 'give' ); ?>:</td> |
|
196 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The largest filesize that can be contained in one post.', 'give' ) ); ?>"></span></td> |
|
197 | - <td><?php echo size_format( give_let_to_num( ini_get( 'post_max_size' ) ) ); ?></td> |
|
195 | + <td data-export-label="PHP Post Max Size"><?php _e('PHP Post Max Size', 'give'); ?>:</td> |
|
196 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The largest filesize that can be contained in one post.', 'give')); ?>"></span></td> |
|
197 | + <td><?php echo size_format(give_let_to_num(ini_get('post_max_size'))); ?></td> |
|
198 | 198 | </tr> |
199 | 199 | <tr> |
200 | - <td data-export-label="PHP Time Limit"><?php _e( 'PHP Time Limit', 'give' ); ?>:</td> |
|
201 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups).', 'give' ) ); ?>"></span></td> |
|
202 | - <td><?php echo ini_get( 'max_execution_time' ); ?></td> |
|
200 | + <td data-export-label="PHP Time Limit"><?php _e('PHP Time Limit', 'give'); ?>:</td> |
|
201 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The amount of time (in seconds) that your site will spend on a single operation before timing out (to avoid server lockups).', 'give')); ?>"></span></td> |
|
202 | + <td><?php echo ini_get('max_execution_time'); ?></td> |
|
203 | 203 | </tr> |
204 | 204 | <tr> |
205 | - <td data-export-label="PHP Max Input Vars"><?php _e( 'PHP Max Input Vars', 'give' ); ?>:</td> |
|
206 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The maximum number of variables your server can use for a single function to avoid overloads.', 'give' ) ); ?>"></span></td> |
|
207 | - <td><?php echo ini_get( 'max_input_vars' ); ?></td> |
|
205 | + <td data-export-label="PHP Max Input Vars"><?php _e('PHP Max Input Vars', 'give'); ?>:</td> |
|
206 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The maximum number of variables your server can use for a single function to avoid overloads.', 'give')); ?>"></span></td> |
|
207 | + <td><?php echo ini_get('max_input_vars'); ?></td> |
|
208 | 208 | </tr> |
209 | 209 | <tr> |
210 | - <td data-export-label="PHP Max Upload Size"><?php _e( 'PHP Max Upload Size', 'give' ); ?>:</td> |
|
211 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The largest filesize that can be uploaded to your WordPress installation.', 'give' ) ); ?>"></span></td> |
|
212 | - <td><?php echo size_format( wp_max_upload_size() ); ?></td> |
|
210 | + <td data-export-label="PHP Max Upload Size"><?php _e('PHP Max Upload Size', 'give'); ?>:</td> |
|
211 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The largest filesize that can be uploaded to your WordPress installation.', 'give')); ?>"></span></td> |
|
212 | + <td><?php echo size_format(wp_max_upload_size()); ?></td> |
|
213 | 213 | </tr> |
214 | 214 | <tr> |
215 | - <td data-export-label="cURL Version"><?php _e( 'cURL Version', 'give' ); ?>:</td> |
|
216 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of cURL installed on your server.', 'give' ) ); ?>"></span></td> |
|
215 | + <td data-export-label="cURL Version"><?php _e('cURL Version', 'give'); ?>:</td> |
|
216 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of cURL installed on your server.', 'give')); ?>"></span></td> |
|
217 | 217 | <td> |
218 | 218 | <?php |
219 | - if ( function_exists( 'curl_version' ) ) { |
|
219 | + if (function_exists('curl_version')) { |
|
220 | 220 | $curl_version = curl_version(); |
221 | 221 | |
222 | - if ( version_compare( $curl_version['version'], '7.40', '<' ) ) { |
|
223 | - 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>'; |
|
222 | + if (version_compare($curl_version['version'], '7.40', '<')) { |
|
223 | + 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>'; |
|
224 | 224 | } else { |
225 | - echo '<mark class="yes">' . esc_html( $curl_version['version'] . ', ' . $curl_version['ssl_version'] ) . '</mark>'; |
|
225 | + echo '<mark class="yes">'.esc_html($curl_version['version'].', '.$curl_version['ssl_version']).'</mark>'; |
|
226 | 226 | } |
227 | 227 | } else { |
228 | 228 | echo '&ndash'; |
@@ -231,42 +231,42 @@ discard block |
||
231 | 231 | </td> |
232 | 232 | </tr> |
233 | 233 | <tr> |
234 | - <td data-export-label="SUHOSIN Installed"><?php _e( 'SUHOSIN Installed', 'give' ); ?>:</td> |
|
235 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( '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' ) ); ?>"></span></td> |
|
236 | - <td><?php echo extension_loaded( 'suhosin' ) ? '<span class="dashicons dashicons-yes"></span>' : '–'; ?></td> |
|
234 | + <td data-export-label="SUHOSIN Installed"><?php _e('SUHOSIN Installed', 'give'); ?>:</td> |
|
235 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('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')); ?>"></span></td> |
|
236 | + <td><?php echo extension_loaded('suhosin') ? '<span class="dashicons dashicons-yes"></span>' : '–'; ?></td> |
|
237 | 237 | </tr> |
238 | 238 | <?php endif; |
239 | 239 | |
240 | - if ( $wpdb->use_mysqli ) { |
|
241 | - $ver = mysqli_get_server_info( $wpdb->dbh ); |
|
240 | + if ($wpdb->use_mysqli) { |
|
241 | + $ver = mysqli_get_server_info($wpdb->dbh); |
|
242 | 242 | } else { |
243 | 243 | $ver = mysql_get_server_info(); |
244 | 244 | } |
245 | 245 | |
246 | - if ( ! empty( $wpdb->is_mysql ) && ! stristr( $ver, 'MariaDB' ) ) : ?> |
|
246 | + if ( ! empty($wpdb->is_mysql) && ! stristr($ver, 'MariaDB')) : ?> |
|
247 | 247 | <tr> |
248 | - <td data-export-label="MySQL Version"><?php _e( 'MySQL Version', 'give' ); ?>:</td> |
|
249 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of MySQL installed on your hosting server.', 'give' ) ); ?>"></span></td> |
|
248 | + <td data-export-label="MySQL Version"><?php _e('MySQL Version', 'give'); ?>:</td> |
|
249 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of MySQL installed on your hosting server.', 'give')); ?>"></span></td> |
|
250 | 250 | <td> |
251 | 251 | <?php |
252 | 252 | $mysql_version = $wpdb->db_version(); |
253 | 253 | |
254 | - if ( version_compare( $mysql_version, '5.6', '<' ) ) { |
|
255 | - 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>'; |
|
254 | + if (version_compare($mysql_version, '5.6', '<')) { |
|
255 | + 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>'; |
|
256 | 256 | } else { |
257 | - echo '<mark class="yes">' . esc_html( $mysql_version ) . '</mark>'; |
|
257 | + echo '<mark class="yes">'.esc_html($mysql_version).'</mark>'; |
|
258 | 258 | } |
259 | 259 | ?> |
260 | 260 | </td> |
261 | 261 | </tr> |
262 | 262 | <?php endif; ?> |
263 | 263 | <tr> |
264 | - <td data-export-label="Default Timezone is UTC"><?php _e( 'Default Timezone is UTC', 'give' ); ?>:</td> |
|
265 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The default timezone for your server.', 'give' ) ); ?>"></span></td> |
|
264 | + <td data-export-label="Default Timezone is UTC"><?php _e('Default Timezone is UTC', 'give'); ?>:</td> |
|
265 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The default timezone for your server.', 'give')); ?>"></span></td> |
|
266 | 266 | <td><?php |
267 | 267 | $default_timezone = date_default_timezone_get(); |
268 | - if ( 'UTC' !== $default_timezone ) { |
|
269 | - echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( __( 'Default timezone is %s - it should be UTC', 'give' ), $default_timezone ) . '</mark>'; |
|
268 | + if ('UTC' !== $default_timezone) { |
|
269 | + echo '<mark class="error"><span class="dashicons dashicons-warning"></span> '.sprintf(__('Default timezone is %s - it should be UTC', 'give'), $default_timezone).'</mark>'; |
|
270 | 270 | } else { |
271 | 271 | echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark>'; |
272 | 272 | } ?> |
@@ -277,118 +277,118 @@ discard block |
||
277 | 277 | |
278 | 278 | // fsockopen/cURL. |
279 | 279 | $posting['fsockopen_curl']['name'] = 'fsockopen/cURL'; |
280 | - $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' ); |
|
280 | + $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'); |
|
281 | 281 | |
282 | - if ( function_exists( 'fsockopen' ) || function_exists( 'curl_init' ) ) { |
|
282 | + if (function_exists('fsockopen') || function_exists('curl_init')) { |
|
283 | 283 | $posting['fsockopen_curl']['success'] = true; |
284 | 284 | } else { |
285 | 285 | $posting['fsockopen_curl']['success'] = false; |
286 | - $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' ); |
|
286 | + $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'); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | // SOAP. |
290 | 290 | $posting['soap_client']['name'] = 'SoapClient'; |
291 | - $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' ); |
|
291 | + $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'); |
|
292 | 292 | |
293 | - if ( class_exists( 'SoapClient' ) ) { |
|
293 | + if (class_exists('SoapClient')) { |
|
294 | 294 | $posting['soap_client']['success'] = true; |
295 | 295 | } else { |
296 | 296 | $posting['soap_client']['success'] = false; |
297 | - $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>' ); |
|
297 | + $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>'); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | // DOMDocument. |
301 | 301 | $posting['dom_document']['name'] = 'DOMDocument'; |
302 | - $posting['dom_document']['help'] = __( 'HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', 'give' ); |
|
302 | + $posting['dom_document']['help'] = __('HTML/Multipart emails use DOMDocument to generate inline CSS in templates.', 'give'); |
|
303 | 303 | |
304 | - if ( class_exists( 'DOMDocument' ) ) { |
|
304 | + if (class_exists('DOMDocument')) { |
|
305 | 305 | $posting['dom_document']['success'] = true; |
306 | 306 | } else { |
307 | 307 | $posting['dom_document']['success'] = false; |
308 | - $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>' ); |
|
308 | + $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>'); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | // gzip. |
312 | 312 | $posting['gzip']['name'] = 'gzip'; |
313 | - $posting['gzip']['help'] = __( 'gzip is used for file compression and decompression.', 'give' ); |
|
313 | + $posting['gzip']['help'] = __('gzip is used for file compression and decompression.', 'give'); |
|
314 | 314 | |
315 | - if ( is_callable( 'gzopen' ) ) { |
|
315 | + if (is_callable('gzopen')) { |
|
316 | 316 | $posting['gzip']['success'] = true; |
317 | 317 | } else { |
318 | 318 | $posting['gzip']['success'] = false; |
319 | - $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>' ); |
|
319 | + $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>'); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | // GD Graphics Library. |
323 | 323 | $posting['gd']['name'] = 'GD Graphics Library'; |
324 | - $posting['gd']['help'] = __( 'GD Graphics Library is used for dynamically manipulating images.', 'give' ); |
|
325 | - $posting['gd']['success'] = extension_loaded( 'gd' ) && function_exists( 'gd_info' ) ? true : false; |
|
324 | + $posting['gd']['help'] = __('GD Graphics Library is used for dynamically manipulating images.', 'give'); |
|
325 | + $posting['gd']['success'] = extension_loaded('gd') && function_exists('gd_info') ? true : false; |
|
326 | 326 | |
327 | 327 | // Multibyte String. |
328 | 328 | $posting['mbstring']['name'] = 'Multibyte String'; |
329 | - $posting['mbstring']['help'] = __( 'Multibyte String (mbstring) is used to convert character encoding, like for emails or converting characters to lowercase.', 'give' ); |
|
329 | + $posting['mbstring']['help'] = __('Multibyte String (mbstring) is used to convert character encoding, like for emails or converting characters to lowercase.', 'give'); |
|
330 | 330 | |
331 | - if ( extension_loaded( 'mbstring' ) ) { |
|
331 | + if (extension_loaded('mbstring')) { |
|
332 | 332 | $posting['mbstring']['success'] = true; |
333 | 333 | } else { |
334 | 334 | $posting['mbstring']['success'] = false; |
335 | - $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>' ); |
|
335 | + $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>'); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | // WP Remote Post Check. |
339 | - $posting['wp_remote_post']['name'] = __( 'Remote Post', 'give'); |
|
340 | - $posting['wp_remote_post']['help'] = __( 'PayPal uses this method of communicating when sending back transaction information.', 'give' ); |
|
339 | + $posting['wp_remote_post']['name'] = __('Remote Post', 'give'); |
|
340 | + $posting['wp_remote_post']['help'] = __('PayPal uses this method of communicating when sending back transaction information.', 'give'); |
|
341 | 341 | |
342 | - $response = wp_safe_remote_post( 'https://www.paypal.com/cgi-bin/webscr', array( |
|
342 | + $response = wp_safe_remote_post('https://www.paypal.com/cgi-bin/webscr', array( |
|
343 | 343 | 'timeout' => 60, |
344 | - 'user-agent' => 'Give/' . GIVE_VERSION, |
|
344 | + 'user-agent' => 'Give/'.GIVE_VERSION, |
|
345 | 345 | 'httpversion' => '1.1', |
346 | 346 | 'body' => array( |
347 | 347 | 'cmd' => '_notify-validate' |
348 | 348 | ) |
349 | - ) ); |
|
349 | + )); |
|
350 | 350 | |
351 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
351 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
352 | 352 | $posting['wp_remote_post']['success'] = true; |
353 | 353 | } else { |
354 | - $posting['wp_remote_post']['note'] = __( 'wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider.', 'give' ); |
|
355 | - if ( is_wp_error( $response ) ) { |
|
356 | - $posting['wp_remote_post']['note'] .= ' ' . sprintf( __( 'Error: %s', 'give' ), sanitize_text_field( $response->get_error_message() ) ); |
|
354 | + $posting['wp_remote_post']['note'] = __('wp_remote_post() failed. PayPal IPN won\'t work with your server. Contact your hosting provider.', 'give'); |
|
355 | + if (is_wp_error($response)) { |
|
356 | + $posting['wp_remote_post']['note'] .= ' '.sprintf(__('Error: %s', 'give'), sanitize_text_field($response->get_error_message())); |
|
357 | 357 | } else { |
358 | - $posting['wp_remote_post']['note'] .= ' ' . sprintf( __( 'Status code: %s', 'give' ), sanitize_text_field( $response['response']['code'] ) ); |
|
358 | + $posting['wp_remote_post']['note'] .= ' '.sprintf(__('Status code: %s', 'give'), sanitize_text_field($response['response']['code'])); |
|
359 | 359 | } |
360 | 360 | $posting['wp_remote_post']['success'] = false; |
361 | 361 | } |
362 | 362 | |
363 | 363 | // WP Remote Get Check. |
364 | - $posting['wp_remote_get']['name'] = __( 'Remote Get', 'give'); |
|
365 | - $posting['wp_remote_get']['help'] = __( 'Give plugins may use this method of communication when checking for plugin updates.', 'give' ); |
|
364 | + $posting['wp_remote_get']['name'] = __('Remote Get', 'give'); |
|
365 | + $posting['wp_remote_get']['help'] = __('Give plugins may use this method of communication when checking for plugin updates.', 'give'); |
|
366 | 366 | |
367 | - $response = wp_safe_remote_get( 'https://woocommerce.com/wc-api/product-key-api?request=ping&network=' . ( is_multisite() ? '1' : '0' ) ); |
|
367 | + $response = wp_safe_remote_get('https://woocommerce.com/wc-api/product-key-api?request=ping&network='.(is_multisite() ? '1' : '0')); |
|
368 | 368 | |
369 | - if ( ! is_wp_error( $response ) && $response['response']['code'] >= 200 && $response['response']['code'] < 300 ) { |
|
369 | + if ( ! is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) { |
|
370 | 370 | $posting['wp_remote_get']['success'] = true; |
371 | 371 | } else { |
372 | - $posting['wp_remote_get']['note'] = __( 'wp_remote_get() failed. The WooCommerce plugin updater won\'t work with your server. Contact your hosting provider.', 'give' ); |
|
373 | - if ( is_wp_error( $response ) ) { |
|
374 | - $posting['wp_remote_get']['note'] .= ' ' . sprintf( __( 'Error: %s', 'give' ), give_clean( $response->get_error_message() ) ); |
|
372 | + $posting['wp_remote_get']['note'] = __('wp_remote_get() failed. The WooCommerce plugin updater won\'t work with your server. Contact your hosting provider.', 'give'); |
|
373 | + if (is_wp_error($response)) { |
|
374 | + $posting['wp_remote_get']['note'] .= ' '.sprintf(__('Error: %s', 'give'), give_clean($response->get_error_message())); |
|
375 | 375 | } else { |
376 | - $posting['wp_remote_get']['note'] .= ' ' . sprintf( __( 'Status code: %s', 'give' ), give_clean( $response['response']['code'] ) ); |
|
376 | + $posting['wp_remote_get']['note'] .= ' '.sprintf(__('Status code: %s', 'give'), give_clean($response['response']['code'])); |
|
377 | 377 | } |
378 | 378 | $posting['wp_remote_get']['success'] = false; |
379 | 379 | } |
380 | 380 | |
381 | - $posting = apply_filters( 'woocommerce_debug_posting', $posting ); |
|
381 | + $posting = apply_filters('woocommerce_debug_posting', $posting); |
|
382 | 382 | |
383 | - foreach ( $posting as $post ) { |
|
384 | - $mark = ! empty( $post['success'] ) ? 'yes' : 'error'; |
|
383 | + foreach ($posting as $post) { |
|
384 | + $mark = ! empty($post['success']) ? 'yes' : 'error'; |
|
385 | 385 | ?> |
386 | 386 | <tr> |
387 | - <td data-export-label="<?php echo esc_html( $post['name'] ); ?>"><?php echo esc_html( $post['name'] ); ?>:</td> |
|
388 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( isset( $post['help'] ) ? $post['help'] : '' ); ?>"></span></td> |
|
387 | + <td data-export-label="<?php echo esc_html($post['name']); ?>"><?php echo esc_html($post['name']); ?>:</td> |
|
388 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(isset($post['help']) ? $post['help'] : ''); ?>"></span></td> |
|
389 | 389 | <td> |
390 | 390 | <mark class="<?php echo $mark; ?>"> |
391 | - <?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'] ) : ''; ?> |
|
391 | + <?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']) : ''; ?> |
|
392 | 392 | </mark> |
393 | 393 | </td> |
394 | 394 | </tr> |
@@ -401,102 +401,102 @@ discard block |
||
401 | 401 | <table class="give-status-table widefat" cellspacing="0"> |
402 | 402 | <thead> |
403 | 403 | <tr> |
404 | - <th colspan="3" data-export-label="Give Configuration"><h2><?php _e( 'Give Configuration', 'give' ); ?></h2></th> |
|
404 | + <th colspan="3" data-export-label="Give Configuration"><h2><?php _e('Give Configuration', 'give'); ?></h2></th> |
|
405 | 405 | </tr> |
406 | 406 | </thead> |
407 | 407 | <tbody> |
408 | 408 | <tr> |
409 | - <td data-export-label="Give Version"><?php _e( 'Give Version', 'give' ); ?>:</td> |
|
410 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of Give installed on your site.', 'give' ) ); ?>"></span></td> |
|
411 | - <td><?php echo esc_html( GIVE_VERSION ); ?></td> |
|
409 | + <td data-export-label="Give Version"><?php _e('Give Version', 'give'); ?>:</td> |
|
410 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of Give installed on your site.', 'give')); ?>"></span></td> |
|
411 | + <td><?php echo esc_html(GIVE_VERSION); ?></td> |
|
412 | 412 | </tr> |
413 | 413 | <tr> |
414 | - <td data-export-label="Upgraded From"><?php _e( 'Upgraded From', 'give' ); ?>:</td> |
|
415 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The version of Give installed prior to the last update.', 'give' ) ); ?>"></span></td> |
|
416 | - <td><?php echo esc_html( get_option( 'give_version_upgraded_from', '–' ) ); ?></td> |
|
414 | + <td data-export-label="Upgraded From"><?php _e('Upgraded From', 'give'); ?>:</td> |
|
415 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The version of Give installed prior to the last update.', 'give')); ?>"></span></td> |
|
416 | + <td><?php echo esc_html(get_option('give_version_upgraded_from', '–')); ?></td> |
|
417 | 417 | </tr> |
418 | 418 | <tr> |
419 | - <td data-export-label="Test Mode"><?php _e( 'Test Mode', 'give' ); ?>:</td> |
|
420 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether Test Mode is enabled in Give settings.', 'give' ) ); ?>"></span></td> |
|
421 | - <td><?php echo give_is_test_mode() ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
419 | + <td data-export-label="Test Mode"><?php _e('Test Mode', 'give'); ?>:</td> |
|
420 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether Test Mode is enabled in Give settings.', 'give')); ?>"></span></td> |
|
421 | + <td><?php echo give_is_test_mode() ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
422 | 422 | </tr> |
423 | 423 | <tr> |
424 | - <td data-export-label="Currency Code"><?php _e( 'Currency Code', 'give' ); ?>:</td> |
|
425 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The currency code selected in Give settings.', 'give' ) ); ?>"></span></td> |
|
426 | - <td><?php echo esc_html( give_get_currency() ); ?></td> |
|
424 | + <td data-export-label="Currency Code"><?php _e('Currency Code', 'give'); ?>:</td> |
|
425 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The currency code selected in Give settings.', 'give')); ?>"></span></td> |
|
426 | + <td><?php echo esc_html(give_get_currency()); ?></td> |
|
427 | 427 | </tr> |
428 | 428 | <tr> |
429 | - <td data-export-label="Currency Position"><?php _e( 'Currency Position', 'give' ); ?>:</td> |
|
430 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The currency position selected in Give settings.', 'give' ) ); ?>"></span></td> |
|
431 | - <td><?php echo 'before' === give_get_option( 'currency_position' ) ? __( 'Before', 'give' ) : __( 'After', 'give' ); ?></td> |
|
429 | + <td data-export-label="Currency Position"><?php _e('Currency Position', 'give'); ?>:</td> |
|
430 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The currency position selected in Give settings.', 'give')); ?>"></span></td> |
|
431 | + <td><?php echo 'before' === give_get_option('currency_position') ? __('Before', 'give') : __('After', 'give'); ?></td> |
|
432 | 432 | </tr> |
433 | 433 | <tr> |
434 | - <td data-export-label="Decimal Separator"><?php _e( 'Decimal Separator', 'give' ); ?>:</td> |
|
435 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The decimal separator defined in Give settings.', 'give' ) ); ?>"></span></td> |
|
436 | - <td><?php echo esc_html( give_get_option( 'decimal_separator', '.' ) ); ?></td> |
|
434 | + <td data-export-label="Decimal Separator"><?php _e('Decimal Separator', 'give'); ?>:</td> |
|
435 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The decimal separator defined in Give settings.', 'give')); ?>"></span></td> |
|
436 | + <td><?php echo esc_html(give_get_option('decimal_separator', '.')); ?></td> |
|
437 | 437 | </tr> |
438 | 438 | <tr> |
439 | - <td data-export-label="Thousands Separator"><?php _e( 'Thousands Separator', 'give' ); ?>:</td> |
|
440 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The thousands separator defined in Give settings.', 'give' ) ); ?>"></span></td> |
|
441 | - <td><?php echo esc_html( give_get_option( 'thousands_separator', ',' ) ); ?></td> |
|
439 | + <td data-export-label="Thousands Separator"><?php _e('Thousands Separator', 'give'); ?>:</td> |
|
440 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The thousands separator defined in Give settings.', 'give')); ?>"></span></td> |
|
441 | + <td><?php echo esc_html(give_get_option('thousands_separator', ',')); ?></td> |
|
442 | 442 | </tr> |
443 | 443 | <tr> |
444 | - <td data-export-label="Success Page"><?php _e( 'Success Page', 'give' ); ?>:</td> |
|
445 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The page where donors land following a successful transaction.', 'give' ) ); ?>"></span></td> |
|
446 | - <td><?php echo ! empty( $give_options['success_page'] ) ? esc_url( get_permalink( $give_options['success_page'] ) ) : '–'; ?></td> |
|
444 | + <td data-export-label="Success Page"><?php _e('Success Page', 'give'); ?>:</td> |
|
445 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The page where donors land following a successful transaction.', 'give')); ?>"></span></td> |
|
446 | + <td><?php echo ! empty($give_options['success_page']) ? esc_url(get_permalink($give_options['success_page'])) : '–'; ?></td> |
|
447 | 447 | </tr> |
448 | 448 | <tr> |
449 | - <td data-export-label="Failure Page"><?php _e( 'Failure Page', 'give' ); ?>:</td> |
|
450 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The page where donors land following a failed transaction.', 'give' ) ); ?>"></span></td> |
|
451 | - <td><?php echo ! empty( $give_options['failure_page'] ) ? esc_url( get_permalink( $give_options['failure_page'] ) ) : '–'; ?></td> |
|
449 | + <td data-export-label="Failure Page"><?php _e('Failure Page', 'give'); ?>:</td> |
|
450 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The page where donors land following a failed transaction.', 'give')); ?>"></span></td> |
|
451 | + <td><?php echo ! empty($give_options['failure_page']) ? esc_url(get_permalink($give_options['failure_page'])) : '–'; ?></td> |
|
452 | 452 | </tr> |
453 | 453 | <tr> |
454 | - <td data-export-label="Give Forms Slug"><?php _e( 'Give Forms Slug', 'give' ); ?>:</td> |
|
455 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The slug used for Give donation forms.', 'give' ) ); ?>"></span></td> |
|
456 | - <td><?php echo esc_html( defined( 'GIVE_SLUG' ) ? '/' . GIVE_SLUG . '/' : '/donations/' ); ?></td> |
|
454 | + <td data-export-label="Give Forms Slug"><?php _e('Give Forms Slug', 'give'); ?>:</td> |
|
455 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The slug used for Give donation forms.', 'give')); ?>"></span></td> |
|
456 | + <td><?php echo esc_html(defined('GIVE_SLUG') ? '/'.GIVE_SLUG.'/' : '/donations/'); ?></td> |
|
457 | 457 | </tr> |
458 | 458 | <?php |
459 | 459 | $active_gateways = give_get_enabled_payment_gateways(); |
460 | 460 | $enabled_gateways = $default_gateway = ''; |
461 | 461 | |
462 | - if ( $active_gateways ) { |
|
463 | - $default_gateway_is_active = give_is_gateway_active( give_get_default_gateway( null ) ); |
|
462 | + if ($active_gateways) { |
|
463 | + $default_gateway_is_active = give_is_gateway_active(give_get_default_gateway(null)); |
|
464 | 464 | |
465 | - if ( $default_gateway_is_active ) { |
|
466 | - $default_gateway = give_get_default_gateway( null ); |
|
467 | - $default_gateway = $active_gateways[ $default_gateway ]['admin_label']; |
|
465 | + if ($default_gateway_is_active) { |
|
466 | + $default_gateway = give_get_default_gateway(null); |
|
467 | + $default_gateway = $active_gateways[$default_gateway]['admin_label']; |
|
468 | 468 | } else { |
469 | - $default_gateway = __( 'Test Donation', 'give' ); |
|
469 | + $default_gateway = __('Test Donation', 'give'); |
|
470 | 470 | } |
471 | 471 | |
472 | 472 | $gateways = array(); |
473 | 473 | |
474 | - foreach ( $active_gateways as $gateway ) { |
|
474 | + foreach ($active_gateways as $gateway) { |
|
475 | 475 | $gateways[] = $gateway['admin_label']; |
476 | 476 | } |
477 | 477 | |
478 | - $enabled_gateways = implode( ', ', $gateways ); |
|
478 | + $enabled_gateways = implode(', ', $gateways); |
|
479 | 479 | } |
480 | 480 | ?> |
481 | 481 | <tr> |
482 | - <td data-export-label="Enabled Payment Gateways"><?php _e( 'Enabled Payment Gateways', 'give' ); ?>:</td> |
|
483 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'All payment gateways enabled in Give settings.', 'give' ) ); ?>"></span></td> |
|
484 | - <td><?php echo esc_html( ! empty( $enabled_gateways ) ? $enabled_gateways : '–' ); ?></td> |
|
482 | + <td data-export-label="Enabled Payment Gateways"><?php _e('Enabled Payment Gateways', 'give'); ?>:</td> |
|
483 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('All payment gateways enabled in Give settings.', 'give')); ?>"></span></td> |
|
484 | + <td><?php echo esc_html( ! empty($enabled_gateways) ? $enabled_gateways : '–'); ?></td> |
|
485 | 485 | </tr> |
486 | 486 | <tr> |
487 | - <td data-export-label="Default Payment Gateway"><?php _e( 'Default Payment Gateway', 'give' ); ?>:</td> |
|
488 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The default payment gateway selected in Give settings.', 'give' ) ); ?>"></span></td> |
|
489 | - <td><?php echo esc_html( ! empty( $default_gateway ) ? $default_gateway : '–' ); ?></td> |
|
487 | + <td data-export-label="Default Payment Gateway"><?php _e('Default Payment Gateway', 'give'); ?>:</td> |
|
488 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The default payment gateway selected in Give settings.', 'give')); ?>"></span></td> |
|
489 | + <td><?php echo esc_html( ! empty($default_gateway) ? $default_gateway : '–'); ?></td> |
|
490 | 490 | </tr> |
491 | 491 | <tr> |
492 | - <td data-export-label="Admin Email Notifications"><?php _e( 'Admin Email Notifications', 'give' ); ?>:</td> |
|
493 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether admins receive email notifications of transactions.', 'give' ) ); ?>"></span></td> |
|
494 | - <td><?php echo 'enabled' === give_get_option( 'admin_notices' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
492 | + <td data-export-label="Admin Email Notifications"><?php _e('Admin Email Notifications', 'give'); ?>:</td> |
|
493 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether admins receive email notifications of transactions.', 'give')); ?>"></span></td> |
|
494 | + <td><?php echo 'enabled' === give_get_option('admin_notices') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
495 | 495 | </tr> |
496 | 496 | <tr> |
497 | - <td data-export-label="Donor Email Access"><?php _e( 'Donor Email Access', 'give' ); ?>:</td> |
|
498 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether donors can access their donation history using only email.', 'give' ) ); ?>"></span></td> |
|
499 | - <td><?php echo 'enabled' === give_get_option( 'email_access' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
497 | + <td data-export-label="Donor Email Access"><?php _e('Donor Email Access', 'give'); ?>:</td> |
|
498 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether donors can access their donation history using only email.', 'give')); ?>"></span></td> |
|
499 | + <td><?php echo 'enabled' === give_get_option('email_access') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
500 | 500 | </tr> |
501 | 501 | </tbody> |
502 | 502 | </table> |
@@ -504,45 +504,45 @@ discard block |
||
504 | 504 | <table class="give-status-table widefat" cellspacing="0"> |
505 | 505 | <thead> |
506 | 506 | <tr> |
507 | - <th colspan="3" data-export-label="Session Configuration"><h2><?php _e( 'Session Configuration', 'give' ); ?></h2></th> |
|
507 | + <th colspan="3" data-export-label="Session Configuration"><h2><?php _e('Session Configuration', 'give'); ?></h2></th> |
|
508 | 508 | </tr> |
509 | 509 | </thead> |
510 | 510 | <tbody> |
511 | 511 | <tr> |
512 | - <td data-export-label="Give Use Sessions"><?php _e( 'Give Use Sessions', 'give' ); ?>:</td> |
|
513 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether PHP sessions are enforced, enabled, or disabled.', 'give' ) ); ?>"></span></td> |
|
514 | - <td><?php echo defined( 'GIVE_USE_PHP_SESSIONS' ) && GIVE_USE_PHP_SESSIONS ? __( 'Enforced', 'give' ) : ( Give()->session->use_php_sessions() ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ) ); ?></td> |
|
512 | + <td data-export-label="Give Use Sessions"><?php _e('Give Use Sessions', 'give'); ?>:</td> |
|
513 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether PHP sessions are enforced, enabled, or disabled.', 'give')); ?>"></span></td> |
|
514 | + <td><?php echo defined('GIVE_USE_PHP_SESSIONS') && GIVE_USE_PHP_SESSIONS ? __('Enforced', 'give') : (Give()->session->use_php_sessions() ? __('Enabled', 'give') : __('Disabled', 'give')); ?></td> |
|
515 | 515 | </tr> |
516 | 516 | <tr> |
517 | - <td data-export-label="Session"><?php _e( 'Session', 'give' ); ?>:</td> |
|
518 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether a PHP session is currently set.', 'give' ) ); ?>"></span></td> |
|
519 | - <td><?php echo isset( $_SESSION ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
517 | + <td data-export-label="Session"><?php _e('Session', 'give'); ?>:</td> |
|
518 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether a PHP session is currently set.', 'give')); ?>"></span></td> |
|
519 | + <td><?php echo isset($_SESSION) ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
520 | 520 | </tr> |
521 | - <?php if ( isset( $_SESSION ) ) { ?> |
|
521 | + <?php if (isset($_SESSION)) { ?> |
|
522 | 522 | <tr> |
523 | - <td data-export-label="Session Name"><?php _e( 'Session Name', 'give' ); ?>:</td> |
|
524 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The name of the current PHP session.', 'give' ) ); ?>"></span></td> |
|
525 | - <td><?php echo esc_html( ini_get( 'session.name' ) ); ?></td> |
|
523 | + <td data-export-label="Session Name"><?php _e('Session Name', 'give'); ?>:</td> |
|
524 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The name of the current PHP session.', 'give')); ?>"></span></td> |
|
525 | + <td><?php echo esc_html(ini_get('session.name')); ?></td> |
|
526 | 526 | </tr> |
527 | 527 | <tr> |
528 | - <td data-export-label="Cookie Path"><?php _e( 'Cookie Path', 'give' ); ?>:</td> |
|
529 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The cookie path of the current PHP session.', 'give' ) ); ?>"></span></td> |
|
530 | - <td><?php echo esc_html( ini_get( 'session.cookie_path' ) ); ?></td> |
|
528 | + <td data-export-label="Cookie Path"><?php _e('Cookie Path', 'give'); ?>:</td> |
|
529 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The cookie path of the current PHP session.', 'give')); ?>"></span></td> |
|
530 | + <td><?php echo esc_html(ini_get('session.cookie_path')); ?></td> |
|
531 | 531 | </tr> |
532 | 532 | <tr> |
533 | - <td data-export-label="Save Path"><?php _e( 'Save Path', 'give' ); ?>:</td> |
|
534 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The save path of the current PHP session.', 'give' ) ); ?>"></span></td> |
|
535 | - <td><?php echo esc_html( ini_get( 'session.save_path' ) ); ?></td> |
|
533 | + <td data-export-label="Save Path"><?php _e('Save Path', 'give'); ?>:</td> |
|
534 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The save path of the current PHP session.', 'give')); ?>"></span></td> |
|
535 | + <td><?php echo esc_html(ini_get('session.save_path')); ?></td> |
|
536 | 536 | </tr> |
537 | 537 | <tr> |
538 | - <td data-export-label="Use Cookies"><?php _e( 'Use Cookies', 'give' ); ?>:</td> |
|
539 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether the current PHP session is set to use cookies.', 'give' ) ); ?>"></span></td> |
|
540 | - <td><?php echo ini_get( 'session.use_cookies' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
538 | + <td data-export-label="Use Cookies"><?php _e('Use Cookies', 'give'); ?>:</td> |
|
539 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether the current PHP session is set to use cookies.', 'give')); ?>"></span></td> |
|
540 | + <td><?php echo ini_get('session.use_cookies') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
541 | 541 | </tr> |
542 | 542 | <tr> |
543 | - <td data-export-label="Use Only Cookies"><?php _e( 'Use Only Cookies', 'give' ); ?>:</td> |
|
544 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether the current PHP session is set to use only cookies.', 'give' ) ); ?>"></span></td> |
|
545 | - <td><?php echo ini_get( 'session.use_only_cookies' ) ? __( 'Enabled', 'give' ) : __( 'Disabled', 'give' ); ?></td> |
|
543 | + <td data-export-label="Use Only Cookies"><?php _e('Use Only Cookies', 'give'); ?>:</td> |
|
544 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether the current PHP session is set to use only cookies.', 'give')); ?>"></span></td> |
|
545 | + <td><?php echo ini_get('session.use_only_cookies') ? __('Enabled', 'give') : __('Disabled', 'give'); ?></td> |
|
546 | 546 | </tr> |
547 | 547 | <?php } ?> |
548 | 548 | </tbody> |
@@ -551,13 +551,13 @@ discard block |
||
551 | 551 | <table class="give-status-table widefat" cellspacing="0"> |
552 | 552 | <thead> |
553 | 553 | <tr> |
554 | - <th colspan="3" data-export-label="Active Give Add-ons"><h2><?php _e( 'Active Give Add-ons', 'give' ); ?></h2></th> |
|
554 | + <th colspan="3" data-export-label="Active Give Add-ons"><h2><?php _e('Active Give Add-ons', 'give'); ?></h2></th> |
|
555 | 555 | </tr> |
556 | 556 | </thead> |
557 | 557 | <tbody> |
558 | 558 | <?php |
559 | - foreach ( $plugins as $plugin_data ) { |
|
560 | - if ( 'active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type'] ) { |
|
559 | + foreach ($plugins as $plugin_data) { |
|
560 | + if ('active' != $plugin_data['Status'] || 'add-on' != $plugin_data['Type']) { |
|
561 | 561 | continue; |
562 | 562 | } |
563 | 563 | |
@@ -565,30 +565,30 @@ discard block |
||
565 | 565 | $author_name = $plugin_data['Author']; |
566 | 566 | |
567 | 567 | // Link the plugin name to the plugin URL if available. |
568 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
569 | - $plugin_name = '<a href="' . esc_url( $plugin_data['PluginURI'] ) . '" title="' . esc_attr__( 'Visit plugin homepage' , 'give' ) . '">' . $plugin_name . '</a>'; |
|
568 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
569 | + $plugin_name = '<a href="'.esc_url($plugin_data['PluginURI']).'" title="'.esc_attr__('Visit plugin homepage', 'give').'">'.$plugin_name.'</a>'; |
|
570 | 570 | } |
571 | 571 | |
572 | 572 | // Link the author name to the author URL if available. |
573 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
574 | - $author_name = '<a href="' . esc_url( $plugin_data['AuthorURI'] ) . '" title="' . esc_attr__( 'Visit author homepage' , 'give' ) . '">' . $author_name . '</a>'; |
|
573 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
574 | + $author_name = '<a href="'.esc_url($plugin_data['AuthorURI']).'" title="'.esc_attr__('Visit author homepage', 'give').'">'.$author_name.'</a>'; |
|
575 | 575 | } |
576 | 576 | ?> |
577 | 577 | <tr> |
578 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
578 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
579 | 579 | <td class="help"> </td> |
580 | 580 | <td> |
581 | 581 | <?php |
582 | - if ( true === $plugin_data['License'] ) { |
|
583 | - echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark> ' . __( 'Licensed', 'give' ); |
|
582 | + if (true === $plugin_data['License']) { |
|
583 | + echo '<mark class="yes"><span class="dashicons dashicons-yes"></span></mark> '.__('Licensed', 'give'); |
|
584 | 584 | } else { |
585 | - echo '<mark class="error"><span class="dashicons dashicons-no-alt"></span></mark> ' . __( 'Unlicensed', 'give' ); |
|
585 | + echo '<mark class="error"><span class="dashicons dashicons-no-alt"></span></mark> '.__('Unlicensed', 'give'); |
|
586 | 586 | } |
587 | 587 | |
588 | 588 | echo ' – ' |
589 | - . sprintf( _x( 'by %s', 'by author', 'give' ), wp_kses( $author_name, wp_kses_allowed_html( 'post' ) ) ) |
|
589 | + . sprintf(_x('by %s', 'by author', 'give'), wp_kses($author_name, wp_kses_allowed_html('post'))) |
|
590 | 590 | . ' – ' |
591 | - . esc_html( $plugin_data['Version'] ); |
|
591 | + . esc_html($plugin_data['Version']); |
|
592 | 592 | ?> |
593 | 593 | </td> |
594 | 594 | </tr> |
@@ -601,18 +601,18 @@ discard block |
||
601 | 601 | <table class="give-status-table widefat" cellspacing="0"> |
602 | 602 | <thead> |
603 | 603 | <tr> |
604 | - <th colspan="3" data-export-label="Other Active Plugins"><h2><?php _e( 'Other Active Plugins', 'give' ); ?></h2></th> |
|
604 | + <th colspan="3" data-export-label="Other Active Plugins"><h2><?php _e('Other Active Plugins', 'give'); ?></h2></th> |
|
605 | 605 | </tr> |
606 | 606 | </thead> |
607 | 607 | <tbody> |
608 | 608 | <?php |
609 | - foreach ( $plugins as $plugin_data ) { |
|
610 | - if ( 'active' != $plugin_data['Status'] || 'other' != $plugin_data['Type'] ) { |
|
609 | + foreach ($plugins as $plugin_data) { |
|
610 | + if ('active' != $plugin_data['Status'] || 'other' != $plugin_data['Type']) { |
|
611 | 611 | continue; |
612 | 612 | } |
613 | 613 | |
614 | 614 | // Do not show Give core plugin. |
615 | - if ( 'Give - Donation Plugin' === $plugin_data['Name'] ) { |
|
615 | + if ('Give - Donation Plugin' === $plugin_data['Name']) { |
|
616 | 616 | continue; |
617 | 617 | } |
618 | 618 | |
@@ -620,19 +620,19 @@ discard block |
||
620 | 620 | $author_name = $plugin_data['Author']; |
621 | 621 | |
622 | 622 | // Link the plugin name to the plugin URL if available. |
623 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
624 | - $plugin_name = '<a href="' . esc_url( $plugin_data['PluginURI'] ) . '" title="' . esc_attr__( 'Visit plugin homepage' , 'give' ) . '">' . $plugin_name . '</a>'; |
|
623 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
624 | + $plugin_name = '<a href="'.esc_url($plugin_data['PluginURI']).'" title="'.esc_attr__('Visit plugin homepage', 'give').'">'.$plugin_name.'</a>'; |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | // Link the author name to the author URL if available. |
628 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
629 | - $author_name = '<a href="' . esc_url( $plugin_data['AuthorURI'] ) . '" title="' . esc_attr__( 'Visit author homepage' , 'give' ) . '">' . $author_name . '</a>'; |
|
628 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
629 | + $author_name = '<a href="'.esc_url($plugin_data['AuthorURI']).'" title="'.esc_attr__('Visit author homepage', 'give').'">'.$author_name.'</a>'; |
|
630 | 630 | } |
631 | 631 | ?> |
632 | 632 | <tr> |
633 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
633 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
634 | 634 | <td class="help"> </td> |
635 | - <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> |
|
635 | + <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> |
|
636 | 636 | </tr> |
637 | 637 | <?php |
638 | 638 | } |
@@ -643,13 +643,13 @@ discard block |
||
643 | 643 | <table class="give-status-table widefat" cellspacing="0"> |
644 | 644 | <thead> |
645 | 645 | <tr> |
646 | - <th colspan="3" data-export-label="Inactive Plugins"><h2><?php _e( 'Inactive Plugins', 'give' ); ?></h2></th> |
|
646 | + <th colspan="3" data-export-label="Inactive Plugins"><h2><?php _e('Inactive Plugins', 'give'); ?></h2></th> |
|
647 | 647 | </tr> |
648 | 648 | </thead> |
649 | 649 | <tbody> |
650 | 650 | <?php |
651 | - foreach ( $plugins as $plugin_data ) { |
|
652 | - if ( 'inactive' != $plugin_data['Status'] ) { |
|
651 | + foreach ($plugins as $plugin_data) { |
|
652 | + if ('inactive' != $plugin_data['Status']) { |
|
653 | 653 | continue; |
654 | 654 | } |
655 | 655 | |
@@ -657,19 +657,19 @@ discard block |
||
657 | 657 | $author_name = $plugin_data['Author']; |
658 | 658 | |
659 | 659 | // Link the plugin name to the plugin URL if available. |
660 | - if ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
661 | - $plugin_name = '<a href="' . esc_url( $plugin_data['PluginURI'] ) . '" title="' . esc_attr__( 'Visit plugin homepage' , 'give' ) . '">' . $plugin_name . '</a>'; |
|
660 | + if ( ! empty($plugin_data['PluginURI'])) { |
|
661 | + $plugin_name = '<a href="'.esc_url($plugin_data['PluginURI']).'" title="'.esc_attr__('Visit plugin homepage', 'give').'">'.$plugin_name.'</a>'; |
|
662 | 662 | } |
663 | 663 | |
664 | 664 | // Link the author name to the author URL if available. |
665 | - if ( ! empty( $plugin_data['AuthorURI'] ) ) { |
|
666 | - $author_name = '<a href="' . esc_url( $plugin_data['AuthorURI'] ) . '" title="' . esc_attr__( 'Visit author homepage' , 'give' ) . '">' . $author_name . '</a>'; |
|
665 | + if ( ! empty($plugin_data['AuthorURI'])) { |
|
666 | + $author_name = '<a href="'.esc_url($plugin_data['AuthorURI']).'" title="'.esc_attr__('Visit author homepage', 'give').'">'.$author_name.'</a>'; |
|
667 | 667 | } |
668 | 668 | ?> |
669 | 669 | <tr> |
670 | - <td><?php echo wp_kses( $plugin_name, wp_kses_allowed_html( 'post' ) ); ?></td> |
|
670 | + <td><?php echo wp_kses($plugin_name, wp_kses_allowed_html('post')); ?></td> |
|
671 | 671 | <td class="help"> </td> |
672 | - <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> |
|
672 | + <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> |
|
673 | 673 | </tr> |
674 | 674 | <?php |
675 | 675 | } |
@@ -679,37 +679,37 @@ discard block |
||
679 | 679 | |
680 | 680 | <?php |
681 | 681 | $active_mu_plugins = (array) get_mu_plugins(); |
682 | -if ( ! empty( $active_mu_plugins ) ) { |
|
682 | +if ( ! empty($active_mu_plugins)) { |
|
683 | 683 | ?> |
684 | 684 | <table class="give-status-table widefat" cellspacing="0"> |
685 | 685 | <thead> |
686 | 686 | <tr> |
687 | - <th colspan="3" data-export-label="Active MU Plugins"><h2><?php _e( 'Active MU Plugins', 'give' ); ?></h2></th> |
|
687 | + <th colspan="3" data-export-label="Active MU Plugins"><h2><?php _e('Active MU Plugins', 'give'); ?></h2></th> |
|
688 | 688 | </tr> |
689 | 689 | </thead> |
690 | 690 | <tbody> |
691 | 691 | <?php |
692 | 692 | |
693 | - foreach ( $active_mu_plugins as $mu_plugin_data ) { |
|
694 | - if ( ! empty( $mu_plugin_data['Name'] ) ) { |
|
693 | + foreach ($active_mu_plugins as $mu_plugin_data) { |
|
694 | + if ( ! empty($mu_plugin_data['Name'])) { |
|
695 | 695 | // Link the plugin name to the plugin URL if available. |
696 | - $plugin_name = esc_html( $mu_plugin_data['Name'] ); |
|
696 | + $plugin_name = esc_html($mu_plugin_data['Name']); |
|
697 | 697 | |
698 | - if ( ! empty( $mu_plugin_data['PluginURI'] ) ) { |
|
699 | - $plugin_name = '<a href="' . esc_url( $mu_plugin_data['PluginURI'] ) . '" title="' . esc_attr__( 'Visit plugin homepage' , 'give' ) . '">' . $plugin_name . '</a>'; |
|
698 | + if ( ! empty($mu_plugin_data['PluginURI'])) { |
|
699 | + $plugin_name = '<a href="'.esc_url($mu_plugin_data['PluginURI']).'" title="'.esc_attr__('Visit plugin homepage', 'give').'">'.$plugin_name.'</a>'; |
|
700 | 700 | } |
701 | 701 | |
702 | 702 | // Link the author name to the author URL if available. |
703 | - $author_name = esc_html( $mu_plugin_data['Author'] ); |
|
703 | + $author_name = esc_html($mu_plugin_data['Author']); |
|
704 | 704 | |
705 | - if ( ! empty( $mu_plugin_data['AuthorURI'] ) ) { |
|
706 | - $author_name = '<a href="' . esc_url( $mu_plugin_data['AuthorURI'] ) . '">' . $author_name . '</a>'; |
|
705 | + if ( ! empty($mu_plugin_data['AuthorURI'])) { |
|
706 | + $author_name = '<a href="'.esc_url($mu_plugin_data['AuthorURI']).'">'.$author_name.'</a>'; |
|
707 | 707 | } |
708 | 708 | ?> |
709 | 709 | <tr> |
710 | 710 | <td><?php echo $plugin_name; ?></td> |
711 | 711 | <td class="help"> </td> |
712 | - <td><?php echo sprintf( _x( 'by %s', 'by author', 'give' ), $author_name ) . ' – ' . esc_html( $mu_plugin_data['Version'] ); ?></td> |
|
712 | + <td><?php echo sprintf(_x('by %s', 'by author', 'give'), $author_name).' – '.esc_html($mu_plugin_data['Version']); ?></td> |
|
713 | 713 | </tr> |
714 | 714 | <?php |
715 | 715 | } |
@@ -722,53 +722,53 @@ discard block |
||
722 | 722 | <table class="give-status-table widefat" cellspacing="0"> |
723 | 723 | <thead> |
724 | 724 | <tr> |
725 | - <th colspan="3" data-export-label="Theme"><h2><?php _e( 'Theme', 'give' ); ?></h2></th> |
|
725 | + <th colspan="3" data-export-label="Theme"><h2><?php _e('Theme', 'give'); ?></h2></th> |
|
726 | 726 | </tr> |
727 | 727 | </thead> |
728 | 728 | <?php |
729 | - include_once( ABSPATH . 'wp-admin/includes/theme-install.php' ); |
|
729 | + include_once(ABSPATH.'wp-admin/includes/theme-install.php'); |
|
730 | 730 | $active_theme = wp_get_theme(); |
731 | 731 | ?> |
732 | 732 | <tbody> |
733 | 733 | <tr> |
734 | - <td data-export-label="Name"><?php _e( 'Name', 'give' ); ?>:</td> |
|
735 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The name of the current active theme.', 'give' ) ); ?>"></span></td> |
|
736 | - <td><?php echo esc_html( $active_theme->Name ); ?></td> |
|
734 | + <td data-export-label="Name"><?php _e('Name', 'give'); ?>:</td> |
|
735 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The name of the current active theme.', 'give')); ?>"></span></td> |
|
736 | + <td><?php echo esc_html($active_theme->Name); ?></td> |
|
737 | 737 | </tr> |
738 | 738 | <tr> |
739 | - <td data-export-label="Version"><?php _e( 'Version', 'give' ); ?>:</td> |
|
740 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The installed version of the current active theme.', 'give' ) ); ?>"></span></td> |
|
741 | - <td><?php echo esc_html( $active_theme->Version ); ?></td> |
|
739 | + <td data-export-label="Version"><?php _e('Version', 'give'); ?>:</td> |
|
740 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The installed version of the current active theme.', 'give')); ?>"></span></td> |
|
741 | + <td><?php echo esc_html($active_theme->Version); ?></td> |
|
742 | 742 | </tr> |
743 | 743 | <tr> |
744 | - <td data-export-label="Author URL"><?php _e( 'Author URL', 'give' ); ?>:</td> |
|
745 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The theme developer\'s URL.', 'give' ) ); ?>"></span></td> |
|
744 | + <td data-export-label="Author URL"><?php _e('Author URL', 'give'); ?>:</td> |
|
745 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The theme developer\'s URL.', 'give')); ?>"></span></td> |
|
746 | 746 | <td><?php echo $active_theme->{'Author URI'}; ?></td> |
747 | 747 | </tr> |
748 | 748 | <tr> |
749 | - <td data-export-label="Child Theme"><?php _e( 'Child Theme', 'give' ); ?>:</td> |
|
750 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'Whether the current theme is a child theme.', 'give' ) ); ?>"></span></td> |
|
749 | + <td data-export-label="Child Theme"><?php _e('Child Theme', 'give'); ?>:</td> |
|
750 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('Whether the current theme is a child theme.', 'give')); ?>"></span></td> |
|
751 | 751 | <td><?php |
752 | - 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' ); |
|
752 | + 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'); |
|
753 | 753 | ?></td> |
754 | 754 | </tr> |
755 | 755 | <?php |
756 | - if( is_child_theme() ) { |
|
757 | - $parent_theme = wp_get_theme( $active_theme->Template ); |
|
756 | + if (is_child_theme()) { |
|
757 | + $parent_theme = wp_get_theme($active_theme->Template); |
|
758 | 758 | ?> |
759 | 759 | <tr> |
760 | - <td data-export-label="Parent Theme Name"><?php _e( 'Parent Theme Name', 'give' ); ?>:</td> |
|
761 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The name of the parent theme.', 'give' ) ); ?>"></span></td> |
|
762 | - <td><?php echo esc_html( $parent_theme->Name ); ?></td> |
|
760 | + <td data-export-label="Parent Theme Name"><?php _e('Parent Theme Name', 'give'); ?>:</td> |
|
761 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The name of the parent theme.', 'give')); ?>"></span></td> |
|
762 | + <td><?php echo esc_html($parent_theme->Name); ?></td> |
|
763 | 763 | </tr> |
764 | 764 | <tr> |
765 | - <td data-export-label="Parent Theme Version"><?php _e( 'Parent Theme Version', 'give' ); ?>:</td> |
|
766 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The installed version of the parent theme.', 'give' ) ); ?>"></span></td> |
|
767 | - <td><?php echo esc_html( $parent_theme->Version ); ?></td> |
|
765 | + <td data-export-label="Parent Theme Version"><?php _e('Parent Theme Version', 'give'); ?>:</td> |
|
766 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The installed version of the parent theme.', 'give')); ?>"></span></td> |
|
767 | + <td><?php echo esc_html($parent_theme->Version); ?></td> |
|
768 | 768 | </tr> |
769 | 769 | <tr> |
770 | - <td data-export-label="Parent Theme Author URL"><?php _e( 'Parent Theme Author URL', 'give' ); ?>:</td> |
|
771 | - <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr( __( 'The parent theme developers URL.', 'give' ) ); ?>"></span></td> |
|
770 | + <td data-export-label="Parent Theme Author URL"><?php _e('Parent Theme Author URL', 'give'); ?>:</td> |
|
771 | + <td class="help"><span class="give-tooltip give-icon give-icon-question" data-tooltip="<?php echo esc_attr(__('The parent theme developers URL.', 'give')); ?>"></span></td> |
|
772 | 772 | <td><?php echo $parent_theme->{'Author URI'}; ?></td> |
773 | 773 | </tr> |
774 | 774 | <?php } ?> |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | global $status, $page; |
51 | 51 | |
52 | 52 | // Set parent defaults |
53 | - parent::__construct( array( |
|
54 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
55 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
53 | + parent::__construct(array( |
|
54 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
55 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
56 | 56 | 'ajax' => false // Does this table support ajax? |
57 | - ) ); |
|
57 | + )); |
|
58 | 58 | |
59 | - add_action( 'give_report_view_actions', array( $this, 'category_filter' ) ); |
|
59 | + add_action('give_report_view_actions', array($this, 'category_filter')); |
|
60 | 60 | $this->query(); |
61 | 61 | |
62 | 62 | } |
@@ -72,18 +72,18 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @return string Column Name |
74 | 74 | */ |
75 | - public function column_default( $item, $column_name ) { |
|
76 | - switch ( $column_name ) { |
|
75 | + public function column_default($item, $column_name) { |
|
76 | + switch ($column_name) { |
|
77 | 77 | case 'earnings' : |
78 | - return give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
78 | + return give_currency_filter(give_format_amount($item[$column_name])); |
|
79 | 79 | case 'average_sales' : |
80 | - return round( $item[ $column_name ] ); |
|
80 | + return round($item[$column_name]); |
|
81 | 81 | case 'average_earnings' : |
82 | - return give_currency_filter( give_format_amount( $item[ $column_name ] ) ); |
|
82 | + return give_currency_filter(give_format_amount($item[$column_name])); |
|
83 | 83 | case 'details' : |
84 | - return '<a href="' . admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id=' . $item['ID'] ) . '">' . esc_html__( 'View Detailed Report', 'give' ) . '</a>'; |
|
84 | + return '<a href="'.admin_url('edit.php?post_type=give_forms&page=give-reports&tab=forms&form-id='.$item['ID']).'">'.esc_html__('View Detailed Report', 'give').'</a>'; |
|
85 | 85 | default: |
86 | - return $item[ $column_name ]; |
|
86 | + return $item[$column_name]; |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
@@ -96,12 +96,12 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function get_columns() { |
98 | 98 | $columns = array( |
99 | - 'title' => esc_html__( 'Form', 'give' ), |
|
100 | - 'sales' => esc_html__( 'Donations', 'give' ), |
|
101 | - 'earnings' => esc_html__( 'Income', 'give' ), |
|
102 | - 'average_sales' => esc_html__( 'Monthly Average Donations', 'give' ), |
|
103 | - 'average_earnings' => esc_html__( 'Monthly Average Income', 'give' ), |
|
104 | - 'details' => esc_html__( 'Detailed Report', 'give' ) |
|
99 | + 'title' => esc_html__('Form', 'give'), |
|
100 | + 'sales' => esc_html__('Donations', 'give'), |
|
101 | + 'earnings' => esc_html__('Income', 'give'), |
|
102 | + 'average_sales' => esc_html__('Monthly Average Donations', 'give'), |
|
103 | + 'average_earnings' => esc_html__('Monthly Average Income', 'give'), |
|
104 | + 'details' => esc_html__('Detailed Report', 'give') |
|
105 | 105 | ); |
106 | 106 | |
107 | 107 | return $columns; |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public function get_sortable_columns() { |
118 | 118 | return array( |
119 | - 'title' => array( 'title', true ), |
|
120 | - 'sales' => array( 'sales', false ), |
|
121 | - 'earnings' => array( 'earnings', false ), |
|
119 | + 'title' => array('title', true), |
|
120 | + 'sales' => array('sales', false), |
|
121 | + 'earnings' => array('earnings', false), |
|
122 | 122 | ); |
123 | 123 | } |
124 | 124 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * @return int Current page number |
131 | 131 | */ |
132 | 132 | public function get_paged() { |
133 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
133 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @return int Category ID |
143 | 143 | */ |
144 | 144 | public function get_category() { |
145 | - return isset( $_GET['category'] ) ? absint( $_GET['category'] ) : 0; |
|
145 | + return isset($_GET['category']) ? absint($_GET['category']) : 0; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function get_total_forms() { |
157 | 157 | $total = 0; |
158 | - $counts = wp_count_posts( 'give_forms', 'readable' ); |
|
159 | - foreach ( $counts as $status => $count ) { |
|
158 | + $counts = wp_count_posts('give_forms', 'readable'); |
|
159 | + foreach ($counts as $status => $count) { |
|
160 | 160 | $total += $count; |
161 | 161 | } |
162 | 162 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @since 1.0 |
171 | 171 | * @return void |
172 | 172 | */ |
173 | - public function bulk_actions( $which = '' ) { |
|
173 | + public function bulk_actions($which = '') { |
|
174 | 174 | |
175 | 175 | } |
176 | 176 | |
@@ -182,27 +182,27 @@ discard block |
||
182 | 182 | * |
183 | 183 | * @param string $which |
184 | 184 | */ |
185 | - protected function display_tablenav( $which ) { |
|
185 | + protected function display_tablenav($which) { |
|
186 | 186 | |
187 | - if ( 'top' === $which ) { |
|
188 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
187 | + if ('top' === $which) { |
|
188 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
189 | 189 | } |
190 | 190 | ?> |
191 | - <div class="tablenav give-clearfix <?php echo esc_attr( $which ); ?>"> |
|
191 | + <div class="tablenav give-clearfix <?php echo esc_attr($which); ?>"> |
|
192 | 192 | |
193 | - <?php if ( 'top' === $which ) { ?> |
|
193 | + <?php if ('top' === $which) { ?> |
|
194 | 194 | <h3 class="alignleft reports-earnings-title"> |
195 | - <span><?php esc_html_e( 'Donation Forms Report', 'give' ); ?></span> |
|
195 | + <span><?php esc_html_e('Donation Forms Report', 'give'); ?></span> |
|
196 | 196 | </h3> |
197 | 197 | <?php } ?> |
198 | 198 | |
199 | 199 | <div class="alignright tablenav-right"> |
200 | 200 | <div class="actions bulkactions"> |
201 | - <?php $this->bulk_actions( $which ); ?> |
|
201 | + <?php $this->bulk_actions($which); ?> |
|
202 | 202 | </div> |
203 | 203 | <?php |
204 | - $this->extra_tablenav( $which ); |
|
205 | - $this->pagination( $which ); |
|
204 | + $this->extra_tablenav($which); |
|
205 | + $this->pagination($which); |
|
206 | 206 | ?> |
207 | 207 | </div> |
208 | 208 | |
@@ -222,9 +222,9 @@ discard block |
||
222 | 222 | */ |
223 | 223 | public function category_filter() { |
224 | 224 | |
225 | - $categories = get_terms( 'form_category' ); |
|
226 | - if ( $categories && ! is_wp_error( $categories ) ) { |
|
227 | - echo Give()->html->category_dropdown( 'category', $this->get_category() ); |
|
225 | + $categories = get_terms('form_category'); |
|
226 | + if ($categories && ! is_wp_error($categories)) { |
|
227 | + echo Give()->html->category_dropdown('category', $this->get_category()); |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | */ |
239 | 239 | public function query() { |
240 | 240 | |
241 | - $orderby = isset( $_GET['orderby'] ) ? $_GET['orderby'] : 'title'; |
|
242 | - $order = isset( $_GET['order'] ) ? $_GET['order'] : 'DESC'; |
|
241 | + $orderby = isset($_GET['orderby']) ? $_GET['orderby'] : 'title'; |
|
242 | + $order = isset($_GET['order']) ? $_GET['order'] : 'DESC'; |
|
243 | 243 | $category = $this->get_category(); |
244 | 244 | |
245 | 245 | $args = array( |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | 'suppress_filters' => true |
253 | 253 | ); |
254 | 254 | |
255 | - if ( ! empty( $category ) ) { |
|
255 | + if ( ! empty($category)) { |
|
256 | 256 | $args['tax_query'] = array( |
257 | 257 | array( |
258 | 258 | 'taxonomy' => 'form_category', |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | ); |
262 | 262 | } |
263 | 263 | |
264 | - switch ( $orderby ) : |
|
264 | + switch ($orderby) : |
|
265 | 265 | case 'title' : |
266 | 266 | $args['orderby'] = 'title'; |
267 | 267 | break; |
@@ -277,9 +277,9 @@ discard block |
||
277 | 277 | break; |
278 | 278 | endswitch; |
279 | 279 | |
280 | - $args = apply_filters( 'give_form_reports_prepare_items_args', $args, $this ); |
|
280 | + $args = apply_filters('give_form_reports_prepare_items_args', $args, $this); |
|
281 | 281 | |
282 | - $this->products = new WP_Query( $args ); |
|
282 | + $this->products = new WP_Query($args); |
|
283 | 283 | |
284 | 284 | } |
285 | 285 | |
@@ -295,15 +295,15 @@ discard block |
||
295 | 295 | |
296 | 296 | $give_forms = $this->products->posts; |
297 | 297 | |
298 | - if ( $give_forms ) { |
|
299 | - foreach ( $give_forms as $form ) { |
|
298 | + if ($give_forms) { |
|
299 | + foreach ($give_forms as $form) { |
|
300 | 300 | $reports_data[] = array( |
301 | 301 | 'ID' => $form, |
302 | - 'title' => get_the_title( $form ), |
|
303 | - 'sales' => give_get_form_sales_stats( $form ), |
|
304 | - 'earnings' => give_get_form_earnings_stats( $form ), |
|
305 | - 'average_sales' => give_get_average_monthly_form_sales( $form ), |
|
306 | - 'average_earnings' => give_get_average_monthly_form_earnings( $form ) |
|
302 | + 'title' => get_the_title($form), |
|
303 | + 'sales' => give_get_form_sales_stats($form), |
|
304 | + 'earnings' => give_get_form_earnings_stats($form), |
|
305 | + 'average_sales' => give_get_average_monthly_form_sales($form), |
|
306 | + 'average_earnings' => give_get_average_monthly_form_earnings($form) |
|
307 | 307 | ); |
308 | 308 | } |
309 | 309 | } |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | |
332 | 332 | $sortable = $this->get_sortable_columns(); |
333 | 333 | |
334 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
334 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
335 | 335 | |
336 | 336 | $data = $this->reports_data(); |
337 | 337 | |
@@ -339,10 +339,10 @@ discard block |
||
339 | 339 | |
340 | 340 | $this->items = $data; |
341 | 341 | |
342 | - $this->set_pagination_args( array( |
|
342 | + $this->set_pagination_args(array( |
|
343 | 343 | 'total_items' => $total_items, |
344 | 344 | 'per_page' => $this->per_page, |
345 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
345 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
346 | 346 | ) |
347 | 347 | ); |
348 | 348 | } |
@@ -814,12 +814,12 @@ |
||
814 | 814 | ) ), 'give-refresh-reports' ); |
815 | 815 | |
816 | 816 | echo '<a href="' |
817 | - . esc_url_raw( $url ) |
|
818 | - . '" data-tooltip="'. esc_attr__( 'Clicking this will clear the reports cache.', 'give' ) |
|
819 | - . '" data-tooltip-my-position="right center" data-tooltip-target-position="left center" class="button alignright give-admin-button give-tooltip">' |
|
820 | - . '<span class="give-admin-button-icon give-admin-button-icon-update"></span>' |
|
821 | - . esc_html__( 'Refresh Report Data', 'give' ) |
|
822 | - . '</a>'; |
|
817 | + . esc_url_raw( $url ) |
|
818 | + . '" data-tooltip="'. esc_attr__( 'Clicking this will clear the reports cache.', 'give' ) |
|
819 | + . '" data-tooltip-my-position="right center" data-tooltip-target-position="left center" class="button alignright give-admin-button give-tooltip">' |
|
820 | + . '<span class="give-admin-button-icon give-admin-button-icon-update"></span>' |
|
821 | + . esc_html__( 'Refresh Report Data', 'give' ) |
|
822 | + . '</a>'; |
|
823 | 823 | |
824 | 824 | } |
825 | 825 |
@@ -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 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $dates = give_get_report_dates(); |
26 | 26 | |
27 | 27 | // Determine graph options |
28 | - switch ( $dates['range'] ) : |
|
28 | + switch ($dates['range']) : |
|
29 | 29 | case 'today' : |
30 | 30 | case 'yesterday' : |
31 | 31 | $day_by_day = true; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $day_by_day = false; |
38 | 38 | break; |
39 | 39 | case 'other' : |
40 | - if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ( $dates['m_start'] != '12' && $dates['m_end'] != '1' ) ) { |
|
40 | + if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] && ($dates['m_start'] != '12' && $dates['m_end'] != '1')) { |
|
41 | 41 | $day_by_day = false; |
42 | 42 | } else { |
43 | 43 | $day_by_day = true; |
@@ -49,61 +49,61 @@ discard block |
||
49 | 49 | endswitch; |
50 | 50 | |
51 | 51 | $earnings_totals = 0.00; // Total earnings for time period shown |
52 | - $sales_totals = 0; // Total sales for time period shown |
|
52 | + $sales_totals = 0; // Total sales for time period shown |
|
53 | 53 | |
54 | 54 | $earnings_data = array(); |
55 | 55 | $sales_data = array(); |
56 | 56 | |
57 | - if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) { |
|
57 | + if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') { |
|
58 | 58 | // Hour by hour |
59 | 59 | $hour = 1; |
60 | - $month = date( 'n', current_time( 'timestamp' ) ); |
|
61 | - while ( $hour <= 23 ) : |
|
60 | + $month = date('n', current_time('timestamp')); |
|
61 | + while ($hour <= 23) : |
|
62 | 62 | |
63 | - $sales = give_get_sales_by_date( $dates['day'], $month, $dates['year'], $hour ); |
|
64 | - $earnings = give_get_earnings_by_date( $dates['day'], $month, $dates['year'], $hour ); |
|
63 | + $sales = give_get_sales_by_date($dates['day'], $month, $dates['year'], $hour); |
|
64 | + $earnings = give_get_earnings_by_date($dates['day'], $month, $dates['year'], $hour); |
|
65 | 65 | |
66 | 66 | $sales_totals += $sales; |
67 | 67 | $earnings_totals += $earnings; |
68 | 68 | |
69 | - $date = mktime( $hour, 0, 0, $month, $dates['day'], $dates['year'] ) * 1000; |
|
70 | - $sales_data[] = array( $date, $sales ); |
|
71 | - $earnings_data[] = array( $date, $earnings ); |
|
69 | + $date = mktime($hour, 0, 0, $month, $dates['day'], $dates['year']) * 1000; |
|
70 | + $sales_data[] = array($date, $sales); |
|
71 | + $earnings_data[] = array($date, $earnings); |
|
72 | 72 | |
73 | - $hour ++; |
|
73 | + $hour++; |
|
74 | 74 | endwhile; |
75 | 75 | |
76 | - } elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) { |
|
76 | + } elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') { |
|
77 | 77 | |
78 | 78 | // Day by day |
79 | 79 | $day = $dates['day']; |
80 | 80 | $day_end = $dates['day_end']; |
81 | 81 | $month = $dates['m_start']; |
82 | - while ( $day <= $day_end ) : |
|
83 | - $sales = give_get_sales_by_date( $day, $month, $dates['year'] ); |
|
82 | + while ($day <= $day_end) : |
|
83 | + $sales = give_get_sales_by_date($day, $month, $dates['year']); |
|
84 | 84 | $sales_totals += $sales; |
85 | 85 | |
86 | - $earnings = give_get_earnings_by_date( $day, $month, $dates['year'] ); |
|
86 | + $earnings = give_get_earnings_by_date($day, $month, $dates['year']); |
|
87 | 87 | $earnings_totals += $earnings; |
88 | 88 | |
89 | - $date = mktime( 0, 0, 0, $month, $day, $dates['year'] ) * 1000; |
|
90 | - $sales_data[] = array( $date, $sales ); |
|
91 | - $earnings_data[] = array( $date, $earnings ); |
|
92 | - $day ++; |
|
89 | + $date = mktime(0, 0, 0, $month, $day, $dates['year']) * 1000; |
|
90 | + $sales_data[] = array($date, $sales); |
|
91 | + $earnings_data[] = array($date, $earnings); |
|
92 | + $day++; |
|
93 | 93 | endwhile; |
94 | 94 | |
95 | 95 | } else { |
96 | 96 | |
97 | 97 | $y = $dates['year']; |
98 | - while ( $y <= $dates['year_end'] ) : |
|
98 | + while ($y <= $dates['year_end']) : |
|
99 | 99 | |
100 | - if ( $dates['year'] == $dates['year_end'] ) { |
|
100 | + if ($dates['year'] == $dates['year_end']) { |
|
101 | 101 | $month_start = $dates['m_start']; |
102 | 102 | $month_end = $dates['m_end']; |
103 | - } elseif ( $y == $dates['year'] ) { |
|
103 | + } elseif ($y == $dates['year']) { |
|
104 | 104 | $month_start = $dates['m_start']; |
105 | 105 | $month_end = 12; |
106 | - } elseif ( $y == $dates['year_end'] ) { |
|
106 | + } elseif ($y == $dates['year_end']) { |
|
107 | 107 | $month_start = 1; |
108 | 108 | $month_end = $dates['m_end']; |
109 | 109 | } else { |
@@ -112,48 +112,48 @@ discard block |
||
112 | 112 | } |
113 | 113 | |
114 | 114 | $i = $month_start; |
115 | - while ( $i <= $month_end ) : |
|
115 | + while ($i <= $month_end) : |
|
116 | 116 | |
117 | - if ( $day_by_day ) { |
|
117 | + if ($day_by_day) { |
|
118 | 118 | |
119 | - if ( $i == $month_end ) { |
|
119 | + if ($i == $month_end) { |
|
120 | 120 | |
121 | 121 | $num_of_days = $dates['day_end']; |
122 | 122 | |
123 | 123 | } else { |
124 | 124 | |
125 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
125 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
126 | 126 | |
127 | 127 | } |
128 | 128 | |
129 | 129 | $d = $dates['day']; |
130 | 130 | |
131 | - while ( $d <= $num_of_days ) : |
|
131 | + while ($d <= $num_of_days) : |
|
132 | 132 | |
133 | - $sales = give_get_sales_by_date( $d, $i, $y ); |
|
133 | + $sales = give_get_sales_by_date($d, $i, $y); |
|
134 | 134 | $sales_totals += $sales; |
135 | 135 | |
136 | - $earnings = give_get_earnings_by_date( $d, $i, $y ); |
|
136 | + $earnings = give_get_earnings_by_date($d, $i, $y); |
|
137 | 137 | $earnings_totals += $earnings; |
138 | 138 | |
139 | - $date = mktime( 0, 0, 0, $i, $d, $y ) * 1000; |
|
140 | - $sales_data[] = array( $date, $sales ); |
|
141 | - $earnings_data[] = array( $date, $earnings ); |
|
142 | - $d ++; |
|
139 | + $date = mktime(0, 0, 0, $i, $d, $y) * 1000; |
|
140 | + $sales_data[] = array($date, $sales); |
|
141 | + $earnings_data[] = array($date, $earnings); |
|
142 | + $d++; |
|
143 | 143 | |
144 | 144 | endwhile; |
145 | 145 | |
146 | 146 | } else { |
147 | 147 | |
148 | - $sales = give_get_sales_by_date( null, $i, $y ); |
|
148 | + $sales = give_get_sales_by_date(null, $i, $y); |
|
149 | 149 | $sales_totals += $sales; |
150 | 150 | |
151 | - $earnings = give_get_earnings_by_date( null, $i, $y ); |
|
151 | + $earnings = give_get_earnings_by_date(null, $i, $y); |
|
152 | 152 | $earnings_totals += $earnings; |
153 | 153 | |
154 | - if ( $i == $month_end ) { |
|
154 | + if ($i == $month_end) { |
|
155 | 155 | |
156 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
156 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
157 | 157 | |
158 | 158 | } else { |
159 | 159 | |
@@ -161,24 +161,24 @@ discard block |
||
161 | 161 | |
162 | 162 | } |
163 | 163 | |
164 | - $date = mktime( 0, 0, 0, $i, $num_of_days, $y ) * 1000; |
|
165 | - $sales_data[] = array( $date, $sales ); |
|
166 | - $earnings_data[] = array( $date, $earnings ); |
|
164 | + $date = mktime(0, 0, 0, $i, $num_of_days, $y) * 1000; |
|
165 | + $sales_data[] = array($date, $sales); |
|
166 | + $earnings_data[] = array($date, $earnings); |
|
167 | 167 | |
168 | 168 | } |
169 | 169 | |
170 | - $i ++; |
|
170 | + $i++; |
|
171 | 171 | |
172 | 172 | endwhile; |
173 | 173 | |
174 | - $y ++; |
|
174 | + $y++; |
|
175 | 175 | endwhile; |
176 | 176 | |
177 | 177 | } |
178 | 178 | |
179 | 179 | $data = array( |
180 | - esc_html__( 'Income', 'give' ) => $earnings_data, |
|
181 | - esc_html__( 'Donations', 'give' ) => $sales_data |
|
180 | + esc_html__('Income', 'give') => $earnings_data, |
|
181 | + esc_html__('Donations', 'give') => $sales_data |
|
182 | 182 | ); |
183 | 183 | |
184 | 184 | // start our own output buffer |
@@ -191,12 +191,12 @@ discard block |
||
191 | 191 | <div class="inside"> |
192 | 192 | <?php give_reports_graph_controls(); ?> |
193 | 193 | <?php |
194 | - $graph = new Give_Graph( $data, array( 'dataType' => array( 'amount', 'count' ) ) ); |
|
195 | - $graph->set( 'x_mode', 'time' ); |
|
196 | - $graph->set( 'multiple_y_axes', true ); |
|
194 | + $graph = new Give_Graph($data, array('dataType' => array('amount', 'count'))); |
|
195 | + $graph->set('x_mode', 'time'); |
|
196 | + $graph->set('multiple_y_axes', true); |
|
197 | 197 | $graph->display(); |
198 | 198 | |
199 | - if ( 'this_month' == $dates['range'] ) { |
|
199 | + if ('this_month' == $dates['range']) { |
|
200 | 200 | $estimated = give_estimated_monthly_stats(); |
201 | 201 | } |
202 | 202 | ?> |
@@ -205,21 +205,21 @@ discard block |
||
205 | 205 | <table class="widefat reports-table alignleft" style="max-width:450px"> |
206 | 206 | <tbody> |
207 | 207 | <tr> |
208 | - <th scope="row"><strong><?php esc_html_e( 'Total income for period:', 'give' ); ?></strong></th> |
|
209 | - <td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td> |
|
208 | + <th scope="row"><strong><?php esc_html_e('Total income for period:', 'give'); ?></strong></th> |
|
209 | + <td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td> |
|
210 | 210 | </tr> |
211 | 211 | <tr class="alternate"> |
212 | - <th scope="row"><strong><?php esc_html_e( 'Total donations for period:', 'give' ); ?><strong></th> |
|
212 | + <th scope="row"><strong><?php esc_html_e('Total donations for period:', 'give'); ?><strong></th> |
|
213 | 213 | <td><?php echo $sales_totals; ?></td> |
214 | 214 | </tr> |
215 | - <?php if ( 'this_month' == $dates['range'] ) : ?> |
|
215 | + <?php if ('this_month' == $dates['range']) : ?> |
|
216 | 216 | <tr> |
217 | - <th scope="row"><strong><?php esc_html_e( 'Estimated monthly income:', 'give' ); ?></strong></th> |
|
218 | - <td><?php echo give_currency_filter( give_format_amount( $estimated['earnings'] ) ); ?></td> |
|
217 | + <th scope="row"><strong><?php esc_html_e('Estimated monthly income:', 'give'); ?></strong></th> |
|
218 | + <td><?php echo give_currency_filter(give_format_amount($estimated['earnings'])); ?></td> |
|
219 | 219 | </tr> |
220 | 220 | <tr class="alternate"> |
221 | - <th scope="row"><strong><?php esc_html_e( 'Estimated monthly donations:', 'give' ); ?></strong></th> |
|
222 | - <td><?php echo floor( $estimated['sales'] ); ?></td> |
|
221 | + <th scope="row"><strong><?php esc_html_e('Estimated monthly donations:', 'give'); ?></strong></th> |
|
222 | + <td><?php echo floor($estimated['sales']); ?></td> |
|
223 | 223 | </tr> |
224 | 224 | <?php endif; ?> |
225 | 225 | </table> |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * |
233 | 233 | * @since 1.0 |
234 | 234 | */ |
235 | - do_action( 'give_reports_graph_additional_stats' ); |
|
235 | + do_action('give_reports_graph_additional_stats'); |
|
236 | 236 | ?> |
237 | 237 | |
238 | 238 | </div> |
@@ -251,12 +251,12 @@ discard block |
||
251 | 251 | * @since 1.0 |
252 | 252 | * @return void |
253 | 253 | */ |
254 | -function give_reports_graph_of_form( $form_id = 0 ) { |
|
254 | +function give_reports_graph_of_form($form_id = 0) { |
|
255 | 255 | // Retrieve the queried dates |
256 | 256 | $dates = give_get_report_dates(); |
257 | 257 | |
258 | 258 | // Determine graph options |
259 | - switch ( $dates['range'] ) : |
|
259 | + switch ($dates['range']) : |
|
260 | 260 | case 'today' : |
261 | 261 | case 'yesterday' : |
262 | 262 | $day_by_day = true; |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | $day_by_day = false; |
275 | 275 | break; |
276 | 276 | case 'other' : |
277 | - if ( $dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year'] ) { |
|
277 | + if ($dates['m_end'] - $dates['m_start'] >= 2 || $dates['year_end'] > $dates['year']) { |
|
278 | 278 | $day_by_day = false; |
279 | 279 | } else { |
280 | 280 | $day_by_day = true; |
@@ -286,75 +286,75 @@ discard block |
||
286 | 286 | endswitch; |
287 | 287 | |
288 | 288 | $earnings_totals = (float) 0.00; // Total earnings for time period shown |
289 | - $sales_totals = 0; // Total sales for time period shown |
|
289 | + $sales_totals = 0; // Total sales for time period shown |
|
290 | 290 | |
291 | 291 | $earnings_data = array(); |
292 | 292 | $sales_data = array(); |
293 | 293 | $stats = new Give_Payment_Stats; |
294 | 294 | |
295 | - if ( $dates['range'] == 'today' || $dates['range'] == 'yesterday' ) { |
|
295 | + if ($dates['range'] == 'today' || $dates['range'] == 'yesterday') { |
|
296 | 296 | |
297 | 297 | // Hour by hour |
298 | 298 | $month = $dates['m_start']; |
299 | 299 | $hour = 1; |
300 | 300 | $minute = 0; |
301 | 301 | $second = 0; |
302 | - while ( $hour <= 23 ) : |
|
302 | + while ($hour <= 23) : |
|
303 | 303 | |
304 | - if ( $hour == 23 ) { |
|
304 | + if ($hour == 23) { |
|
305 | 305 | $minute = $second = 59; |
306 | 306 | } |
307 | 307 | |
308 | - $date = mktime( $hour, $minute, $second, $month, $dates['day'], $dates['year'] ); |
|
309 | - $date_end = mktime( $hour + 1, $minute, $second, $month, $dates['day'], $dates['year'] ); |
|
308 | + $date = mktime($hour, $minute, $second, $month, $dates['day'], $dates['year']); |
|
309 | + $date_end = mktime($hour + 1, $minute, $second, $month, $dates['day'], $dates['year']); |
|
310 | 310 | |
311 | - $sales = $stats->get_sales( $form_id, $date, $date_end ); |
|
311 | + $sales = $stats->get_sales($form_id, $date, $date_end); |
|
312 | 312 | $sales_totals += $sales; |
313 | 313 | |
314 | - $earnings = $stats->get_earnings( $form_id, $date, $date_end ); |
|
314 | + $earnings = $stats->get_earnings($form_id, $date, $date_end); |
|
315 | 315 | $earnings_totals += $earnings; |
316 | 316 | |
317 | - $sales_data[] = array( $date * 1000, $sales ); |
|
318 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
317 | + $sales_data[] = array($date * 1000, $sales); |
|
318 | + $earnings_data[] = array($date * 1000, $earnings); |
|
319 | 319 | |
320 | - $hour ++; |
|
320 | + $hour++; |
|
321 | 321 | endwhile; |
322 | 322 | |
323 | - } elseif ( $dates['range'] == 'this_week' || $dates['range'] == 'last_week' ) { |
|
323 | + } elseif ($dates['range'] == 'this_week' || $dates['range'] == 'last_week') { |
|
324 | 324 | |
325 | 325 | //Day by day |
326 | 326 | $day = $dates['day']; |
327 | 327 | $day_end = $dates['day_end']; |
328 | 328 | $month = $dates['m_start']; |
329 | - while ( $day <= $day_end ) : |
|
329 | + while ($day <= $day_end) : |
|
330 | 330 | |
331 | - $date = mktime( 0, 0, 0, $month, $day, $dates['year'] ); |
|
332 | - $date_end = mktime( 0, 0, 0, $month, $day + 1, $dates['year'] ); |
|
333 | - $sales = $stats->get_sales( $form_id, $date, $date_end ); |
|
331 | + $date = mktime(0, 0, 0, $month, $day, $dates['year']); |
|
332 | + $date_end = mktime(0, 0, 0, $month, $day + 1, $dates['year']); |
|
333 | + $sales = $stats->get_sales($form_id, $date, $date_end); |
|
334 | 334 | $sales_totals += $sales; |
335 | 335 | |
336 | - $earnings = $stats->get_earnings( $form_id, $date, $date_end ); |
|
336 | + $earnings = $stats->get_earnings($form_id, $date, $date_end); |
|
337 | 337 | $earnings_totals += $earnings; |
338 | 338 | |
339 | - $sales_data[] = array( $date * 1000, $sales ); |
|
340 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
339 | + $sales_data[] = array($date * 1000, $sales); |
|
340 | + $earnings_data[] = array($date * 1000, $earnings); |
|
341 | 341 | |
342 | - $day ++; |
|
342 | + $day++; |
|
343 | 343 | endwhile; |
344 | 344 | |
345 | 345 | } else { |
346 | 346 | |
347 | 347 | $y = $dates['year']; |
348 | 348 | |
349 | - while ( $y <= $dates['year_end'] ) : |
|
349 | + while ($y <= $dates['year_end']) : |
|
350 | 350 | |
351 | 351 | $last_year = false; |
352 | 352 | |
353 | - if ( $dates['year'] == $dates['year_end'] ) { |
|
353 | + if ($dates['year'] == $dates['year_end']) { |
|
354 | 354 | $month_start = $dates['m_start']; |
355 | 355 | $month_end = $dates['m_end']; |
356 | 356 | $last_year = true; |
357 | - } elseif ( $y == $dates['year'] ) { |
|
357 | + } elseif ($y == $dates['year']) { |
|
358 | 358 | $month_start = $dates['m_start']; |
359 | 359 | $month_end = 12; |
360 | 360 | } else { |
@@ -363,76 +363,76 @@ discard block |
||
363 | 363 | } |
364 | 364 | |
365 | 365 | $i = $month_start; |
366 | - while ( $i <= $month_end ) : |
|
366 | + while ($i <= $month_end) : |
|
367 | 367 | |
368 | - if ( $day_by_day ) { |
|
368 | + if ($day_by_day) { |
|
369 | 369 | |
370 | - if ( $i == $month_end && $last_year ) { |
|
370 | + if ($i == $month_end && $last_year) { |
|
371 | 371 | |
372 | 372 | $num_of_days = $dates['day_end']; |
373 | 373 | |
374 | 374 | } else { |
375 | 375 | |
376 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
376 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
377 | 377 | |
378 | 378 | } |
379 | 379 | |
380 | 380 | $d = $dates['day']; |
381 | - while ( $d <= $num_of_days ) : |
|
381 | + while ($d <= $num_of_days) : |
|
382 | 382 | |
383 | - $date = mktime( 0, 0, 0, $i, $d, $y ); |
|
384 | - $end_date = mktime( 23, 59, 59, $i, $d, $y ); |
|
383 | + $date = mktime(0, 0, 0, $i, $d, $y); |
|
384 | + $end_date = mktime(23, 59, 59, $i, $d, $y); |
|
385 | 385 | |
386 | - $sales = $stats->get_sales( $form_id, $date, $end_date ); |
|
386 | + $sales = $stats->get_sales($form_id, $date, $end_date); |
|
387 | 387 | $sales_totals += $sales; |
388 | 388 | |
389 | - $earnings = $stats->get_earnings( $form_id, $date, $end_date ); |
|
389 | + $earnings = $stats->get_earnings($form_id, $date, $end_date); |
|
390 | 390 | $earnings_totals += $earnings; |
391 | 391 | |
392 | - $sales_data[] = array( $date * 1000, $sales ); |
|
393 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
394 | - $d ++; |
|
392 | + $sales_data[] = array($date * 1000, $sales); |
|
393 | + $earnings_data[] = array($date * 1000, $earnings); |
|
394 | + $d++; |
|
395 | 395 | |
396 | 396 | endwhile; |
397 | 397 | |
398 | 398 | } else { |
399 | 399 | |
400 | - $num_of_days = cal_days_in_month( CAL_GREGORIAN, $i, $y ); |
|
400 | + $num_of_days = cal_days_in_month(CAL_GREGORIAN, $i, $y); |
|
401 | 401 | |
402 | - $date = mktime( 0, 0, 0, $i, 1, $y ); |
|
403 | - $end_date = mktime( 23, 59, 59, $i, $num_of_days, $y ); |
|
402 | + $date = mktime(0, 0, 0, $i, 1, $y); |
|
403 | + $end_date = mktime(23, 59, 59, $i, $num_of_days, $y); |
|
404 | 404 | |
405 | - $sales = $stats->get_sales( $form_id, $date, $end_date ); |
|
405 | + $sales = $stats->get_sales($form_id, $date, $end_date); |
|
406 | 406 | $sales_totals += $sales; |
407 | 407 | |
408 | - $earnings = $stats->get_earnings( $form_id, $date, $end_date ); |
|
408 | + $earnings = $stats->get_earnings($form_id, $date, $end_date); |
|
409 | 409 | $earnings_totals += $earnings; |
410 | 410 | |
411 | - $sales_data[] = array( $date * 1000, $sales ); |
|
412 | - $earnings_data[] = array( $date * 1000, $earnings ); |
|
411 | + $sales_data[] = array($date * 1000, $sales); |
|
412 | + $earnings_data[] = array($date * 1000, $earnings); |
|
413 | 413 | |
414 | 414 | } |
415 | 415 | |
416 | - $i ++; |
|
416 | + $i++; |
|
417 | 417 | |
418 | 418 | endwhile; |
419 | 419 | |
420 | - $y ++; |
|
420 | + $y++; |
|
421 | 421 | endwhile; |
422 | 422 | |
423 | 423 | } |
424 | 424 | |
425 | 425 | $data = array( |
426 | - esc_html__( 'Income', 'give' ) => $earnings_data, |
|
427 | - esc_html__( 'Donations', 'give' ) => $sales_data |
|
426 | + esc_html__('Income', 'give') => $earnings_data, |
|
427 | + esc_html__('Donations', 'give') => $sales_data |
|
428 | 428 | ); |
429 | 429 | |
430 | 430 | ?> |
431 | 431 | <h3><span><?php |
432 | 432 | printf( |
433 | 433 | /* translators: %s: form title */ |
434 | - esc_html__( 'Income Report for %s', 'give' ), |
|
435 | - get_the_title( $form_id ) |
|
434 | + esc_html__('Income Report for %s', 'give'), |
|
435 | + get_the_title($form_id) |
|
436 | 436 | ); |
437 | 437 | ?></span></h3> |
438 | 438 | <div id="give-dashboard-widgets-wrap"> |
@@ -441,9 +441,9 @@ discard block |
||
441 | 441 | <div class="inside"> |
442 | 442 | <?php give_reports_graph_controls(); ?> |
443 | 443 | <?php |
444 | - $graph = new Give_Graph( $data, array( 'dataType' => array( 'amount', 'count' ) ) ); |
|
445 | - $graph->set( 'x_mode', 'time' ); |
|
446 | - $graph->set( 'multiple_y_axes', true ); |
|
444 | + $graph = new Give_Graph($data, array('dataType' => array('amount', 'count'))); |
|
445 | + $graph->set('x_mode', 'time'); |
|
446 | + $graph->set('multiple_y_axes', true); |
|
447 | 447 | $graph->display(); |
448 | 448 | ?> |
449 | 449 | </div> |
@@ -452,20 +452,20 @@ discard block |
||
452 | 452 | <table class="widefat reports-table alignleft" style="max-width:450px"> |
453 | 453 | <tbody> |
454 | 454 | <tr> |
455 | - <th scope="row"><strong><?php esc_html_e( 'Total income for period:', 'give' ); ?></strong></th> |
|
456 | - <td><?php echo give_currency_filter( give_format_amount( $earnings_totals ) ); ?></td> |
|
455 | + <th scope="row"><strong><?php esc_html_e('Total income for period:', 'give'); ?></strong></th> |
|
456 | + <td><?php echo give_currency_filter(give_format_amount($earnings_totals)); ?></td> |
|
457 | 457 | </tr> |
458 | 458 | <tr class="alternate"> |
459 | - <th scope="row"><strong><?php esc_html_e( 'Total donations for period:', 'give' ); ?></strong></th> |
|
459 | + <th scope="row"><strong><?php esc_html_e('Total donations for period:', 'give'); ?></strong></th> |
|
460 | 460 | <td><?php echo $sales_totals; ?></td> |
461 | 461 | </tr> |
462 | 462 | <tr> |
463 | - <th scope="row"><strong><?php esc_html_e( 'Average monthly income:', 'give' ); ?></strong></th> |
|
464 | - <td><?php echo give_currency_filter( give_format_amount( give_get_average_monthly_form_earnings( $form_id ) ) ); ?></td> |
|
463 | + <th scope="row"><strong><?php esc_html_e('Average monthly income:', 'give'); ?></strong></th> |
|
464 | + <td><?php echo give_currency_filter(give_format_amount(give_get_average_monthly_form_earnings($form_id))); ?></td> |
|
465 | 465 | </tr> |
466 | 466 | <tr class="alternate"> |
467 | - <th scope="row"><strong><?php esc_html_e( 'Average monthly donations:', 'give' ); ?></strong></th> |
|
468 | - <td><?php echo number_format( give_get_average_monthly_form_sales( $form_id ), 0 ); ?></td> |
|
467 | + <th scope="row"><strong><?php esc_html_e('Average monthly donations:', 'give'); ?></strong></th> |
|
468 | + <td><?php echo number_format(give_get_average_monthly_form_sales($form_id), 0); ?></td> |
|
469 | 469 | </tr> |
470 | 470 | </tbody> |
471 | 471 | </table> |
@@ -484,26 +484,26 @@ discard block |
||
484 | 484 | * @return void |
485 | 485 | */ |
486 | 486 | function give_reports_graph_controls() { |
487 | - $date_options = apply_filters( 'give_report_date_options', array( |
|
488 | - 'today' => esc_html__( 'Today', 'give' ), |
|
489 | - 'yesterday' => esc_html__( 'Yesterday', 'give' ), |
|
490 | - 'this_week' => esc_html__( 'This Week', 'give' ), |
|
491 | - 'last_week' => esc_html__( 'Last Week', 'give' ), |
|
492 | - 'this_month' => esc_html__( 'This Month', 'give' ), |
|
493 | - 'last_month' => esc_html__( 'Last Month', 'give' ), |
|
494 | - 'this_quarter' => esc_html__( 'This Quarter', 'give' ), |
|
495 | - 'last_quarter' => esc_html__( 'Last Quarter', 'give' ), |
|
496 | - 'this_year' => esc_html__( 'This Year', 'give' ), |
|
497 | - 'last_year' => esc_html__( 'Last Year', 'give' ), |
|
498 | - 'other' => esc_html__( 'Custom', 'give' ) |
|
499 | - ) ); |
|
487 | + $date_options = apply_filters('give_report_date_options', array( |
|
488 | + 'today' => esc_html__('Today', 'give'), |
|
489 | + 'yesterday' => esc_html__('Yesterday', 'give'), |
|
490 | + 'this_week' => esc_html__('This Week', 'give'), |
|
491 | + 'last_week' => esc_html__('Last Week', 'give'), |
|
492 | + 'this_month' => esc_html__('This Month', 'give'), |
|
493 | + 'last_month' => esc_html__('Last Month', 'give'), |
|
494 | + 'this_quarter' => esc_html__('This Quarter', 'give'), |
|
495 | + 'last_quarter' => esc_html__('Last Quarter', 'give'), |
|
496 | + 'this_year' => esc_html__('This Year', 'give'), |
|
497 | + 'last_year' => esc_html__('Last Year', 'give'), |
|
498 | + 'other' => esc_html__('Custom', 'give') |
|
499 | + )); |
|
500 | 500 | |
501 | 501 | $dates = give_get_report_dates(); |
502 | 502 | $display = $dates['range'] == 'other' ? '' : 'display: none;'; |
503 | - $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
503 | + $tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
504 | 504 | |
505 | - if ( empty( $dates['day_end'] ) ) { |
|
506 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, date( 'n' ), date( 'Y' ) ); |
|
505 | + if (empty($dates['day_end'])) { |
|
506 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, date('n'), date('Y')); |
|
507 | 507 | } |
508 | 508 | |
509 | 509 | /** |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | * |
512 | 512 | * @since 1.0 |
513 | 513 | */ |
514 | - do_action( 'give_report_graph_controls_before' ); |
|
514 | + do_action('give_report_graph_controls_before'); |
|
515 | 515 | ?> |
516 | 516 | <form id="give-graphs-filter" method="get"> |
517 | 517 | <div class="tablenav top"> |
@@ -519,56 +519,56 @@ discard block |
||
519 | 519 | |
520 | 520 | <input type="hidden" name="post_type" value="give_forms" /> |
521 | 521 | <input type="hidden" name="page" value="give-reports" /> |
522 | - <input type="hidden" name="tab" value="<?php echo esc_attr( $tab ); ?>" /> |
|
522 | + <input type="hidden" name="tab" value="<?php echo esc_attr($tab); ?>" /> |
|
523 | 523 | |
524 | - <?php if ( isset( $_GET['form-id'] ) ) : ?> |
|
525 | - <input type="hidden" name="form-id" value="<?php echo absint( $_GET['form-id'] ); ?>" /> |
|
524 | + <?php if (isset($_GET['form-id'])) : ?> |
|
525 | + <input type="hidden" name="form-id" value="<?php echo absint($_GET['form-id']); ?>" /> |
|
526 | 526 | <?php endif; ?> |
527 | 527 | |
528 | 528 | <div id="give-graphs-date-options-wrap"> |
529 | 529 | <select id="give-graphs-date-options" name="range"> |
530 | - <?php foreach ( $date_options as $key => $option ) : ?> |
|
531 | - <option value="<?php echo esc_attr( $key ); ?>"<?php selected( $key, $dates['range'] ); ?>><?php echo esc_html( $option ); ?></option> |
|
530 | + <?php foreach ($date_options as $key => $option) : ?> |
|
531 | + <option value="<?php echo esc_attr($key); ?>"<?php selected($key, $dates['range']); ?>><?php echo esc_html($option); ?></option> |
|
532 | 532 | <?php endforeach; ?> |
533 | 533 | </select> |
534 | 534 | |
535 | - <div id="give-date-range-options" style="<?php echo esc_attr( $display ); ?>"> |
|
536 | - <span class="screen-reader-text"><?php esc_html_e( 'From', 'give' ); ?> </span> |
|
535 | + <div id="give-date-range-options" style="<?php echo esc_attr($display); ?>"> |
|
536 | + <span class="screen-reader-text"><?php esc_html_e('From', 'give'); ?> </span> |
|
537 | 537 | <select id="give-graphs-month-start" name="m_start" aria-label="Start Month"> |
538 | - <?php for ( $i = 1; $i <= 12; $i ++ ) : ?> |
|
539 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['m_start'] ) ); ?>><?php echo esc_html( give_month_num_to_name( $i ) ); ?></option> |
|
538 | + <?php for ($i = 1; $i <= 12; $i++) : ?> |
|
539 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['m_start'])); ?>><?php echo esc_html(give_month_num_to_name($i)); ?></option> |
|
540 | 540 | <?php endfor; ?> |
541 | 541 | </select> |
542 | 542 | <select id="give-graphs-day-start" name="day" aria-label="Start Day"> |
543 | - <?php for ( $i = 1; $i <= 31; $i ++ ) : ?> |
|
544 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['day'] ) ); ?>><?php echo esc_html( $i ); ?></option> |
|
543 | + <?php for ($i = 1; $i <= 31; $i++) : ?> |
|
544 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['day'])); ?>><?php echo esc_html($i); ?></option> |
|
545 | 545 | <?php endfor; ?> |
546 | 546 | </select> |
547 | 547 | <select id="give-graphs-year-start" name="year" aria-label="Start Year"> |
548 | - <?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?> |
|
549 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['year'] ) ); ?>><?php echo esc_html( $i ); ?></option> |
|
548 | + <?php for ($i = 2007; $i <= date('Y'); $i++) : ?> |
|
549 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['year'])); ?>><?php echo esc_html($i); ?></option> |
|
550 | 550 | <?php endfor; ?> |
551 | 551 | </select> |
552 | - <span class="screen-reader-text"><?php esc_html_e( 'To', 'give' ); ?> </span> |
|
552 | + <span class="screen-reader-text"><?php esc_html_e('To', 'give'); ?> </span> |
|
553 | 553 | <span>–</span> |
554 | 554 | <select id="give-graphs-month-end" name="m_end" aria-label="End Month"> |
555 | - <?php for ( $i = 1; $i <= 12; $i ++ ) : ?> |
|
556 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['m_end'] ) ); ?>><?php echo esc_html( give_month_num_to_name( $i ) ); ?></option> |
|
555 | + <?php for ($i = 1; $i <= 12; $i++) : ?> |
|
556 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['m_end'])); ?>><?php echo esc_html(give_month_num_to_name($i)); ?></option> |
|
557 | 557 | <?php endfor; ?> |
558 | 558 | </select> |
559 | 559 | <select id="give-graphs-day-end" name="day_end" aria-label="End Day"> |
560 | - <?php for ( $i = 1; $i <= 31; $i ++ ) : ?> |
|
561 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['day_end'] ) ); ?>><?php echo esc_html( $i ); ?></option> |
|
560 | + <?php for ($i = 1; $i <= 31; $i++) : ?> |
|
561 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['day_end'])); ?>><?php echo esc_html($i); ?></option> |
|
562 | 562 | <?php endfor; ?> |
563 | 563 | </select> |
564 | 564 | <select id="give-graphs-year-end" name="year_end" aria-label="End Year"> |
565 | - <?php for ( $i = 2007; $i <= date( 'Y' ); $i ++ ) : ?> |
|
566 | - <option value="<?php echo absint( $i ); ?>" <?php echo esc_attr( selected( $i, $dates['year_end'] ) ); ?>><?php echo esc_html( $i ); ?></option> |
|
565 | + <?php for ($i = 2007; $i <= date('Y'); $i++) : ?> |
|
566 | + <option value="<?php echo absint($i); ?>" <?php echo esc_attr(selected($i, $dates['year_end'])); ?>><?php echo esc_html($i); ?></option> |
|
567 | 567 | <?php endfor; ?> |
568 | 568 | </select> |
569 | 569 | </div> |
570 | 570 | |
571 | - <input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Filter', 'give' ); ?>" /> |
|
571 | + <input type="submit" class="button-secondary" value="<?php esc_attr_e('Filter', 'give'); ?>" /> |
|
572 | 572 | </div> |
573 | 573 | |
574 | 574 | <input type="hidden" name="give_action" value="filter_reports" /> |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | * |
582 | 582 | * @since 1.0 |
583 | 583 | */ |
584 | - do_action( 'give_report_graph_controls_after' ); |
|
584 | + do_action('give_report_graph_controls_after'); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | /** |
@@ -596,65 +596,65 @@ discard block |
||
596 | 596 | function give_get_report_dates() { |
597 | 597 | $dates = array(); |
598 | 598 | |
599 | - $current_time = current_time( 'timestamp' ); |
|
599 | + $current_time = current_time('timestamp'); |
|
600 | 600 | |
601 | - $dates['range'] = isset( $_GET['range'] ) ? $_GET['range'] : 'this_month'; |
|
602 | - $dates['year'] = isset( $_GET['year'] ) ? $_GET['year'] : date( 'Y' ); |
|
603 | - $dates['year_end'] = isset( $_GET['year_end'] ) ? $_GET['year_end'] : date( 'Y' ); |
|
604 | - $dates['m_start'] = isset( $_GET['m_start'] ) ? $_GET['m_start'] : 1; |
|
605 | - $dates['m_end'] = isset( $_GET['m_end'] ) ? $_GET['m_end'] : 12; |
|
606 | - $dates['day'] = isset( $_GET['day'] ) ? $_GET['day'] : 1; |
|
607 | - $dates['day_end'] = isset( $_GET['day_end'] ) ? $_GET['day_end'] : cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
601 | + $dates['range'] = isset($_GET['range']) ? $_GET['range'] : 'this_month'; |
|
602 | + $dates['year'] = isset($_GET['year']) ? $_GET['year'] : date('Y'); |
|
603 | + $dates['year_end'] = isset($_GET['year_end']) ? $_GET['year_end'] : date('Y'); |
|
604 | + $dates['m_start'] = isset($_GET['m_start']) ? $_GET['m_start'] : 1; |
|
605 | + $dates['m_end'] = isset($_GET['m_end']) ? $_GET['m_end'] : 12; |
|
606 | + $dates['day'] = isset($_GET['day']) ? $_GET['day'] : 1; |
|
607 | + $dates['day_end'] = isset($_GET['day_end']) ? $_GET['day_end'] : cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
608 | 608 | |
609 | 609 | // Modify dates based on predefined ranges |
610 | - switch ( $dates['range'] ) : |
|
610 | + switch ($dates['range']) : |
|
611 | 611 | |
612 | 612 | case 'this_month' : |
613 | - $dates['m_start'] = date( 'n', $current_time ); |
|
614 | - $dates['m_end'] = date( 'n', $current_time ); |
|
613 | + $dates['m_start'] = date('n', $current_time); |
|
614 | + $dates['m_end'] = date('n', $current_time); |
|
615 | 615 | $dates['day'] = 1; |
616 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
617 | - $dates['year'] = date( 'Y' ); |
|
618 | - $dates['year_end'] = date( 'Y' ); |
|
616 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
617 | + $dates['year'] = date('Y'); |
|
618 | + $dates['year_end'] = date('Y'); |
|
619 | 619 | break; |
620 | 620 | |
621 | 621 | case 'last_month' : |
622 | - if ( date( 'n' ) == 1 ) { |
|
622 | + if (date('n') == 1) { |
|
623 | 623 | $dates['m_start'] = 12; |
624 | 624 | $dates['m_end'] = 12; |
625 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
626 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
625 | + $dates['year'] = date('Y', $current_time) - 1; |
|
626 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
627 | 627 | } else { |
628 | - $dates['m_start'] = date( 'n' ) - 1; |
|
629 | - $dates['m_end'] = date( 'n' ) - 1; |
|
628 | + $dates['m_start'] = date('n') - 1; |
|
629 | + $dates['m_end'] = date('n') - 1; |
|
630 | 630 | $dates['year_end'] = $dates['year']; |
631 | 631 | } |
632 | - $dates['day_end'] = cal_days_in_month( CAL_GREGORIAN, $dates['m_end'], $dates['year'] ); |
|
632 | + $dates['day_end'] = cal_days_in_month(CAL_GREGORIAN, $dates['m_end'], $dates['year']); |
|
633 | 633 | break; |
634 | 634 | |
635 | 635 | case 'today' : |
636 | - $dates['day'] = date( 'd', $current_time ); |
|
637 | - $dates['m_start'] = date( 'n', $current_time ); |
|
638 | - $dates['m_end'] = date( 'n', $current_time ); |
|
639 | - $dates['year'] = date( 'Y', $current_time ); |
|
636 | + $dates['day'] = date('d', $current_time); |
|
637 | + $dates['m_start'] = date('n', $current_time); |
|
638 | + $dates['m_end'] = date('n', $current_time); |
|
639 | + $dates['year'] = date('Y', $current_time); |
|
640 | 640 | break; |
641 | 641 | |
642 | 642 | case 'yesterday' : |
643 | 643 | |
644 | - $year = date( 'Y', $current_time ); |
|
645 | - $month = date( 'n', $current_time ); |
|
646 | - $day = date( 'd', $current_time ); |
|
644 | + $year = date('Y', $current_time); |
|
645 | + $month = date('n', $current_time); |
|
646 | + $day = date('d', $current_time); |
|
647 | 647 | |
648 | - if ( $month == 1 && $day == 1 ) { |
|
648 | + if ($month == 1 && $day == 1) { |
|
649 | 649 | |
650 | 650 | $year -= 1; |
651 | 651 | $month = 12; |
652 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
652 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
653 | 653 | |
654 | - } elseif ( $month > 1 && $day == 1 ) { |
|
654 | + } elseif ($month > 1 && $day == 1) { |
|
655 | 655 | |
656 | 656 | $month -= 1; |
657 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
657 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
658 | 658 | |
659 | 659 | } else { |
660 | 660 | |
@@ -670,91 +670,91 @@ discard block |
||
670 | 670 | break; |
671 | 671 | |
672 | 672 | case 'this_week' : |
673 | - $dates['day'] = date( 'd', $current_time - ( date( 'w', $current_time ) - 1 ) * 60 * 60 * 24 ) - 1; |
|
674 | - $dates['day'] += get_option( 'start_of_week' ); |
|
673 | + $dates['day'] = date('d', $current_time - (date('w', $current_time) - 1) * 60 * 60 * 24) - 1; |
|
674 | + $dates['day'] += get_option('start_of_week'); |
|
675 | 675 | $dates['day_end'] = $dates['day'] + 6; |
676 | - $dates['m_start'] = date( 'n', $current_time ); |
|
677 | - $dates['m_end'] = date( 'n', $current_time ); |
|
678 | - $dates['year'] = date( 'Y', $current_time ); |
|
676 | + $dates['m_start'] = date('n', $current_time); |
|
677 | + $dates['m_end'] = date('n', $current_time); |
|
678 | + $dates['year'] = date('Y', $current_time); |
|
679 | 679 | break; |
680 | 680 | |
681 | 681 | case 'last_week' : |
682 | - $dates['day'] = date( 'd', $current_time - ( date( 'w' ) - 1 ) * 60 * 60 * 24 ) - 8; |
|
683 | - $dates['day'] += get_option( 'start_of_week' ); |
|
682 | + $dates['day'] = date('d', $current_time - (date('w') - 1) * 60 * 60 * 24) - 8; |
|
683 | + $dates['day'] += get_option('start_of_week'); |
|
684 | 684 | $dates['day_end'] = $dates['day'] + 6; |
685 | - $dates['year'] = date( 'Y' ); |
|
686 | - |
|
687 | - if ( date( 'j', $current_time ) <= 7 ) { |
|
688 | - $dates['m_start'] = date( 'n', $current_time ) - 1; |
|
689 | - $dates['m_end'] = date( 'n', $current_time ) - 1; |
|
690 | - if ( $dates['m_start'] <= 1 ) { |
|
691 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
692 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
685 | + $dates['year'] = date('Y'); |
|
686 | + |
|
687 | + if (date('j', $current_time) <= 7) { |
|
688 | + $dates['m_start'] = date('n', $current_time) - 1; |
|
689 | + $dates['m_end'] = date('n', $current_time) - 1; |
|
690 | + if ($dates['m_start'] <= 1) { |
|
691 | + $dates['year'] = date('Y', $current_time) - 1; |
|
692 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
693 | 693 | } |
694 | 694 | } else { |
695 | - $dates['m_start'] = date( 'n', $current_time ); |
|
696 | - $dates['m_end'] = date( 'n', $current_time ); |
|
695 | + $dates['m_start'] = date('n', $current_time); |
|
696 | + $dates['m_end'] = date('n', $current_time); |
|
697 | 697 | } |
698 | 698 | break; |
699 | 699 | |
700 | 700 | case 'this_quarter' : |
701 | - $month_now = date( 'n', $current_time ); |
|
701 | + $month_now = date('n', $current_time); |
|
702 | 702 | |
703 | - if ( $month_now <= 3 ) { |
|
703 | + if ($month_now <= 3) { |
|
704 | 704 | |
705 | 705 | $dates['m_start'] = 1; |
706 | 706 | $dates['m_end'] = 4; |
707 | - $dates['year'] = date( 'Y', $current_time ); |
|
707 | + $dates['year'] = date('Y', $current_time); |
|
708 | 708 | |
709 | - } else if ( $month_now <= 6 ) { |
|
709 | + } else if ($month_now <= 6) { |
|
710 | 710 | |
711 | 711 | $dates['m_start'] = 4; |
712 | 712 | $dates['m_end'] = 7; |
713 | - $dates['year'] = date( 'Y', $current_time ); |
|
713 | + $dates['year'] = date('Y', $current_time); |
|
714 | 714 | |
715 | - } else if ( $month_now <= 9 ) { |
|
715 | + } else if ($month_now <= 9) { |
|
716 | 716 | |
717 | 717 | $dates['m_start'] = 7; |
718 | 718 | $dates['m_end'] = 10; |
719 | - $dates['year'] = date( 'Y', $current_time ); |
|
719 | + $dates['year'] = date('Y', $current_time); |
|
720 | 720 | |
721 | 721 | } else { |
722 | 722 | |
723 | 723 | $dates['m_start'] = 10; |
724 | 724 | $dates['m_end'] = 1; |
725 | - $dates['year'] = date( 'Y', $current_time ); |
|
726 | - $dates['year_end'] = date( 'Y', $current_time ) + 1; |
|
725 | + $dates['year'] = date('Y', $current_time); |
|
726 | + $dates['year_end'] = date('Y', $current_time) + 1; |
|
727 | 727 | |
728 | 728 | } |
729 | 729 | break; |
730 | 730 | |
731 | 731 | case 'last_quarter' : |
732 | - $month_now = date( 'n' ); |
|
732 | + $month_now = date('n'); |
|
733 | 733 | |
734 | - if ( $month_now <= 3 ) { |
|
734 | + if ($month_now <= 3) { |
|
735 | 735 | |
736 | 736 | $dates['m_start'] = 10; |
737 | 737 | $dates['m_end'] = 12; |
738 | - $dates['year'] = date( 'Y', $current_time ) - 1; // Previous year |
|
739 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; // Previous year |
|
738 | + $dates['year'] = date('Y', $current_time) - 1; // Previous year |
|
739 | + $dates['year_end'] = date('Y', $current_time) - 1; // Previous year |
|
740 | 740 | |
741 | - } else if ( $month_now <= 6 ) { |
|
741 | + } else if ($month_now <= 6) { |
|
742 | 742 | |
743 | 743 | $dates['m_start'] = 1; |
744 | 744 | $dates['m_end'] = 3; |
745 | - $dates['year'] = date( 'Y', $current_time ); |
|
745 | + $dates['year'] = date('Y', $current_time); |
|
746 | 746 | |
747 | - } else if ( $month_now <= 9 ) { |
|
747 | + } else if ($month_now <= 9) { |
|
748 | 748 | |
749 | 749 | $dates['m_start'] = 4; |
750 | 750 | $dates['m_end'] = 6; |
751 | - $dates['year'] = date( 'Y', $current_time ); |
|
751 | + $dates['year'] = date('Y', $current_time); |
|
752 | 752 | |
753 | 753 | } else { |
754 | 754 | |
755 | 755 | $dates['m_start'] = 7; |
756 | 756 | $dates['m_end'] = 9; |
757 | - $dates['year'] = date( 'Y', $current_time ); |
|
757 | + $dates['year'] = date('Y', $current_time); |
|
758 | 758 | |
759 | 759 | } |
760 | 760 | break; |
@@ -762,19 +762,19 @@ discard block |
||
762 | 762 | case 'this_year' : |
763 | 763 | $dates['m_start'] = 1; |
764 | 764 | $dates['m_end'] = 12; |
765 | - $dates['year'] = date( 'Y', $current_time ); |
|
765 | + $dates['year'] = date('Y', $current_time); |
|
766 | 766 | break; |
767 | 767 | |
768 | 768 | case 'last_year' : |
769 | 769 | $dates['m_start'] = 1; |
770 | 770 | $dates['m_end'] = 12; |
771 | - $dates['year'] = date( 'Y', $current_time ) - 1; |
|
772 | - $dates['year_end'] = date( 'Y', $current_time ) - 1; |
|
771 | + $dates['year'] = date('Y', $current_time) - 1; |
|
772 | + $dates['year_end'] = date('Y', $current_time) - 1; |
|
773 | 773 | break; |
774 | 774 | |
775 | 775 | endswitch; |
776 | 776 | |
777 | - return apply_filters( 'give_report_dates', $dates ); |
|
777 | + return apply_filters('give_report_dates', $dates); |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | /** |
@@ -785,18 +785,18 @@ discard block |
||
785 | 785 | * |
786 | 786 | * @param $data |
787 | 787 | */ |
788 | -function give_parse_report_dates( $data ) { |
|
788 | +function give_parse_report_dates($data) { |
|
789 | 789 | $dates = give_get_report_dates(); |
790 | 790 | |
791 | 791 | $view = give_get_reporting_view(); |
792 | - $tab = isset( $_GET['tab'] ) ? sanitize_text_field( $_GET['tab'] ) : 'earnings'; |
|
793 | - $id = isset( $_GET['form-id'] ) ? $_GET['form-id'] : null; |
|
792 | + $tab = isset($_GET['tab']) ? sanitize_text_field($_GET['tab']) : 'earnings'; |
|
793 | + $id = isset($_GET['form-id']) ? $_GET['form-id'] : null; |
|
794 | 794 | |
795 | - wp_redirect( add_query_arg( $dates, admin_url( 'edit.php?post_type=give_forms&page=give-reports&tab=' . esc_attr( $tab ) . '&view=' . esc_attr( $view ) . '&form-id=' . absint( $id ) ) ) ); |
|
795 | + wp_redirect(add_query_arg($dates, admin_url('edit.php?post_type=give_forms&page=give-reports&tab='.esc_attr($tab).'&view='.esc_attr($view).'&form-id='.absint($id)))); |
|
796 | 796 | give_die(); |
797 | 797 | } |
798 | 798 | |
799 | -add_action( 'give_filter_reports', 'give_parse_report_dates' ); |
|
799 | +add_action('give_filter_reports', 'give_parse_report_dates'); |
|
800 | 800 | |
801 | 801 | |
802 | 802 | /** |
@@ -808,22 +808,22 @@ discard block |
||
808 | 808 | */ |
809 | 809 | function give_reports_refresh_button() { |
810 | 810 | |
811 | - $url = wp_nonce_url( add_query_arg( array( |
|
811 | + $url = wp_nonce_url(add_query_arg(array( |
|
812 | 812 | 'give_action' => 'refresh_reports_transients', |
813 | 813 | 'give-message' => 'refreshed-reports' |
814 | - ) ), 'give-refresh-reports' ); |
|
814 | + )), 'give-refresh-reports'); |
|
815 | 815 | |
816 | 816 | echo '<a href="' |
817 | - . esc_url_raw( $url ) |
|
818 | - . '" data-tooltip="'. esc_attr__( 'Clicking this will clear the reports cache.', 'give' ) |
|
817 | + . esc_url_raw($url) |
|
818 | + . '" data-tooltip="'.esc_attr__('Clicking this will clear the reports cache.', 'give') |
|
819 | 819 | . '" data-tooltip-my-position="right center" data-tooltip-target-position="left center" class="button alignright give-admin-button give-tooltip">' |
820 | 820 | . '<span class="give-admin-button-icon give-admin-button-icon-update"></span>' |
821 | - . esc_html__( 'Refresh Report Data', 'give' ) |
|
821 | + . esc_html__('Refresh Report Data', 'give') |
|
822 | 822 | . '</a>'; |
823 | 823 | |
824 | 824 | } |
825 | 825 | |
826 | -add_action( 'give_reports_graph_additional_stats', 'give_reports_refresh_button' ); |
|
826 | +add_action('give_reports_graph_additional_stats', 'give_reports_refresh_button'); |
|
827 | 827 | |
828 | 828 | /** |
829 | 829 | * Trigger the refresh of reports transients |
@@ -834,20 +834,20 @@ discard block |
||
834 | 834 | * |
835 | 835 | * @return void |
836 | 836 | */ |
837 | -function give_run_refresh_reports_transients( $data ) { |
|
837 | +function give_run_refresh_reports_transients($data) { |
|
838 | 838 | |
839 | - if ( ! wp_verify_nonce( $data['_wpnonce'], 'give-refresh-reports' ) ) { |
|
839 | + if ( ! wp_verify_nonce($data['_wpnonce'], 'give-refresh-reports')) { |
|
840 | 840 | return; |
841 | 841 | } |
842 | 842 | |
843 | 843 | // Monthly stats. |
844 | - Give_Cache::delete( Give_Cache::get_key( 'give_estimated_monthly_stats' ) ); |
|
844 | + Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats')); |
|
845 | 845 | |
846 | 846 | // Total earning. |
847 | - delete_option( 'give_earnings_total' ); |
|
847 | + delete_option('give_earnings_total'); |
|
848 | 848 | |
849 | 849 | // @todo: Refresh only range related stat cache |
850 | 850 | give_delete_donation_stats(); |
851 | 851 | } |
852 | 852 | |
853 | -add_action( 'give_refresh_reports_transients', 'give_run_refresh_reports_transients' ); |
|
854 | 853 | \ No newline at end of file |
854 | +add_action('give_refresh_reports_transients', 'give_run_refresh_reports_transients'); |
|
855 | 855 | \ No newline at end of file |