@@ -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 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @access public |
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | - add_filter( 'give_map_meta_cap', array( $this, 'meta_caps' ), 10, 4 ); |
|
38 | + add_filter('give_map_meta_cap', array($this, 'meta_caps'), 10, 4); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public function add_roles() { |
52 | - add_role( 'give_manager', esc_html__( 'Give Manager', 'give' ), array( |
|
52 | + add_role('give_manager', esc_html__('Give Manager', 'give'), array( |
|
53 | 53 | 'read' => true, |
54 | 54 | 'edit_posts' => true, |
55 | 55 | 'delete_posts' => true, |
@@ -78,20 +78,20 @@ discard block |
||
78 | 78 | 'publish_posts' => true, |
79 | 79 | 'read_private_pages' => true, |
80 | 80 | 'read_private_posts' => true |
81 | - ) ); |
|
81 | + )); |
|
82 | 82 | |
83 | - add_role( 'give_accountant', esc_html__( 'Give Accountant', 'give' ), array( |
|
83 | + add_role('give_accountant', esc_html__('Give Accountant', 'give'), array( |
|
84 | 84 | 'read' => true, |
85 | 85 | 'edit_posts' => false, |
86 | 86 | 'delete_posts' => false |
87 | - ) ); |
|
87 | + )); |
|
88 | 88 | |
89 | - add_role( 'give_worker', esc_html__( 'Give Worker', 'give' ), array( |
|
89 | + add_role('give_worker', esc_html__('Give Worker', 'give'), array( |
|
90 | 90 | 'read' => true, |
91 | 91 | 'edit_posts' => false, |
92 | 92 | 'upload_files' => true, |
93 | 93 | 'delete_posts' => false |
94 | - ) ); |
|
94 | + )); |
|
95 | 95 | |
96 | 96 | } |
97 | 97 | |
@@ -110,38 +110,38 @@ discard block |
||
110 | 110 | public function add_caps() { |
111 | 111 | global $wp_roles; |
112 | 112 | |
113 | - if ( class_exists( 'WP_Roles' ) ) { |
|
114 | - if ( ! isset( $wp_roles ) ) { |
|
113 | + if (class_exists('WP_Roles')) { |
|
114 | + if ( ! isset($wp_roles)) { |
|
115 | 115 | $wp_roles = new WP_Roles(); |
116 | 116 | } |
117 | 117 | } |
118 | 118 | |
119 | - if ( is_object( $wp_roles ) ) { |
|
120 | - $wp_roles->add_cap( 'give_manager', 'view_give_reports' ); |
|
121 | - $wp_roles->add_cap( 'give_manager', 'view_give_sensitive_data' ); |
|
122 | - $wp_roles->add_cap( 'give_manager', 'export_give_reports' ); |
|
123 | - $wp_roles->add_cap( 'give_manager', 'manage_give_settings' ); |
|
119 | + if (is_object($wp_roles)) { |
|
120 | + $wp_roles->add_cap('give_manager', 'view_give_reports'); |
|
121 | + $wp_roles->add_cap('give_manager', 'view_give_sensitive_data'); |
|
122 | + $wp_roles->add_cap('give_manager', 'export_give_reports'); |
|
123 | + $wp_roles->add_cap('give_manager', 'manage_give_settings'); |
|
124 | 124 | |
125 | - $wp_roles->add_cap( 'administrator', 'view_give_reports' ); |
|
126 | - $wp_roles->add_cap( 'administrator', 'view_give_sensitive_data' ); |
|
127 | - $wp_roles->add_cap( 'administrator', 'export_give_reports' ); |
|
128 | - $wp_roles->add_cap( 'administrator', 'manage_give_settings' ); |
|
125 | + $wp_roles->add_cap('administrator', 'view_give_reports'); |
|
126 | + $wp_roles->add_cap('administrator', 'view_give_sensitive_data'); |
|
127 | + $wp_roles->add_cap('administrator', 'export_give_reports'); |
|
128 | + $wp_roles->add_cap('administrator', 'manage_give_settings'); |
|
129 | 129 | |
130 | 130 | // Add the main post type capabilities. |
131 | 131 | $capabilities = $this->get_core_caps(); |
132 | - foreach ( $capabilities as $cap_group ) { |
|
133 | - foreach ( $cap_group as $cap ) { |
|
134 | - $wp_roles->add_cap( 'administrator', $cap ); |
|
135 | - $wp_roles->add_cap( 'give_manager', $cap ); |
|
136 | - $wp_roles->add_cap( 'give_worker', $cap ); |
|
132 | + foreach ($capabilities as $cap_group) { |
|
133 | + foreach ($cap_group as $cap) { |
|
134 | + $wp_roles->add_cap('administrator', $cap); |
|
135 | + $wp_roles->add_cap('give_manager', $cap); |
|
136 | + $wp_roles->add_cap('give_worker', $cap); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | - $wp_roles->add_cap( 'give_accountant', 'edit_give_forms' ); |
|
141 | - $wp_roles->add_cap( 'give_accountant', 'read_private_give_forms' ); |
|
142 | - $wp_roles->add_cap( 'give_accountant', 'view_give_reports' ); |
|
143 | - $wp_roles->add_cap( 'give_accountant', 'export_give_reports' ); |
|
144 | - $wp_roles->add_cap( 'give_accountant', 'edit_give_payments' ); |
|
140 | + $wp_roles->add_cap('give_accountant', 'edit_give_forms'); |
|
141 | + $wp_roles->add_cap('give_accountant', 'read_private_give_forms'); |
|
142 | + $wp_roles->add_cap('give_accountant', 'view_give_reports'); |
|
143 | + $wp_roles->add_cap('give_accountant', 'export_give_reports'); |
|
144 | + $wp_roles->add_cap('give_accountant', 'edit_give_payments'); |
|
145 | 145 | |
146 | 146 | } |
147 | 147 | } |
@@ -159,10 +159,10 @@ discard block |
||
159 | 159 | public function get_core_caps() { |
160 | 160 | $capabilities = array(); |
161 | 161 | |
162 | - $capability_types = array( 'give_form', 'give_payment' ); |
|
162 | + $capability_types = array('give_form', 'give_payment'); |
|
163 | 163 | |
164 | - foreach ( $capability_types as $capability_type ) { |
|
165 | - $capabilities[ $capability_type ] = array( |
|
164 | + foreach ($capability_types as $capability_type) { |
|
165 | + $capabilities[$capability_type] = array( |
|
166 | 166 | // Post type. |
167 | 167 | "edit_{$capability_type}", |
168 | 168 | "read_{$capability_type}", |
@@ -208,22 +208,22 @@ discard block |
||
208 | 208 | * |
209 | 209 | * @return array $caps Meta capabilities. |
210 | 210 | */ |
211 | - public function meta_caps( $caps, $cap, $user_id, $args ) { |
|
211 | + public function meta_caps($caps, $cap, $user_id, $args) { |
|
212 | 212 | |
213 | - switch ( $cap ) { |
|
213 | + switch ($cap) { |
|
214 | 214 | |
215 | 215 | case 'view_give_form_stats' : |
216 | 216 | |
217 | - if ( empty( $args[0] ) ) { |
|
217 | + if (empty($args[0])) { |
|
218 | 218 | break; |
219 | 219 | } |
220 | 220 | |
221 | - $form = get_post( $args[0] ); |
|
222 | - if ( empty( $form ) ) { |
|
221 | + $form = get_post($args[0]); |
|
222 | + if (empty($form)) { |
|
223 | 223 | break; |
224 | 224 | } |
225 | 225 | |
226 | - if ( user_can( $user_id, 'view_give_reports' ) || $user_id == $form->post_author ) { |
|
226 | + if (user_can($user_id, 'view_give_reports') || $user_id == $form->post_author) { |
|
227 | 227 | $caps = array(); |
228 | 228 | } |
229 | 229 | |
@@ -250,41 +250,41 @@ discard block |
||
250 | 250 | |
251 | 251 | global $wp_roles; |
252 | 252 | |
253 | - if ( class_exists( 'WP_Roles' ) ) { |
|
254 | - if ( ! isset( $wp_roles ) ) { |
|
253 | + if (class_exists('WP_Roles')) { |
|
254 | + if ( ! isset($wp_roles)) { |
|
255 | 255 | $wp_roles = new WP_Roles(); |
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
259 | - if ( is_object( $wp_roles ) ) { |
|
259 | + if (is_object($wp_roles)) { |
|
260 | 260 | // Give Manager Capabilities. |
261 | - $wp_roles->remove_cap( 'give_manager', 'view_give_reports' ); |
|
262 | - $wp_roles->remove_cap( 'give_manager', 'view_give_sensitive_data' ); |
|
263 | - $wp_roles->remove_cap( 'give_manager', 'export_give_reports' ); |
|
264 | - $wp_roles->remove_cap( 'give_manager', 'manage_give_settings' ); |
|
261 | + $wp_roles->remove_cap('give_manager', 'view_give_reports'); |
|
262 | + $wp_roles->remove_cap('give_manager', 'view_give_sensitive_data'); |
|
263 | + $wp_roles->remove_cap('give_manager', 'export_give_reports'); |
|
264 | + $wp_roles->remove_cap('give_manager', 'manage_give_settings'); |
|
265 | 265 | |
266 | 266 | // Site Administrator Capabilities. |
267 | - $wp_roles->remove_cap( 'administrator', 'view_give_reports' ); |
|
268 | - $wp_roles->remove_cap( 'administrator', 'view_give_sensitive_data' ); |
|
269 | - $wp_roles->remove_cap( 'administrator', 'export_give_reports' ); |
|
270 | - $wp_roles->remove_cap( 'administrator', 'manage_give_settings' ); |
|
267 | + $wp_roles->remove_cap('administrator', 'view_give_reports'); |
|
268 | + $wp_roles->remove_cap('administrator', 'view_give_sensitive_data'); |
|
269 | + $wp_roles->remove_cap('administrator', 'export_give_reports'); |
|
270 | + $wp_roles->remove_cap('administrator', 'manage_give_settings'); |
|
271 | 271 | |
272 | 272 | // Remove the Main Post Type Capabilities. |
273 | 273 | $capabilities = $this->get_core_caps(); |
274 | 274 | |
275 | - foreach ( $capabilities as $cap_group ) { |
|
276 | - foreach ( $cap_group as $cap ) { |
|
277 | - $wp_roles->remove_cap( 'give_manager', $cap ); |
|
278 | - $wp_roles->remove_cap( 'administrator', $cap ); |
|
279 | - $wp_roles->remove_cap( 'give_worker', $cap ); |
|
275 | + foreach ($capabilities as $cap_group) { |
|
276 | + foreach ($cap_group as $cap) { |
|
277 | + $wp_roles->remove_cap('give_manager', $cap); |
|
278 | + $wp_roles->remove_cap('administrator', $cap); |
|
279 | + $wp_roles->remove_cap('give_worker', $cap); |
|
280 | 280 | } |
281 | 281 | } |
282 | 282 | |
283 | 283 | /** Give Accountant Capabilities */ |
284 | - $wp_roles->remove_cap( 'give_accountant', 'edit_give_forms' ); |
|
285 | - $wp_roles->remove_cap( 'give_accountant', 'read_private_give_forms' ); |
|
286 | - $wp_roles->remove_cap( 'give_accountant', 'view_give_reports' ); |
|
287 | - $wp_roles->remove_cap( 'give_accountant', 'export_give_reports' ); |
|
284 | + $wp_roles->remove_cap('give_accountant', 'edit_give_forms'); |
|
285 | + $wp_roles->remove_cap('give_accountant', 'read_private_give_forms'); |
|
286 | + $wp_roles->remove_cap('give_accountant', 'view_give_reports'); |
|
287 | + $wp_roles->remove_cap('give_accountant', 'export_give_reports'); |
|
288 | 288 | |
289 | 289 | } |
290 | 290 | } |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -55,16 +55,16 @@ discard block |
||
55 | 55 | public function get_data() { |
56 | 56 | global $wpdb; |
57 | 57 | |
58 | - $items = $this->get_stored_data( 'give_temp_reset_ids' ); |
|
58 | + $items = $this->get_stored_data('give_temp_reset_ids'); |
|
59 | 59 | |
60 | - if ( ! is_array( $items ) ) { |
|
60 | + if ( ! is_array($items)) { |
|
61 | 61 | return false; |
62 | 62 | } |
63 | 63 | |
64 | - $offset = ( $this->step - 1 ) * $this->per_step; |
|
65 | - $step_items = array_slice( $items, $offset, $this->per_step ); |
|
64 | + $offset = ($this->step - 1) * $this->per_step; |
|
65 | + $step_items = array_slice($items, $offset, $this->per_step); |
|
66 | 66 | |
67 | - if ( $step_items ) { |
|
67 | + if ($step_items) { |
|
68 | 68 | |
69 | 69 | $step_ids = array( |
70 | 70 | 'customers' => array(), |
@@ -72,9 +72,9 @@ discard block |
||
72 | 72 | 'other' => array(), |
73 | 73 | ); |
74 | 74 | |
75 | - foreach ( $step_items as $item ) { |
|
75 | + foreach ($step_items as $item) { |
|
76 | 76 | |
77 | - switch ( $item['type'] ) { |
|
77 | + switch ($item['type']) { |
|
78 | 78 | case 'customer': |
79 | 79 | $step_ids['customers'][] = $item['id']; |
80 | 80 | break; |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | $step_ids['give_forms'][] = $item['id']; |
83 | 83 | break; |
84 | 84 | default: |
85 | - $item_type = apply_filters( 'give_reset_item_type', 'other', $item ); |
|
86 | - $step_ids[ $item_type ][] = $item['id']; |
|
85 | + $item_type = apply_filters('give_reset_item_type', 'other', $item); |
|
86 | + $step_ids[$item_type][] = $item['id']; |
|
87 | 87 | break; |
88 | 88 | } |
89 | 89 | |
@@ -91,17 +91,17 @@ discard block |
||
91 | 91 | |
92 | 92 | $sql = array(); |
93 | 93 | |
94 | - foreach ( $step_ids as $type => $ids ) { |
|
94 | + foreach ($step_ids as $type => $ids) { |
|
95 | 95 | |
96 | - if ( empty( $ids ) ) { |
|
96 | + if (empty($ids)) { |
|
97 | 97 | continue; |
98 | 98 | } |
99 | 99 | |
100 | - $ids = implode( ',', $ids ); |
|
100 | + $ids = implode(',', $ids); |
|
101 | 101 | |
102 | - switch ( $type ) { |
|
102 | + switch ($type) { |
|
103 | 103 | case 'customers': |
104 | - $table_name = $wpdb->prefix . 'give_customers'; |
|
104 | + $table_name = $wpdb->prefix.'give_customers'; |
|
105 | 105 | $sql[] = "DELETE FROM $table_name WHERE id IN ($ids)"; |
106 | 106 | break; |
107 | 107 | case 'forms': |
@@ -116,18 +116,18 @@ discard block |
||
116 | 116 | break; |
117 | 117 | } |
118 | 118 | |
119 | - if ( ! in_array( $type, array( 'customers', 'forms', 'other' ) ) ) { |
|
119 | + if ( ! in_array($type, array('customers', 'forms', 'other'))) { |
|
120 | 120 | // Allows other types of custom post types to filter on their own post_type |
121 | 121 | // and add items to the query list, for the IDs found in their post type. |
122 | - $sql = apply_filters( "give_reset_add_queries_{$type}", $sql, $ids ); |
|
122 | + $sql = apply_filters("give_reset_add_queries_{$type}", $sql, $ids); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | |
126 | 126 | } |
127 | 127 | |
128 | - if ( ! empty( $sql ) ) { |
|
129 | - foreach ( $sql as $query ) { |
|
130 | - $wpdb->query( $query ); |
|
128 | + if ( ! empty($sql)) { |
|
129 | + foreach ($sql as $query) { |
|
130 | + $wpdb->query($query); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
@@ -147,16 +147,16 @@ discard block |
||
147 | 147 | */ |
148 | 148 | public function get_percentage_complete() { |
149 | 149 | |
150 | - $items = $this->get_stored_data( 'give_temp_reset_ids', false ); |
|
151 | - $total = count( $items ); |
|
150 | + $items = $this->get_stored_data('give_temp_reset_ids', false); |
|
151 | + $total = count($items); |
|
152 | 152 | |
153 | 153 | $percentage = 100; |
154 | 154 | |
155 | - if ( $total > 0 ) { |
|
156 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
155 | + if ($total > 0) { |
|
156 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
157 | 157 | } |
158 | 158 | |
159 | - if ( $percentage > 100 ) { |
|
159 | + if ($percentage > 100) { |
|
160 | 160 | $percentage = 100; |
161 | 161 | } |
162 | 162 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * |
171 | 171 | * @param array $request The Form Data passed into the batch processing |
172 | 172 | */ |
173 | - public function set_properties( $request ) { |
|
173 | + public function set_properties($request) { |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -181,30 +181,30 @@ discard block |
||
181 | 181 | */ |
182 | 182 | public function process_step() { |
183 | 183 | |
184 | - if ( ! $this->can_export() ) { |
|
185 | - wp_die( esc_html__( 'You do not have permission to reset data.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
184 | + if ( ! $this->can_export()) { |
|
185 | + wp_die(esc_html__('You do not have permission to reset data.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | $had_data = $this->get_data(); |
189 | 189 | |
190 | - if ( $had_data ) { |
|
190 | + if ($had_data) { |
|
191 | 191 | $this->done = false; |
192 | 192 | |
193 | 193 | return true; |
194 | 194 | } else { |
195 | - update_option( 'give_earnings_total', 0 ); |
|
196 | - delete_transient( 'give_earnings_total' ); |
|
197 | - delete_transient( 'give_estimated_monthly_stats' . true ); |
|
198 | - delete_transient( 'give_estimated_monthly_stats' . false ); |
|
199 | - $this->delete_data( 'give_temp_reset_ids' ); |
|
195 | + update_option('give_earnings_total', 0); |
|
196 | + delete_transient('give_earnings_total'); |
|
197 | + delete_transient('give_estimated_monthly_stats'.true); |
|
198 | + delete_transient('give_estimated_monthly_stats'.false); |
|
199 | + $this->delete_data('give_temp_reset_ids'); |
|
200 | 200 | |
201 | 201 | // Reset the sequential order numbers |
202 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
203 | - delete_option( 'give_last_payment_number' ); |
|
202 | + if (give_get_option('enable_sequential')) { |
|
203 | + delete_option('give_last_payment_number'); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | $this->done = true; |
207 | - $this->message = esc_html__( 'Donation forms, income, donations counts, and logs successfully reset.', 'give' ); |
|
207 | + $this->message = esc_html__('Donation forms, income, donations counts, and logs successfully reset.', 'give'); |
|
208 | 208 | |
209 | 209 | return false; |
210 | 210 | } |
@@ -214,10 +214,10 @@ discard block |
||
214 | 214 | * Headers |
215 | 215 | */ |
216 | 216 | public function headers() { |
217 | - ignore_user_abort( true ); |
|
217 | + ignore_user_abort(true); |
|
218 | 218 | |
219 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
220 | - set_time_limit( 0 ); |
|
219 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
220 | + set_time_limit(0); |
|
221 | 221 | } |
222 | 222 | } |
223 | 223 | |
@@ -241,35 +241,35 @@ discard block |
||
241 | 241 | */ |
242 | 242 | public function pre_fetch() { |
243 | 243 | |
244 | - if ( $this->step == 1 ) { |
|
245 | - $this->delete_data( 'give_temp_reset_ids' ); |
|
244 | + if ($this->step == 1) { |
|
245 | + $this->delete_data('give_temp_reset_ids'); |
|
246 | 246 | } |
247 | 247 | |
248 | - $items = get_option( 'give_temp_reset_ids', false ); |
|
248 | + $items = get_option('give_temp_reset_ids', false); |
|
249 | 249 | |
250 | - if ( false === $items ) { |
|
250 | + if (false === $items) { |
|
251 | 251 | $items = array(); |
252 | 252 | |
253 | - $give_types_for_reset = array( 'give_forms', 'give_log', 'give_payment' ); |
|
254 | - $give_types_for_reset = apply_filters( 'give_reset_store_post_types', $give_types_for_reset ); |
|
253 | + $give_types_for_reset = array('give_forms', 'give_log', 'give_payment'); |
|
254 | + $give_types_for_reset = apply_filters('give_reset_store_post_types', $give_types_for_reset); |
|
255 | 255 | |
256 | - $args = apply_filters( 'give_tools_reset_stats_total_args', array( |
|
256 | + $args = apply_filters('give_tools_reset_stats_total_args', array( |
|
257 | 257 | 'post_type' => $give_types_for_reset, |
258 | 258 | 'post_status' => 'any', |
259 | - 'posts_per_page' => - 1, |
|
260 | - ) ); |
|
259 | + 'posts_per_page' => -1, |
|
260 | + )); |
|
261 | 261 | |
262 | - $posts = get_posts( $args ); |
|
263 | - foreach ( $posts as $post ) { |
|
262 | + $posts = get_posts($args); |
|
263 | + foreach ($posts as $post) { |
|
264 | 264 | $items[] = array( |
265 | 265 | 'id' => (int) $post->ID, |
266 | 266 | 'type' => $post->post_type, |
267 | 267 | ); |
268 | 268 | } |
269 | 269 | |
270 | - $customer_args = array( 'number' => - 1 ); |
|
271 | - $customers = Give()->customers->get_customers( $customer_args ); |
|
272 | - foreach ( $customers as $customer ) { |
|
270 | + $customer_args = array('number' => -1); |
|
271 | + $customers = Give()->customers->get_customers($customer_args); |
|
272 | + foreach ($customers as $customer) { |
|
273 | 273 | $items[] = array( |
274 | 274 | 'id' => (int) $customer->id, |
275 | 275 | 'type' => 'customer', |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | |
279 | 279 | // Allow filtering of items to remove with an unassociative array for each item |
280 | 280 | // The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method |
281 | - $items = apply_filters( 'give_reset_items', $items ); |
|
281 | + $items = apply_filters('give_reset_items', $items); |
|
282 | 282 | |
283 | - $this->store_data( 'give_temp_reset_ids', $items ); |
|
283 | + $this->store_data('give_temp_reset_ids', $items); |
|
284 | 284 | } |
285 | 285 | |
286 | 286 | } |
@@ -294,11 +294,11 @@ discard block |
||
294 | 294 | * |
295 | 295 | * @return mixed Returns the data from the database. |
296 | 296 | */ |
297 | - private function get_stored_data( $key ) { |
|
297 | + private function get_stored_data($key) { |
|
298 | 298 | global $wpdb; |
299 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
299 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
300 | 300 | |
301 | - return empty( $value ) ? false : maybe_unserialize( $value ); |
|
301 | + return empty($value) ? false : maybe_unserialize($value); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | /** |
@@ -311,10 +311,10 @@ discard block |
||
311 | 311 | * |
312 | 312 | * @return void |
313 | 313 | */ |
314 | - private function store_data( $key, $value ) { |
|
314 | + private function store_data($key, $value) { |
|
315 | 315 | global $wpdb; |
316 | 316 | |
317 | - $value = maybe_serialize( $value ); |
|
317 | + $value = maybe_serialize($value); |
|
318 | 318 | |
319 | 319 | $data = array( |
320 | 320 | 'option_name' => $key, |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | '%s', |
329 | 329 | ); |
330 | 330 | |
331 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
331 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
332 | 332 | } |
333 | 333 | |
334 | 334 | /** |
@@ -340,9 +340,9 @@ discard block |
||
340 | 340 | * |
341 | 341 | * @return void |
342 | 342 | */ |
343 | - private function delete_data( $key ) { |
|
343 | + private function delete_data($key) { |
|
344 | 344 | global $wpdb; |
345 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
345 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | } |
@@ -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; |
@@ -645,20 +645,20 @@ |
||
645 | 645 | } |
646 | 646 | |
647 | 647 | /** |
648 | - * Output the documentation link. |
|
649 | - * |
|
650 | - * @since 1.8 |
|
651 | - * @param array $field { |
|
652 | - * Optional. Array of customizable link attributes. |
|
653 | - * |
|
654 | - * @type string $name Name of input field. Default ''. |
|
655 | - * @type string $type Type of input field. Default 'text'. |
|
656 | - * @type string $url Value to be passed as a link. Default 'https://givewp.com/documentation'. |
|
657 | - * @type string $title Value to be passed as text of link. Default 'Documentation'. |
|
658 | - * @type array $attributes List of attributes of input field. Default array(). |
|
659 | - * for example: 'attributes' => array( 'placeholder' => '*****', 'class' => '****' ) |
|
660 | - * } |
|
661 | - * @return void |
|
648 | + * Output the documentation link. |
|
649 | + * |
|
650 | + * @since 1.8 |
|
651 | + * @param array $field { |
|
652 | + * Optional. Array of customizable link attributes. |
|
653 | + * |
|
654 | + * @type string $name Name of input field. Default ''. |
|
655 | + * @type string $type Type of input field. Default 'text'. |
|
656 | + * @type string $url Value to be passed as a link. Default 'https://givewp.com/documentation'. |
|
657 | + * @type string $title Value to be passed as text of link. Default 'Documentation'. |
|
658 | + * @type array $attributes List of attributes of input field. Default array(). |
|
659 | + * for example: 'attributes' => array( 'placeholder' => '*****', 'class' => '****' ) |
|
660 | + * } |
|
661 | + * @return void |
|
662 | 662 | */ |
663 | 663 | |
664 | 664 | function give_docs_link($field) { |
@@ -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; |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | default: |
78 | 78 | |
79 | 79 | if ( |
80 | - array_key_exists( 'callback', $field ) |
|
81 | - && ! empty( $field['callback'] ) |
|
80 | + array_key_exists('callback', $field) |
|
81 | + && ! empty($field['callback']) |
|
82 | 82 | ) { |
83 | 83 | $func_name = $field['callback']; |
84 | 84 | } else { |
@@ -91,15 +91,15 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @since 1.8 |
93 | 93 | */ |
94 | - $func_name = apply_filters( 'give_get_field_callback', $func_name, $field ); |
|
94 | + $func_name = apply_filters('give_get_field_callback', $func_name, $field); |
|
95 | 95 | |
96 | 96 | // Exit if not any function exist. |
97 | 97 | // Check if render callback exist or not. |
98 | - if ( empty( $func_name ) ) { |
|
98 | + if (empty($func_name)) { |
|
99 | 99 | return false; |
100 | - } elseif ( is_string( $func_name ) && ! function_exists( "$func_name" ) ) { |
|
100 | + } elseif (is_string($func_name) && ! function_exists("$func_name")) { |
|
101 | 101 | return false; |
102 | - } elseif ( is_array( $func_name ) && ! method_exists( $func_name[0], "$func_name[1]" ) ) { |
|
102 | + } elseif (is_array($func_name) && ! method_exists($func_name[0], "$func_name[1]")) { |
|
103 | 103 | return false; |
104 | 104 | } |
105 | 105 | |
@@ -115,36 +115,36 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @return bool |
117 | 117 | */ |
118 | -function give_render_field( $field ) { |
|
118 | +function give_render_field($field) { |
|
119 | 119 | |
120 | 120 | // Check if render callback exist or not. |
121 | - if ( ! ( $func_name = give_get_field_callback( $field ) ) ) { |
|
121 | + if ( ! ($func_name = give_get_field_callback($field))) { |
|
122 | 122 | return false; |
123 | 123 | } |
124 | 124 | |
125 | 125 | // CMB2 compatibility: Push all classes to attributes's class key |
126 | - if ( empty( $field['class'] ) ) { |
|
126 | + if (empty($field['class'])) { |
|
127 | 127 | $field['class'] = ''; |
128 | 128 | } |
129 | 129 | |
130 | - if ( empty( $field['attributes']['class'] ) ) { |
|
130 | + if (empty($field['attributes']['class'])) { |
|
131 | 131 | $field['attributes']['class'] = ''; |
132 | 132 | } |
133 | 133 | |
134 | - $field['attributes']['class'] = trim( "give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}" ); |
|
135 | - unset( $field['class'] ); |
|
134 | + $field['attributes']['class'] = trim("give-field {$field['attributes']['class']} give-{$field['type']} {$field['class']}"); |
|
135 | + unset($field['class']); |
|
136 | 136 | |
137 | 137 | |
138 | 138 | // CMB2 compatibility: Set wrapper class if any. |
139 | - if ( ! empty( $field['row_classes'] ) ) { |
|
139 | + if ( ! empty($field['row_classes'])) { |
|
140 | 140 | $field['wrapper_class'] = $field['row_classes']; |
141 | - unset( $field['row_classes'] ); |
|
141 | + unset($field['row_classes']); |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | // Set field params on basis of cmb2 field name. |
145 | - switch ( $field['type'] ) { |
|
145 | + switch ($field['type']) { |
|
146 | 146 | case 'radio_inline': |
147 | - if ( empty( $field['wrapper_class'] ) ) { |
|
147 | + if (empty($field['wrapper_class'])) { |
|
148 | 148 | $field['wrapper_class'] = ''; |
149 | 149 | } |
150 | 150 | $field['wrapper_class'] .= ' give-inline-radio-fields'; |
@@ -157,15 +157,15 @@ discard block |
||
157 | 157 | case 'text-small' : |
158 | 158 | case 'text_small' : |
159 | 159 | // CMB2 compatibility: Set field type to text. |
160 | - $field['type'] = isset( $field['attributes']['type'] ) ? $field['attributes']['type'] : 'text'; |
|
160 | + $field['type'] = isset($field['attributes']['type']) ? $field['attributes']['type'] : 'text'; |
|
161 | 161 | |
162 | 162 | // CMB2 compatibility: Set data type to price. |
163 | 163 | if ( |
164 | - empty( $field['data_type'] ) |
|
165 | - && ! empty( $field['attributes']['class'] ) |
|
164 | + empty($field['data_type']) |
|
165 | + && ! empty($field['attributes']['class']) |
|
166 | 166 | && ( |
167 | - false !== strpos( $field['attributes']['class'], 'money' ) |
|
168 | - || false !== strpos( $field['attributes']['class'], 'amount' ) |
|
167 | + false !== strpos($field['attributes']['class'], 'money') |
|
168 | + || false !== strpos($field['attributes']['class'], 'amount') |
|
169 | 169 | ) |
170 | 170 | ) { |
171 | 171 | $field['data_type'] = 'decimal'; |
@@ -184,22 +184,22 @@ discard block |
||
184 | 184 | case 'give_default_radio_inline': |
185 | 185 | $field['type'] = 'radio'; |
186 | 186 | $field['options'] = array( |
187 | - 'default' => __( 'Default' ), |
|
187 | + 'default' => __('Default'), |
|
188 | 188 | ); |
189 | 189 | break; |
190 | 190 | } |
191 | 191 | |
192 | 192 | // CMB2 compatibility: Add support to define field description by desc & description param. |
193 | 193 | // We encourage you to use description param. |
194 | - $field['description'] = ( ! empty( $field['description'] ) |
|
194 | + $field['description'] = ( ! empty($field['description']) |
|
195 | 195 | ? $field['description'] |
196 | - : ( ! empty( $field['desc'] ) ? $field['desc'] : '' ) ); |
|
196 | + : ( ! empty($field['desc']) ? $field['desc'] : '')); |
|
197 | 197 | |
198 | 198 | // Call render function. |
199 | - if ( is_array( $func_name ) ) { |
|
200 | - $func_name[0]->$func_name[1]( $field ); |
|
199 | + if (is_array($func_name)) { |
|
200 | + $func_name[0]->$func_name[1]($field); |
|
201 | 201 | } else { |
202 | - $func_name( $field ); |
|
202 | + $func_name($field); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | 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' ? '<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' ) == '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' ? '<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') == '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 : |
@@ -259,17 +259,17 @@ discard block |
||
259 | 259 | // Custom attribute handling |
260 | 260 | $custom_attributes = array(); |
261 | 261 | |
262 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
262 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
263 | 263 | |
264 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
265 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
264 | + foreach ($field['attributes'] as $attribute => $value) { |
|
265 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
266 | 266 | } |
267 | 267 | } |
268 | 268 | |
269 | - echo '<p class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><label for="' . give_get_field_name( $field ) . '">' . wp_kses_post( $field['name'] ) . '</label>' . $field['before_field'] . '<input type="' . esc_attr( $field['type'] ) . '" style="' . esc_attr( $field['style'] ) . '" name="' . give_get_field_name( $field ) . '" id="' . esc_attr( $field['id'] ) . '" value="' . esc_attr( $field['value'] ) . '" ' . implode( ' ', $custom_attributes ) . ' />' . $field['after_field']; |
|
269 | + echo '<p class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><label for="'.give_get_field_name($field).'">'.wp_kses_post($field['name']).'</label>'.$field['before_field'].'<input type="'.esc_attr($field['type']).'" style="'.esc_attr($field['style']).'" name="'.give_get_field_name($field).'" id="'.esc_attr($field['id']).'" value="'.esc_attr($field['value']).'" '.implode(' ', $custom_attributes).' />'.$field['after_field']; |
|
270 | 270 | |
271 | - if ( ! empty( $field['description'] ) ) { |
|
272 | - echo '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
271 | + if ( ! empty($field['description'])) { |
|
272 | + echo '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
273 | 273 | } |
274 | 274 | echo '</p>'; |
275 | 275 | } |
@@ -290,23 +290,23 @@ discard block |
||
290 | 290 | * } |
291 | 291 | * @return void |
292 | 292 | */ |
293 | -function give_hidden_input( $field ) { |
|
293 | +function give_hidden_input($field) { |
|
294 | 294 | global $thepostid, $post; |
295 | 295 | |
296 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
297 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
296 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
297 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
298 | 298 | |
299 | 299 | // Custom attribute handling |
300 | 300 | $custom_attributes = array(); |
301 | 301 | |
302 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
302 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
303 | 303 | |
304 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
305 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
304 | + foreach ($field['attributes'] as $attribute => $value) { |
|
305 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
306 | 306 | } |
307 | 307 | } |
308 | 308 | |
309 | - echo '<input type="hidden" name="' . give_get_field_name( $field ) . '" id="' . esc_attr( $field['id'] ) . '" value="' . esc_attr( $field['value'] ) . '" ' . implode( ' ', $custom_attributes ) . '/> '; |
|
309 | + echo '<input type="hidden" name="'.give_get_field_name($field).'" id="'.esc_attr($field['id']).'" value="'.esc_attr($field['value']).'" '.implode(' ', $custom_attributes).'/> '; |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
@@ -328,28 +328,28 @@ discard block |
||
328 | 328 | * } |
329 | 329 | * @return void |
330 | 330 | */ |
331 | -function give_textarea_input( $field ) { |
|
331 | +function give_textarea_input($field) { |
|
332 | 332 | global $thepostid, $post; |
333 | 333 | |
334 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
335 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
336 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
337 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
334 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
335 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
336 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
337 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
338 | 338 | |
339 | 339 | // Custom attribute handling |
340 | 340 | $custom_attributes = array(); |
341 | 341 | |
342 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
342 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
343 | 343 | |
344 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
345 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
344 | + foreach ($field['attributes'] as $attribute => $value) { |
|
345 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
346 | 346 | } |
347 | 347 | } |
348 | 348 | |
349 | - echo '<p class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><label for="' . give_get_field_name( $field ) . '">' . wp_kses_post( $field['name'] ) . '</label><textarea style="' . esc_attr( $field['style'] ) . '" name="' . give_get_field_name( $field ) . '" id="' . esc_attr( $field['id'] ) . '" rows="10" cols="20" ' . implode( ' ', $custom_attributes ) . '>' . esc_textarea( $field['value'] ) . '</textarea> '; |
|
349 | + echo '<p class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><label for="'.give_get_field_name($field).'">'.wp_kses_post($field['name']).'</label><textarea style="'.esc_attr($field['style']).'" name="'.give_get_field_name($field).'" id="'.esc_attr($field['id']).'" rows="10" cols="20" '.implode(' ', $custom_attributes).'>'.esc_textarea($field['value']).'</textarea> '; |
|
350 | 350 | |
351 | - if ( ! empty( $field['description'] ) ) { |
|
352 | - echo '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
351 | + if ( ! empty($field['description'])) { |
|
352 | + echo '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
353 | 353 | } |
354 | 354 | echo '</p>'; |
355 | 355 | } |
@@ -372,24 +372,24 @@ discard block |
||
372 | 372 | * } |
373 | 373 | * @return void |
374 | 374 | */ |
375 | -function give_wysiwyg( $field ) { |
|
375 | +function give_wysiwyg($field) { |
|
376 | 376 | global $thepostid, $post; |
377 | 377 | |
378 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
379 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
380 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
381 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
382 | - $field['unique_field_id'] = give_get_field_name( $field ); |
|
378 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
379 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
380 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
381 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
382 | + $field['unique_field_id'] = give_get_field_name($field); |
|
383 | 383 | $editor_attributes = array( |
384 | - 'textarea_name' => isset( $field['repeatable_field_id'] ) ? $field['repeatable_field_id'] : $field['id'], |
|
384 | + 'textarea_name' => isset($field['repeatable_field_id']) ? $field['repeatable_field_id'] : $field['id'], |
|
385 | 385 | 'textarea_rows' => '10', |
386 | - 'editor_css' => esc_attr( $field['style'] ), |
|
386 | + 'editor_css' => esc_attr($field['style']), |
|
387 | 387 | 'editor_class' => $field['attributes']['class'] |
388 | 388 | ); |
389 | - $data_wp_editor = ' data-wp-editor="'. base64_encode( json_encode( array( $field['value'], $field['unique_field_id'],$editor_attributes ) ) ) .'"'; |
|
390 | - $data_wp_editor = isset( $field['repeatable_field_id'] ) ? $data_wp_editor : ''; |
|
389 | + $data_wp_editor = ' data-wp-editor="'.base64_encode(json_encode(array($field['value'], $field['unique_field_id'], $editor_attributes))).'"'; |
|
390 | + $data_wp_editor = isset($field['repeatable_field_id']) ? $data_wp_editor : ''; |
|
391 | 391 | |
392 | - 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>'; |
|
392 | + 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>'; |
|
393 | 393 | |
394 | 394 | wp_editor( |
395 | 395 | $field['value'], |
@@ -397,8 +397,8 @@ discard block |
||
397 | 397 | $editor_attributes |
398 | 398 | ); |
399 | 399 | |
400 | - if ( ! empty( $field['description'] ) ) { |
|
401 | - echo '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
400 | + if ( ! empty($field['description'])) { |
|
401 | + echo '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
402 | 402 | } |
403 | 403 | echo '</div>'; |
404 | 404 | } |
@@ -422,30 +422,30 @@ discard block |
||
422 | 422 | * } |
423 | 423 | * @return void |
424 | 424 | */ |
425 | -function give_checkbox( $field ) { |
|
425 | +function give_checkbox($field) { |
|
426 | 426 | global $thepostid, $post; |
427 | 427 | |
428 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
429 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
430 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
431 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
432 | - $field['cbvalue'] = isset( $field['cbvalue'] ) ? $field['cbvalue'] : 'on'; |
|
433 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
428 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
429 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
430 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
431 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
432 | + $field['cbvalue'] = isset($field['cbvalue']) ? $field['cbvalue'] : 'on'; |
|
433 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
434 | 434 | |
435 | 435 | // Custom attribute handling. |
436 | 436 | $custom_attributes = array(); |
437 | 437 | |
438 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
438 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
439 | 439 | |
440 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
441 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
440 | + foreach ($field['attributes'] as $attribute => $value) { |
|
441 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
442 | 442 | } |
443 | 443 | } |
444 | 444 | |
445 | - echo '<p class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><label for="' . give_get_field_name( $field ) . '">' . wp_kses_post( $field['name'] ) . '</label><input type="checkbox" style="' . esc_attr( $field['style'] ) . '" name="' . give_get_field_name( $field ) . '" id="' . esc_attr( $field['id'] ) . '" value="' . esc_attr( $field['cbvalue'] ) . '" ' . checked( $field['value'], $field['cbvalue'], false ) . ' ' . implode( ' ', $custom_attributes ) . '/> '; |
|
445 | + echo '<p class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><label for="'.give_get_field_name($field).'">'.wp_kses_post($field['name']).'</label><input type="checkbox" style="'.esc_attr($field['style']).'" name="'.give_get_field_name($field).'" id="'.esc_attr($field['id']).'" value="'.esc_attr($field['cbvalue']).'" '.checked($field['value'], $field['cbvalue'], false).' '.implode(' ', $custom_attributes).'/> '; |
|
446 | 446 | |
447 | - if ( ! empty( $field['description'] ) ) { |
|
448 | - echo '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
447 | + if ( ! empty($field['description'])) { |
|
448 | + echo '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
449 | 449 | } |
450 | 450 | |
451 | 451 | echo '</p>'; |
@@ -471,35 +471,35 @@ discard block |
||
471 | 471 | * } |
472 | 472 | * @return void |
473 | 473 | */ |
474 | -function give_select( $field ) { |
|
474 | +function give_select($field) { |
|
475 | 475 | global $thepostid, $post; |
476 | 476 | |
477 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
478 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
479 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
480 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
481 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
477 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
478 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
479 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
480 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
481 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
482 | 482 | |
483 | 483 | // Custom attribute handling |
484 | 484 | $custom_attributes = array(); |
485 | 485 | |
486 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
486 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
487 | 487 | |
488 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
489 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
488 | + foreach ($field['attributes'] as $attribute => $value) { |
|
489 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
490 | 490 | } |
491 | 491 | } |
492 | 492 | |
493 | - echo '<p class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><label for="' . give_get_field_name( $field ) . '">' . wp_kses_post( $field['name'] ) . '</label><select id="' . esc_attr( $field['id'] ) . '" name="' . give_get_field_name( $field ) . '" style="' . esc_attr( $field['style'] ) . '" ' . implode( ' ', $custom_attributes ) . '>'; |
|
493 | + echo '<p class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><label for="'.give_get_field_name($field).'">'.wp_kses_post($field['name']).'</label><select id="'.esc_attr($field['id']).'" name="'.give_get_field_name($field).'" style="'.esc_attr($field['style']).'" '.implode(' ', $custom_attributes).'>'; |
|
494 | 494 | |
495 | - foreach ( $field['options'] as $key => $value ) { |
|
496 | - echo '<option value="' . esc_attr( $key ) . '" ' . selected( esc_attr( $field['value'] ), esc_attr( $key ), false ) . '>' . esc_html( $value ) . '</option>'; |
|
495 | + foreach ($field['options'] as $key => $value) { |
|
496 | + echo '<option value="'.esc_attr($key).'" '.selected(esc_attr($field['value']), esc_attr($key), false).'>'.esc_html($value).'</option>'; |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | echo '</select> '; |
500 | 500 | |
501 | - if ( ! empty( $field['description'] ) ) { |
|
502 | - echo '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
501 | + if ( ! empty($field['description'])) { |
|
502 | + echo '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
503 | 503 | } |
504 | 504 | echo '</p>'; |
505 | 505 | } |
@@ -524,43 +524,43 @@ discard block |
||
524 | 524 | * } |
525 | 525 | * @return void |
526 | 526 | */ |
527 | -function give_radio( $field ) { |
|
527 | +function give_radio($field) { |
|
528 | 528 | global $thepostid, $post; |
529 | 529 | |
530 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
531 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
532 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
533 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
534 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
530 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
531 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
532 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
533 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
534 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
535 | 535 | |
536 | 536 | // Custom attribute handling |
537 | 537 | $custom_attributes = array(); |
538 | 538 | |
539 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
539 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
540 | 540 | |
541 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
542 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
541 | + foreach ($field['attributes'] as $attribute => $value) { |
|
542 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
543 | 543 | } |
544 | 544 | } |
545 | 545 | |
546 | - 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">'; |
|
546 | + 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">'; |
|
547 | 547 | |
548 | - foreach ( $field['options'] as $key => $value ) { |
|
548 | + foreach ($field['options'] as $key => $value) { |
|
549 | 549 | |
550 | 550 | echo '<li><label><input |
551 | - name="' . give_get_field_name( $field ) . '" |
|
552 | - value="' . esc_attr( $key ) . '" |
|
551 | + name="' . give_get_field_name($field).'" |
|
552 | + value="' . esc_attr($key).'" |
|
553 | 553 | type="radio" |
554 | - style="' . esc_attr( $field['style'] ) . '" |
|
555 | - ' . checked( esc_attr( $field['value'] ), esc_attr( $key ), false ) . ' ' |
|
556 | - . implode( ' ', $custom_attributes ) . ' |
|
557 | - /> ' . esc_html( $value ) . '</label> |
|
554 | + style="' . esc_attr($field['style']).'" |
|
555 | + ' . checked(esc_attr($field['value']), esc_attr($key), false).' ' |
|
556 | + . implode(' ', $custom_attributes).' |
|
557 | + /> ' . esc_html($value).'</label> |
|
558 | 558 | </li>'; |
559 | 559 | } |
560 | 560 | echo '</ul>'; |
561 | 561 | |
562 | - if ( ! empty( $field['description'] ) ) { |
|
563 | - echo '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
562 | + if ( ! empty($field['description'])) { |
|
563 | + echo '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
564 | 564 | } |
565 | 565 | |
566 | 566 | echo '</fieldset>'; |
@@ -584,30 +584,30 @@ discard block |
||
584 | 584 | * } |
585 | 585 | * @return void |
586 | 586 | */ |
587 | -function give_colorpicker( $field ) { |
|
587 | +function give_colorpicker($field) { |
|
588 | 588 | global $thepostid, $post; |
589 | 589 | |
590 | - $thepostid = empty( $thepostid ) ? $post->ID : $thepostid; |
|
591 | - $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; |
|
592 | - $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; |
|
593 | - $field['value'] = give_get_field_value( $field, $thepostid ); |
|
594 | - $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; |
|
590 | + $thepostid = empty($thepostid) ? $post->ID : $thepostid; |
|
591 | + $field['style'] = isset($field['style']) ? $field['style'] : ''; |
|
592 | + $field['wrapper_class'] = isset($field['wrapper_class']) ? $field['wrapper_class'] : ''; |
|
593 | + $field['value'] = give_get_field_value($field, $thepostid); |
|
594 | + $field['name'] = isset($field['name']) ? $field['name'] : $field['id']; |
|
595 | 595 | $field['type'] = 'text'; |
596 | 596 | |
597 | 597 | // Custom attribute handling |
598 | 598 | $custom_attributes = array(); |
599 | 599 | |
600 | - if ( ! empty( $field['attributes'] ) && is_array( $field['attributes'] ) ) { |
|
600 | + if ( ! empty($field['attributes']) && is_array($field['attributes'])) { |
|
601 | 601 | |
602 | - foreach ( $field['attributes'] as $attribute => $value ) { |
|
603 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"'; |
|
602 | + foreach ($field['attributes'] as $attribute => $value) { |
|
603 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($value).'"'; |
|
604 | 604 | } |
605 | 605 | } |
606 | 606 | |
607 | - echo '<p class="give-field-wrap ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '"><label for="' . give_get_field_name( $field ) . '">' . wp_kses_post( $field['name'] ) . '</label><input type="' . esc_attr( $field['type'] ) . '" style="' . esc_attr( $field['style'] ) . '" name="' . give_get_field_name( $field ) . '" id="' . esc_attr( $field['id'] ) . '" value="' . esc_attr( $field['value'] ) . '" ' . implode( ' ', $custom_attributes ) . ' /> '; |
|
607 | + echo '<p class="give-field-wrap '.esc_attr($field['id']).'_field '.esc_attr($field['wrapper_class']).'"><label for="'.give_get_field_name($field).'">'.wp_kses_post($field['name']).'</label><input type="'.esc_attr($field['type']).'" style="'.esc_attr($field['style']).'" name="'.give_get_field_name($field).'" id="'.esc_attr($field['id']).'" value="'.esc_attr($field['value']).'" '.implode(' ', $custom_attributes).' /> '; |
|
608 | 608 | |
609 | - if ( ! empty( $field['description'] ) ) { |
|
610 | - echo '<span class="give-field-description">' . wp_kses_post( $field['description'] ) . '</span>'; |
|
609 | + if ( ! empty($field['description'])) { |
|
610 | + echo '<span class="give-field-description">'.wp_kses_post($field['description']).'</span>'; |
|
611 | 611 | } |
612 | 612 | echo '</p>'; |
613 | 613 | } |
@@ -621,27 +621,27 @@ discard block |
||
621 | 621 | * |
622 | 622 | * @return void |
623 | 623 | */ |
624 | -function give_default_gateway( $field ) { |
|
624 | +function give_default_gateway($field) { |
|
625 | 625 | global $thepostid, $post; |
626 | 626 | |
627 | 627 | // get all active payment gateways. |
628 | - $gateways = give_get_enabled_payment_gateways( $thepostid ); |
|
628 | + $gateways = give_get_enabled_payment_gateways($thepostid); |
|
629 | 629 | $field['options'] = array(); |
630 | 630 | |
631 | 631 | // Set field option value. |
632 | - if( ! empty( $gateways ) ) { |
|
633 | - foreach ( $gateways as $key => $option ) { |
|
634 | - $field['options'][ $key ] = $option['admin_label']; |
|
632 | + if ( ! empty($gateways)) { |
|
633 | + foreach ($gateways as $key => $option) { |
|
634 | + $field['options'][$key] = $option['admin_label']; |
|
635 | 635 | } |
636 | 636 | } |
637 | 637 | |
638 | 638 | //Add a field to the Give Form admin single post view of this field |
639 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
640 | - $field['options'] = array_merge( array( 'global' => esc_html__( 'Global Default', 'give' ) ), $field['options'] ); |
|
639 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
640 | + $field['options'] = array_merge(array('global' => esc_html__('Global Default', 'give')), $field['options']); |
|
641 | 641 | } |
642 | 642 | |
643 | 643 | // Render select field. |
644 | - give_select( $field ); |
|
644 | + give_select($field); |
|
645 | 645 | } |
646 | 646 | |
647 | 647 | /** |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | $field['url'] = isset($field['url']) ? $field['url'] : 'https://givewp.com/documentation'; |
666 | 666 | $field['title'] = isset($field['title']) ? $field['title'] : 'Documentation'; |
667 | 667 | |
668 | - echo '<p class="give-docs-link"><a href="' . esc_url($field['url']) |
|
668 | + echo '<p class="give-docs-link"><a href="'.esc_url($field['url']) |
|
669 | 669 | . '" target="_blank">' |
670 | 670 | . sprintf(esc_html__('Need Help? See docs on "%s"'), $field['title']) |
671 | 671 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
@@ -683,13 +683,13 @@ discard block |
||
683 | 683 | * |
684 | 684 | * @return mixed |
685 | 685 | */ |
686 | -function give_get_field_value( $field, $postid ) { |
|
687 | - if ( isset( $field['attributes']['value'] ) ) { |
|
686 | +function give_get_field_value($field, $postid) { |
|
687 | + if (isset($field['attributes']['value'])) { |
|
688 | 688 | return $field['attributes']['value']; |
689 | 689 | } |
690 | 690 | |
691 | 691 | // Get value from db. |
692 | - $field_value = get_post_meta( $postid, $field['id'], true ); |
|
692 | + $field_value = get_post_meta($postid, $field['id'], true); |
|
693 | 693 | |
694 | 694 | /** |
695 | 695 | * Filter the field value before apply default value. |
@@ -698,11 +698,11 @@ discard block |
||
698 | 698 | * |
699 | 699 | * @param mixed $field_value Field value. |
700 | 700 | */ |
701 | - $field_value = apply_filters( "{$field['id']}_field_value", $field_value, $field, $postid ); |
|
701 | + $field_value = apply_filters("{$field['id']}_field_value", $field_value, $field, $postid); |
|
702 | 702 | |
703 | 703 | |
704 | 704 | // Set default value if no any data saved to db. |
705 | - if ( ! $field_value && isset( $field['default'] ) ) { |
|
705 | + if ( ! $field_value && isset($field['default'])) { |
|
706 | 706 | $field_value = $field['default']; |
707 | 707 | } |
708 | 708 | |
@@ -722,8 +722,8 @@ discard block |
||
722 | 722 | * |
723 | 723 | * @return string |
724 | 724 | */ |
725 | -function give_get_repeater_field_value( $field, $field_group, $fields ) { |
|
726 | - $field_value = ( isset( $field_group[ $field['id'] ] ) ? $field_group[ $field['id'] ] : '' ); |
|
725 | +function give_get_repeater_field_value($field, $field_group, $fields) { |
|
726 | + $field_value = (isset($field_group[$field['id']]) ? $field_group[$field['id']] : ''); |
|
727 | 727 | |
728 | 728 | /** |
729 | 729 | * Filter the specific repeater field value |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | * |
733 | 733 | * @param string $field_id |
734 | 734 | */ |
735 | - $field_value = apply_filters( "give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields ); |
|
735 | + $field_value = apply_filters("give_get_repeater_field_{$field['id']}_value", $field_value, $field, $field_group, $fields); |
|
736 | 736 | |
737 | 737 | /** |
738 | 738 | * Filter the repeater field value |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | * |
742 | 742 | * @param string $field_id |
743 | 743 | */ |
744 | - $field_value = apply_filters( 'give_get_repeater_field_value', $field_value, $field, $field_group, $fields ); |
|
744 | + $field_value = apply_filters('give_get_repeater_field_value', $field_value, $field, $field_group, $fields); |
|
745 | 745 | |
746 | 746 | return $field_value; |
747 | 747 | } |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | * |
760 | 760 | * @return string |
761 | 761 | */ |
762 | -function give_get_repeater_field_id( $field, $fields, $default = false ) { |
|
762 | +function give_get_repeater_field_id($field, $fields, $default = false) { |
|
763 | 763 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
764 | 764 | |
765 | 765 | // Get field id. |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | * |
773 | 773 | * @param string $field_id |
774 | 774 | */ |
775 | - $field_id = apply_filters( "give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default ); |
|
775 | + $field_id = apply_filters("give_get_repeater_field_{$field['id']}_id", $field_id, $field, $fields, $default); |
|
776 | 776 | |
777 | 777 | |
778 | 778 | /** |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | * |
783 | 783 | * @param string $field_id |
784 | 784 | */ |
785 | - $field_id = apply_filters( 'give_get_repeater_field_id', $field_id, $field, $fields, $default ); |
|
785 | + $field_id = apply_filters('give_get_repeater_field_id', $field_id, $field, $fields, $default); |
|
786 | 786 | |
787 | 787 | return $field_id; |
788 | 788 | } |
@@ -797,8 +797,8 @@ discard block |
||
797 | 797 | * |
798 | 798 | * @return string |
799 | 799 | */ |
800 | -function give_get_field_name( $field ) { |
|
801 | - $field_name = esc_attr( empty( $field['repeat'] ) ? $field['id'] : $field['repeatable_field_id'] ); |
|
800 | +function give_get_field_name($field) { |
|
801 | + $field_name = esc_attr(empty($field['repeat']) ? $field['id'] : $field['repeatable_field_id']); |
|
802 | 802 | |
803 | 803 | /** |
804 | 804 | * Filter the field name. |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | * |
808 | 808 | * @param string $field_name |
809 | 809 | */ |
810 | - $field_name = apply_filters( 'give_get_field_name', $field_name, $field ); |
|
810 | + $field_name = apply_filters('give_get_field_name', $field_name, $field); |
|
811 | 811 | |
812 | 812 | return $field_name; |
813 | 813 | } |
@@ -823,38 +823,38 @@ discard block |
||
823 | 823 | * |
824 | 824 | * @return void |
825 | 825 | */ |
826 | -function _give_metabox_form_data_repeater_fields( $fields ) { |
|
826 | +function _give_metabox_form_data_repeater_fields($fields) { |
|
827 | 827 | global $thepostid, $post; |
828 | 828 | |
829 | 829 | // Bailout. |
830 | - if ( ! isset( $fields['fields'] ) || empty( $fields['fields'] ) ) { |
|
830 | + if ( ! isset($fields['fields']) || empty($fields['fields'])) { |
|
831 | 831 | return; |
832 | 832 | } |
833 | 833 | |
834 | - $group_numbering = isset( $fields['options']['group_numbering'] ) ? (int) $fields['options']['group_numbering'] : 0; |
|
835 | - $close_tabs = isset( $fields['options']['close_tabs'] ) ? (int) $fields['options']['close_tabs'] : 0; |
|
834 | + $group_numbering = isset($fields['options']['group_numbering']) ? (int) $fields['options']['group_numbering'] : 0; |
|
835 | + $close_tabs = isset($fields['options']['close_tabs']) ? (int) $fields['options']['close_tabs'] : 0; |
|
836 | 836 | ?> |
837 | 837 | <div class="give-repeatable-field-section" id="<?php echo "{$fields['id']}_field"; ?>" data-group-numbering="<?php echo $group_numbering; ?>" data-close-tabs="<?php echo $close_tabs; ?>"> |
838 | - <?php if ( ! empty( $fields['name'] ) ) : ?> |
|
838 | + <?php if ( ! empty($fields['name'])) : ?> |
|
839 | 839 | <p class="give-repeater-field-name"><?php echo $fields['name']; ?></p> |
840 | 840 | <?php endif; ?> |
841 | 841 | |
842 | - <?php if ( ! empty( $fields['description'] ) ) : ?> |
|
842 | + <?php if ( ! empty($fields['description'])) : ?> |
|
843 | 843 | <p class="give-repeater-field-description"><?php echo $fields['description']; ?></p> |
844 | 844 | <?php endif; ?> |
845 | 845 | |
846 | 846 | <table class="give-repeatable-fields-section-wrapper" cellspacing="0"> |
847 | 847 | <?php |
848 | - $repeater_field_values = get_post_meta( $thepostid, $fields['id'], true ); |
|
849 | - $header_title = isset( $fields['options']['header_title'] ) |
|
848 | + $repeater_field_values = get_post_meta($thepostid, $fields['id'], true); |
|
849 | + $header_title = isset($fields['options']['header_title']) |
|
850 | 850 | ? $fields['options']['header_title'] |
851 | - : esc_attr__( 'Group', 'give' ); |
|
851 | + : esc_attr__('Group', 'give'); |
|
852 | 852 | |
853 | 853 | $add_default_donation_field = false; |
854 | 854 | |
855 | 855 | // Check if level is not created or we have to add default level. |
856 | - if ( is_array( $repeater_field_values ) && ( $fields_count = count( $repeater_field_values ) ) ) { |
|
857 | - $repeater_field_values = array_values( $repeater_field_values ); |
|
856 | + if (is_array($repeater_field_values) && ($fields_count = count($repeater_field_values))) { |
|
857 | + $repeater_field_values = array_values($repeater_field_values); |
|
858 | 858 | } else { |
859 | 859 | $fields_count = 1; |
860 | 860 | $add_default_donation_field = true; |
@@ -867,73 +867,73 @@ discard block |
||
867 | 867 | <div class="give-row-head give-move"> |
868 | 868 | <button type="button" class="handlediv button-link"><span class="toggle-indicator"></span> |
869 | 869 | </button> |
870 | - <span class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">-</span> |
|
870 | + <span class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">-</span> |
|
871 | 871 | <h2> |
872 | 872 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
873 | 873 | </h2> |
874 | 874 | </div> |
875 | 875 | <div class="give-row-body"> |
876 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
877 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
876 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
877 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
878 | 878 | continue; |
879 | 879 | } ?> |
880 | 880 | <?php |
881 | 881 | $field['repeat'] = true; |
882 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields ); |
|
883 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
882 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields); |
|
883 | + $field['id'] = str_replace(array('[', ']'), array( |
|
884 | 884 | '_', |
885 | 885 | '', |
886 | - ), $field['repeatable_field_id'] ); |
|
886 | + ), $field['repeatable_field_id']); |
|
887 | 887 | ?> |
888 | - <?php give_render_field( $field ); ?> |
|
888 | + <?php give_render_field($field); ?> |
|
889 | 889 | <?php endforeach; ?> |
890 | 890 | </div> |
891 | 891 | </td> |
892 | 892 | </tr> |
893 | 893 | |
894 | - <?php if ( ! empty( $repeater_field_values ) ) : ?> |
|
894 | + <?php if ( ! empty($repeater_field_values)) : ?> |
|
895 | 895 | <!--Stored repeater field group--> |
896 | - <?php foreach ( $repeater_field_values as $index => $field_group ) : ?> |
|
896 | + <?php foreach ($repeater_field_values as $index => $field_group) : ?> |
|
897 | 897 | <tr class="give-row"> |
898 | 898 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
899 | 899 | <div class="give-row-head give-move"> |
900 | 900 | <button type="button" class="handlediv button-link"> |
901 | 901 | <span class="toggle-indicator"></span></button> |
902 | - <sapn class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
902 | + <sapn class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
903 | 903 | </sapn> |
904 | 904 | <h2> |
905 | 905 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
906 | 906 | </h2> |
907 | 907 | </div> |
908 | 908 | <div class="give-row-body"> |
909 | - <?php foreach ( $fields['fields'] as $field ) : ?> |
|
910 | - <?php if ( ! give_is_field_callback_exist( $field ) ) { |
|
909 | + <?php foreach ($fields['fields'] as $field) : ?> |
|
910 | + <?php if ( ! give_is_field_callback_exist($field)) { |
|
911 | 911 | continue; |
912 | 912 | } ?> |
913 | 913 | <?php |
914 | 914 | $field['repeat'] = true; |
915 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, $index ); |
|
916 | - $field['attributes']['value'] = give_get_repeater_field_value( $field, $field_group, $fields ); |
|
917 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
915 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, $index); |
|
916 | + $field['attributes']['value'] = give_get_repeater_field_value($field, $field_group, $fields); |
|
917 | + $field['id'] = str_replace(array('[', ']'), array( |
|
918 | 918 | '_', |
919 | 919 | '', |
920 | - ), $field['repeatable_field_id'] ); |
|
920 | + ), $field['repeatable_field_id']); |
|
921 | 921 | ?> |
922 | - <?php give_render_field( $field ); ?> |
|
922 | + <?php give_render_field($field); ?> |
|
923 | 923 | <?php endforeach; ?> |
924 | 924 | </div> |
925 | 925 | </td> |
926 | 926 | </tr> |
927 | - <?php endforeach;; ?> |
|
927 | + <?php endforeach; ; ?> |
|
928 | 928 | |
929 | - <?php elseif ( $add_default_donation_field ) : ?> |
|
929 | + <?php elseif ($add_default_donation_field) : ?> |
|
930 | 930 | <!--Default repeater field group--> |
931 | 931 | <tr class="give-row"> |
932 | 932 | <td class="give-repeater-field-wrap give-column" colspan="2"> |
933 | 933 | <div class="give-row-head give-move"> |
934 | 934 | <button type="button" class="handlediv button-link"> |
935 | 935 | <span class="toggle-indicator"></span></button> |
936 | - <sapn class="give-remove" title="<?php esc_html_e( 'Remove Group', 'give' ); ?>">- |
|
936 | + <sapn class="give-remove" title="<?php esc_html_e('Remove Group', 'give'); ?>">- |
|
937 | 937 | </sapn> |
938 | 938 | <h2> |
939 | 939 | <span data-header-title="<?php echo $header_title; ?>"><?php echo $header_title; ?></span> |
@@ -941,19 +941,19 @@ discard block |
||
941 | 941 | </div> |
942 | 942 | <div class="give-row-body"> |
943 | 943 | <?php |
944 | - foreach ( $fields['fields'] as $field ) : |
|
945 | - if ( ! give_is_field_callback_exist( $field ) ) { |
|
944 | + foreach ($fields['fields'] as $field) : |
|
945 | + if ( ! give_is_field_callback_exist($field)) { |
|
946 | 946 | continue; |
947 | 947 | } |
948 | 948 | |
949 | 949 | $field['repeat'] = true; |
950 | - $field['repeatable_field_id'] = give_get_repeater_field_id( $field, $fields, 0 ); |
|
951 | - $field['attributes']['value'] = apply_filters( "give_default_field_group_field_{$field['id']}_value", ( ! empty( $field['default'] ) ? $field['default'] : '' ), $field ); |
|
952 | - $field['id'] = str_replace( array( '[', ']' ), array( |
|
950 | + $field['repeatable_field_id'] = give_get_repeater_field_id($field, $fields, 0); |
|
951 | + $field['attributes']['value'] = apply_filters("give_default_field_group_field_{$field['id']}_value", ( ! empty($field['default']) ? $field['default'] : ''), $field); |
|
952 | + $field['id'] = str_replace(array('[', ']'), array( |
|
953 | 953 | '_', |
954 | 954 | '', |
955 | - ), $field['repeatable_field_id'] ); |
|
956 | - give_render_field( $field ); |
|
955 | + ), $field['repeatable_field_id']); |
|
956 | + give_render_field($field); |
|
957 | 957 | endforeach; |
958 | 958 | ?> |
959 | 959 | </div> |
@@ -964,9 +964,9 @@ discard block |
||
964 | 964 | <tfoot> |
965 | 965 | <tr> |
966 | 966 | <?php |
967 | - $add_row_btn_title = isset( $fields['options']['add_button'] ) |
|
967 | + $add_row_btn_title = isset($fields['options']['add_button']) |
|
968 | 968 | ? $add_row_btn_title = $fields['options']['add_button'] |
969 | - : esc_html__( 'Add Row', 'give' ); |
|
969 | + : esc_html__('Add Row', 'give'); |
|
970 | 970 | ?> |
971 | 971 | <td colspan="2" class="give-add-repeater-field-section-row-wrap"> |
972 | 972 | <span class="button button-primary give-add-repeater-field-section-row"><?php echo $add_row_btn_title; ?></span> |
@@ -996,10 +996,10 @@ discard block |
||
996 | 996 | * |
997 | 997 | * @param string |
998 | 998 | */ |
999 | - $default_current_tab = apply_filters( "give_default_setting_tab_{$current_setting_page}", 'general' ); |
|
999 | + $default_current_tab = apply_filters("give_default_setting_tab_{$current_setting_page}", 'general'); |
|
1000 | 1000 | |
1001 | 1001 | // Get current tab. |
1002 | - $current_tab = empty( $_GET['tab'] ) ? $default_current_tab : urldecode( $_GET['tab'] ); |
|
1002 | + $current_tab = empty($_GET['tab']) ? $default_current_tab : urldecode($_GET['tab']); |
|
1003 | 1003 | |
1004 | 1004 | // Output. |
1005 | 1005 | return $current_tab; |
@@ -1023,10 +1023,10 @@ discard block |
||
1023 | 1023 | * |
1024 | 1024 | * @param string |
1025 | 1025 | */ |
1026 | - $default_current_section = apply_filters( "give_default_setting_tab_section_{$current_tab}", '' ); |
|
1026 | + $default_current_section = apply_filters("give_default_setting_tab_section_{$current_tab}", ''); |
|
1027 | 1027 | |
1028 | 1028 | // Get current section. |
1029 | - $current_section = empty( $_REQUEST['section'] ) ? $default_current_section : urldecode( $_REQUEST['section'] ); |
|
1029 | + $current_section = empty($_REQUEST['section']) ? $default_current_section : urldecode($_REQUEST['section']); |
|
1030 | 1030 | |
1031 | 1031 | //Output. |
1032 | 1032 | return $current_section; |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | */ |
1041 | 1041 | function give_get_current_setting_page() { |
1042 | 1042 | // Get current page. |
1043 | - $setting_page = ! empty( $_GET['page'] ) ? urldecode( $_GET['page'] ) : ''; |
|
1043 | + $setting_page = ! empty($_GET['page']) ? urldecode($_GET['page']) : ''; |
|
1044 | 1044 | |
1045 | 1045 | //Output. |
1046 | 1046 | return $setting_page; |
@@ -1059,13 +1059,13 @@ discard block |
||
1059 | 1059 | * |
1060 | 1060 | * @return string |
1061 | 1061 | */ |
1062 | -function _give_display_content_field_value( $field_value, $field, $postid ) { |
|
1063 | - $show_content = get_post_meta( $postid, '_give_content_option', true ); |
|
1062 | +function _give_display_content_field_value($field_value, $field, $postid) { |
|
1063 | + $show_content = get_post_meta($postid, '_give_content_option', true); |
|
1064 | 1064 | |
1065 | 1065 | if ( |
1066 | - ! get_post_meta( $postid, '_give_display_content', true ) |
|
1066 | + ! get_post_meta($postid, '_give_display_content', true) |
|
1067 | 1067 | && $show_content |
1068 | - && ( 'none' !== $show_content ) |
|
1068 | + && ('none' !== $show_content) |
|
1069 | 1069 | ) { |
1070 | 1070 | $field_value = 'enabled'; |
1071 | 1071 | } |
@@ -1073,7 +1073,7 @@ discard block |
||
1073 | 1073 | return $field_value; |
1074 | 1074 | } |
1075 | 1075 | |
1076 | -add_filter( '_give_display_content_field_value', '_give_display_content_field_value', 10, 3 ); |
|
1076 | +add_filter('_give_display_content_field_value', '_give_display_content_field_value', 10, 3); |
|
1077 | 1077 | |
1078 | 1078 | |
1079 | 1079 | /** |
@@ -1089,12 +1089,12 @@ discard block |
||
1089 | 1089 | * |
1090 | 1090 | * @return string |
1091 | 1091 | */ |
1092 | -function _give_content_placement_field_value( $field_value, $field, $postid ) { |
|
1093 | - $show_content = get_post_meta( $postid, '_give_content_option', true ); |
|
1092 | +function _give_content_placement_field_value($field_value, $field, $postid) { |
|
1093 | + $show_content = get_post_meta($postid, '_give_content_option', true); |
|
1094 | 1094 | |
1095 | 1095 | if ( |
1096 | - ! get_post_meta( $postid, '_give_content_placement', true ) |
|
1097 | - && ( 'none' !== $show_content ) |
|
1096 | + ! get_post_meta($postid, '_give_content_placement', true) |
|
1097 | + && ('none' !== $show_content) |
|
1098 | 1098 | ) { |
1099 | 1099 | $field_value = $show_content; |
1100 | 1100 | } |
@@ -1102,7 +1102,7 @@ discard block |
||
1102 | 1102 | return $field_value; |
1103 | 1103 | } |
1104 | 1104 | |
1105 | -add_filter( '_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3 ); |
|
1105 | +add_filter('_give_content_placement_field_value', '_give_content_placement_field_value', 10, 3); |
|
1106 | 1106 | |
1107 | 1107 | |
1108 | 1108 | /** |
@@ -1118,17 +1118,17 @@ discard block |
||
1118 | 1118 | * |
1119 | 1119 | * @return string |
1120 | 1120 | */ |
1121 | -function _give_terms_option_field_value( $field_value, $field, $postid ) { |
|
1122 | - $term_option = get_post_meta( $postid, '_give_terms_option', true ); |
|
1121 | +function _give_terms_option_field_value($field_value, $field, $postid) { |
|
1122 | + $term_option = get_post_meta($postid, '_give_terms_option', true); |
|
1123 | 1123 | |
1124 | - if ( in_array( $term_option, array( 'none', 'yes' ) ) ) { |
|
1125 | - $field_value = ( 'yes' === $term_option ? 'enabled' : 'disabled' ); |
|
1124 | + if (in_array($term_option, array('none', 'yes'))) { |
|
1125 | + $field_value = ('yes' === $term_option ? 'enabled' : 'disabled'); |
|
1126 | 1126 | } |
1127 | 1127 | |
1128 | 1128 | return $field_value; |
1129 | 1129 | } |
1130 | 1130 | |
1131 | -add_filter( '_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3 ); |
|
1131 | +add_filter('_give_terms_option_field_value', '_give_terms_option_field_value', 10, 3); |
|
1132 | 1132 | |
1133 | 1133 | |
1134 | 1134 | /** |
@@ -1144,17 +1144,17 @@ discard block |
||
1144 | 1144 | * |
1145 | 1145 | * @return string |
1146 | 1146 | */ |
1147 | -function _give_offline_donation_enable_billing_fields_single_field_value( $field_value, $field, $postid ) { |
|
1148 | - $offline_donation = get_post_meta( $postid, '_give_offline_donation_enable_billing_fields_single', true ); |
|
1147 | +function _give_offline_donation_enable_billing_fields_single_field_value($field_value, $field, $postid) { |
|
1148 | + $offline_donation = get_post_meta($postid, '_give_offline_donation_enable_billing_fields_single', true); |
|
1149 | 1149 | |
1150 | - if ( 'on' === $offline_donation ) { |
|
1150 | + if ('on' === $offline_donation) { |
|
1151 | 1151 | $field_value = 'enabled'; |
1152 | 1152 | } |
1153 | 1153 | |
1154 | 1154 | return $field_value; |
1155 | 1155 | } |
1156 | 1156 | |
1157 | -add_filter( '_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3 ); |
|
1157 | +add_filter('_give_offline_donation_enable_billing_fields_single_field_value', '_give_offline_donation_enable_billing_fields_single_field_value', 10, 3); |
|
1158 | 1158 | |
1159 | 1159 | |
1160 | 1160 | /** |
@@ -1170,17 +1170,17 @@ discard block |
||
1170 | 1170 | * |
1171 | 1171 | * @return string |
1172 | 1172 | */ |
1173 | -function _give_custom_amount_field_value( $field_value, $field, $postid ) { |
|
1174 | - $custom_amount = get_post_meta( $postid, '_give_custom_amount', true ); |
|
1173 | +function _give_custom_amount_field_value($field_value, $field, $postid) { |
|
1174 | + $custom_amount = get_post_meta($postid, '_give_custom_amount', true); |
|
1175 | 1175 | |
1176 | - if ( in_array( $custom_amount, array( 'yes', 'no' ) ) ) { |
|
1177 | - $field_value = ( 'yes' === $custom_amount ? 'enabled' : 'disabled' ); |
|
1176 | + if (in_array($custom_amount, array('yes', 'no'))) { |
|
1177 | + $field_value = ('yes' === $custom_amount ? 'enabled' : 'disabled'); |
|
1178 | 1178 | } |
1179 | 1179 | |
1180 | 1180 | return $field_value; |
1181 | 1181 | } |
1182 | 1182 | |
1183 | -add_filter( '_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3 ); |
|
1183 | +add_filter('_give_custom_amount_field_value', '_give_custom_amount_field_value', 10, 3); |
|
1184 | 1184 | |
1185 | 1185 | |
1186 | 1186 | /** |
@@ -1196,17 +1196,17 @@ discard block |
||
1196 | 1196 | * |
1197 | 1197 | * @return string |
1198 | 1198 | */ |
1199 | -function _give_goal_option_field_value( $field_value, $field, $postid ) { |
|
1200 | - $goal_option = get_post_meta( $postid, '_give_goal_option', true ); |
|
1199 | +function _give_goal_option_field_value($field_value, $field, $postid) { |
|
1200 | + $goal_option = get_post_meta($postid, '_give_goal_option', true); |
|
1201 | 1201 | |
1202 | - if ( in_array( $goal_option, array( 'yes', 'no' ) ) ) { |
|
1203 | - $field_value = ( 'yes' === $goal_option ? 'enabled' : 'disabled' ); |
|
1202 | + if (in_array($goal_option, array('yes', 'no'))) { |
|
1203 | + $field_value = ('yes' === $goal_option ? 'enabled' : 'disabled'); |
|
1204 | 1204 | } |
1205 | 1205 | |
1206 | 1206 | return $field_value; |
1207 | 1207 | } |
1208 | 1208 | |
1209 | -add_filter( '_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3 ); |
|
1209 | +add_filter('_give_goal_option_field_value', '_give_goal_option_field_value', 10, 3); |
|
1210 | 1210 | |
1211 | 1211 | /** |
1212 | 1212 | * Set value for Donation Goal --> close Form. |
@@ -1221,17 +1221,17 @@ discard block |
||
1221 | 1221 | * |
1222 | 1222 | * @return string |
1223 | 1223 | */ |
1224 | -function _give_close_form_when_goal_achieved_value( $field_value, $field, $postid ) { |
|
1225 | - $close_form = get_post_meta( $postid, '_give_close_form_when_goal_achieved', true ); |
|
1224 | +function _give_close_form_when_goal_achieved_value($field_value, $field, $postid) { |
|
1225 | + $close_form = get_post_meta($postid, '_give_close_form_when_goal_achieved', true); |
|
1226 | 1226 | |
1227 | - if ( in_array( $close_form, array( 'yes', 'no' ) ) ) { |
|
1228 | - $field_value = ( 'yes' === $close_form ? 'enabled' : 'disabled' ); |
|
1227 | + if (in_array($close_form, array('yes', 'no'))) { |
|
1228 | + $field_value = ('yes' === $close_form ? 'enabled' : 'disabled'); |
|
1229 | 1229 | } |
1230 | 1230 | |
1231 | 1231 | return $field_value; |
1232 | 1232 | } |
1233 | 1233 | |
1234 | -add_filter( '_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3 ); |
|
1234 | +add_filter('_give_close_form_when_goal_achieved_field_value', '_give_close_form_when_goal_achieved_value', 10, 3); |
|
1235 | 1235 | |
1236 | 1236 | |
1237 | 1237 | /** |
@@ -1247,17 +1247,17 @@ discard block |
||
1247 | 1247 | * |
1248 | 1248 | * @return string |
1249 | 1249 | */ |
1250 | -function _give_logged_in_only_value( $field_value, $field, $postid ) { |
|
1251 | - $guest_donation = get_post_meta( $postid, '_give_logged_in_only', true ); |
|
1250 | +function _give_logged_in_only_value($field_value, $field, $postid) { |
|
1251 | + $guest_donation = get_post_meta($postid, '_give_logged_in_only', true); |
|
1252 | 1252 | |
1253 | - if ( in_array( $guest_donation, array( 'yes', 'no' ) ) ) { |
|
1254 | - $field_value = ( 'yes' === $guest_donation ? 'enabled' : 'disabled' ); |
|
1253 | + if (in_array($guest_donation, array('yes', 'no'))) { |
|
1254 | + $field_value = ('yes' === $guest_donation ? 'enabled' : 'disabled'); |
|
1255 | 1255 | } |
1256 | 1256 | |
1257 | 1257 | return $field_value; |
1258 | 1258 | } |
1259 | 1259 | |
1260 | -add_filter( '_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3 ); |
|
1260 | +add_filter('_give_logged_in_only_field_value', '_give_logged_in_only_value', 10, 3); |
|
1261 | 1261 | |
1262 | 1262 | /** |
1263 | 1263 | * Set value for Offline Donations --> Offline Donations. |
@@ -1272,17 +1272,17 @@ discard block |
||
1272 | 1272 | * |
1273 | 1273 | * @return string |
1274 | 1274 | */ |
1275 | -function _give_customize_offline_donations_value( $field_value, $field, $postid ) { |
|
1276 | - $customize_offline_text = get_post_meta( $postid, '_give_customize_offline_donations', true ); |
|
1275 | +function _give_customize_offline_donations_value($field_value, $field, $postid) { |
|
1276 | + $customize_offline_text = get_post_meta($postid, '_give_customize_offline_donations', true); |
|
1277 | 1277 | |
1278 | - if ( in_array( $customize_offline_text, array( 'yes', 'no' ) ) ) { |
|
1279 | - $field_value = ( 'yes' === $customize_offline_text ? 'enabled' : 'disabled' ); |
|
1278 | + if (in_array($customize_offline_text, array('yes', 'no'))) { |
|
1279 | + $field_value = ('yes' === $customize_offline_text ? 'enabled' : 'disabled'); |
|
1280 | 1280 | } |
1281 | 1281 | |
1282 | 1282 | return $field_value; |
1283 | 1283 | } |
1284 | 1284 | |
1285 | -add_filter( '_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3 ); |
|
1285 | +add_filter('_give_customize_offline_donations_field_value', '_give_customize_offline_donations_value', 10, 3); |
|
1286 | 1286 | |
1287 | 1287 | |
1288 | 1288 | /** |
@@ -1297,14 +1297,14 @@ discard block |
||
1297 | 1297 | * |
1298 | 1298 | * @return mixed |
1299 | 1299 | */ |
1300 | -function _give_set_multi_level_repeater_field_id( $field_id, $field, $fields, $default ) { |
|
1300 | +function _give_set_multi_level_repeater_field_id($field_id, $field, $fields, $default) { |
|
1301 | 1301 | $row_placeholder = false !== $default ? $default : '{{row-count-placeholder}}'; |
1302 | 1302 | $field_id = "{$fields['id']}[{$row_placeholder}][{$field['id']}][level_id]"; |
1303 | 1303 | |
1304 | 1304 | return $field_id; |
1305 | 1305 | } |
1306 | 1306 | |
1307 | -add_filter( 'give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4 ); |
|
1307 | +add_filter('give_get_repeater_field__give_id_id', '_give_set_multi_level_repeater_field_id', 10, 4); |
|
1308 | 1308 | |
1309 | 1309 | /** |
1310 | 1310 | * Set repeater field value for multi donation form. |
@@ -1318,13 +1318,13 @@ discard block |
||
1318 | 1318 | * |
1319 | 1319 | * @return mixed |
1320 | 1320 | */ |
1321 | -function _give_set_multi_level_repeater_field_value( $field_value, $field, $field_group, $fields ) { |
|
1322 | - $field_value = $field_group[ $field['id'] ]['level_id']; |
|
1321 | +function _give_set_multi_level_repeater_field_value($field_value, $field, $field_group, $fields) { |
|
1322 | + $field_value = $field_group[$field['id']]['level_id']; |
|
1323 | 1323 | |
1324 | 1324 | return $field_value; |
1325 | 1325 | } |
1326 | 1326 | |
1327 | -add_filter( 'give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4 ); |
|
1327 | +add_filter('give_get_repeater_field__give_id_value', '_give_set_multi_level_repeater_field_value', 10, 4); |
|
1328 | 1328 | |
1329 | 1329 | /** |
1330 | 1330 | * Set default value for _give_id field. |
@@ -1335,11 +1335,11 @@ discard block |
||
1335 | 1335 | * |
1336 | 1336 | * @return string |
1337 | 1337 | */ |
1338 | -function _give_set_field_give_id_default_value( $field ) { |
|
1338 | +function _give_set_field_give_id_default_value($field) { |
|
1339 | 1339 | return 0; |
1340 | 1340 | } |
1341 | 1341 | |
1342 | -add_filter( 'give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value' ); |
|
1342 | +add_filter('give_default_field_group_field__give_id_value', '_give_set_field_give_id_default_value'); |
|
1343 | 1343 | |
1344 | 1344 | /** |
1345 | 1345 | * Set default value for _give_default field. |
@@ -1350,11 +1350,11 @@ discard block |
||
1350 | 1350 | * |
1351 | 1351 | * @return string |
1352 | 1352 | */ |
1353 | -function _give_set_field_give_default_default_value( $field ) { |
|
1353 | +function _give_set_field_give_default_default_value($field) { |
|
1354 | 1354 | return 'default'; |
1355 | 1355 | } |
1356 | 1356 | |
1357 | -add_filter( 'give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value' ); |
|
1357 | +add_filter('give_default_field_group_field__give_default_value', '_give_set_field_give_default_default_value'); |
|
1358 | 1358 | |
1359 | 1359 | /** |
1360 | 1360 | * Set repeater field editor id for field type wysiwyg. |
@@ -1366,11 +1366,11 @@ discard block |
||
1366 | 1366 | * |
1367 | 1367 | * @return string |
1368 | 1368 | */ |
1369 | -function give_repeater_field_set_editor_id( $field_name, $field ) { |
|
1370 | - if ( isset( $field['repeatable_field_id'] ) && 'wysiwyg' == $field['type'] ) { |
|
1371 | - $field_name = '_give_repeater_' . uniqid() . '_wysiwyg'; |
|
1369 | +function give_repeater_field_set_editor_id($field_name, $field) { |
|
1370 | + if (isset($field['repeatable_field_id']) && 'wysiwyg' == $field['type']) { |
|
1371 | + $field_name = '_give_repeater_'.uniqid().'_wysiwyg'; |
|
1372 | 1372 | } |
1373 | 1373 | |
1374 | 1374 | return $field_name; |
1375 | 1375 | } |
1376 | -add_filter( 'give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2 ); |
|
1377 | 1376 | \ No newline at end of file |
1377 | +add_filter('give_get_field_name', 'give_repeater_field_set_editor_id', 10, 2); |
|
1378 | 1378 | \ No newline at end of file |
@@ -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. |
@@ -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 = get_post_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true ); |
|
84 | - $post_offline_customize_option = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
83 | + $post_offline_cc_fields = get_post_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true); |
|
84 | + $post_offline_customize_option = get_post_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 = get_post_meta( $payment_data['form_id'], '_give_customize_offline_donations', true ); |
|
157 | + $payment_data = give_get_payment_meta($payment_id); |
|
158 | + $post_offline_customization_option = get_post_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 = get_post_meta( $payment_data['form_id'], '_give_offline_donation_email', true ); |
|
163 | + if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) { |
|
164 | + $email_content = get_post_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 = get_post_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 = get_post_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,52 +221,52 @@ 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 .= __( 'An offline donation has been made on your website:', 'give' ) . ' ' . get_bloginfo( 'name' ) . ' '; |
|
245 | - $admin_message .= __( 'Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n"; |
|
243 | + $admin_message = __('Dear Admin,', 'give')."\n\n"; |
|
244 | + $admin_message .= __('An offline donation has been made on your website:', 'give').' '.get_bloginfo('name').' '; |
|
245 | + $admin_message .= __('Hooray! The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n"; |
|
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-order-details&id=' . $payment_id ), |
|
254 | - __( 'Click Here to View and/or Update Donation Details', 'give' ) |
|
255 | - ) . "\n\n"; |
|
253 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id), |
|
254 | + __('Click Here to View and/or Update 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 | - if ( ! empty( $admin_headers ) ) { |
|
266 | - $emails->__set( 'headers', $admin_headers ); |
|
265 | + if ( ! empty($admin_headers)) { |
|
266 | + $emails->__set('headers', $admin_headers); |
|
267 | 267 | } |
268 | 268 | |
269 | - $emails->send( $admin_email, $admin_subject, $admin_message, $attachments ); |
|
269 | + $emails->send($admin_email, $admin_subject, $admin_message, $attachments); |
|
270 | 270 | |
271 | 271 | } |
272 | 272 | |
@@ -278,20 +278,20 @@ discard block |
||
278 | 278 | * |
279 | 279 | * @return array |
280 | 280 | */ |
281 | -function give_offline_add_settings( $settings ) { |
|
281 | +function give_offline_add_settings($settings) { |
|
282 | 282 | |
283 | 283 | // Bailout: Do not show offline gateways setting in to metabox if its disabled globally. |
284 | - if ( in_array( 'offline', give_get_option( 'gateways' ) ) ) { |
|
284 | + if (in_array('offline', give_get_option('gateways'))) { |
|
285 | 285 | return $settings; |
286 | 286 | } |
287 | 287 | |
288 | 288 | //Vars |
289 | 289 | $prefix = '_give_'; |
290 | 290 | |
291 | - $is_gateway_active = give_is_gateway_active( 'offline' ); |
|
291 | + $is_gateway_active = give_is_gateway_active('offline'); |
|
292 | 292 | |
293 | 293 | //this gateway isn't active |
294 | - if ( ! $is_gateway_active ) { |
|
294 | + if ( ! $is_gateway_active) { |
|
295 | 295 | //return settings and bounce |
296 | 296 | return $settings; |
297 | 297 | } |
@@ -300,34 +300,34 @@ discard block |
||
300 | 300 | $check_settings = array( |
301 | 301 | |
302 | 302 | array( |
303 | - 'name' => __( 'Offline Donations', 'give' ), |
|
304 | - 'desc' => __( 'Do you want to customize the donation instructions for this form?', 'give' ), |
|
305 | - 'id' => $prefix . 'customize_offline_donations', |
|
303 | + 'name' => __('Offline Donations', 'give'), |
|
304 | + 'desc' => __('Do you want to customize the donation instructions for this form?', 'give'), |
|
305 | + 'id' => $prefix.'customize_offline_donations', |
|
306 | 306 | 'type' => 'radio_inline', |
307 | 307 | 'default' => 'global', |
308 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
309 | - 'global' => __( 'Global Options', 'give' ), |
|
310 | - 'enabled' => __( 'Customize', 'give' ), |
|
311 | - 'disabled' => __( 'Disable', 'give' ), |
|
308 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
309 | + 'global' => __('Global Options', 'give'), |
|
310 | + 'enabled' => __('Customize', 'give'), |
|
311 | + 'disabled' => __('Disable', 'give'), |
|
312 | 312 | ) |
313 | 313 | ), |
314 | 314 | ), |
315 | 315 | array( |
316 | - 'name' => __( 'Billing Fields', 'give' ), |
|
317 | - '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' ), |
|
318 | - 'id' => $prefix . 'offline_donation_enable_billing_fields_single', |
|
316 | + 'name' => __('Billing Fields', 'give'), |
|
317 | + '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'), |
|
318 | + 'id' => $prefix.'offline_donation_enable_billing_fields_single', |
|
319 | 319 | 'row_classes' => 'give-subfield', |
320 | 320 | 'type' => 'radio_inline', |
321 | 321 | 'default' => 'disabled', |
322 | 322 | 'options' => array( |
323 | - 'enabled' => __( 'Enabled', 'give' ), |
|
324 | - 'disabled' => __( 'Disabled', 'give' ), |
|
323 | + 'enabled' => __('Enabled', 'give'), |
|
324 | + 'disabled' => __('Disabled', 'give'), |
|
325 | 325 | ), |
326 | 326 | ), |
327 | 327 | array( |
328 | - 'id' => $prefix . 'offline_checkout_notes', |
|
329 | - 'name' => __( 'Donation Instructions', 'give' ), |
|
330 | - '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' ), |
|
328 | + 'id' => $prefix.'offline_checkout_notes', |
|
329 | + 'name' => __('Donation Instructions', 'give'), |
|
330 | + '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'), |
|
331 | 331 | 'default' => give_get_default_offline_donation_content(), |
332 | 332 | 'type' => 'wysiwyg', |
333 | 333 | 'row_classes' => 'give-subfield', |
@@ -336,17 +336,17 @@ discard block |
||
336 | 336 | ) |
337 | 337 | ), |
338 | 338 | array( |
339 | - 'id' => $prefix . 'offline_donation_subject', |
|
340 | - 'name' => __( 'Email Subject', 'give' ), |
|
341 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
342 | - 'default' => __( '{form_title} - Offline Donation Instructions', 'give' ), |
|
339 | + 'id' => $prefix.'offline_donation_subject', |
|
340 | + 'name' => __('Email Subject', 'give'), |
|
341 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
342 | + 'default' => __('{form_title} - Offline Donation Instructions', 'give'), |
|
343 | 343 | 'row_classes' => 'give-subfield', |
344 | 344 | 'type' => 'text' |
345 | 345 | ), |
346 | 346 | array( |
347 | - 'id' => $prefix . 'offline_donation_email', |
|
348 | - 'name' => __( 'Email Instructions', 'give' ), |
|
349 | - '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' ), |
|
347 | + 'id' => $prefix.'offline_donation_email', |
|
348 | + 'name' => __('Email Instructions', 'give'), |
|
349 | + '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'), |
|
350 | 350 | 'default' => give_get_default_offline_donation_email_content(), |
351 | 351 | 'type' => 'wysiwyg', |
352 | 352 | 'row_classes' => 'give-subfield', |
@@ -362,10 +362,10 @@ discard block |
||
362 | 362 | ), |
363 | 363 | ); |
364 | 364 | |
365 | - return array_merge( $settings, $check_settings ); |
|
365 | + return array_merge($settings, $check_settings); |
|
366 | 366 | } |
367 | 367 | |
368 | -add_filter( 'give_forms_offline_donations_metabox_fields', 'give_offline_add_settings' ); |
|
368 | +add_filter('give_forms_offline_donations_metabox_fields', 'give_offline_add_settings'); |
|
369 | 369 | |
370 | 370 | |
371 | 371 | /** |
@@ -377,32 +377,32 @@ discard block |
||
377 | 377 | */ |
378 | 378 | function give_get_default_offline_donation_content() { |
379 | 379 | |
380 | - $sitename = get_bloginfo( 'sitename' ); |
|
380 | + $sitename = get_bloginfo('sitename'); |
|
381 | 381 | |
382 | - $default_text = '<p>' . __( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>'; |
|
382 | + $default_text = '<p>'.__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>'; |
|
383 | 383 | $default_text .= '<ol>'; |
384 | 384 | $default_text .= '<li>'; |
385 | 385 | $default_text .= sprintf( |
386 | 386 | /* translators: %s: site name */ |
387 | - __( 'Make a check payable to "%s"', 'give' ), |
|
387 | + __('Make a check payable to "%s"', 'give'), |
|
388 | 388 | $sitename |
389 | 389 | ); |
390 | 390 | $default_text .= '</li>'; |
391 | 391 | $default_text .= '<li>'; |
392 | 392 | $default_text .= sprintf( |
393 | 393 | /* translators: %s: site name */ |
394 | - __( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
394 | + __('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
395 | 395 | $sitename |
396 | 396 | ); |
397 | 397 | $default_text .= '</li>'; |
398 | - $default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>'; |
|
398 | + $default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>'; |
|
399 | 399 | $default_text .= '</ol>'; |
400 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
400 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
401 | 401 | $default_text .= ' <em>123 G Street </em><br>'; |
402 | 402 | $default_text .= ' <em>San Diego, CA 92101 </em><br>'; |
403 | - $default_text .= '<p>' . __( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>'; |
|
403 | + $default_text .= '<p>'.__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>'; |
|
404 | 404 | |
405 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
405 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
406 | 406 | |
407 | 407 | } |
408 | 408 | |
@@ -415,34 +415,34 @@ discard block |
||
415 | 415 | */ |
416 | 416 | function give_get_default_offline_donation_email_content() { |
417 | 417 | |
418 | - $sitename = get_bloginfo( 'sitename' ); |
|
419 | - $default_text = '<p>' . __( 'Dear {name},', 'give' ) . '</p>'; |
|
420 | - $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>'; |
|
418 | + $sitename = get_bloginfo('sitename'); |
|
419 | + $default_text = '<p>'.__('Dear {name},', 'give').'</p>'; |
|
420 | + $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>'; |
|
421 | 421 | $default_text .= '<ol>'; |
422 | 422 | $default_text .= '<li>'; |
423 | 423 | $default_text .= sprintf( |
424 | 424 | /* translators: %s: site name */ |
425 | - __( 'Make a check payable to "%s"', 'give' ), |
|
425 | + __('Make a check payable to "%s"', 'give'), |
|
426 | 426 | $sitename |
427 | 427 | ); |
428 | 428 | $default_text .= '</li>'; |
429 | 429 | $default_text .= '<li>'; |
430 | 430 | $default_text .= sprintf( |
431 | 431 | /* translators: %s: site name */ |
432 | - __( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
432 | + __('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
433 | 433 | $sitename |
434 | 434 | ); |
435 | 435 | $default_text .= '</li>'; |
436 | - $default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>'; |
|
436 | + $default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>'; |
|
437 | 437 | $default_text .= '</ol>'; |
438 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
438 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
439 | 439 | $default_text .= ' <em>123 G Street </em><br>'; |
440 | 440 | $default_text .= ' <em>San Diego, CA 92101 </em><br>'; |
441 | - $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>'; |
|
442 | - $default_text .= '<p>' . __( 'Sincerely,', 'give' ) . '</p>'; |
|
443 | - $default_text .= '<p>' . $sitename . '</p>'; |
|
441 | + $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>'; |
|
442 | + $default_text .= '<p>'.__('Sincerely,', 'give').'</p>'; |
|
443 | + $default_text .= '<p>'.$sitename.'</p>'; |
|
444 | 444 | |
445 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
445 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
446 | 446 | |
447 | 447 | } |
448 | 448 | |
@@ -456,17 +456,17 @@ discard block |
||
456 | 456 | * |
457 | 457 | * @return string |
458 | 458 | */ |
459 | -function give_offline_donation_receipt_status_notice( $notice, $id ) { |
|
460 | - $payment = new Give_Payment( $id ); |
|
459 | +function give_offline_donation_receipt_status_notice($notice, $id) { |
|
460 | + $payment = new Give_Payment($id); |
|
461 | 461 | |
462 | - if ( 'offline' !== $payment->gateway ) { |
|
462 | + if ('offline' !== $payment->gateway) { |
|
463 | 463 | return $notice; |
464 | 464 | } |
465 | 465 | |
466 | - return give_output_error( __('Payment Pending: Please follow the instructions below to complete your donation.', 'give'), false, 'warning' ); |
|
466 | + return give_output_error(__('Payment Pending: Please follow the instructions below to complete your donation.', 'give'), false, 'warning'); |
|
467 | 467 | } |
468 | 468 | |
469 | -add_filter( 'give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2 ); |
|
469 | +add_filter('give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2); |
|
470 | 470 | |
471 | 471 | /** |
472 | 472 | * Add offline payment instruction on payment receipt. |
@@ -477,26 +477,26 @@ discard block |
||
477 | 477 | * |
478 | 478 | * @return mixed |
479 | 479 | */ |
480 | -function give_offline_payment_receipt_after( $payment ) { |
|
480 | +function give_offline_payment_receipt_after($payment) { |
|
481 | 481 | // Get payment object. |
482 | - $payment = new Give_Payment( $payment->ID ); |
|
482 | + $payment = new Give_Payment($payment->ID); |
|
483 | 483 | |
484 | 484 | // Bailout. |
485 | - if ( 'offline' !== $payment->gateway ) { |
|
485 | + if ('offline' !== $payment->gateway) { |
|
486 | 486 | return false; |
487 | 487 | } |
488 | 488 | |
489 | 489 | ?> |
490 | 490 | <tr> |
491 | - <td scope="row"><strong><?php esc_html_e( 'Offline Payment Instruction:', 'give' ); ?></strong></td> |
|
491 | + <td scope="row"><strong><?php esc_html_e('Offline Payment Instruction:', 'give'); ?></strong></td> |
|
492 | 492 | <td> |
493 | - <?php echo give_get_offline_payment_instruction( $payment->form_id, true ); ?> |
|
493 | + <?php echo give_get_offline_payment_instruction($payment->form_id, true); ?> |
|
494 | 494 | </td> |
495 | 495 | </tr> |
496 | 496 | <?php |
497 | 497 | } |
498 | 498 | |
499 | -add_filter( 'give_payment_receipt_after', 'give_offline_payment_receipt_after' ); |
|
499 | +add_filter('give_payment_receipt_after', 'give_offline_payment_receipt_after'); |
|
500 | 500 | |
501 | 501 | /** |
502 | 502 | * Get offline payment instructions. |
@@ -508,27 +508,27 @@ discard block |
||
508 | 508 | * |
509 | 509 | * @return string |
510 | 510 | */ |
511 | -function give_get_offline_payment_instruction( $form_id, $wpautop = false ) { |
|
511 | +function give_get_offline_payment_instruction($form_id, $wpautop = false) { |
|
512 | 512 | // Bailout. |
513 | - if ( ! $form_id ) { |
|
513 | + if ( ! $form_id) { |
|
514 | 514 | return ''; |
515 | 515 | } |
516 | 516 | |
517 | - $post_offline_customization_option = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
518 | - $post_offline_instructions = get_post_meta( $form_id, '_give_offline_checkout_notes', true ); |
|
519 | - $global_offline_instruction = give_get_option( 'global_offline_donation_content' ); |
|
517 | + $post_offline_customization_option = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
518 | + $post_offline_instructions = get_post_meta($form_id, '_give_offline_checkout_notes', true); |
|
519 | + $global_offline_instruction = give_get_option('global_offline_donation_content'); |
|
520 | 520 | $offline_instructions = $global_offline_instruction; |
521 | 521 | |
522 | - if ( $post_offline_customization_option == 'yes' ) { |
|
522 | + if ($post_offline_customization_option == 'yes') { |
|
523 | 523 | $offline_instructions = $post_offline_instructions; |
524 | 524 | } |
525 | 525 | |
526 | - $settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' ); |
|
526 | + $settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1'); |
|
527 | 527 | |
528 | 528 | /* translators: %s: form settings url */ |
529 | - $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 ); |
|
529 | + $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); |
|
530 | 530 | |
531 | - return ( $wpautop ? wpautop( $offline_instructions ) : $offline_instructions ); |
|
531 | + return ($wpautop ? wpautop($offline_instructions) : $offline_instructions); |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | |
@@ -542,16 +542,16 @@ discard block |
||
542 | 542 | * |
543 | 543 | * @return array |
544 | 544 | */ |
545 | -function give_filter_offline_gateway( $gateway_list, $form_id ) { |
|
546 | - if ( $form_id && ! give_is_setting_enabled( get_post_meta( $form_id, '_give_customize_offline_donations', true ), array( 'enabled', 'global' ) ) ) { |
|
547 | - unset( $gateway_list['offline'] ); |
|
545 | +function give_filter_offline_gateway($gateway_list, $form_id) { |
|
546 | + if ($form_id && ! give_is_setting_enabled(get_post_meta($form_id, '_give_customize_offline_donations', true), array('enabled', 'global'))) { |
|
547 | + unset($gateway_list['offline']); |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | // Output. |
551 | 551 | return $gateway_list; |
552 | 552 | } |
553 | 553 | |
554 | -add_filter( 'give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2 ); |
|
554 | +add_filter('give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2); |
|
555 | 555 | |
556 | 556 | /** |
557 | 557 | * Set default gateway to global default payment gateway |
@@ -565,10 +565,10 @@ discard block |
||
565 | 565 | * |
566 | 566 | * @return void |
567 | 567 | */ |
568 | -function _give_customize_offline_donations_on_save_callback( $meta_key, $meta_value, $postid ) { |
|
569 | - if ( ( 'no' === $meta_value ) && ( 'offline' === get_post_meta( $postid, '_give_default_gateway', true ) ) ) { |
|
570 | - update_post_meta( $postid, '_give_default_gateway', 'global' ); |
|
568 | +function _give_customize_offline_donations_on_save_callback($meta_key, $meta_value, $postid) { |
|
569 | + if (('no' === $meta_value) && ('offline' === get_post_meta($postid, '_give_default_gateway', true))) { |
|
570 | + update_post_meta($postid, '_give_default_gateway', 'global'); |
|
571 | 571 | } |
572 | 572 | } |
573 | 573 | |
574 | -add_filter( 'give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3 ); |
|
574 | +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']; |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | |
593 | 593 | if( 'button' === $display_option ) { |
594 | 594 | $display_option = 'modal'; |
595 | - }elseif ( $display_option === 'onpage' ) { |
|
595 | + } elseif ( $display_option === 'onpage' ) { |
|
596 | 596 | return ''; |
597 | 597 | } |
598 | 598 | |
@@ -1033,9 +1033,12 @@ discard block |
||
1033 | 1033 | } |
1034 | 1034 | ?> |
1035 | 1035 | </select> |
1036 | - <?php else : ?> |
|
1036 | + <?php else { |
|
1037 | + : ?> |
|
1037 | 1038 | <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" |
1038 | - placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/> |
|
1039 | + placeholder="<?php esc_attr_e( 'State / Province', 'give' ); |
|
1040 | +} |
|
1041 | +?>"/> |
|
1039 | 1042 | <?php endif; ?> |
1040 | 1043 | </p> |
1041 | 1044 | <?php |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param array $args An array of form arguments. |
23 | 23 | * |
24 | - * @return string Donation form. |
|
24 | + * @return false|null Donation form. |
|
25 | 25 | */ |
26 | 26 | function give_get_donation_form( $args = array() ) { |
27 | 27 | |
@@ -1468,7 +1468,7 @@ discard block |
||
1468 | 1468 | * |
1469 | 1469 | * @param int $form_id The form ID. |
1470 | 1470 | * |
1471 | - * @return bool |
|
1471 | + * @return false|null |
|
1472 | 1472 | */ |
1473 | 1473 | function give_terms_agreement( $form_id ) { |
1474 | 1474 | $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
@@ -1677,7 +1677,7 @@ discard block |
||
1677 | 1677 | * @param int $form_id The form ID. |
1678 | 1678 | * @param array $args An array of form arguments. |
1679 | 1679 | * |
1680 | - * @return mixed |
|
1680 | + * @return boolean |
|
1681 | 1681 | */ |
1682 | 1682 | function give_show_goal_progress( $form_id, $args ) { |
1683 | 1683 | |
@@ -1696,7 +1696,7 @@ discard block |
||
1696 | 1696 | * Get form content position. |
1697 | 1697 | * |
1698 | 1698 | * @since 1.8 |
1699 | - * @param $form_id |
|
1699 | + * @param integer $form_id |
|
1700 | 1700 | * @param $args |
1701 | 1701 | * @return mixed|string |
1702 | 1702 | */ |
@@ -1731,7 +1731,7 @@ discard block |
||
1731 | 1731 | * @param int $form_id The form ID. |
1732 | 1732 | * @param array $args An array of form arguments. |
1733 | 1733 | * |
1734 | - * @return void|bool |
|
1734 | + * @return false|null |
|
1735 | 1735 | */ |
1736 | 1736 | function give_form_content( $form_id, $args ) { |
1737 | 1737 |
@@ -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 | |
@@ -23,50 +23,50 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return string Donation form. |
25 | 25 | */ |
26 | -function give_get_donation_form( $args = array() ) { |
|
26 | +function give_get_donation_form($args = array()) { |
|
27 | 27 | |
28 | 28 | global $post; |
29 | 29 | |
30 | - $form_id = is_object( $post ) ? $post->ID : 0; |
|
30 | + $form_id = is_object($post) ? $post->ID : 0; |
|
31 | 31 | |
32 | - if ( isset( $args['id'] ) ) { |
|
32 | + if (isset($args['id'])) { |
|
33 | 33 | $form_id = $args['id']; |
34 | 34 | } |
35 | 35 | |
36 | - $defaults = apply_filters( 'give_form_args_defaults', array( |
|
36 | + $defaults = apply_filters('give_form_args_defaults', array( |
|
37 | 37 | 'form_id' => $form_id, |
38 | - ) ); |
|
38 | + )); |
|
39 | 39 | |
40 | - $args = wp_parse_args( $args, $defaults ); |
|
40 | + $args = wp_parse_args($args, $defaults); |
|
41 | 41 | |
42 | - $form = new Give_Donate_Form( $args['form_id'] ); |
|
42 | + $form = new Give_Donate_Form($args['form_id']); |
|
43 | 43 | |
44 | 44 | //bail if no form ID. |
45 | - if ( empty( $form->ID ) ) { |
|
45 | + if (empty($form->ID)) { |
|
46 | 46 | return false; |
47 | 47 | } |
48 | 48 | |
49 | - $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
49 | + $payment_mode = give_get_chosen_gateway($form->ID); |
|
50 | 50 | |
51 | - $form_action = add_query_arg( apply_filters( 'give_form_action_args', array( |
|
51 | + $form_action = add_query_arg(apply_filters('give_form_action_args', array( |
|
52 | 52 | 'payment-mode' => $payment_mode, |
53 | - ) ), |
|
53 | + )), |
|
54 | 54 | give_get_current_page_url() |
55 | 55 | ); |
56 | 56 | |
57 | 57 | //Sanity Check: Donation form not published or user doesn't have permission to view drafts. |
58 | 58 | if ( |
59 | - ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) |
|
60 | - || ( 'trash' === $form->post_status ) |
|
59 | + ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) |
|
60 | + || ('trash' === $form->post_status) |
|
61 | 61 | ) { |
62 | 62 | return false; |
63 | 63 | } |
64 | 64 | |
65 | 65 | //Get the form wrap CSS classes. |
66 | - $form_wrap_classes = $form->get_form_wrap_classes( $args ); |
|
66 | + $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
67 | 67 | |
68 | 68 | //Get the <form> tag wrap CSS classes. |
69 | - $form_classes = $form->get_form_classes( $args ); |
|
69 | + $form_classes = $form->get_form_classes($args); |
|
70 | 70 | |
71 | 71 | ob_start(); |
72 | 72 | |
@@ -78,19 +78,19 @@ discard block |
||
78 | 78 | * @param int $form_id The form ID. |
79 | 79 | * @param array $args An array of form arguments. |
80 | 80 | */ |
81 | - do_action( 'give_pre_form_output', $form->ID, $args ); |
|
81 | + do_action('give_pre_form_output', $form->ID, $args); |
|
82 | 82 | |
83 | 83 | ?> |
84 | 84 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
85 | 85 | |
86 | - <?php if ( $form->is_close_donation_form() ) { |
|
86 | + <?php if ($form->is_close_donation_form()) { |
|
87 | 87 | |
88 | 88 | //Get Goal thank you message. |
89 | - $display_thankyou_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true ); |
|
90 | - $display_thankyou_message = ! empty( $display_thankyou_message ) ? $display_thankyou_message : esc_html__( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ); |
|
89 | + $display_thankyou_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true); |
|
90 | + $display_thankyou_message = ! empty($display_thankyou_message) ? $display_thankyou_message : esc_html__('Thank you to all our donors, we have met our fundraising goal.', 'give'); |
|
91 | 91 | |
92 | 92 | //Print thank you message. |
93 | - echo apply_filters( 'give_goal_closed_output', give_output_error( $display_thankyou_message, false, 'success' ), $form->ID ); |
|
93 | + echo apply_filters('give_goal_closed_output', give_output_error($display_thankyou_message, false, 'success'), $form->ID); |
|
94 | 94 | |
95 | 95 | } else { |
96 | 96 | /** |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | * 1. if show_title params set to true |
99 | 99 | * 2. if admin set form display_style to button |
100 | 100 | */ |
101 | - $form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
101 | + $form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
102 | 102 | if ( |
103 | 103 | ( |
104 | - ( isset( $args['show_title'] ) && $args['show_title'] == true ) |
|
105 | - || ( 'button' === get_post_meta( $form_id, '_give_payment_display', true ) ) |
|
104 | + (isset($args['show_title']) && $args['show_title'] == true) |
|
105 | + || ('button' === get_post_meta($form_id, '_give_payment_display', true)) |
|
106 | 106 | ) |
107 | - && ! doing_action( 'give_single_form_summary' ) |
|
107 | + && ! doing_action('give_single_form_summary') |
|
108 | 108 | ) { |
109 | 109 | echo $form_title; |
110 | 110 | } |
@@ -117,19 +117,19 @@ discard block |
||
117 | 117 | * @param int $form_id The form ID. |
118 | 118 | * @param array $args An array of form arguments. |
119 | 119 | */ |
120 | - do_action( 'give_pre_form', $form->ID, $args ); |
|
120 | + do_action('give_pre_form', $form->ID, $args); |
|
121 | 121 | ?> |
122 | 122 | |
123 | 123 | <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" |
124 | - action="<?php echo esc_url_raw( $form_action ); ?>" method="post"> |
|
124 | + action="<?php echo esc_url_raw($form_action); ?>" method="post"> |
|
125 | 125 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
126 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
126 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
127 | 127 | <input type="hidden" name="give-current-url" |
128 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
128 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
129 | 129 | <input type="hidden" name="give-form-url" |
130 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
130 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
131 | 131 | <input type="hidden" name="give-form-minimum" |
132 | - value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/> |
|
132 | + value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/> |
|
133 | 133 | |
134 | 134 | <!-- The following field is for robots only, invisible to humans: --> |
135 | 135 | <span class="give-hidden" style="display: none !important;"> |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | <?php |
142 | 142 | |
143 | 143 | //Price ID hidden field for variable (mult-level) donation forms. |
144 | - if ( give_has_variable_prices( $form_id ) ) { |
|
144 | + if (give_has_variable_prices($form_id)) { |
|
145 | 145 | //get default selected price ID. |
146 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
146 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
147 | 147 | $price_id = 0; |
148 | 148 | //loop through prices. |
149 | - foreach ( $prices as $price ) { |
|
150 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
149 | + foreach ($prices as $price) { |
|
150 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
151 | 151 | $price_id = $price['_give_id']['level_id']; |
152 | 152 | }; |
153 | 153 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | * @param int $form_id The form ID. |
164 | 164 | * @param array $args An array of form arguments. |
165 | 165 | */ |
166 | - do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
166 | + do_action('give_checkout_form_top', $form->ID, $args); |
|
167 | 167 | |
168 | 168 | /** |
169 | 169 | * Fires while outputing donation form, for payment gatways fields. |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * @param int $form_id The form ID. |
174 | 174 | * @param array $args An array of form arguments. |
175 | 175 | */ |
176 | - do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
176 | + do_action('give_payment_mode_select', $form->ID, $args); |
|
177 | 177 | |
178 | 178 | /** |
179 | 179 | * Fires while outputing donation form, after all other fields. |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @param int $form_id The form ID. |
184 | 184 | * @param array $args An array of form arguments. |
185 | 185 | */ |
186 | - do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
186 | + do_action('give_checkout_form_bottom', $form->ID, $args); |
|
187 | 187 | |
188 | 188 | ?> |
189 | 189 | </form> |
@@ -197,12 +197,12 @@ discard block |
||
197 | 197 | * @param int $form_id The form ID. |
198 | 198 | * @param array $args An array of form arguments. |
199 | 199 | */ |
200 | - do_action( 'give_post_form', $form->ID, $args ); |
|
200 | + do_action('give_post_form', $form->ID, $args); |
|
201 | 201 | |
202 | 202 | } |
203 | 203 | ?> |
204 | 204 | |
205 | - </div><!--end #give-form-<?php echo absint( $form->ID ); ?>--> |
|
205 | + </div><!--end #give-form-<?php echo absint($form->ID); ?>--> |
|
206 | 206 | <?php |
207 | 207 | |
208 | 208 | /** |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | * @param int $form_id The form ID. |
214 | 214 | * @param array $args An array of form arguments. |
215 | 215 | */ |
216 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
216 | + do_action('give_post_form_output', $form->ID, $args); |
|
217 | 217 | |
218 | 218 | $final_output = ob_get_clean(); |
219 | 219 | |
220 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
220 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -234,11 +234,11 @@ discard block |
||
234 | 234 | * |
235 | 235 | * @return string |
236 | 236 | */ |
237 | -function give_show_purchase_form( $form_id ) { |
|
237 | +function give_show_purchase_form($form_id) { |
|
238 | 238 | |
239 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
239 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
240 | 240 | |
241 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
241 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
242 | 242 | $form_id = $_POST['give_form_id']; |
243 | 243 | } |
244 | 244 | |
@@ -247,33 +247,33 @@ discard block |
||
247 | 247 | * |
248 | 248 | * @since 1.7 |
249 | 249 | */ |
250 | - do_action( 'give_donation_form_top', $form_id ); |
|
250 | + do_action('give_donation_form_top', $form_id); |
|
251 | 251 | |
252 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
252 | + if (give_can_checkout() && isset($form_id)) { |
|
253 | 253 | |
254 | 254 | /** |
255 | 255 | * Fires while displaying donation form, before registration login. |
256 | 256 | * |
257 | 257 | * @since 1.7 |
258 | 258 | */ |
259 | - do_action( 'give_donation_form_before_register_login', $form_id ); |
|
259 | + do_action('give_donation_form_before_register_login', $form_id); |
|
260 | 260 | |
261 | 261 | /** |
262 | 262 | * Fire when register/login form fields render. |
263 | 263 | * |
264 | 264 | * @since 1.7 |
265 | 265 | */ |
266 | - do_action( 'give_donation_form_register_login_fields', $form_id ); |
|
266 | + do_action('give_donation_form_register_login_fields', $form_id); |
|
267 | 267 | |
268 | 268 | /** |
269 | 269 | * Fire when credit card form fields render. |
270 | 270 | * |
271 | 271 | * @since 1.7 |
272 | 272 | */ |
273 | - do_action( 'give_donation_form_before_cc_form', $form_id ); |
|
273 | + do_action('give_donation_form_before_cc_form', $form_id); |
|
274 | 274 | |
275 | 275 | // Load the credit card form and allow gateways to load their own if they wish. |
276 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
276 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
277 | 277 | /** |
278 | 278 | * Fires while displaying donation form, credit card form fields for a given gateway. |
279 | 279 | * |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @param int $form_id The form ID. |
283 | 283 | */ |
284 | - do_action( "give_{$payment_mode}_cc_form", $form_id ); |
|
284 | + do_action("give_{$payment_mode}_cc_form", $form_id); |
|
285 | 285 | } else { |
286 | 286 | /** |
287 | 287 | * Fires while displaying donation form, credit card form fields. |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | * |
291 | 291 | * @param int $form_id The form ID. |
292 | 292 | */ |
293 | - do_action( 'give_cc_form', $form_id ); |
|
293 | + do_action('give_cc_form', $form_id); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | /** |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | * |
299 | 299 | * @since 1.7 |
300 | 300 | */ |
301 | - do_action( 'give_donation_form_after_cc_form', $form_id ); |
|
301 | + do_action('give_donation_form_after_cc_form', $form_id); |
|
302 | 302 | |
303 | 303 | } else { |
304 | 304 | /** |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * |
307 | 307 | * @since 1.7 |
308 | 308 | */ |
309 | - do_action( 'give_donation_form_no_access', $form_id ); |
|
309 | + do_action('give_donation_form_no_access', $form_id); |
|
310 | 310 | |
311 | 311 | } |
312 | 312 | |
@@ -315,10 +315,10 @@ discard block |
||
315 | 315 | * |
316 | 316 | * @since 1.7 |
317 | 317 | */ |
318 | - do_action( 'give_donation_form_bottom', $form_id ); |
|
318 | + do_action('give_donation_form_bottom', $form_id); |
|
319 | 319 | } |
320 | 320 | |
321 | -add_action( 'give_donation_form', 'give_show_purchase_form' ); |
|
321 | +add_action('give_donation_form', 'give_show_purchase_form'); |
|
322 | 322 | |
323 | 323 | /** |
324 | 324 | * Give Show Login/Register Form Fields. |
@@ -329,11 +329,11 @@ discard block |
||
329 | 329 | * |
330 | 330 | * @return void |
331 | 331 | */ |
332 | -function give_show_register_login_fields( $form_id ) { |
|
332 | +function give_show_register_login_fields($form_id) { |
|
333 | 333 | |
334 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
334 | + $show_register_form = give_show_login_register_option($form_id); |
|
335 | 335 | |
336 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
336 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : |
|
337 | 337 | ?> |
338 | 338 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
339 | 339 | <?php |
@@ -342,11 +342,11 @@ discard block |
||
342 | 342 | * |
343 | 343 | * @since 1.7 |
344 | 344 | */ |
345 | - do_action( 'give_donation_form_register_fields', $form_id ); |
|
345 | + do_action('give_donation_form_register_fields', $form_id); |
|
346 | 346 | ?> |
347 | 347 | </div> |
348 | 348 | <?php |
349 | - elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
349 | + elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : |
|
350 | 350 | ?> |
351 | 351 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
352 | 352 | <?php |
@@ -355,23 +355,23 @@ discard block |
||
355 | 355 | * |
356 | 356 | * @since 1.7 |
357 | 357 | */ |
358 | - do_action( 'give_donation_form_login_fields', $form_id ); |
|
358 | + do_action('give_donation_form_login_fields', $form_id); |
|
359 | 359 | ?> |
360 | 360 | </div> |
361 | 361 | <?php |
362 | 362 | endif; |
363 | 363 | |
364 | - if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
364 | + if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
365 | 365 | /** |
366 | 366 | * Fire when user info render. |
367 | 367 | * |
368 | 368 | * @since 1.7 |
369 | 369 | */ |
370 | - do_action( 'give_donation_form_after_user_info', $form_id ); |
|
370 | + do_action('give_donation_form_after_user_info', $form_id); |
|
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
374 | -add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' ); |
|
374 | +add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields'); |
|
375 | 375 | |
376 | 376 | /** |
377 | 377 | * Donation Amount Field. |
@@ -385,16 +385,16 @@ discard block |
||
385 | 385 | * |
386 | 386 | * @return void |
387 | 387 | */ |
388 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
388 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
389 | 389 | |
390 | 390 | $give_options = give_get_settings(); |
391 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
392 | - $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
393 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
394 | - $symbol = give_currency_symbol( give_get_currency() ); |
|
395 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
396 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
397 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
391 | + $variable_pricing = give_has_variable_prices($form_id); |
|
392 | + $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
393 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
394 | + $symbol = give_currency_symbol(give_get_currency()); |
|
395 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
396 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
397 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
398 | 398 | |
399 | 399 | /** |
400 | 400 | * Fires while displaying donation form, before donation level fields. |
@@ -404,20 +404,20 @@ discard block |
||
404 | 404 | * @param int $form_id The form ID. |
405 | 405 | * @param array $args An array of form arguments. |
406 | 406 | */ |
407 | - do_action( 'give_before_donation_levels', $form_id, $args ); |
|
407 | + do_action('give_before_donation_levels', $form_id, $args); |
|
408 | 408 | |
409 | 409 | //Set Price, No Custom Amount Allowed means hidden price field |
410 | - if ( ! give_is_setting_enabled( $allow_custom_amount ) ) { |
|
410 | + if ( ! give_is_setting_enabled($allow_custom_amount)) { |
|
411 | 411 | ?> |
412 | - <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
412 | + <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
413 | 413 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
414 | 414 | value="<?php echo $default_amount; ?>" required aria-required="true"/> |
415 | 415 | <div class="set-price give-donation-amount form-row-wide"> |
416 | - <?php if ( $currency_position == 'before' ) { |
|
416 | + <?php if ($currency_position == 'before') { |
|
417 | 417 | echo $currency_output; |
418 | 418 | } ?> |
419 | 419 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
420 | - <?php if ( $currency_position == 'after' ) { |
|
420 | + <?php if ($currency_position == 'after') { |
|
421 | 421 | echo $currency_output; |
422 | 422 | } ?> |
423 | 423 | </div> |
@@ -427,13 +427,13 @@ discard block |
||
427 | 427 | ?> |
428 | 428 | <div class="give-total-wrap"> |
429 | 429 | <div class="give-donation-amount form-row-wide"> |
430 | - <?php if ( $currency_position == 'before' ) { |
|
430 | + <?php if ($currency_position == 'before') { |
|
431 | 431 | echo $currency_output; |
432 | 432 | } ?> |
433 | - <label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
433 | + <label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
434 | 434 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" |
435 | 435 | placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
436 | - <?php if ( $currency_position == 'after' ) { |
|
436 | + <?php if ($currency_position == 'after') { |
|
437 | 437 | echo $currency_output; |
438 | 438 | } ?> |
439 | 439 | </div> |
@@ -448,16 +448,16 @@ discard block |
||
448 | 448 | * @param int $form_id The form ID. |
449 | 449 | * @param array $args An array of form arguments. |
450 | 450 | */ |
451 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
451 | + do_action('give_after_donation_amount', $form_id, $args); |
|
452 | 452 | |
453 | 453 | //Custom Amount Text |
454 | - if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { ?> |
|
454 | + if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { ?> |
|
455 | 455 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
456 | 456 | <?php } |
457 | 457 | |
458 | 458 | //Output Variable Pricing Levels. |
459 | - if ( $variable_pricing ) { |
|
460 | - give_output_levels( $form_id ); |
|
459 | + if ($variable_pricing) { |
|
460 | + give_output_levels($form_id); |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | /** |
@@ -468,10 +468,10 @@ discard block |
||
468 | 468 | * @param int $form_id The form ID. |
469 | 469 | * @param array $args An array of form arguments. |
470 | 470 | */ |
471 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
471 | + do_action('give_after_donation_levels', $form_id, $args); |
|
472 | 472 | } |
473 | 473 | |
474 | -add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
474 | +add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
475 | 475 | |
476 | 476 | /** |
477 | 477 | * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons. |
@@ -482,32 +482,32 @@ discard block |
||
482 | 482 | * |
483 | 483 | * @return string Donation levels. |
484 | 484 | */ |
485 | -function give_output_levels( $form_id ) { |
|
485 | +function give_output_levels($form_id) { |
|
486 | 486 | |
487 | 487 | //Get variable pricing. |
488 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
489 | - $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
|
490 | - $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
491 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
492 | - if ( empty( $custom_amount_text ) ) { |
|
493 | - $custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' ); |
|
488 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
489 | + $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
490 | + $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
491 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
492 | + if (empty($custom_amount_text)) { |
|
493 | + $custom_amount_text = esc_html__('Give a Custom Amount', 'give'); |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | $output = ''; |
497 | 497 | $counter = 0; |
498 | 498 | |
499 | - switch ( $display_style ) { |
|
499 | + switch ($display_style) { |
|
500 | 500 | case 'buttons': |
501 | 501 | |
502 | 502 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
503 | 503 | |
504 | - foreach ( $prices as $price ) { |
|
505 | - $counter ++; |
|
506 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
507 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price ); |
|
504 | + foreach ($prices as $price) { |
|
505 | + $counter++; |
|
506 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
507 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price); |
|
508 | 508 | |
509 | 509 | $output .= '<li>'; |
510 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
510 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
511 | 511 | $output .= $level_text; |
512 | 512 | $output .= '</button>'; |
513 | 513 | $output .= '</li>'; |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | } |
516 | 516 | |
517 | 517 | //Custom Amount. |
518 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
518 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
519 | 519 | $output .= '<li>'; |
520 | 520 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
521 | 521 | $output .= $custom_amount_text; |
@@ -531,23 +531,23 @@ discard block |
||
531 | 531 | |
532 | 532 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
533 | 533 | |
534 | - foreach ( $prices as $price ) { |
|
535 | - $counter ++; |
|
536 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
537 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
534 | + foreach ($prices as $price) { |
|
535 | + $counter++; |
|
536 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
537 | + $level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
538 | 538 | |
539 | 539 | $output .= '<li>'; |
540 | - $output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
541 | - $output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>'; |
|
540 | + $output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
541 | + $output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>'; |
|
542 | 542 | $output .= '</li>'; |
543 | 543 | |
544 | 544 | } |
545 | 545 | |
546 | 546 | //Custom Amount. |
547 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
547 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
548 | 548 | $output .= '<li>'; |
549 | 549 | $output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">'; |
550 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
550 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
551 | 551 | $output .= '</li>'; |
552 | 552 | } |
553 | 553 | |
@@ -557,23 +557,23 @@ discard block |
||
557 | 557 | |
558 | 558 | case 'dropdown': |
559 | 559 | |
560 | - $output .= '<label for="give-donation-level" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
561 | - $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">'; |
|
560 | + $output .= '<label for="give-donation-level" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>'; |
|
561 | + $output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">'; |
|
562 | 562 | |
563 | 563 | //first loop through prices. |
564 | - foreach ( $prices as $price ) { |
|
565 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
566 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
564 | + foreach ($prices as $price) { |
|
565 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
566 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
567 | 567 | |
568 | - $output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
568 | + $output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
569 | 569 | $output .= $level_text; |
570 | 570 | $output .= '</option>'; |
571 | 571 | |
572 | 572 | } |
573 | 573 | |
574 | 574 | //Custom Amount. |
575 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
576 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
575 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
576 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
577 | 577 | } |
578 | 578 | |
579 | 579 | $output .= '</select>'; |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | break; |
582 | 582 | } |
583 | 583 | |
584 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
584 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | /** |
@@ -596,27 +596,27 @@ discard block |
||
596 | 596 | * |
597 | 597 | * @return string Checkout button. |
598 | 598 | */ |
599 | -function give_display_checkout_button( $form_id, $args ) { |
|
599 | +function give_display_checkout_button($form_id, $args) { |
|
600 | 600 | |
601 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
601 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
602 | 602 | ? $args['display_style'] |
603 | - : get_post_meta( $form_id, '_give_payment_display', true ); |
|
603 | + : get_post_meta($form_id, '_give_payment_display', true); |
|
604 | 604 | |
605 | - if( 'button' === $display_option ) { |
|
605 | + if ('button' === $display_option) { |
|
606 | 606 | $display_option = 'modal'; |
607 | - }elseif ( $display_option === 'onpage' ) { |
|
607 | + }elseif ($display_option === 'onpage') { |
|
608 | 608 | return ''; |
609 | 609 | } |
610 | 610 | |
611 | - $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
|
612 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
611 | + $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
612 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
613 | 613 | |
614 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
614 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
615 | 615 | |
616 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
616 | + echo apply_filters('give_display_checkout_button', $output); |
|
617 | 617 | } |
618 | 618 | |
619 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
619 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
620 | 620 | |
621 | 621 | /** |
622 | 622 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -627,57 +627,57 @@ discard block |
||
627 | 627 | * |
628 | 628 | * @return void |
629 | 629 | */ |
630 | -function give_user_info_fields( $form_id ) { |
|
630 | +function give_user_info_fields($form_id) { |
|
631 | 631 | // Get user info. |
632 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
632 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
633 | 633 | |
634 | 634 | /** |
635 | 635 | * Fire before user personal information fields |
636 | 636 | * |
637 | 637 | * @since 1.7 |
638 | 638 | */ |
639 | - do_action( 'give_donation_form_before_personal_info', $form_id ); |
|
639 | + do_action('give_donation_form_before_personal_info', $form_id); |
|
640 | 640 | ?> |
641 | 641 | <fieldset id="give_checkout_user_info"> |
642 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend> |
|
642 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend> |
|
643 | 643 | <p id="give-first-name-wrap" class="form-row form-row-first"> |
644 | 644 | <label class="give-label" for="give-first"> |
645 | - <?php esc_html_e( 'First Name', 'give' ); ?> |
|
646 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?> |
|
645 | + <?php esc_html_e('First Name', 'give'); ?> |
|
646 | + <?php if (give_field_is_required('give_first', $form_id)) : ?> |
|
647 | 647 | <span class="give-required-indicator">*</span> |
648 | 648 | <?php endif ?> |
649 | 649 | <span class="give-tooltip give-icon give-icon-question" |
650 | - data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
650 | + data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
651 | 651 | </label> |
652 | 652 | <input |
653 | 653 | class="give-input required" |
654 | 654 | type="text" |
655 | 655 | name="give_first" |
656 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" |
|
656 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" |
|
657 | 657 | id="give-first" |
658 | - value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>" |
|
659 | - <?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
658 | + value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>" |
|
659 | + <?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
660 | 660 | /> |
661 | 661 | </p> |
662 | 662 | |
663 | 663 | <p id="give-last-name-wrap" class="form-row form-row-last"> |
664 | 664 | <label class="give-label" for="give-last"> |
665 | - <?php esc_html_e( 'Last Name', 'give' ); ?> |
|
666 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?> |
|
665 | + <?php esc_html_e('Last Name', 'give'); ?> |
|
666 | + <?php if (give_field_is_required('give_last', $form_id)) : ?> |
|
667 | 667 | <span class="give-required-indicator">*</span> |
668 | 668 | <?php endif ?> |
669 | 669 | <span class="give-tooltip give-icon give-icon-question" |
670 | - data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
670 | + data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
671 | 671 | </label> |
672 | 672 | |
673 | 673 | <input |
674 | - class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>" |
|
674 | + class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>" |
|
675 | 675 | type="text" |
676 | 676 | name="give_last" |
677 | 677 | id="give-last" |
678 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" |
|
679 | - value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>" |
|
680 | - <?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
678 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" |
|
679 | + value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>" |
|
680 | + <?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
681 | 681 | /> |
682 | 682 | </p> |
683 | 683 | |
@@ -687,26 +687,26 @@ discard block |
||
687 | 687 | * |
688 | 688 | * @since 1.7 |
689 | 689 | */ |
690 | - do_action( 'give_donation_form_before_email', $form_id ); |
|
690 | + do_action('give_donation_form_before_email', $form_id); |
|
691 | 691 | ?> |
692 | 692 | <p id="give-email-wrap" class="form-row form-row-wide"> |
693 | 693 | <label class="give-label" for="give-email"> |
694 | - <?php esc_html_e( 'Email Address', 'give' ); ?> |
|
695 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
694 | + <?php esc_html_e('Email Address', 'give'); ?> |
|
695 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
696 | 696 | <span class="give-required-indicator">*</span> |
697 | 697 | <?php } ?> |
698 | 698 | <span class="give-tooltip give-icon give-icon-question" |
699 | - data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span> |
|
699 | + data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span> |
|
700 | 700 | </label> |
701 | 701 | |
702 | 702 | <input |
703 | 703 | class="give-input required" |
704 | 704 | type="email" |
705 | 705 | name="give_email" |
706 | - placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>" |
|
706 | + placeholder="<?php esc_attr_e('Email Address', 'give'); ?>" |
|
707 | 707 | id="give-email" |
708 | - value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>" |
|
709 | - <?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
708 | + value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>" |
|
709 | + <?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
710 | 710 | /> |
711 | 711 | |
712 | 712 | </p> |
@@ -716,14 +716,14 @@ discard block |
||
716 | 716 | * |
717 | 717 | * @since 1.7 |
718 | 718 | */ |
719 | - do_action( 'give_donation_form_after_email', $form_id ); |
|
719 | + do_action('give_donation_form_after_email', $form_id); |
|
720 | 720 | |
721 | 721 | /** |
722 | 722 | * Fire after personal email field |
723 | 723 | * |
724 | 724 | * @since 1.7 |
725 | 725 | */ |
726 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
726 | + do_action('give_donation_form_user_info', $form_id); |
|
727 | 727 | ?> |
728 | 728 | </fieldset> |
729 | 729 | <?php |
@@ -732,11 +732,11 @@ discard block |
||
732 | 732 | * |
733 | 733 | * @since 1.7 |
734 | 734 | */ |
735 | - do_action( 'give_donation_form_after_personal_info', $form_id ); |
|
735 | + do_action('give_donation_form_after_personal_info', $form_id); |
|
736 | 736 | } |
737 | 737 | |
738 | -add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' ); |
|
739 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
738 | +add_action('give_donation_form_after_user_info', 'give_user_info_fields'); |
|
739 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
740 | 740 | |
741 | 741 | /** |
742 | 742 | * Renders the credit card info form. |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | * |
748 | 748 | * @return void |
749 | 749 | */ |
750 | -function give_get_cc_form( $form_id ) { |
|
750 | +function give_get_cc_form($form_id) { |
|
751 | 751 | |
752 | 752 | ob_start(); |
753 | 753 | |
@@ -758,53 +758,53 @@ discard block |
||
758 | 758 | * |
759 | 759 | * @param int $form_id The form ID. |
760 | 760 | */ |
761 | - do_action( 'give_before_cc_fields', $form_id ); |
|
761 | + do_action('give_before_cc_fields', $form_id); |
|
762 | 762 | ?> |
763 | 763 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
764 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend> |
|
765 | - <?php if ( is_ssl() ) : ?> |
|
764 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend> |
|
765 | + <?php if (is_ssl()) : ?> |
|
766 | 766 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
767 | 767 | <span class="give-icon padlock"></span> |
768 | - <span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
768 | + <span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
769 | 769 | </div> |
770 | 770 | <?php endif; ?> |
771 | 771 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
772 | 772 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
773 | - <?php esc_html_e( 'Card Number', 'give' ); ?> |
|
773 | + <?php esc_html_e('Card Number', 'give'); ?> |
|
774 | 774 | <span class="give-required-indicator">*</span> |
775 | 775 | <span class="give-tooltip give-icon give-icon-question" |
776 | - data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
776 | + data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
777 | 777 | <span class="card-type"></span> |
778 | 778 | </label> |
779 | 779 | |
780 | 780 | <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" |
781 | - class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>" |
|
781 | + class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>" |
|
782 | 782 | required aria-required="true"/> |
783 | 783 | </p> |
784 | 784 | |
785 | 785 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third"> |
786 | 786 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
787 | - <?php esc_html_e( 'CVC', 'give' ); ?> |
|
787 | + <?php esc_html_e('CVC', 'give'); ?> |
|
788 | 788 | <span class="give-required-indicator">*</span> |
789 | 789 | <span class="give-tooltip give-icon give-icon-question" |
790 | - data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
790 | + data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
791 | 791 | </label> |
792 | 792 | |
793 | 793 | <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" |
794 | - class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>" |
|
794 | + class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>" |
|
795 | 795 | required aria-required="true"/> |
796 | 796 | </p> |
797 | 797 | |
798 | 798 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds"> |
799 | 799 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
800 | - <?php esc_html_e( 'Name on the Card', 'give' ); ?> |
|
800 | + <?php esc_html_e('Name on the Card', 'give'); ?> |
|
801 | 801 | <span class="give-required-indicator">*</span> |
802 | 802 | <span class="give-tooltip give-icon give-icon-question" |
803 | - data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
803 | + data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
804 | 804 | </label> |
805 | 805 | |
806 | 806 | <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" |
807 | - class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>" |
|
807 | + class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>" |
|
808 | 808 | required aria-required="true"/> |
809 | 809 | </p> |
810 | 810 | <?php |
@@ -815,14 +815,14 @@ discard block |
||
815 | 815 | * |
816 | 816 | * @param int $form_id The form ID. |
817 | 817 | */ |
818 | - do_action( 'give_before_cc_expiration' ); |
|
818 | + do_action('give_before_cc_expiration'); |
|
819 | 819 | ?> |
820 | 820 | <p class="card-expiration form-row form-row-one-third"> |
821 | 821 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
822 | - <?php esc_html_e( 'Expiration', 'give' ); ?> |
|
822 | + <?php esc_html_e('Expiration', 'give'); ?> |
|
823 | 823 | <span class="give-required-indicator">*</span> |
824 | 824 | <span class="give-tooltip give-icon give-icon-question" |
825 | - data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
825 | + data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
826 | 826 | </label> |
827 | 827 | |
828 | 828 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | class="card-expiry-year"/> |
832 | 832 | |
833 | 833 | <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" |
834 | - class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" |
|
834 | + class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" |
|
835 | 835 | required aria-required="true"/> |
836 | 836 | </p> |
837 | 837 | <?php |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | * |
843 | 843 | * @param int $form_id The form ID. |
844 | 844 | */ |
845 | - do_action( 'give_after_cc_expiration', $form_id ); |
|
845 | + do_action('give_after_cc_expiration', $form_id); |
|
846 | 846 | ?> |
847 | 847 | </fieldset> |
848 | 848 | <?php |
@@ -853,12 +853,12 @@ discard block |
||
853 | 853 | * |
854 | 854 | * @param int $form_id The form ID. |
855 | 855 | */ |
856 | - do_action( 'give_after_cc_fields', $form_id ); |
|
856 | + do_action('give_after_cc_fields', $form_id); |
|
857 | 857 | |
858 | 858 | echo ob_get_clean(); |
859 | 859 | } |
860 | 860 | |
861 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
861 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
862 | 862 | |
863 | 863 | /** |
864 | 864 | * Outputs the default credit card address fields. |
@@ -869,24 +869,24 @@ discard block |
||
869 | 869 | * |
870 | 870 | * @return void |
871 | 871 | */ |
872 | -function give_default_cc_address_fields( $form_id ) { |
|
872 | +function give_default_cc_address_fields($form_id) { |
|
873 | 873 | // Get user info. |
874 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
874 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
875 | 875 | |
876 | 876 | $logged_in = is_user_logged_in(); |
877 | 877 | |
878 | - if ( $logged_in ) { |
|
879 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
878 | + if ($logged_in) { |
|
879 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
880 | 880 | } |
881 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
882 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
883 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
884 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
881 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
882 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
883 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
884 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
885 | 885 | |
886 | 886 | ob_start(); |
887 | 887 | ?> |
888 | 888 | <fieldset id="give_cc_address" class="cc-address"> |
889 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend> |
|
889 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend> |
|
890 | 890 | <?php |
891 | 891 | /** |
892 | 892 | * Fires while rendering credit card billing form, before address fields. |
@@ -895,79 +895,79 @@ discard block |
||
895 | 895 | * |
896 | 896 | * @param int $form_id The form ID. |
897 | 897 | */ |
898 | - do_action( 'give_cc_billing_top' ); |
|
898 | + do_action('give_cc_billing_top'); |
|
899 | 899 | ?> |
900 | 900 | <p id="give-card-address-wrap" class="form-row form-row-two-thirds"> |
901 | 901 | <label for="card_address" class="give-label"> |
902 | - <?php esc_html_e( 'Address 1', 'give' ); ?> |
|
902 | + <?php esc_html_e('Address 1', 'give'); ?> |
|
903 | 903 | <?php |
904 | - if ( give_field_is_required( 'card_address', $form_id ) ) : ?> |
|
904 | + if (give_field_is_required('card_address', $form_id)) : ?> |
|
905 | 905 | <span class="give-required-indicator">*</span> |
906 | 906 | <?php endif; ?> |
907 | 907 | <span class="give-tooltip give-icon give-icon-question" |
908 | - data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
908 | + data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
909 | 909 | </label> |
910 | 910 | |
911 | 911 | <input |
912 | 912 | type="text" |
913 | 913 | id="card_address" |
914 | 914 | name="card_address" |
915 | - class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>" |
|
916 | - placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>" |
|
917 | - value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>" |
|
918 | - <?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
915 | + class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>" |
|
916 | + placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>" |
|
917 | + value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>" |
|
918 | + <?php echo(give_field_is_required('card_address', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
919 | 919 | /> |
920 | 920 | </p> |
921 | 921 | |
922 | 922 | <p id="give-card-address-2-wrap" class="form-row form-row-one-third"> |
923 | 923 | <label for="card_address_2" class="give-label"> |
924 | - <?php esc_html_e( 'Address 2', 'give' ); ?> |
|
925 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?> |
|
924 | + <?php esc_html_e('Address 2', 'give'); ?> |
|
925 | + <?php if (give_field_is_required('card_address_2', $form_id)) : ?> |
|
926 | 926 | <span class="give-required-indicator">*</span> |
927 | 927 | <?php endif; ?> |
928 | 928 | <span class="give-tooltip give-icon give-icon-question" |
929 | - data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
929 | + data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
930 | 930 | </label> |
931 | 931 | |
932 | 932 | <input |
933 | 933 | type="text" |
934 | 934 | id="card_address_2" |
935 | 935 | name="card_address_2" |
936 | - class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>" |
|
937 | - placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>" |
|
938 | - value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>" |
|
939 | - <?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
936 | + class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>" |
|
937 | + placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>" |
|
938 | + value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>" |
|
939 | + <?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
940 | 940 | /> |
941 | 941 | </p> |
942 | 942 | |
943 | 943 | <p id="give-card-city-wrap" class="form-row form-row-two-thirds"> |
944 | 944 | <label for="card_city" class="give-label"> |
945 | - <?php esc_html_e( 'City', 'give' ); ?> |
|
946 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?> |
|
945 | + <?php esc_html_e('City', 'give'); ?> |
|
946 | + <?php if (give_field_is_required('card_city', $form_id)) : ?> |
|
947 | 947 | <span class="give-required-indicator">*</span> |
948 | 948 | <?php endif; ?> |
949 | 949 | <span class="give-tooltip give-icon give-icon-question" |
950 | - data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
950 | + data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span> |
|
951 | 951 | </label> |
952 | 952 | <input |
953 | 953 | type="text" |
954 | 954 | id="card_city" |
955 | 955 | name="card_city" |
956 | - class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>" |
|
957 | - placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" |
|
958 | - value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>" |
|
959 | - <?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
956 | + class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>" |
|
957 | + placeholder="<?php esc_attr_e('City', 'give'); ?>" |
|
958 | + value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>" |
|
959 | + <?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
960 | 960 | /> |
961 | 961 | </p> |
962 | 962 | |
963 | 963 | <p id="give-card-zip-wrap" class="form-row form-row-one-third"> |
964 | 964 | <label for="card_zip" class="give-label"> |
965 | - <?php esc_html_e( 'Zip / Postal Code', 'give' ); ?> |
|
966 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?> |
|
965 | + <?php esc_html_e('Zip / Postal Code', 'give'); ?> |
|
966 | + <?php if (give_field_is_required('card_zip', $form_id)) : ?> |
|
967 | 967 | <span class="give-required-indicator">*</span> |
968 | 968 | <?php endif; ?> |
969 | 969 | <span class="give-tooltip give-icon give-icon-question" |
970 | - data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
970 | + data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
971 | 971 | </label> |
972 | 972 | |
973 | 973 | <input |
@@ -975,40 +975,40 @@ discard block |
||
975 | 975 | size="4" |
976 | 976 | id="card_zip" |
977 | 977 | name="card_zip" |
978 | - class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>" |
|
979 | - placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" |
|
980 | - value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>" |
|
981 | - <?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
978 | + class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>" |
|
979 | + placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" |
|
980 | + value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>" |
|
981 | + <?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
982 | 982 | /> |
983 | 983 | </p> |
984 | 984 | |
985 | 985 | <p id="give-card-country-wrap" class="form-row form-row-first"> |
986 | 986 | <label for="billing_country" class="give-label"> |
987 | - <?php esc_html_e( 'Country', 'give' ); ?> |
|
988 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?> |
|
987 | + <?php esc_html_e('Country', 'give'); ?> |
|
988 | + <?php if (give_field_is_required('billing_country', $form_id)) : ?> |
|
989 | 989 | <span class="give-required-indicator">*</span> |
990 | 990 | <?php endif; ?> |
991 | 991 | <span class="give-tooltip give-icon give-icon-question" |
992 | - data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
992 | + data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span> |
|
993 | 993 | </label> |
994 | 994 | |
995 | 995 | <select |
996 | 996 | name="billing_country" |
997 | 997 | id="billing_country" |
998 | - class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>" |
|
999 | - <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
998 | + class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>" |
|
999 | + <?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
1000 | 1000 | > |
1001 | 1001 | <?php |
1002 | 1002 | |
1003 | 1003 | $selected_country = give_get_country(); |
1004 | 1004 | |
1005 | - if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) { |
|
1005 | + if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) { |
|
1006 | 1006 | $selected_country = $give_user_info['billing_country']; |
1007 | 1007 | } |
1008 | 1008 | |
1009 | 1009 | $countries = give_get_country_list(); |
1010 | - foreach ( $countries as $country_code => $country ) { |
|
1011 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
1010 | + foreach ($countries as $country_code => $country) { |
|
1011 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
1012 | 1012 | } |
1013 | 1013 | ?> |
1014 | 1014 | </select> |
@@ -1016,37 +1016,37 @@ discard block |
||
1016 | 1016 | |
1017 | 1017 | <p id="give-card-state-wrap" class="form-row form-row-last"> |
1018 | 1018 | <label for="card_state" class="give-label"> |
1019 | - <?php esc_html_e( 'State / Province', 'give' ); ?> |
|
1020 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) : ?> |
|
1019 | + <?php esc_html_e('State / Province', 'give'); ?> |
|
1020 | + <?php if (give_field_is_required('card_state', $form_id)) : ?> |
|
1021 | 1021 | <span class="give-required-indicator">*</span> |
1022 | 1022 | <?php endif; ?> |
1023 | 1023 | <span class="give-tooltip give-icon give-icon-question" |
1024 | - data-tooltip="<?php esc_attr_e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
1024 | + data-tooltip="<?php esc_attr_e('The state or province for your billing address.', 'give'); ?>"></span> |
|
1025 | 1025 | </label> |
1026 | 1026 | |
1027 | 1027 | <?php |
1028 | 1028 | $selected_state = give_get_state(); |
1029 | - $states = give_get_states( $selected_country ); |
|
1029 | + $states = give_get_states($selected_country); |
|
1030 | 1030 | |
1031 | - if ( ! empty( $give_user_info['card_state'] ) ) { |
|
1031 | + if ( ! empty($give_user_info['card_state'])) { |
|
1032 | 1032 | $selected_state = $give_user_info['card_state']; |
1033 | 1033 | } |
1034 | 1034 | |
1035 | - if ( ! empty( $states ) ) : ?> |
|
1035 | + if ( ! empty($states)) : ?> |
|
1036 | 1036 | <select |
1037 | 1037 | name="card_state" |
1038 | 1038 | id="card_state" |
1039 | - class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>" |
|
1040 | - <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>> |
|
1039 | + class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>" |
|
1040 | + <?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>> |
|
1041 | 1041 | <?php |
1042 | - foreach ( $states as $state_code => $state ) { |
|
1043 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
1042 | + foreach ($states as $state_code => $state) { |
|
1043 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
1044 | 1044 | } |
1045 | 1045 | ?> |
1046 | 1046 | </select> |
1047 | 1047 | <?php else : ?> |
1048 | 1048 | <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" |
1049 | - placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/> |
|
1049 | + placeholder="<?php esc_attr_e('State / Province', 'give'); ?>"/> |
|
1050 | 1050 | <?php endif; ?> |
1051 | 1051 | </p> |
1052 | 1052 | <?php |
@@ -1057,14 +1057,14 @@ discard block |
||
1057 | 1057 | * |
1058 | 1058 | * @param int $form_id The form ID. |
1059 | 1059 | */ |
1060 | - do_action( 'give_cc_billing_bottom' ); |
|
1060 | + do_action('give_cc_billing_bottom'); |
|
1061 | 1061 | ?> |
1062 | 1062 | </fieldset> |
1063 | 1063 | <?php |
1064 | 1064 | echo ob_get_clean(); |
1065 | 1065 | } |
1066 | 1066 | |
1067 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
1067 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
1068 | 1068 | |
1069 | 1069 | |
1070 | 1070 | /** |
@@ -1076,27 +1076,27 @@ discard block |
||
1076 | 1076 | * |
1077 | 1077 | * @return string |
1078 | 1078 | */ |
1079 | -function give_get_register_fields( $form_id ) { |
|
1079 | +function give_get_register_fields($form_id) { |
|
1080 | 1080 | |
1081 | 1081 | global $user_ID; |
1082 | 1082 | |
1083 | - if ( is_user_logged_in() ) { |
|
1084 | - $user_data = get_userdata( $user_ID ); |
|
1083 | + if (is_user_logged_in()) { |
|
1084 | + $user_data = get_userdata($user_ID); |
|
1085 | 1085 | } |
1086 | 1086 | |
1087 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
1087 | + $show_register_form = give_show_login_register_option($form_id); |
|
1088 | 1088 | |
1089 | 1089 | ob_start(); ?> |
1090 | 1090 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
1091 | 1091 | |
1092 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
1092 | + <?php if ($show_register_form == 'both') { ?> |
|
1093 | 1093 | <div class="give-login-account-wrap"> |
1094 | - <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?> |
|
1095 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" |
|
1096 | - data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a> |
|
1094 | + <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?> |
|
1095 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" |
|
1096 | + data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a> |
|
1097 | 1097 | </p> |
1098 | 1098 | <p class="give-loading-text"> |
1099 | - <span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></p> |
|
1099 | + <span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></p> |
|
1100 | 1100 | </div> |
1101 | 1101 | <?php } ?> |
1102 | 1102 | |
@@ -1108,15 +1108,15 @@ discard block |
||
1108 | 1108 | * |
1109 | 1109 | * @param int $form_id The form ID. |
1110 | 1110 | */ |
1111 | - do_action( 'give_register_fields_before', $form_id ); |
|
1111 | + do_action('give_register_fields_before', $form_id); |
|
1112 | 1112 | ?> |
1113 | 1113 | |
1114 | 1114 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
1115 | 1115 | <legend> |
1116 | 1116 | <?php |
1117 | - echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) ); |
|
1118 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1119 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
1117 | + echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give')); |
|
1118 | + if ( ! give_logged_in_only($form_id)) { |
|
1119 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
1120 | 1120 | } |
1121 | 1121 | ?> |
1122 | 1122 | </legend> |
@@ -1128,52 +1128,52 @@ discard block |
||
1128 | 1128 | * |
1129 | 1129 | * @param int $form_id The form ID. |
1130 | 1130 | */ |
1131 | - do_action( 'give_register_account_fields_before', $form_id ); |
|
1131 | + do_action('give_register_account_fields_before', $form_id); |
|
1132 | 1132 | ?> |
1133 | 1133 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third form-row-first"> |
1134 | 1134 | <label for="give-user-login-<?php echo $form_id; ?>"> |
1135 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
1136 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1135 | + <?php esc_html_e('Username', 'give'); ?> |
|
1136 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1137 | 1137 | <span class="give-required-indicator">*</span> |
1138 | 1138 | <?php } ?> |
1139 | 1139 | <span class="give-tooltip give-icon give-icon-question" |
1140 | - data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
1140 | + data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
1141 | 1141 | </label> |
1142 | 1142 | |
1143 | 1143 | <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input" |
1144 | 1144 | type="text" |
1145 | - placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1145 | + placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1146 | 1146 | </div> |
1147 | 1147 | |
1148 | 1148 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="form-row form-row-one-third"> |
1149 | 1149 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
1150 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
1151 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1150 | + <?php esc_html_e('Password', 'give'); ?> |
|
1151 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1152 | 1152 | <span class="give-required-indicator">*</span> |
1153 | 1153 | <?php } ?> |
1154 | 1154 | <span class="give-tooltip give-icon give-icon-question" |
1155 | - data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
1155 | + data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span> |
|
1156 | 1156 | </label> |
1157 | 1157 | |
1158 | 1158 | <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input" |
1159 | - placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>" |
|
1160 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1159 | + placeholder="<?php esc_attr_e('Password', 'give'); ?>" |
|
1160 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1161 | 1161 | </div> |
1162 | 1162 | |
1163 | 1163 | <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" |
1164 | 1164 | class="give-register-password form-row form-row-one-third"> |
1165 | 1165 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
1166 | - <?php esc_html_e( 'Confirm PW', 'give' ); ?> |
|
1167 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1166 | + <?php esc_html_e('Confirm PW', 'give'); ?> |
|
1167 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1168 | 1168 | <span class="give-required-indicator">*</span> |
1169 | 1169 | <?php } ?> |
1170 | 1170 | <span class="give-tooltip give-icon give-icon-question" |
1171 | - data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
1171 | + data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
1172 | 1172 | </label> |
1173 | 1173 | |
1174 | 1174 | <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" |
1175 | - class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>" |
|
1176 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1175 | + class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>" |
|
1176 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1177 | 1177 | </div> |
1178 | 1178 | <?php |
1179 | 1179 | /** |
@@ -1183,7 +1183,7 @@ discard block |
||
1183 | 1183 | * |
1184 | 1184 | * @param int $form_id The form ID. |
1185 | 1185 | */ |
1186 | - do_action( 'give_register_account_fields_after', $form_id ); |
|
1186 | + do_action('give_register_account_fields_after', $form_id); |
|
1187 | 1187 | ?> |
1188 | 1188 | </fieldset> |
1189 | 1189 | |
@@ -1195,7 +1195,7 @@ discard block |
||
1195 | 1195 | * |
1196 | 1196 | * @param int $form_id The form ID. |
1197 | 1197 | */ |
1198 | - do_action( 'give_register_fields_after', $form_id ); |
|
1198 | + do_action('give_register_fields_after', $form_id); |
|
1199 | 1199 | ?> |
1200 | 1200 | |
1201 | 1201 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
@@ -1206,7 +1206,7 @@ discard block |
||
1206 | 1206 | * |
1207 | 1207 | * @since 1.7 |
1208 | 1208 | */ |
1209 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
1209 | + do_action('give_donation_form_user_info', $form_id); |
|
1210 | 1210 | ?> |
1211 | 1211 | |
1212 | 1212 | </fieldset> |
@@ -1214,7 +1214,7 @@ discard block |
||
1214 | 1214 | echo ob_get_clean(); |
1215 | 1215 | } |
1216 | 1216 | |
1217 | -add_action( 'give_donation_form_register_fields', 'give_get_register_fields' ); |
|
1217 | +add_action('give_donation_form_register_fields', 'give_get_register_fields'); |
|
1218 | 1218 | |
1219 | 1219 | /** |
1220 | 1220 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -1227,32 +1227,32 @@ discard block |
||
1227 | 1227 | * |
1228 | 1228 | * @return string |
1229 | 1229 | */ |
1230 | -function give_get_login_fields( $form_id ) { |
|
1230 | +function give_get_login_fields($form_id) { |
|
1231 | 1231 | |
1232 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
1233 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
1232 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
1233 | + $show_register_form = give_show_login_register_option($form_id); |
|
1234 | 1234 | |
1235 | 1235 | ob_start(); |
1236 | 1236 | ?> |
1237 | 1237 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
1238 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) ); |
|
1239 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1240 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
1238 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give')); |
|
1239 | + if ( ! give_logged_in_only($form_id)) { |
|
1240 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
1241 | 1241 | } ?> |
1242 | 1242 | </legend> |
1243 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
1243 | + <?php if ($show_register_form == 'both') { ?> |
|
1244 | 1244 | <p class="give-new-account-link"> |
1245 | - <?php esc_html_e( 'Need to create an account?', 'give' ); ?> |
|
1246 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" |
|
1245 | + <?php esc_html_e('Need to create an account?', 'give'); ?> |
|
1246 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" |
|
1247 | 1247 | data-action="give_checkout_register"> |
1248 | - <?php esc_html_e( 'Register', 'give' ); |
|
1249 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
1250 | - echo ' ' . esc_html__( 'or checkout as a guest »', 'give' ); |
|
1248 | + <?php esc_html_e('Register', 'give'); |
|
1249 | + if ( ! give_logged_in_only($form_id)) { |
|
1250 | + echo ' '.esc_html__('or checkout as a guest »', 'give'); |
|
1251 | 1251 | } ?> |
1252 | 1252 | </a> |
1253 | 1253 | </p> |
1254 | 1254 | <p class="give-loading-text"> |
1255 | - <span class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?> </p> |
|
1255 | + <span class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?> </p> |
|
1256 | 1256 | <?php } ?> |
1257 | 1257 | <?php |
1258 | 1258 | /** |
@@ -1262,48 +1262,48 @@ discard block |
||
1262 | 1262 | * |
1263 | 1263 | * @param int $form_id The form ID. |
1264 | 1264 | */ |
1265 | - do_action( 'give_checkout_login_fields_before', $form_id ); |
|
1265 | + do_action('give_checkout_login_fields_before', $form_id); |
|
1266 | 1266 | ?> |
1267 | 1267 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first"> |
1268 | 1268 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
1269 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
1270 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1269 | + <?php esc_html_e('Username', 'give'); ?> |
|
1270 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1271 | 1271 | <span class="give-required-indicator">*</span> |
1272 | 1272 | <?php } ?> |
1273 | 1273 | </label> |
1274 | 1274 | |
1275 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text" |
|
1275 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text" |
|
1276 | 1276 | name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" |
1277 | - placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1277 | + placeholder="<?php esc_attr_e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1278 | 1278 | </div> |
1279 | 1279 | |
1280 | 1280 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" class="give_login_password form-row form-row-last"> |
1281 | 1281 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
1282 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
1283 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
1282 | + <?php esc_html_e('Password', 'give'); ?> |
|
1283 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
1284 | 1284 | <span class="give-required-indicator">*</span> |
1285 | 1285 | <?php } ?> |
1286 | 1286 | </label> |
1287 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" |
|
1287 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" |
|
1288 | 1288 | type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" |
1289 | - placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
1289 | + placeholder="<?php esc_attr_e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
1290 | 1290 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
1291 | 1291 | </div> |
1292 | 1292 | |
1293 | 1293 | <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password"> |
1294 | 1294 | <span class="give-forgot-password "> |
1295 | 1295 | <a href="<?php echo wp_lostpassword_url() ?>" |
1296 | - target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a> |
|
1296 | + target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a> |
|
1297 | 1297 | </span> |
1298 | 1298 | </div> |
1299 | 1299 | |
1300 | 1300 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
1301 | 1301 | <input type="submit" class="give-submit give-btn button" name="give_login_submit" |
1302 | - value="<?php esc_attr_e( 'Login', 'give' ); ?>"/> |
|
1303 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
1302 | + value="<?php esc_attr_e('Login', 'give'); ?>"/> |
|
1303 | + <?php if ($show_register_form !== 'login') { ?> |
|
1304 | 1304 | <input type="button" data-action="give_cancel_login" |
1305 | 1305 | class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" |
1306 | - value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/> |
|
1306 | + value="<?php esc_attr_e('Cancel', 'give'); ?>"/> |
|
1307 | 1307 | <?php } ?> |
1308 | 1308 | <span class="give-loading-animation"></span> |
1309 | 1309 | </div> |
@@ -1315,14 +1315,14 @@ discard block |
||
1315 | 1315 | * |
1316 | 1316 | * @param int $form_id The form ID. |
1317 | 1317 | */ |
1318 | - do_action( 'give_checkout_login_fields_after', $form_id ); |
|
1318 | + do_action('give_checkout_login_fields_after', $form_id); |
|
1319 | 1319 | ?> |
1320 | 1320 | </fieldset><!--end #give-login-fields--> |
1321 | 1321 | <?php |
1322 | 1322 | echo ob_get_clean(); |
1323 | 1323 | } |
1324 | 1324 | |
1325 | -add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
1325 | +add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1); |
|
1326 | 1326 | |
1327 | 1327 | /** |
1328 | 1328 | * Payment Mode Select. |
@@ -1338,9 +1338,9 @@ discard block |
||
1338 | 1338 | * |
1339 | 1339 | * @return void |
1340 | 1340 | */ |
1341 | -function give_payment_mode_select( $form_id ) { |
|
1341 | +function give_payment_mode_select($form_id) { |
|
1342 | 1342 | |
1343 | - $gateways = give_get_enabled_payment_gateways( $form_id ); |
|
1343 | + $gateways = give_get_enabled_payment_gateways($form_id); |
|
1344 | 1344 | |
1345 | 1345 | /** |
1346 | 1346 | * Fires while selecting payment gateways, before the fields. |
@@ -1349,10 +1349,10 @@ discard block |
||
1349 | 1349 | * |
1350 | 1350 | * @param int $form_id The form ID. |
1351 | 1351 | */ |
1352 | - do_action( 'give_payment_mode_top', $form_id ); |
|
1352 | + do_action('give_payment_mode_top', $form_id); |
|
1353 | 1353 | ?> |
1354 | 1354 | |
1355 | - <fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) { |
|
1355 | + <fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) { |
|
1356 | 1356 | echo 'style="display: none;"'; |
1357 | 1357 | } ?>> |
1358 | 1358 | <?php |
@@ -1363,14 +1363,14 @@ discard block |
||
1363 | 1363 | * |
1364 | 1364 | * @param int $form_id The form ID. |
1365 | 1365 | */ |
1366 | - do_action( 'give_payment_mode_before_gateways_wrap' ); |
|
1366 | + do_action('give_payment_mode_before_gateways_wrap'); |
|
1367 | 1367 | ?> |
1368 | 1368 | <legend |
1369 | - class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?></legend> |
|
1369 | + class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?></legend> |
|
1370 | 1370 | |
1371 | 1371 | <div id="give-payment-mode-wrap"> |
1372 | 1372 | <span class="give-loading-text"><span |
1373 | - class="give-loading-animation"></span> <?php esc_html_e( 'Loading...', 'give' ); ?></span> |
|
1373 | + class="give-loading-animation"></span> <?php esc_html_e('Loading...', 'give'); ?></span> |
|
1374 | 1374 | |
1375 | 1375 | <?php |
1376 | 1376 | /** |
@@ -1378,26 +1378,26 @@ discard block |
||
1378 | 1378 | * |
1379 | 1379 | * @since 1.7 |
1380 | 1380 | */ |
1381 | - do_action( 'give_payment_mode_before_gateways' ) |
|
1381 | + do_action('give_payment_mode_before_gateways') |
|
1382 | 1382 | ?> |
1383 | 1383 | <ul id="give-gateway-radio-list"> |
1384 | 1384 | <?php |
1385 | 1385 | /** |
1386 | 1386 | * Loop through the active payment gateways. |
1387 | 1387 | */ |
1388 | - $selected_gateway = give_get_chosen_gateway( $form_id ); |
|
1388 | + $selected_gateway = give_get_chosen_gateway($form_id); |
|
1389 | 1389 | |
1390 | - foreach ( $gateways as $gateway_id => $gateway ) : |
|
1390 | + foreach ($gateways as $gateway_id => $gateway) : |
|
1391 | 1391 | //Determine the default gateway. |
1392 | - $checked = checked( $gateway_id, $selected_gateway, false ); |
|
1392 | + $checked = checked($gateway_id, $selected_gateway, false); |
|
1393 | 1393 | $checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?> |
1394 | 1394 | <li<?php echo $checked_class?>> |
1395 | 1395 | <input type="radio" name="payment-mode" class="give-gateway" |
1396 | - id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
1397 | - value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>> |
|
1398 | - <label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
1396 | + id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
1397 | + value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>> |
|
1398 | + <label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
1399 | 1399 | class="give-gateway-option" |
1400 | - id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label> |
|
1400 | + id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label> |
|
1401 | 1401 | </li> |
1402 | 1402 | <?php |
1403 | 1403 | endforeach; |
@@ -1409,7 +1409,7 @@ discard block |
||
1409 | 1409 | * |
1410 | 1410 | * @since 1.7 |
1411 | 1411 | */ |
1412 | - do_action( 'give_payment_mode_after_gateways' ); |
|
1412 | + do_action('give_payment_mode_after_gateways'); |
|
1413 | 1413 | ?> |
1414 | 1414 | </div> |
1415 | 1415 | <?php |
@@ -1420,7 +1420,7 @@ discard block |
||
1420 | 1420 | * |
1421 | 1421 | * @param int $form_id The form ID. |
1422 | 1422 | */ |
1423 | - do_action( 'give_payment_mode_after_gateways_wrap' ); |
|
1423 | + do_action('give_payment_mode_after_gateways_wrap'); |
|
1424 | 1424 | ?> |
1425 | 1425 | </fieldset> |
1426 | 1426 | |
@@ -1432,7 +1432,7 @@ discard block |
||
1432 | 1432 | * |
1433 | 1433 | * @param int $form_id The form ID. |
1434 | 1434 | */ |
1435 | - do_action( 'give_payment_mode_bottom', $form_id ); |
|
1435 | + do_action('give_payment_mode_bottom', $form_id); |
|
1436 | 1436 | ?> |
1437 | 1437 | |
1438 | 1438 | <div id="give_purchase_form_wrap"> |
@@ -1443,7 +1443,7 @@ discard block |
||
1443 | 1443 | * |
1444 | 1444 | * @since 1.7 |
1445 | 1445 | */ |
1446 | - do_action( 'give_donation_form', $form_id ); |
|
1446 | + do_action('give_donation_form', $form_id); |
|
1447 | 1447 | ?> |
1448 | 1448 | |
1449 | 1449 | </div> |
@@ -1454,10 +1454,10 @@ discard block |
||
1454 | 1454 | * |
1455 | 1455 | * @since 1.7 |
1456 | 1456 | */ |
1457 | - do_action( 'give_donation_form_wrap_bottom', $form_id ); |
|
1457 | + do_action('give_donation_form_wrap_bottom', $form_id); |
|
1458 | 1458 | } |
1459 | 1459 | |
1460 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
1460 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
1461 | 1461 | |
1462 | 1462 | /** |
1463 | 1463 | * Renders the Checkout Agree to Terms, this displays a checkbox for users to |
@@ -1470,31 +1470,31 @@ discard block |
||
1470 | 1470 | * |
1471 | 1471 | * @return bool |
1472 | 1472 | */ |
1473 | -function give_terms_agreement( $form_id ) { |
|
1474 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1473 | +function give_terms_agreement($form_id) { |
|
1474 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1475 | 1475 | |
1476 | 1476 | // Bailout if per form and global term and conditions is not setup. |
1477 | 1477 | if ( |
1478 | - give_is_setting_enabled( $form_option, 'global' ) |
|
1479 | - && give_is_setting_enabled( give_get_option( 'terms' ) ) |
|
1478 | + give_is_setting_enabled($form_option, 'global') |
|
1479 | + && give_is_setting_enabled(give_get_option('terms')) |
|
1480 | 1480 | ) { |
1481 | - $label = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) ); |
|
1482 | - $terms = $terms = give_get_option( 'agreement_text', '' ); |
|
1483 | - $edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions' ); |
|
1481 | + $label = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give')); |
|
1482 | + $terms = $terms = give_get_option('agreement_text', ''); |
|
1483 | + $edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions'); |
|
1484 | 1484 | |
1485 | - } elseif ( give_is_setting_enabled( $form_option ) ) { |
|
1486 | - $label = ( $label = get_post_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' ); |
|
1487 | - $terms = get_post_meta( $form_id, '_give_agree_text', true ); |
|
1488 | - $edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' ); |
|
1485 | + } elseif (give_is_setting_enabled($form_option)) { |
|
1486 | + $label = ($label = get_post_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give'); |
|
1487 | + $terms = get_post_meta($form_id, '_give_agree_text', true); |
|
1488 | + $edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options'); |
|
1489 | 1489 | |
1490 | 1490 | } else { |
1491 | 1491 | return false; |
1492 | 1492 | } |
1493 | 1493 | |
1494 | 1494 | // Bailout: Check if term and conditions text is empty or not. |
1495 | - if ( empty( $terms ) ) { |
|
1496 | - if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) { |
|
1497 | - echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url ); |
|
1495 | + if (empty($terms)) { |
|
1496 | + if (is_user_logged_in() && current_user_can('edit_give_forms')) { |
|
1497 | + echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url); |
|
1498 | 1498 | } |
1499 | 1499 | |
1500 | 1500 | return false; |
@@ -1502,7 +1502,7 @@ discard block |
||
1502 | 1502 | |
1503 | 1503 | ?> |
1504 | 1504 | <fieldset id="give_terms_agreement"> |
1505 | - <legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend> |
|
1505 | + <legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend> |
|
1506 | 1506 | <div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;"> |
1507 | 1507 | <?php |
1508 | 1508 | /** |
@@ -1510,22 +1510,22 @@ discard block |
||
1510 | 1510 | * |
1511 | 1511 | * @since 1.0 |
1512 | 1512 | */ |
1513 | - do_action( 'give_before_terms' ); |
|
1513 | + do_action('give_before_terms'); |
|
1514 | 1514 | |
1515 | - echo wpautop( stripslashes( $terms ) ); |
|
1515 | + echo wpautop(stripslashes($terms)); |
|
1516 | 1516 | /** |
1517 | 1517 | * Fires while rendering terms of agreement, after the fields. |
1518 | 1518 | * |
1519 | 1519 | * @since 1.0 |
1520 | 1520 | */ |
1521 | - do_action( 'give_after_terms' ); |
|
1521 | + do_action('give_after_terms'); |
|
1522 | 1522 | ?> |
1523 | 1523 | </div> |
1524 | 1524 | <div id="give_show_terms"> |
1525 | 1525 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
1526 | - aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a> |
|
1526 | + aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a> |
|
1527 | 1527 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
1528 | - aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a> |
|
1528 | + aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a> |
|
1529 | 1529 | </div> |
1530 | 1530 | |
1531 | 1531 | <input name="give_agree_to_terms" class="required" type="checkbox" id="give_agree_to_terms-<?php echo $form_id; ?>" value="1" required aria-required="true" /> |
@@ -1535,7 +1535,7 @@ discard block |
||
1535 | 1535 | <?php |
1536 | 1536 | } |
1537 | 1537 | |
1538 | -add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 ); |
|
1538 | +add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1); |
|
1539 | 1539 | |
1540 | 1540 | /** |
1541 | 1541 | * Checkout Final Total. |
@@ -1548,29 +1548,29 @@ discard block |
||
1548 | 1548 | * |
1549 | 1549 | * @return void |
1550 | 1550 | */ |
1551 | -function give_checkout_final_total( $form_id ) { |
|
1551 | +function give_checkout_final_total($form_id) { |
|
1552 | 1552 | |
1553 | - if ( isset( $_POST['give_total'] ) ) { |
|
1554 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
1553 | + if (isset($_POST['give_total'])) { |
|
1554 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
1555 | 1555 | } else { |
1556 | 1556 | //default total. |
1557 | - $total = give_get_default_form_amount( $form_id ); |
|
1557 | + $total = give_get_default_form_amount($form_id); |
|
1558 | 1558 | } |
1559 | 1559 | //Only proceed if give_total available. |
1560 | - if ( empty( $total ) ) { |
|
1560 | + if (empty($total)) { |
|
1561 | 1561 | return; |
1562 | 1562 | } |
1563 | 1563 | ?> |
1564 | 1564 | <p id="give-final-total-wrap" class="form-wrap "> |
1565 | 1565 | <span |
1566 | - class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span> |
|
1566 | + class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span> |
|
1567 | 1567 | <span class="give-final-total-amount" |
1568 | - data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
1568 | + data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
1569 | 1569 | </p> |
1570 | 1570 | <?php |
1571 | 1571 | } |
1572 | 1572 | |
1573 | -add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 ); |
|
1573 | +add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999); |
|
1574 | 1574 | |
1575 | 1575 | /** |
1576 | 1576 | * Renders the Checkout Submit section. |
@@ -1581,7 +1581,7 @@ discard block |
||
1581 | 1581 | * |
1582 | 1582 | * @return void |
1583 | 1583 | */ |
1584 | -function give_checkout_submit( $form_id ) { |
|
1584 | +function give_checkout_submit($form_id) { |
|
1585 | 1585 | ?> |
1586 | 1586 | <fieldset id="give_purchase_submit"> |
1587 | 1587 | <?php |
@@ -1590,24 +1590,24 @@ discard block |
||
1590 | 1590 | * |
1591 | 1591 | * @since 1.7 |
1592 | 1592 | */ |
1593 | - do_action( 'give_donation_form_before_submit', $form_id ); |
|
1593 | + do_action('give_donation_form_before_submit', $form_id); |
|
1594 | 1594 | |
1595 | - give_checkout_hidden_fields( $form_id ); |
|
1595 | + give_checkout_hidden_fields($form_id); |
|
1596 | 1596 | |
1597 | - echo give_checkout_button_purchase( $form_id ); |
|
1597 | + echo give_checkout_button_purchase($form_id); |
|
1598 | 1598 | |
1599 | 1599 | /** |
1600 | 1600 | * Fire after donation form submit. |
1601 | 1601 | * |
1602 | 1602 | * @since 1.7 |
1603 | 1603 | */ |
1604 | - do_action( 'give_donation_form_after_submit', $form_id ); |
|
1604 | + do_action('give_donation_form_after_submit', $form_id); |
|
1605 | 1605 | ?> |
1606 | 1606 | </fieldset> |
1607 | 1607 | <?php |
1608 | 1608 | } |
1609 | 1609 | |
1610 | -add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
1610 | +add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999); |
|
1611 | 1611 | |
1612 | 1612 | /** |
1613 | 1613 | * Give Checkout Button. |
@@ -1620,10 +1620,10 @@ discard block |
||
1620 | 1620 | * |
1621 | 1621 | * @return string |
1622 | 1622 | */ |
1623 | -function give_checkout_button_purchase( $form_id ) { |
|
1623 | +function give_checkout_button_purchase($form_id) { |
|
1624 | 1624 | |
1625 | - $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
|
1626 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
1625 | + $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
1626 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
1627 | 1627 | ob_start(); ?> |
1628 | 1628 | <div class="give-submit-button-wrap give-clearfix"> |
1629 | 1629 | <input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" |
@@ -1631,7 +1631,7 @@ discard block |
||
1631 | 1631 | <span class="give-loading-animation"></span> |
1632 | 1632 | </div> |
1633 | 1633 | <?php |
1634 | - return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
1634 | + return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
|
1635 | 1635 | } |
1636 | 1636 | |
1637 | 1637 | /** |
@@ -1645,18 +1645,18 @@ discard block |
||
1645 | 1645 | * |
1646 | 1646 | * @return void |
1647 | 1647 | */ |
1648 | -function give_agree_to_terms_js( $form_id ) { |
|
1648 | +function give_agree_to_terms_js($form_id) { |
|
1649 | 1649 | |
1650 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1650 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1651 | 1651 | |
1652 | - if ( give_is_setting_enabled( $form_option, array( 'enabled', 'global' ) ) ) { |
|
1652 | + if (give_is_setting_enabled($form_option, array('enabled', 'global'))) { |
|
1653 | 1653 | ?> |
1654 | 1654 | <script type="text/javascript"> |
1655 | 1655 | jQuery(document).ready(function ($) { |
1656 | - $('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) { |
|
1656 | + $('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) { |
|
1657 | 1657 | e.preventDefault(); |
1658 | - $('.give_terms-<?php echo $form_id;?>').slideToggle(); |
|
1659 | - $('.give_terms_links-<?php echo $form_id;?>').toggle(); |
|
1658 | + $('.give_terms-<?php echo $form_id; ?>').slideToggle(); |
|
1659 | + $('.give_terms_links-<?php echo $form_id; ?>').toggle(); |
|
1660 | 1660 | return false; |
1661 | 1661 | }); |
1662 | 1662 | }); |
@@ -1665,7 +1665,7 @@ discard block |
||
1665 | 1665 | } |
1666 | 1666 | } |
1667 | 1667 | |
1668 | -add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 ); |
|
1668 | +add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2); |
|
1669 | 1669 | |
1670 | 1670 | /** |
1671 | 1671 | * Show Give Goals. |
@@ -1679,17 +1679,17 @@ discard block |
||
1679 | 1679 | * |
1680 | 1680 | * @return mixed |
1681 | 1681 | */ |
1682 | -function give_show_goal_progress( $form_id, $args ) { |
|
1682 | +function give_show_goal_progress($form_id, $args) { |
|
1683 | 1683 | |
1684 | 1684 | ob_start(); |
1685 | - give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) ); |
|
1685 | + give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args)); |
|
1686 | 1686 | |
1687 | - echo apply_filters( 'give_goal_output', ob_get_clean() ); |
|
1687 | + echo apply_filters('give_goal_output', ob_get_clean()); |
|
1688 | 1688 | |
1689 | 1689 | return true; |
1690 | 1690 | } |
1691 | 1691 | |
1692 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
1692 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
1693 | 1693 | |
1694 | 1694 | |
1695 | 1695 | /** |
@@ -1700,10 +1700,10 @@ discard block |
||
1700 | 1700 | * @param $args |
1701 | 1701 | * @return mixed|string |
1702 | 1702 | */ |
1703 | -function give_get_form_content_placement( $form_id, $args ) { |
|
1703 | +function give_get_form_content_placement($form_id, $args) { |
|
1704 | 1704 | $show_content = ''; |
1705 | 1705 | |
1706 | - if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) { |
|
1706 | + if (isset($args['show_content']) && ! empty($args['show_content'])) { |
|
1707 | 1707 | // Content positions. |
1708 | 1708 | $content_placement = array( |
1709 | 1709 | 'above' => 'give_pre_form', |
@@ -1711,13 +1711,13 @@ discard block |
||
1711 | 1711 | ); |
1712 | 1712 | |
1713 | 1713 | // Check if content position already decoded. |
1714 | - if ( in_array( $args['show_content'], $content_placement ) ) { |
|
1714 | + if (in_array($args['show_content'], $content_placement)) { |
|
1715 | 1715 | return $args['show_content']; |
1716 | 1716 | } |
1717 | 1717 | |
1718 | - $show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' ); |
|
1719 | - } elseif ( give_is_setting_enabled( get_post_meta( $form_id, '_give_display_content', true ) ) ) { |
|
1720 | - $show_content = get_post_meta( $form_id, '_give_content_placement', true ); |
|
1718 | + $show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : ''); |
|
1719 | + } elseif (give_is_setting_enabled(get_post_meta($form_id, '_give_display_content', true))) { |
|
1720 | + $show_content = get_post_meta($form_id, '_give_content_placement', true); |
|
1721 | 1721 | } |
1722 | 1722 | |
1723 | 1723 | return $show_content; |
@@ -1733,20 +1733,20 @@ discard block |
||
1733 | 1733 | * |
1734 | 1734 | * @return void|bool |
1735 | 1735 | */ |
1736 | -function give_form_content( $form_id, $args ) { |
|
1736 | +function give_form_content($form_id, $args) { |
|
1737 | 1737 | |
1738 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
1738 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
1739 | 1739 | |
1740 | 1740 | // Bailout. |
1741 | - if( empty( $show_content ) ) { |
|
1741 | + if (empty($show_content)) { |
|
1742 | 1742 | return false; |
1743 | 1743 | } |
1744 | 1744 | |
1745 | 1745 | // Add action according to value. |
1746 | - add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
1746 | + add_action($show_content, 'give_form_display_content', 10, 2); |
|
1747 | 1747 | } |
1748 | 1748 | |
1749 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
1749 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
1750 | 1750 | |
1751 | 1751 | /** |
1752 | 1752 | * Renders Post Form Content. |
@@ -1760,22 +1760,22 @@ discard block |
||
1760 | 1760 | * |
1761 | 1761 | * @return void |
1762 | 1762 | */ |
1763 | -function give_form_display_content( $form_id, $args ) { |
|
1763 | +function give_form_display_content($form_id, $args) { |
|
1764 | 1764 | |
1765 | - $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
1766 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
1765 | + $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
|
1766 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
1767 | 1767 | |
1768 | - if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) { |
|
1769 | - $content = apply_filters( 'the_content', $content ); |
|
1768 | + if (give_is_setting_enabled(give_get_option('the_content_filter'))) { |
|
1769 | + $content = apply_filters('the_content', $content); |
|
1770 | 1770 | } |
1771 | 1771 | |
1772 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap ' . $show_content . '-content">' . $content . '</div>'; |
|
1772 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap '.$show_content.'-content">'.$content.'</div>'; |
|
1773 | 1773 | |
1774 | - echo apply_filters( 'give_form_content_output', $output ); |
|
1774 | + echo apply_filters('give_form_content_output', $output); |
|
1775 | 1775 | |
1776 | 1776 | //remove action to prevent content output on addition forms on page. |
1777 | 1777 | //@see: https://github.com/WordImpress/Give/issues/634. |
1778 | - remove_action( $show_content, 'give_form_display_content' ); |
|
1778 | + remove_action($show_content, 'give_form_display_content'); |
|
1779 | 1779 | } |
1780 | 1780 | |
1781 | 1781 | /** |
@@ -1787,7 +1787,7 @@ discard block |
||
1787 | 1787 | * |
1788 | 1788 | * @return void |
1789 | 1789 | */ |
1790 | -function give_checkout_hidden_fields( $form_id ) { |
|
1790 | +function give_checkout_hidden_fields($form_id) { |
|
1791 | 1791 | |
1792 | 1792 | /** |
1793 | 1793 | * Fires while rendering hidden checkout fields, before the fields. |
@@ -1796,13 +1796,13 @@ discard block |
||
1796 | 1796 | * |
1797 | 1797 | * @param int $form_id The form ID. |
1798 | 1798 | */ |
1799 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
1799 | + do_action('give_hidden_fields_before', $form_id); |
|
1800 | 1800 | |
1801 | - if ( is_user_logged_in() ) { ?> |
|
1801 | + if (is_user_logged_in()) { ?> |
|
1802 | 1802 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
1803 | 1803 | <?php } ?> |
1804 | 1804 | <input type="hidden" name="give_action" value="purchase"/> |
1805 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
1805 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
1806 | 1806 | <?php |
1807 | 1807 | /** |
1808 | 1808 | * Fires while rendering hidden checkout fields, after the fields. |
@@ -1811,7 +1811,7 @@ discard block |
||
1811 | 1811 | * |
1812 | 1812 | * @param int $form_id The form ID. |
1813 | 1813 | */ |
1814 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
1814 | + do_action('give_hidden_fields_after', $form_id); |
|
1815 | 1815 | |
1816 | 1816 | } |
1817 | 1817 | |
@@ -1826,20 +1826,20 @@ discard block |
||
1826 | 1826 | * |
1827 | 1827 | * @return string $content Filtered content. |
1828 | 1828 | */ |
1829 | -function give_filter_success_page_content( $content ) { |
|
1829 | +function give_filter_success_page_content($content) { |
|
1830 | 1830 | |
1831 | 1831 | $give_options = give_get_settings(); |
1832 | 1832 | |
1833 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
1834 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
1835 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
1833 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
1834 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
1835 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
1836 | 1836 | } |
1837 | 1837 | } |
1838 | 1838 | |
1839 | 1839 | return $content; |
1840 | 1840 | } |
1841 | 1841 | |
1842 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
1842 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
1843 | 1843 | |
1844 | 1844 | /** |
1845 | 1845 | * Test Mode Frontend Warning. |
@@ -1850,12 +1850,12 @@ discard block |
||
1850 | 1850 | */ |
1851 | 1851 | function give_test_mode_frontend_warning() { |
1852 | 1852 | |
1853 | - if ( give_is_test_mode() ) { |
|
1854 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>'; |
|
1853 | + if (give_is_test_mode()) { |
|
1854 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>'; |
|
1855 | 1855 | } |
1856 | 1856 | } |
1857 | 1857 | |
1858 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
1858 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
1859 | 1859 | |
1860 | 1860 | /** |
1861 | 1861 | * Members-only Form. |
@@ -1869,21 +1869,21 @@ discard block |
||
1869 | 1869 | * |
1870 | 1870 | * @return string |
1871 | 1871 | */ |
1872 | -function give_members_only_form( $final_output, $args ) { |
|
1872 | +function give_members_only_form($final_output, $args) { |
|
1873 | 1873 | |
1874 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
1874 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
1875 | 1875 | |
1876 | 1876 | //Sanity Check: Must have form_id & not be logged in. |
1877 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
1877 | + if (empty($form_id) || is_user_logged_in()) { |
|
1878 | 1878 | return $final_output; |
1879 | 1879 | } |
1880 | 1880 | |
1881 | 1881 | //Logged in only and Register / Login set to none. |
1882 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
1882 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
1883 | 1883 | |
1884 | - $final_output = give_output_error( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false ); |
|
1884 | + $final_output = give_output_error(esc_html__('Please log in in order to complete your donation.', 'give'), false); |
|
1885 | 1885 | |
1886 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
1886 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
1887 | 1887 | |
1888 | 1888 | } |
1889 | 1889 | |
@@ -1891,4 +1891,4 @@ discard block |
||
1891 | 1891 | |
1892 | 1892 | } |
1893 | 1893 | |
1894 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
1894 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
@@ -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 | |
@@ -336,11 +336,11 @@ discard block |
||
336 | 336 | * @param bool $_id Post id. Default is false. |
337 | 337 | * @param array $_args Arguments passed. |
338 | 338 | */ |
339 | - public function __construct( $_id = false, $_args = array() ) { |
|
339 | + public function __construct($_id = false, $_args = array()) { |
|
340 | 340 | |
341 | - $donation_form = WP_Post::get_instance( $_id ); |
|
341 | + $donation_form = WP_Post::get_instance($_id); |
|
342 | 342 | |
343 | - return $this->setup_donation_form( $donation_form ); |
|
343 | + return $this->setup_donation_form($donation_form); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | /** |
@@ -353,23 +353,23 @@ discard block |
||
353 | 353 | * |
354 | 354 | * @return bool If the setup was successful or not. |
355 | 355 | */ |
356 | - private function setup_donation_form( $donation_form ) { |
|
356 | + private function setup_donation_form($donation_form) { |
|
357 | 357 | |
358 | - if ( ! is_object( $donation_form ) ) { |
|
358 | + if ( ! is_object($donation_form)) { |
|
359 | 359 | return false; |
360 | 360 | } |
361 | 361 | |
362 | - if ( ! is_a( $donation_form, 'WP_Post' ) ) { |
|
362 | + if ( ! is_a($donation_form, 'WP_Post')) { |
|
363 | 363 | return false; |
364 | 364 | } |
365 | 365 | |
366 | - if ( 'give_forms' !== $donation_form->post_type ) { |
|
366 | + if ('give_forms' !== $donation_form->post_type) { |
|
367 | 367 | return false; |
368 | 368 | } |
369 | 369 | |
370 | - foreach ( $donation_form as $key => $value ) { |
|
370 | + foreach ($donation_form as $key => $value) { |
|
371 | 371 | |
372 | - switch ( $key ) { |
|
372 | + switch ($key) { |
|
373 | 373 | |
374 | 374 | default: |
375 | 375 | $this->$key = $value; |
@@ -393,16 +393,16 @@ discard block |
||
393 | 393 | * |
394 | 394 | * @return mixed |
395 | 395 | */ |
396 | - public function __get( $key ) { |
|
396 | + public function __get($key) { |
|
397 | 397 | |
398 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
398 | + if (method_exists($this, 'get_'.$key)) { |
|
399 | 399 | |
400 | - return call_user_func( array( $this, 'get_' . $key ) ); |
|
400 | + return call_user_func(array($this, 'get_'.$key)); |
|
401 | 401 | |
402 | 402 | } else { |
403 | 403 | |
404 | 404 | /* translators: %s: property key */ |
405 | - return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) ); |
|
405 | + return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key)); |
|
406 | 406 | |
407 | 407 | } |
408 | 408 | |
@@ -418,30 +418,30 @@ discard block |
||
418 | 418 | * |
419 | 419 | * @return bool|int False if data isn't passed and class not instantiated for creation, or New Form ID. |
420 | 420 | */ |
421 | - public function create( $data = array() ) { |
|
421 | + public function create($data = array()) { |
|
422 | 422 | |
423 | - if ( $this->id != 0 ) { |
|
423 | + if ($this->id != 0) { |
|
424 | 424 | return false; |
425 | 425 | } |
426 | 426 | |
427 | 427 | $defaults = array( |
428 | 428 | 'post_type' => 'give_forms', |
429 | 429 | 'post_status' => 'draft', |
430 | - 'post_title' => __( 'New Donation Form', 'give' ), |
|
430 | + 'post_title' => __('New Donation Form', 'give'), |
|
431 | 431 | ); |
432 | 432 | |
433 | - $args = wp_parse_args( $data, $defaults ); |
|
433 | + $args = wp_parse_args($data, $defaults); |
|
434 | 434 | |
435 | 435 | /** |
436 | 436 | * Fired before a donation form is created |
437 | 437 | * |
438 | 438 | * @param array $args The post object arguments used for creation. |
439 | 439 | */ |
440 | - do_action( 'give_form_pre_create', $args ); |
|
440 | + do_action('give_form_pre_create', $args); |
|
441 | 441 | |
442 | - $id = wp_insert_post( $args, true ); |
|
442 | + $id = wp_insert_post($args, true); |
|
443 | 443 | |
444 | - $donation_form = WP_Post::get_instance( $id ); |
|
444 | + $donation_form = WP_Post::get_instance($id); |
|
445 | 445 | |
446 | 446 | /** |
447 | 447 | * Fired after a donation form is created |
@@ -449,9 +449,9 @@ discard block |
||
449 | 449 | * @param int $id The post ID of the created item. |
450 | 450 | * @param array $args The post object arguments used for creation. |
451 | 451 | */ |
452 | - do_action( 'give_form_post_create', $id, $args ); |
|
452 | + do_action('give_form_post_create', $id, $args); |
|
453 | 453 | |
454 | - return $this->setup_donation_form( $donation_form ); |
|
454 | + return $this->setup_donation_form($donation_form); |
|
455 | 455 | |
456 | 456 | } |
457 | 457 | |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | * @return string Donation form name. |
477 | 477 | */ |
478 | 478 | public function get_name() { |
479 | - return get_the_title( $this->ID ); |
|
479 | + return get_the_title($this->ID); |
|
480 | 480 | } |
481 | 481 | |
482 | 482 | /** |
@@ -489,13 +489,13 @@ discard block |
||
489 | 489 | */ |
490 | 490 | public function get_price() { |
491 | 491 | |
492 | - if ( ! isset( $this->price ) ) { |
|
492 | + if ( ! isset($this->price)) { |
|
493 | 493 | |
494 | - $this->price = get_post_meta( $this->ID, '_give_set_price', true ); |
|
494 | + $this->price = get_post_meta($this->ID, '_give_set_price', true); |
|
495 | 495 | |
496 | - if ( $this->price ) { |
|
496 | + if ($this->price) { |
|
497 | 497 | |
498 | - $this->price = give_sanitize_amount( $this->price ); |
|
498 | + $this->price = give_sanitize_amount($this->price); |
|
499 | 499 | |
500 | 500 | } else { |
501 | 501 | |
@@ -513,7 +513,7 @@ discard block |
||
513 | 513 | * @param string $price The donation form price. |
514 | 514 | * @param string|int $id The form ID. |
515 | 515 | */ |
516 | - return apply_filters( 'give_get_set_price', $this->price, $this->ID ); |
|
516 | + return apply_filters('give_get_set_price', $this->price, $this->ID); |
|
517 | 517 | } |
518 | 518 | |
519 | 519 | /** |
@@ -526,14 +526,14 @@ discard block |
||
526 | 526 | */ |
527 | 527 | public function get_minimum_price() { |
528 | 528 | |
529 | - if ( ! isset( $this->minimum_price ) ) { |
|
529 | + if ( ! isset($this->minimum_price)) { |
|
530 | 530 | |
531 | - $allow_custom_amount = get_post_meta( $this->ID, '_give_custom_amount', true ); |
|
532 | - $this->minimum_price = get_post_meta( $this->ID, '_give_custom_amount_minimum', true ); |
|
531 | + $allow_custom_amount = get_post_meta($this->ID, '_give_custom_amount', true); |
|
532 | + $this->minimum_price = get_post_meta($this->ID, '_give_custom_amount_minimum', true); |
|
533 | 533 | |
534 | - if ( give_is_setting_enabled( $allow_custom_amount ) && $this->minimum_price ) { |
|
534 | + if (give_is_setting_enabled($allow_custom_amount) && $this->minimum_price) { |
|
535 | 535 | |
536 | - $this->minimum_price = give_sanitize_amount( $this->minimum_price ); |
|
536 | + $this->minimum_price = give_sanitize_amount($this->minimum_price); |
|
537 | 537 | |
538 | 538 | } else { |
539 | 539 | |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | |
544 | 544 | } |
545 | 545 | |
546 | - return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID ); |
|
546 | + return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID); |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | /** |
@@ -556,9 +556,9 @@ discard block |
||
556 | 556 | */ |
557 | 557 | public function get_prices() { |
558 | 558 | |
559 | - if ( ! isset( $this->prices ) ) { |
|
559 | + if ( ! isset($this->prices)) { |
|
560 | 560 | |
561 | - $this->prices = get_post_meta( $this->ID, '_give_donation_levels', true ); |
|
561 | + $this->prices = get_post_meta($this->ID, '_give_donation_levels', true); |
|
562 | 562 | |
563 | 563 | } |
564 | 564 | |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | * @param array $prices The array of mulit-level prices. |
571 | 571 | * @param int|string $ID The ID of the form. |
572 | 572 | */ |
573 | - return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID ); |
|
573 | + return apply_filters('give_get_donation_levels', $this->prices, $this->ID); |
|
574 | 574 | |
575 | 575 | } |
576 | 576 | |
@@ -584,13 +584,13 @@ discard block |
||
584 | 584 | */ |
585 | 585 | public function get_goal() { |
586 | 586 | |
587 | - if ( ! isset( $this->goal ) ) { |
|
587 | + if ( ! isset($this->goal)) { |
|
588 | 588 | |
589 | - $this->goal = get_post_meta( $this->ID, '_give_set_goal', true ); |
|
589 | + $this->goal = get_post_meta($this->ID, '_give_set_goal', true); |
|
590 | 590 | |
591 | - if ( $this->goal ) { |
|
591 | + if ($this->goal) { |
|
592 | 592 | |
593 | - $this->goal = give_sanitize_amount( $this->goal ); |
|
593 | + $this->goal = give_sanitize_amount($this->goal); |
|
594 | 594 | |
595 | 595 | } else { |
596 | 596 | |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | |
601 | 601 | } |
602 | 602 | |
603 | - return apply_filters( 'give_get_set_goal', $this->goal, $this->ID ); |
|
603 | + return apply_filters('give_get_set_goal', $this->goal, $this->ID); |
|
604 | 604 | |
605 | 605 | } |
606 | 606 | |
@@ -614,10 +614,10 @@ discard block |
||
614 | 614 | */ |
615 | 615 | public function is_single_price_mode() { |
616 | 616 | |
617 | - $option = get_post_meta( $this->ID, '_give_price_options_mode', true ); |
|
617 | + $option = get_post_meta($this->ID, '_give_price_options_mode', true); |
|
618 | 618 | $ret = 0; |
619 | 619 | |
620 | - if ( empty( $option ) || $option === 'set' ) { |
|
620 | + if (empty($option) || $option === 'set') { |
|
621 | 621 | $ret = 1; |
622 | 622 | } |
623 | 623 | |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | * @param bool $ret Is donation form in single price mode? |
630 | 630 | * @param int|string $ID The ID of the donation form. |
631 | 631 | */ |
632 | - return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID ); |
|
632 | + return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID); |
|
633 | 633 | |
634 | 634 | } |
635 | 635 | |
@@ -643,10 +643,10 @@ discard block |
||
643 | 643 | */ |
644 | 644 | public function is_custom_price_mode() { |
645 | 645 | |
646 | - $option = get_post_meta( $this->ID, '_give_custom_amount', true ); |
|
646 | + $option = get_post_meta($this->ID, '_give_custom_amount', true); |
|
647 | 647 | $ret = 0; |
648 | 648 | |
649 | - if ( give_is_setting_enabled( $option ) ) { |
|
649 | + if (give_is_setting_enabled($option)) { |
|
650 | 650 | $ret = 1; |
651 | 651 | } |
652 | 652 | |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | * @param bool $ret Is donation form in custom price mode? |
659 | 659 | * @param int|string $ID The ID of the donation form. |
660 | 660 | */ |
661 | - return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID ); |
|
661 | + return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID); |
|
662 | 662 | |
663 | 663 | } |
664 | 664 | |
@@ -674,10 +674,10 @@ discard block |
||
674 | 674 | */ |
675 | 675 | public function has_variable_prices() { |
676 | 676 | |
677 | - $option = get_post_meta( $this->ID, '_give_price_option', true ); |
|
677 | + $option = get_post_meta($this->ID, '_give_price_option', true); |
|
678 | 678 | $ret = 0; |
679 | 679 | |
680 | - if ( $option === 'multi' ) { |
|
680 | + if ($option === 'multi') { |
|
681 | 681 | $ret = 1; |
682 | 682 | } |
683 | 683 | |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | * @param bool $ret Does donation form have variable prices? |
688 | 688 | * @param int|string $ID The ID of the donation form. |
689 | 689 | */ |
690 | - return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID ); |
|
690 | + return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID); |
|
691 | 691 | |
692 | 692 | } |
693 | 693 | |
@@ -701,17 +701,17 @@ discard block |
||
701 | 701 | */ |
702 | 702 | public function get_type() { |
703 | 703 | |
704 | - if ( ! isset( $this->type ) ) { |
|
704 | + if ( ! isset($this->type)) { |
|
705 | 705 | |
706 | - $this->type = get_post_meta( $this->ID, '_give_price_option', true ); |
|
706 | + $this->type = get_post_meta($this->ID, '_give_price_option', true); |
|
707 | 707 | |
708 | - if ( empty( $this->type ) ) { |
|
708 | + if (empty($this->type)) { |
|
709 | 709 | $this->type = 'set'; |
710 | 710 | } |
711 | 711 | |
712 | 712 | } |
713 | 713 | |
714 | - return apply_filters( 'give_get_form_type', $this->type, $this->ID ); |
|
714 | + return apply_filters('give_get_form_type', $this->type, $this->ID); |
|
715 | 715 | |
716 | 716 | } |
717 | 717 | |
@@ -727,23 +727,23 @@ discard block |
||
727 | 727 | * |
728 | 728 | * @return string |
729 | 729 | */ |
730 | - public function get_form_classes( $args ) { |
|
730 | + public function get_form_classes($args) { |
|
731 | 731 | |
732 | - $float_labels_option = give_is_float_labels_enabled( $args ) |
|
732 | + $float_labels_option = give_is_float_labels_enabled($args) |
|
733 | 733 | ? 'float-labels-enabled' |
734 | 734 | : ''; |
735 | 735 | |
736 | - $form_classes_array = apply_filters( 'give_form_classes', array( |
|
736 | + $form_classes_array = apply_filters('give_form_classes', array( |
|
737 | 737 | 'give-form', |
738 | - 'give-form-' . $this->ID, |
|
739 | - 'give-form-type-' . $this->get_type(), |
|
738 | + 'give-form-'.$this->ID, |
|
739 | + 'give-form-type-'.$this->get_type(), |
|
740 | 740 | $float_labels_option, |
741 | - ), $this->ID, $args ); |
|
741 | + ), $this->ID, $args); |
|
742 | 742 | |
743 | 743 | // Remove empty class names. |
744 | - $form_classes_array = array_filter( $form_classes_array ); |
|
744 | + $form_classes_array = array_filter($form_classes_array); |
|
745 | 745 | |
746 | - return implode( ' ', $form_classes_array ); |
|
746 | + return implode(' ', $form_classes_array); |
|
747 | 747 | |
748 | 748 | } |
749 | 749 | |
@@ -758,24 +758,24 @@ discard block |
||
758 | 758 | * |
759 | 759 | * @return string |
760 | 760 | */ |
761 | - public function get_form_wrap_classes( $args ) { |
|
761 | + public function get_form_wrap_classes($args) { |
|
762 | 762 | |
763 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
763 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
764 | 764 | ? $args['display_style'] |
765 | - : get_post_meta( $this->ID, '_give_payment_display', true ); |
|
765 | + : get_post_meta($this->ID, '_give_payment_display', true); |
|
766 | 766 | |
767 | 767 | // If admin want to show only button for form then user inbuilt modal functionality. |
768 | - if( 'button' === $display_option ) { |
|
768 | + if ('button' === $display_option) { |
|
769 | 769 | $display_option = 'modal give-display-button-only'; |
770 | 770 | } |
771 | 771 | |
772 | - $form_wrap_classes_array = apply_filters( 'give_form_wrap_classes', array( |
|
772 | + $form_wrap_classes_array = apply_filters('give_form_wrap_classes', array( |
|
773 | 773 | 'give-form-wrap', |
774 | - 'give-display-' . $display_option, |
|
775 | - ), $this->ID, $args ); |
|
774 | + 'give-display-'.$display_option, |
|
775 | + ), $this->ID, $args); |
|
776 | 776 | |
777 | 777 | |
778 | - return implode( ' ', $form_wrap_classes_array ); |
|
778 | + return implode(' ', $form_wrap_classes_array); |
|
779 | 779 | |
780 | 780 | } |
781 | 781 | |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | public function is_set_type_donation_form() { |
791 | 791 | $form_type = $this->get_type(); |
792 | 792 | |
793 | - return ( 'set' === $form_type ? true : false ); |
|
793 | + return ('set' === $form_type ? true : false); |
|
794 | 794 | } |
795 | 795 | |
796 | 796 | /** |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | public function is_multi_type_donation_form() { |
805 | 805 | $form_type = $this->get_type(); |
806 | 806 | |
807 | - return ( 'multi' === $form_type ? true : false ); |
|
807 | + return ('multi' === $form_type ? true : false); |
|
808 | 808 | |
809 | 809 | } |
810 | 810 | |
@@ -818,15 +818,15 @@ discard block |
||
818 | 818 | */ |
819 | 819 | public function get_sales() { |
820 | 820 | |
821 | - if ( ! isset( $this->sales ) ) { |
|
821 | + if ( ! isset($this->sales)) { |
|
822 | 822 | |
823 | - if ( '' == get_post_meta( $this->ID, '_give_form_sales', true ) ) { |
|
824 | - add_post_meta( $this->ID, '_give_form_sales', 0 ); |
|
823 | + if ('' == get_post_meta($this->ID, '_give_form_sales', true)) { |
|
824 | + add_post_meta($this->ID, '_give_form_sales', 0); |
|
825 | 825 | } // End if |
826 | 826 | |
827 | - $this->sales = get_post_meta( $this->ID, '_give_form_sales', true ); |
|
827 | + $this->sales = get_post_meta($this->ID, '_give_form_sales', true); |
|
828 | 828 | |
829 | - if ( $this->sales < 0 ) { |
|
829 | + if ($this->sales < 0) { |
|
830 | 830 | // Never let sales be less than zero |
831 | 831 | $this->sales = 0; |
832 | 832 | } |
@@ -847,13 +847,13 @@ discard block |
||
847 | 847 | * |
848 | 848 | * @return int|false New number of total sales. |
849 | 849 | */ |
850 | - public function increase_sales( $quantity = 1 ) { |
|
850 | + public function increase_sales($quantity = 1) { |
|
851 | 851 | |
852 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
853 | - $quantity = absint( $quantity ); |
|
852 | + $sales = give_get_form_sales_stats($this->ID); |
|
853 | + $quantity = absint($quantity); |
|
854 | 854 | $total_sales = $sales + $quantity; |
855 | 855 | |
856 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
856 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
857 | 857 | |
858 | 858 | $this->sales = $total_sales; |
859 | 859 | |
@@ -874,17 +874,17 @@ discard block |
||
874 | 874 | * |
875 | 875 | * @return int|false New number of total sales. |
876 | 876 | */ |
877 | - public function decrease_sales( $quantity = 1 ) { |
|
877 | + public function decrease_sales($quantity = 1) { |
|
878 | 878 | |
879 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
879 | + $sales = give_get_form_sales_stats($this->ID); |
|
880 | 880 | |
881 | 881 | // Only decrease if not already zero |
882 | - if ( $sales > 0 ) { |
|
882 | + if ($sales > 0) { |
|
883 | 883 | |
884 | - $quantity = absint( $quantity ); |
|
884 | + $quantity = absint($quantity); |
|
885 | 885 | $total_sales = $sales - $quantity; |
886 | 886 | |
887 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
887 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
888 | 888 | |
889 | 889 | $this->sales = $sales; |
890 | 890 | |
@@ -908,15 +908,15 @@ discard block |
||
908 | 908 | */ |
909 | 909 | public function get_earnings() { |
910 | 910 | |
911 | - if ( ! isset( $this->earnings ) ) { |
|
911 | + if ( ! isset($this->earnings)) { |
|
912 | 912 | |
913 | - if ( '' == get_post_meta( $this->ID, '_give_form_earnings', true ) ) { |
|
914 | - add_post_meta( $this->ID, '_give_form_earnings', 0 ); |
|
913 | + if ('' == get_post_meta($this->ID, '_give_form_earnings', true)) { |
|
914 | + add_post_meta($this->ID, '_give_form_earnings', 0); |
|
915 | 915 | } |
916 | 916 | |
917 | - $this->earnings = get_post_meta( $this->ID, '_give_form_earnings', true ); |
|
917 | + $this->earnings = get_post_meta($this->ID, '_give_form_earnings', true); |
|
918 | 918 | |
919 | - if ( $this->earnings < 0 ) { |
|
919 | + if ($this->earnings < 0) { |
|
920 | 920 | // Never let earnings be less than zero |
921 | 921 | $this->earnings = 0; |
922 | 922 | } |
@@ -937,12 +937,12 @@ discard block |
||
937 | 937 | * |
938 | 938 | * @return float|false |
939 | 939 | */ |
940 | - public function increase_earnings( $amount = 0 ) { |
|
940 | + public function increase_earnings($amount = 0) { |
|
941 | 941 | |
942 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
942 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
943 | 943 | $new_amount = $earnings + (float) $amount; |
944 | 944 | |
945 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
945 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
946 | 946 | |
947 | 947 | $this->earnings = $new_amount; |
948 | 948 | |
@@ -964,16 +964,16 @@ discard block |
||
964 | 964 | * |
965 | 965 | * @return float|false |
966 | 966 | */ |
967 | - public function decrease_earnings( $amount ) { |
|
967 | + public function decrease_earnings($amount) { |
|
968 | 968 | |
969 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
969 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
970 | 970 | |
971 | - if ( $earnings > 0 ) { |
|
971 | + if ($earnings > 0) { |
|
972 | 972 | // Only decrease if greater than zero |
973 | 973 | $new_amount = $earnings - (float) $amount; |
974 | 974 | |
975 | 975 | |
976 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
976 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
977 | 977 | |
978 | 978 | $this->earnings = $new_amount; |
979 | 979 | |
@@ -997,22 +997,22 @@ discard block |
||
997 | 997 | * |
998 | 998 | * @return bool |
999 | 999 | */ |
1000 | - public function is_free( $price_id = false ) { |
|
1000 | + public function is_free($price_id = false) { |
|
1001 | 1001 | |
1002 | 1002 | $is_free = false; |
1003 | - $variable_pricing = give_has_variable_prices( $this->ID ); |
|
1003 | + $variable_pricing = give_has_variable_prices($this->ID); |
|
1004 | 1004 | |
1005 | - if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) { |
|
1006 | - $price = give_get_price_option_amount( $this->ID, $price_id ); |
|
1007 | - } elseif ( ! $variable_pricing ) { |
|
1008 | - $price = get_post_meta( $this->ID, '_give_set_price', true ); |
|
1005 | + if ($variable_pricing && ! is_null($price_id) && $price_id !== false) { |
|
1006 | + $price = give_get_price_option_amount($this->ID, $price_id); |
|
1007 | + } elseif ( ! $variable_pricing) { |
|
1008 | + $price = get_post_meta($this->ID, '_give_set_price', true); |
|
1009 | 1009 | } |
1010 | 1010 | |
1011 | - if ( isset( $price ) && (float) $price == 0 ) { |
|
1011 | + if (isset($price) && (float) $price == 0) { |
|
1012 | 1012 | $is_free = true; |
1013 | 1013 | } |
1014 | 1014 | |
1015 | - return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id ); |
|
1015 | + return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id); |
|
1016 | 1016 | |
1017 | 1017 | } |
1018 | 1018 | |
@@ -1039,9 +1039,9 @@ discard block |
||
1039 | 1039 | $is_close_form = apply_filters( |
1040 | 1040 | 'give_is_close_donation_form', |
1041 | 1041 | ( |
1042 | - give_is_setting_enabled( get_post_meta( $this->ID, '_give_goal_option', true ) ) ) |
|
1043 | - && give_is_setting_enabled( get_post_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) ) |
|
1044 | - && ( $this->get_goal() <= $this->get_earnings() |
|
1042 | + give_is_setting_enabled(get_post_meta($this->ID, '_give_goal_option', true)) ) |
|
1043 | + && give_is_setting_enabled(get_post_meta($this->ID, '_give_close_form_when_goal_achieved', true)) |
|
1044 | + && ($this->get_goal() <= $this->get_earnings() |
|
1045 | 1045 | ), |
1046 | 1046 | $this->ID |
1047 | 1047 | ); |
@@ -1060,29 +1060,29 @@ discard block |
||
1060 | 1060 | * |
1061 | 1061 | * @return bool The result of the update query. |
1062 | 1062 | */ |
1063 | - private function update_meta( $meta_key = '', $meta_value = '' ) { |
|
1063 | + private function update_meta($meta_key = '', $meta_value = '') { |
|
1064 | 1064 | |
1065 | 1065 | /* @var WPDB $wpdb */ |
1066 | 1066 | global $wpdb; |
1067 | 1067 | |
1068 | - if ( empty( $meta_key ) ) { |
|
1068 | + if (empty($meta_key)) { |
|
1069 | 1069 | return false; |
1070 | 1070 | } |
1071 | 1071 | |
1072 | 1072 | // Make sure if it needs to be serialized, we do |
1073 | - $meta_value = maybe_serialize( $meta_value ); |
|
1073 | + $meta_value = maybe_serialize($meta_value); |
|
1074 | 1074 | |
1075 | - if ( is_numeric( $meta_value ) ) { |
|
1076 | - $value_type = is_float( $meta_value ) ? '%f' : '%d'; |
|
1075 | + if (is_numeric($meta_value)) { |
|
1076 | + $value_type = is_float($meta_value) ? '%f' : '%d'; |
|
1077 | 1077 | } else { |
1078 | 1078 | $value_type = "'%s'"; |
1079 | 1079 | } |
1080 | 1080 | |
1081 | - $sql = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key ); |
|
1081 | + $sql = $wpdb->prepare("UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key); |
|
1082 | 1082 | |
1083 | - if ( $wpdb->query( $sql ) ) { |
|
1083 | + if ($wpdb->query($sql)) { |
|
1084 | 1084 | |
1085 | - clean_post_cache( $this->ID ); |
|
1085 | + clean_post_cache($this->ID); |
|
1086 | 1086 | |
1087 | 1087 | return true; |
1088 | 1088 |
@@ -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 | |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @param $args array The array of arguments that can be passed in and used for setting up this payment query. |
58 | 58 | */ |
59 | - public function __construct( $args = array() ) { |
|
59 | + public function __construct($args = array()) { |
|
60 | 60 | $defaults = array( |
61 | 61 | 'output' => 'payments', // Use 'posts' to get standard post objects |
62 | - 'post_type' => array( 'give_payment' ), |
|
62 | + 'post_type' => array('give_payment'), |
|
63 | 63 | 'start_date' => false, |
64 | 64 | 'end_date' => false, |
65 | 65 | 'number' => 20, |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | 'give_forms' => null, |
80 | 80 | ); |
81 | 81 | |
82 | - $this->args = wp_parse_args( $args, $defaults ); |
|
82 | + $this->args = wp_parse_args($args, $defaults); |
|
83 | 83 | |
84 | 84 | $this->init(); |
85 | 85 | } |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | * @param $query_var |
94 | 94 | * @param $value |
95 | 95 | */ |
96 | - public function __set( $query_var, $value ) { |
|
97 | - if ( in_array( $query_var, array( 'meta_query', 'tax_query' ) ) ) { |
|
98 | - $this->args[ $query_var ][] = $value; |
|
96 | + public function __set($query_var, $value) { |
|
97 | + if (in_array($query_var, array('meta_query', 'tax_query'))) { |
|
98 | + $this->args[$query_var][] = $value; |
|
99 | 99 | } else { |
100 | - $this->args[ $query_var ] = $value; |
|
100 | + $this->args[$query_var] = $value; |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
@@ -109,8 +109,8 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @param $query_var |
111 | 111 | */ |
112 | - public function __unset( $query_var ) { |
|
113 | - unset( $this->args[ $query_var ] ); |
|
112 | + public function __unset($query_var) { |
|
113 | + unset($this->args[$query_var]); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -123,20 +123,20 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function init() { |
125 | 125 | |
126 | - add_action( 'give_pre_get_payments', array( $this, 'date_filter_pre' ) ); |
|
127 | - add_action( 'give_post_get_payments', array( $this, 'date_filter_post' ) ); |
|
128 | - |
|
129 | - add_action( 'give_pre_get_payments', array( $this, 'orderby' ) ); |
|
130 | - add_filter( 'posts_orderby', array( $this, 'custom_orderby' ), 10, 2 ); |
|
131 | - add_action( 'give_pre_get_payments', array( $this, 'status' ) ); |
|
132 | - add_action( 'give_pre_get_payments', array( $this, 'month' ) ); |
|
133 | - add_action( 'give_pre_get_payments', array( $this, 'per_page' ) ); |
|
134 | - add_action( 'give_pre_get_payments', array( $this, 'page' ) ); |
|
135 | - add_action( 'give_pre_get_payments', array( $this, 'user' ) ); |
|
136 | - add_action( 'give_pre_get_payments', array( $this, 'search' ) ); |
|
137 | - add_action( 'give_pre_get_payments', array( $this, 'mode' ) ); |
|
138 | - add_action( 'give_pre_get_payments', array( $this, 'children' ) ); |
|
139 | - add_action( 'give_pre_get_payments', array( $this, 'give_forms' ) ); |
|
126 | + add_action('give_pre_get_payments', array($this, 'date_filter_pre')); |
|
127 | + add_action('give_post_get_payments', array($this, 'date_filter_post')); |
|
128 | + |
|
129 | + add_action('give_pre_get_payments', array($this, 'orderby')); |
|
130 | + add_filter('posts_orderby', array($this, 'custom_orderby'), 10, 2); |
|
131 | + add_action('give_pre_get_payments', array($this, 'status')); |
|
132 | + add_action('give_pre_get_payments', array($this, 'month')); |
|
133 | + add_action('give_pre_get_payments', array($this, 'per_page')); |
|
134 | + add_action('give_pre_get_payments', array($this, 'page')); |
|
135 | + add_action('give_pre_get_payments', array($this, 'user')); |
|
136 | + add_action('give_pre_get_payments', array($this, 'search')); |
|
137 | + add_action('give_pre_get_payments', array($this, 'mode')); |
|
138 | + add_action('give_pre_get_payments', array($this, 'children')); |
|
139 | + add_action('give_pre_get_payments', array($this, 'give_forms')); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | /** |
@@ -160,27 +160,27 @@ discard block |
||
160 | 160 | * |
161 | 161 | * @param Give_Payments_Query $this Payments query object. |
162 | 162 | */ |
163 | - do_action( 'give_pre_get_payments', $this ); |
|
163 | + do_action('give_pre_get_payments', $this); |
|
164 | 164 | |
165 | - $query = new WP_Query( $this->args ); |
|
165 | + $query = new WP_Query($this->args); |
|
166 | 166 | |
167 | 167 | $custom_output = array( |
168 | 168 | 'payments', |
169 | 169 | 'give_payments', |
170 | 170 | ); |
171 | 171 | |
172 | - if ( ! in_array( $this->args['output'], $custom_output ) ) { |
|
172 | + if ( ! in_array($this->args['output'], $custom_output)) { |
|
173 | 173 | return $query->posts; |
174 | 174 | } |
175 | 175 | |
176 | - if ( $query->have_posts() ) { |
|
177 | - while ( $query->have_posts() ) { |
|
176 | + if ($query->have_posts()) { |
|
177 | + while ($query->have_posts()) { |
|
178 | 178 | $query->the_post(); |
179 | 179 | |
180 | 180 | $payment_id = get_post()->ID; |
181 | - $payment = new Give_Payment( $payment_id ); |
|
181 | + $payment = new Give_Payment($payment_id); |
|
182 | 182 | |
183 | - $this->payments[] = apply_filters( 'give_payment', $payment, $payment_id, $this ); |
|
183 | + $this->payments[] = apply_filters('give_payment', $payment, $payment_id, $this); |
|
184 | 184 | } |
185 | 185 | |
186 | 186 | wp_reset_postdata(); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @param Give_Payments_Query $this Payments query object. |
195 | 195 | */ |
196 | - do_action( 'give_post_get_payments', $this ); |
|
196 | + do_action('give_post_get_payments', $this); |
|
197 | 197 | |
198 | 198 | return $this->payments; |
199 | 199 | } |
@@ -207,13 +207,13 @@ discard block |
||
207 | 207 | * @return void |
208 | 208 | */ |
209 | 209 | public function date_filter_pre() { |
210 | - if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) { |
|
210 | + if ( ! ($this->args['start_date'] || $this->args['end_date'])) { |
|
211 | 211 | return; |
212 | 212 | } |
213 | 213 | |
214 | - $this->setup_dates( $this->args['start_date'], $this->args['end_date'] ); |
|
214 | + $this->setup_dates($this->args['start_date'], $this->args['end_date']); |
|
215 | 215 | |
216 | - add_filter( 'posts_where', array( $this, 'payments_where' ) ); |
|
216 | + add_filter('posts_where', array($this, 'payments_where')); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
@@ -226,11 +226,11 @@ discard block |
||
226 | 226 | * @return void |
227 | 227 | */ |
228 | 228 | public function date_filter_post() { |
229 | - if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) { |
|
229 | + if ( ! ($this->args['start_date'] || $this->args['end_date'])) { |
|
230 | 230 | return; |
231 | 231 | } |
232 | 232 | |
233 | - remove_filter( 'posts_where', array( $this, 'payments_where' ) ); |
|
233 | + remove_filter('posts_where', array($this, 'payments_where')); |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
@@ -242,12 +242,12 @@ discard block |
||
242 | 242 | * @return void |
243 | 243 | */ |
244 | 244 | public function status() { |
245 | - if ( ! isset ( $this->args['status'] ) ) { |
|
245 | + if ( ! isset ($this->args['status'])) { |
|
246 | 246 | return; |
247 | 247 | } |
248 | 248 | |
249 | - $this->__set( 'post_status', $this->args['status'] ); |
|
250 | - $this->__unset( 'status' ); |
|
249 | + $this->__set('post_status', $this->args['status']); |
|
250 | + $this->__unset('status'); |
|
251 | 251 | } |
252 | 252 | |
253 | 253 | /** |
@@ -259,12 +259,12 @@ discard block |
||
259 | 259 | * @return void |
260 | 260 | */ |
261 | 261 | public function page() { |
262 | - if ( ! isset ( $this->args['page'] ) ) { |
|
262 | + if ( ! isset ($this->args['page'])) { |
|
263 | 263 | return; |
264 | 264 | } |
265 | 265 | |
266 | - $this->__set( 'paged', $this->args['page'] ); |
|
267 | - $this->__unset( 'page' ); |
|
266 | + $this->__set('paged', $this->args['page']); |
|
267 | + $this->__unset('page'); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | /** |
@@ -277,17 +277,17 @@ discard block |
||
277 | 277 | */ |
278 | 278 | public function per_page() { |
279 | 279 | |
280 | - if ( ! isset( $this->args['number'] ) ) { |
|
280 | + if ( ! isset($this->args['number'])) { |
|
281 | 281 | return; |
282 | 282 | } |
283 | 283 | |
284 | - if ( $this->args['number'] == - 1 ) { |
|
285 | - $this->__set( 'nopaging', true ); |
|
284 | + if ($this->args['number'] == - 1) { |
|
285 | + $this->__set('nopaging', true); |
|
286 | 286 | } else { |
287 | - $this->__set( 'posts_per_page', $this->args['number'] ); |
|
287 | + $this->__set('posts_per_page', $this->args['number']); |
|
288 | 288 | } |
289 | 289 | |
290 | - $this->__unset( 'number' ); |
|
290 | + $this->__unset('number'); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | /** |
@@ -299,12 +299,12 @@ discard block |
||
299 | 299 | * @return void |
300 | 300 | */ |
301 | 301 | public function month() { |
302 | - if ( ! isset ( $this->args['month'] ) ) { |
|
302 | + if ( ! isset ($this->args['month'])) { |
|
303 | 303 | return; |
304 | 304 | } |
305 | 305 | |
306 | - $this->__set( 'monthnum', $this->args['month'] ); |
|
307 | - $this->__unset( 'month' ); |
|
306 | + $this->__set('monthnum', $this->args['month']); |
|
307 | + $this->__unset('month'); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
@@ -316,23 +316,23 @@ discard block |
||
316 | 316 | * @return void |
317 | 317 | */ |
318 | 318 | public function orderby() { |
319 | - switch ( $this->args['orderby'] ) { |
|
319 | + switch ($this->args['orderby']) { |
|
320 | 320 | case 'amount' : |
321 | - $this->__set( 'orderby', 'meta_value_num' ); |
|
322 | - $this->__set( 'meta_key', '_give_payment_total' ); |
|
321 | + $this->__set('orderby', 'meta_value_num'); |
|
322 | + $this->__set('meta_key', '_give_payment_total'); |
|
323 | 323 | break; |
324 | 324 | |
325 | 325 | case 'status' : |
326 | - $this->__set( 'orderby', 'post_status' ); |
|
326 | + $this->__set('orderby', 'post_status'); |
|
327 | 327 | break; |
328 | 328 | |
329 | 329 | case 'donation_form' : |
330 | - $this->__set( 'orderby', 'meta_value' ); |
|
331 | - $this->__set( 'meta_key', '_give_payment_form_title' ); |
|
330 | + $this->__set('orderby', 'meta_value'); |
|
331 | + $this->__set('meta_key', '_give_payment_form_title'); |
|
332 | 332 | break; |
333 | 333 | |
334 | 334 | default : |
335 | - $this->__set( 'orderby', $this->args['orderby'] ); |
|
335 | + $this->__set('orderby', $this->args['orderby']); |
|
336 | 336 | break; |
337 | 337 | } |
338 | 338 | } |
@@ -349,15 +349,15 @@ discard block |
||
349 | 349 | * |
350 | 350 | * @return mixed |
351 | 351 | */ |
352 | - public function custom_orderby( $order, $query ) { |
|
353 | - $post_types = is_array( $query->query['post_type'] ) ? $query->query['post_type'] : array( $query->query['post_type'] ); |
|
354 | - if ( ! in_array( 'give_payment', $post_types ) || is_array( $query->query['orderby'] ) ) { |
|
352 | + public function custom_orderby($order, $query) { |
|
353 | + $post_types = is_array($query->query['post_type']) ? $query->query['post_type'] : array($query->query['post_type']); |
|
354 | + if ( ! in_array('give_payment', $post_types) || is_array($query->query['orderby'])) { |
|
355 | 355 | return $order; |
356 | 356 | } |
357 | 357 | |
358 | - switch ( $query->query['orderby'] ) { |
|
358 | + switch ($query->query['orderby']) { |
|
359 | 359 | case 'post_status': |
360 | - $order = 'wp_posts.post_status ' . strtoupper( $query->query['order'] ); |
|
360 | + $order = 'wp_posts.post_status '.strtoupper($query->query['order']); |
|
361 | 361 | break; |
362 | 362 | } |
363 | 363 | |
@@ -373,20 +373,20 @@ discard block |
||
373 | 373 | * @return void |
374 | 374 | */ |
375 | 375 | public function user() { |
376 | - if ( is_null( $this->args['user'] ) ) { |
|
376 | + if (is_null($this->args['user'])) { |
|
377 | 377 | return; |
378 | 378 | } |
379 | 379 | |
380 | - if ( is_numeric( $this->args['user'] ) ) { |
|
380 | + if (is_numeric($this->args['user'])) { |
|
381 | 381 | $user_key = '_give_payment_user_id'; |
382 | 382 | } else { |
383 | 383 | $user_key = '_give_payment_user_email'; |
384 | 384 | } |
385 | 385 | |
386 | - $this->__set( 'meta_query', array( |
|
386 | + $this->__set('meta_query', array( |
|
387 | 387 | 'key' => $user_key, |
388 | 388 | 'value' => $this->args['user'], |
389 | - ) ); |
|
389 | + )); |
|
390 | 390 | } |
391 | 391 | |
392 | 392 | /** |
@@ -399,33 +399,33 @@ discard block |
||
399 | 399 | */ |
400 | 400 | public function search() { |
401 | 401 | |
402 | - if ( ! isset( $this->args['s'] ) ) { |
|
402 | + if ( ! isset($this->args['s'])) { |
|
403 | 403 | return; |
404 | 404 | } |
405 | 405 | |
406 | - $search = trim( $this->args['s'] ); |
|
406 | + $search = trim($this->args['s']); |
|
407 | 407 | |
408 | - if ( empty( $search ) ) { |
|
408 | + if (empty($search)) { |
|
409 | 409 | return; |
410 | 410 | } |
411 | 411 | |
412 | - $is_email = is_email( $search ) || strpos( $search, '@' ) !== false; |
|
413 | - $is_user = strpos( $search, strtolower( 'user:' ) ) !== false; |
|
412 | + $is_email = is_email($search) || strpos($search, '@') !== false; |
|
413 | + $is_user = strpos($search, strtolower('user:')) !== false; |
|
414 | 414 | |
415 | - if ( ! empty( $this->args['search_in_notes'] ) ) { |
|
415 | + if ( ! empty($this->args['search_in_notes'])) { |
|
416 | 416 | |
417 | - $notes = give_get_payment_notes( 0, $search ); |
|
417 | + $notes = give_get_payment_notes(0, $search); |
|
418 | 418 | |
419 | - if ( ! empty( $notes ) ) { |
|
419 | + if ( ! empty($notes)) { |
|
420 | 420 | |
421 | - $payment_ids = wp_list_pluck( (array) $notes, 'comment_post_ID' ); |
|
421 | + $payment_ids = wp_list_pluck((array) $notes, 'comment_post_ID'); |
|
422 | 422 | |
423 | - $this->__set( 'post__in', $payment_ids ); |
|
423 | + $this->__set('post__in', $payment_ids); |
|
424 | 424 | } |
425 | 425 | |
426 | - $this->__unset( 's' ); |
|
426 | + $this->__unset('s'); |
|
427 | 427 | |
428 | - } elseif ( $is_email || strlen( $search ) == 32 ) { |
|
428 | + } elseif ($is_email || strlen($search) == 32) { |
|
429 | 429 | |
430 | 430 | $key = $is_email ? '_give_payment_user_email' : '_give_payment_purchase_key'; |
431 | 431 | $search_meta = array( |
@@ -434,19 +434,19 @@ discard block |
||
434 | 434 | 'compare' => 'LIKE', |
435 | 435 | ); |
436 | 436 | |
437 | - $this->__set( 'meta_query', $search_meta ); |
|
438 | - $this->__unset( 's' ); |
|
437 | + $this->__set('meta_query', $search_meta); |
|
438 | + $this->__unset('s'); |
|
439 | 439 | |
440 | - } elseif ( $is_user ) { |
|
440 | + } elseif ($is_user) { |
|
441 | 441 | |
442 | 442 | $search_meta = array( |
443 | 443 | 'key' => '_give_payment_user_id', |
444 | - 'value' => trim( str_replace( 'user:', '', strtolower( $search ) ) ), |
|
444 | + 'value' => trim(str_replace('user:', '', strtolower($search))), |
|
445 | 445 | ); |
446 | 446 | |
447 | - $this->__set( 'meta_query', $search_meta ); |
|
447 | + $this->__set('meta_query', $search_meta); |
|
448 | 448 | |
449 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
449 | + if (give_get_option('enable_sequential')) { |
|
450 | 450 | |
451 | 451 | $search_meta = array( |
452 | 452 | 'key' => '_give_payment_number', |
@@ -454,19 +454,19 @@ discard block |
||
454 | 454 | 'compare' => 'LIKE', |
455 | 455 | ); |
456 | 456 | |
457 | - $this->__set( 'meta_query', $search_meta ); |
|
457 | + $this->__set('meta_query', $search_meta); |
|
458 | 458 | |
459 | 459 | $this->args['meta_query']['relation'] = 'OR'; |
460 | 460 | |
461 | 461 | } |
462 | 462 | |
463 | - $this->__unset( 's' ); |
|
463 | + $this->__unset('s'); |
|
464 | 464 | |
465 | 465 | } elseif ( |
466 | - give_get_option( 'enable_sequential' ) && |
|
466 | + give_get_option('enable_sequential') && |
|
467 | 467 | ( |
468 | - false !== strpos( $search, give_get_option( 'sequential_prefix' ) ) || |
|
469 | - false !== strpos( $search, give_get_option( 'sequential_postfix' ) ) |
|
468 | + false !== strpos($search, give_get_option('sequential_prefix')) || |
|
469 | + false !== strpos($search, give_get_option('sequential_postfix')) |
|
470 | 470 | ) |
471 | 471 | ) { |
472 | 472 | |
@@ -476,29 +476,29 @@ discard block |
||
476 | 476 | 'compare' => 'LIKE', |
477 | 477 | ); |
478 | 478 | |
479 | - $this->__set( 'meta_query', $search_meta ); |
|
480 | - $this->__unset( 's' ); |
|
479 | + $this->__set('meta_query', $search_meta); |
|
480 | + $this->__unset('s'); |
|
481 | 481 | |
482 | - } elseif ( is_numeric( $search ) ) { |
|
482 | + } elseif (is_numeric($search)) { |
|
483 | 483 | |
484 | - $post = get_post( $search ); |
|
484 | + $post = get_post($search); |
|
485 | 485 | |
486 | - if ( is_object( $post ) && $post->post_type == 'give_payment' ) { |
|
486 | + if (is_object($post) && $post->post_type == 'give_payment') { |
|
487 | 487 | |
488 | 488 | $arr = array(); |
489 | 489 | $arr[] = $search; |
490 | - $this->__set( 'post__in', $arr ); |
|
491 | - $this->__unset( 's' ); |
|
490 | + $this->__set('post__in', $arr); |
|
491 | + $this->__unset('s'); |
|
492 | 492 | } |
493 | - } elseif ( '#' == substr( $search, 0, 1 ) ) { |
|
493 | + } elseif ('#' == substr($search, 0, 1)) { |
|
494 | 494 | |
495 | - $search = str_replace( '#:', '', $search ); |
|
496 | - $search = str_replace( '#', '', $search ); |
|
497 | - $this->__set( 'give_forms', $search ); |
|
498 | - $this->__unset( 's' ); |
|
495 | + $search = str_replace('#:', '', $search); |
|
496 | + $search = str_replace('#', '', $search); |
|
497 | + $this->__set('give_forms', $search); |
|
498 | + $this->__unset('s'); |
|
499 | 499 | |
500 | 500 | } else { |
501 | - $this->__set( 's', $search ); |
|
501 | + $this->__set('s', $search); |
|
502 | 502 | |
503 | 503 | } |
504 | 504 | |
@@ -513,16 +513,16 @@ discard block |
||
513 | 513 | * @return void |
514 | 514 | */ |
515 | 515 | public function mode() { |
516 | - if ( empty( $this->args['mode'] ) || $this->args['mode'] == 'all' ) { |
|
517 | - $this->__unset( 'mode' ); |
|
516 | + if (empty($this->args['mode']) || $this->args['mode'] == 'all') { |
|
517 | + $this->__unset('mode'); |
|
518 | 518 | |
519 | 519 | return; |
520 | 520 | } |
521 | 521 | |
522 | - $this->__set( 'meta_query', array( |
|
522 | + $this->__set('meta_query', array( |
|
523 | 523 | 'key' => '_give_payment_mode', |
524 | 524 | 'value' => $this->args['mode'], |
525 | - ) ); |
|
525 | + )); |
|
526 | 526 | } |
527 | 527 | |
528 | 528 | /** |
@@ -534,10 +534,10 @@ discard block |
||
534 | 534 | * @return void |
535 | 535 | */ |
536 | 536 | public function children() { |
537 | - if ( empty( $this->args['children'] ) ) { |
|
538 | - $this->__set( 'post_parent', 0 ); |
|
537 | + if (empty($this->args['children'])) { |
|
538 | + $this->__set('post_parent', 0); |
|
539 | 539 | } |
540 | - $this->__unset( 'children' ); |
|
540 | + $this->__unset('children'); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | /** |
@@ -550,25 +550,25 @@ discard block |
||
550 | 550 | */ |
551 | 551 | public function give_forms() { |
552 | 552 | |
553 | - if ( empty( $this->args['give_forms'] ) ) { |
|
553 | + if (empty($this->args['give_forms'])) { |
|
554 | 554 | return; |
555 | 555 | } |
556 | 556 | |
557 | 557 | $compare = '='; |
558 | 558 | |
559 | - if ( is_array( $this->args['give_forms'] ) ) { |
|
559 | + if (is_array($this->args['give_forms'])) { |
|
560 | 560 | $compare = 'IN'; |
561 | 561 | } |
562 | 562 | |
563 | - $this->__set( 'meta_query', array( |
|
563 | + $this->__set('meta_query', array( |
|
564 | 564 | array( |
565 | 565 | 'key' => '_give_payment_form_id', |
566 | 566 | 'value' => $this->args['give_forms'], |
567 | 567 | 'compare' => $compare, |
568 | 568 | ), |
569 | - ) ); |
|
569 | + )); |
|
570 | 570 | |
571 | - $this->__unset( 'give_forms' ); |
|
571 | + $this->__unset('give_forms'); |
|
572 | 572 | |
573 | 573 | } |
574 | 574 |
@@ -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,36 +26,36 @@ discard block |
||
26 | 26 | function give_donation_history() { |
27 | 27 | |
28 | 28 | // If payment_key query arg exists, return receipt instead of donation history. |
29 | - if ( isset( $_GET['payment_key'] ) ) { |
|
29 | + if (isset($_GET['payment_key'])) { |
|
30 | 30 | ob_start(); |
31 | - echo give_receipt_shortcode( array() ); |
|
32 | - echo '<a href="' . esc_url( give_get_history_page_uri() ) . '">« ' . esc_html__( 'Return to All Donations', 'give' ) . '</a>'; |
|
31 | + echo give_receipt_shortcode(array()); |
|
32 | + echo '<a href="'.esc_url(give_get_history_page_uri()).'">« '.esc_html__('Return to All Donations', 'give').'</a>'; |
|
33 | 33 | |
34 | 34 | return ob_get_clean(); |
35 | 35 | } |
36 | 36 | |
37 | - $email_access = give_get_option( 'email_access' ); |
|
37 | + $email_access = give_get_option('email_access'); |
|
38 | 38 | |
39 | 39 | //Is user logged in? Does a session exist? Does an email-access token exist? |
40 | - if ( is_user_logged_in() || Give()->session->get_session_expiration() !== false || ( $email_access == 'on' && Give()->email_access->token_exists ) ) { |
|
40 | + if (is_user_logged_in() || Give()->session->get_session_expiration() !== false || ($email_access == 'on' && Give()->email_access->token_exists)) { |
|
41 | 41 | ob_start(); |
42 | - give_get_template_part( 'history', 'donations' ); |
|
42 | + give_get_template_part('history', 'donations'); |
|
43 | 43 | |
44 | 44 | return ob_get_clean(); |
45 | 45 | } //Is Email-based access enabled? |
46 | - elseif ( $email_access == 'on' ) { |
|
46 | + elseif ($email_access == 'on') { |
|
47 | 47 | |
48 | 48 | ob_start(); |
49 | - give_get_template_part( 'email', 'login-form' ); |
|
49 | + give_get_template_part('email', 'login-form'); |
|
50 | 50 | |
51 | 51 | return ob_get_clean(); |
52 | 52 | } else { |
53 | - $message = esc_html__( 'You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give' ); |
|
54 | - echo apply_filters( 'give_donation_history_nonuser_message', give_output_error( $message, false ), $message ); |
|
53 | + $message = esc_html__('You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give'); |
|
54 | + echo apply_filters('give_donation_history_nonuser_message', give_output_error($message, false), $message); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | -add_shortcode( 'donation_history', 'give_donation_history' ); |
|
58 | +add_shortcode('donation_history', 'give_donation_history'); |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Donation Form Shortcode |
@@ -68,15 +68,15 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @return string |
70 | 70 | */ |
71 | -function give_form_shortcode( $atts ) { |
|
72 | - $atts = shortcode_atts( array( |
|
71 | +function give_form_shortcode($atts) { |
|
72 | + $atts = shortcode_atts(array( |
|
73 | 73 | 'id' => '', |
74 | 74 | 'show_title' => true, |
75 | 75 | 'show_goal' => true, |
76 | 76 | 'show_content' => '', |
77 | 77 | 'float_labels' => '', |
78 | 78 | 'display_style' => '', |
79 | - ), $atts, 'give_form' ); |
|
79 | + ), $atts, 'give_form'); |
|
80 | 80 | |
81 | 81 | // Convert string to bool. |
82 | 82 | $atts['show_title'] = (bool) $atts['show_title']; |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | |
85 | 85 | //get the Give Form |
86 | 86 | ob_start(); |
87 | - give_get_donation_form( $atts ); |
|
87 | + give_get_donation_form($atts); |
|
88 | 88 | $final_output = ob_get_clean(); |
89 | 89 | |
90 | - return apply_filters( 'give_donate_form', $final_output, $atts ); |
|
90 | + return apply_filters('give_donate_form', $final_output, $atts); |
|
91 | 91 | } |
92 | 92 | |
93 | -add_shortcode( 'give_form', 'give_form_shortcode' ); |
|
93 | +add_shortcode('give_form', 'give_form_shortcode'); |
|
94 | 94 | |
95 | 95 | /** |
96 | 96 | * Donation Form Goal Shortcode. |
@@ -103,37 +103,37 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @return string |
105 | 105 | */ |
106 | -function give_goal_shortcode( $atts ) { |
|
107 | - $atts = shortcode_atts( array( |
|
106 | +function give_goal_shortcode($atts) { |
|
107 | + $atts = shortcode_atts(array( |
|
108 | 108 | 'id' => '', |
109 | 109 | 'show_text' => true, |
110 | 110 | 'show_bar' => true, |
111 | - ), $atts, 'give_goal' ); |
|
111 | + ), $atts, 'give_goal'); |
|
112 | 112 | |
113 | 113 | |
114 | 114 | //get the Give Form. |
115 | 115 | ob_start(); |
116 | 116 | |
117 | 117 | //Sanity check 1: ensure there is an ID Provided. |
118 | - if ( empty( $atts['id'] ) ) { |
|
119 | - give_output_error( esc_html__( 'The shortcode is missing Donation Form ID attribute.', 'give' ), true ); |
|
118 | + if (empty($atts['id'])) { |
|
119 | + give_output_error(esc_html__('The shortcode is missing Donation Form ID attribute.', 'give'), true); |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | //Sanity check 2: Check the form even has Goals enabled. |
123 | - if ( ! give_is_setting_enabled( get_post_meta( $atts['id'], '_give_goal_option', true ) ) ) { |
|
123 | + if ( ! give_is_setting_enabled(get_post_meta($atts['id'], '_give_goal_option', true))) { |
|
124 | 124 | |
125 | - give_output_error( esc_html__( 'The form does not have Goals enabled.', 'give' ), true ); |
|
125 | + give_output_error(esc_html__('The form does not have Goals enabled.', 'give'), true); |
|
126 | 126 | } else { |
127 | 127 | //Passed all sanity checks: output Goal. |
128 | - give_show_goal_progress( $atts['id'], $atts ); |
|
128 | + give_show_goal_progress($atts['id'], $atts); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | $final_output = ob_get_clean(); |
132 | 132 | |
133 | - return apply_filters( 'give_goal_shortcode_output', $final_output, $atts ); |
|
133 | + return apply_filters('give_goal_shortcode_output', $final_output, $atts); |
|
134 | 134 | } |
135 | 135 | |
136 | -add_shortcode( 'give_goal', 'give_goal_shortcode' ); |
|
136 | +add_shortcode('give_goal', 'give_goal_shortcode'); |
|
137 | 137 | |
138 | 138 | |
139 | 139 | /** |
@@ -150,22 +150,22 @@ discard block |
||
150 | 150 | * |
151 | 151 | * @return string |
152 | 152 | */ |
153 | -function give_login_form_shortcode( $atts ) { |
|
154 | - $atts = shortcode_atts( array( |
|
153 | +function give_login_form_shortcode($atts) { |
|
154 | + $atts = shortcode_atts(array( |
|
155 | 155 | // Add backward compatibility for redirect attribute. |
156 | 156 | 'redirect' => '', |
157 | 157 | |
158 | 158 | 'login-redirect' => '', |
159 | 159 | 'logout-redirect' => '', |
160 | - ), $atts, 'give_login' ); |
|
160 | + ), $atts, 'give_login'); |
|
161 | 161 | |
162 | 162 | // Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute. |
163 | - $atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect'] ) ? $atts['redirect'] : '' ); |
|
163 | + $atts['login-redirect'] = ! empty($atts['login-redirect']) ? $atts['login-redirect'] : ( ! empty($atts['redirect']) ? $atts['redirect'] : ''); |
|
164 | 164 | |
165 | - return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] ); |
|
165 | + return give_login_form($atts['login-redirect'], $atts['logout-redirect']); |
|
166 | 166 | } |
167 | 167 | |
168 | -add_shortcode( 'give_login', 'give_login_form_shortcode' ); |
|
168 | +add_shortcode('give_login', 'give_login_form_shortcode'); |
|
169 | 169 | |
170 | 170 | /** |
171 | 171 | * Register Shortcode. |
@@ -180,15 +180,15 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @return string |
182 | 182 | */ |
183 | -function give_register_form_shortcode( $atts ) { |
|
184 | - $atts = shortcode_atts( array( |
|
183 | +function give_register_form_shortcode($atts) { |
|
184 | + $atts = shortcode_atts(array( |
|
185 | 185 | 'redirect' => '', |
186 | - ), $atts, 'give_register' ); |
|
186 | + ), $atts, 'give_register'); |
|
187 | 187 | |
188 | - return give_register_form( $atts['redirect'] ); |
|
188 | + return give_register_form($atts['redirect']); |
|
189 | 189 | } |
190 | 190 | |
191 | -add_shortcode( 'give_register', 'give_register_form_shortcode' ); |
|
191 | +add_shortcode('give_register', 'give_register_form_shortcode'); |
|
192 | 192 | |
193 | 193 | /** |
194 | 194 | * Receipt Shortcode. |
@@ -201,12 +201,12 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @return string |
203 | 203 | */ |
204 | -function give_receipt_shortcode( $atts ) { |
|
204 | +function give_receipt_shortcode($atts) { |
|
205 | 205 | |
206 | 206 | global $give_receipt_args, $payment; |
207 | 207 | |
208 | - $give_receipt_args = shortcode_atts( array( |
|
209 | - 'error' => esc_html__( 'You are missing the payment key to view this donation receipt.', 'give' ), |
|
208 | + $give_receipt_args = shortcode_atts(array( |
|
209 | + 'error' => esc_html__('You are missing the payment key to view this donation receipt.', 'give'), |
|
210 | 210 | 'price' => true, |
211 | 211 | 'donor' => true, |
212 | 212 | 'date' => true, |
@@ -215,50 +215,50 @@ discard block |
||
215 | 215 | 'payment_id' => true, |
216 | 216 | 'payment_status' => false, |
217 | 217 | 'status_notice' => true, |
218 | - ), $atts, 'give_receipt' ); |
|
218 | + ), $atts, 'give_receipt'); |
|
219 | 219 | |
220 | 220 | //set $session var |
221 | 221 | $session = give_get_purchase_session(); |
222 | 222 | |
223 | 223 | //set payment key var |
224 | - if ( isset( $_GET['payment_key'] ) ) { |
|
225 | - $payment_key = urldecode( $_GET['payment_key'] ); |
|
226 | - } elseif ( $session ) { |
|
224 | + if (isset($_GET['payment_key'])) { |
|
225 | + $payment_key = urldecode($_GET['payment_key']); |
|
226 | + } elseif ($session) { |
|
227 | 227 | $payment_key = $session['purchase_key']; |
228 | - } elseif ( $give_receipt_args['payment_key'] ) { |
|
228 | + } elseif ($give_receipt_args['payment_key']) { |
|
229 | 229 | $payment_key = $give_receipt_args['payment_key']; |
230 | 230 | } |
231 | 231 | |
232 | - $email_access = give_get_option( 'email_access' ); |
|
232 | + $email_access = give_get_option('email_access'); |
|
233 | 233 | |
234 | 234 | // No payment_key found & Email Access is Turned on: |
235 | - if ( ! isset( $payment_key ) && $email_access == 'on' && ! Give()->email_access->token_exists ) { |
|
235 | + if ( ! isset($payment_key) && $email_access == 'on' && ! Give()->email_access->token_exists) { |
|
236 | 236 | |
237 | 237 | ob_start(); |
238 | 238 | |
239 | - give_get_template_part( 'email-login-form' ); |
|
239 | + give_get_template_part('email-login-form'); |
|
240 | 240 | |
241 | 241 | return ob_get_clean(); |
242 | 242 | |
243 | - } elseif ( ! isset( $payment_key ) ) { |
|
243 | + } elseif ( ! isset($payment_key)) { |
|
244 | 244 | |
245 | - return give_output_error( $give_receipt_args['error'], false, 'error' ); |
|
245 | + return give_output_error($give_receipt_args['error'], false, 'error'); |
|
246 | 246 | |
247 | 247 | } |
248 | 248 | |
249 | - $payment_id = give_get_purchase_id_by_key( $payment_key ); |
|
250 | - $user_can_view = give_can_view_receipt( $payment_key ); |
|
249 | + $payment_id = give_get_purchase_id_by_key($payment_key); |
|
250 | + $user_can_view = give_can_view_receipt($payment_key); |
|
251 | 251 | |
252 | 252 | // Key was provided, but user is logged out. Offer them the ability to login and view the receipt. |
253 | - if ( ! $user_can_view && $email_access == 'on' && ! Give()->email_access->token_exists ) { |
|
253 | + if ( ! $user_can_view && $email_access == 'on' && ! Give()->email_access->token_exists) { |
|
254 | 254 | |
255 | 255 | ob_start(); |
256 | 256 | |
257 | - give_get_template_part( 'email-login-form' ); |
|
257 | + give_get_template_part('email-login-form'); |
|
258 | 258 | |
259 | 259 | return ob_get_clean(); |
260 | 260 | |
261 | - } elseif ( ! $user_can_view ) { |
|
261 | + } elseif ( ! $user_can_view) { |
|
262 | 262 | |
263 | 263 | global $give_login_redirect; |
264 | 264 | |
@@ -266,9 +266,9 @@ discard block |
||
266 | 266 | |
267 | 267 | ob_start(); |
268 | 268 | |
269 | - give_output_error( apply_filters( 'give_must_be_logged_in_error_message', esc_html__( 'You must be logged in to view this donation receipt.', 'give' ) ) ); |
|
269 | + give_output_error(apply_filters('give_must_be_logged_in_error_message', esc_html__('You must be logged in to view this donation receipt.', 'give'))); |
|
270 | 270 | |
271 | - give_get_template_part( 'shortcode', 'login' ); |
|
271 | + give_get_template_part('shortcode', 'login'); |
|
272 | 272 | |
273 | 273 | $login_form = ob_get_clean(); |
274 | 274 | |
@@ -283,20 +283,20 @@ discard block |
||
283 | 283 | * or if user is logged in and the user can view sensitive shop data. |
284 | 284 | * |
285 | 285 | */ |
286 | - if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) { |
|
287 | - return give_output_error( $give_receipt_args['error'], false, 'error' ); |
|
286 | + if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) { |
|
287 | + return give_output_error($give_receipt_args['error'], false, 'error'); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | ob_start(); |
291 | 291 | |
292 | - give_get_template_part( 'shortcode', 'receipt' ); |
|
292 | + give_get_template_part('shortcode', 'receipt'); |
|
293 | 293 | |
294 | 294 | $display = ob_get_clean(); |
295 | 295 | |
296 | 296 | return $display; |
297 | 297 | } |
298 | 298 | |
299 | -add_shortcode( 'give_receipt', 'give_receipt_shortcode' ); |
|
299 | +add_shortcode('give_receipt', 'give_receipt_shortcode'); |
|
300 | 300 | |
301 | 301 | /** |
302 | 302 | * Profile Editor Shortcode. |
@@ -315,18 +315,18 @@ discard block |
||
315 | 315 | * |
316 | 316 | * @return string Output generated from the profile editor |
317 | 317 | */ |
318 | -function give_profile_editor_shortcode( $atts ) { |
|
318 | +function give_profile_editor_shortcode($atts) { |
|
319 | 319 | |
320 | 320 | ob_start(); |
321 | 321 | |
322 | - give_get_template_part( 'shortcode', 'profile-editor' ); |
|
322 | + give_get_template_part('shortcode', 'profile-editor'); |
|
323 | 323 | |
324 | 324 | $display = ob_get_clean(); |
325 | 325 | |
326 | 326 | return $display; |
327 | 327 | } |
328 | 328 | |
329 | -add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' ); |
|
329 | +add_shortcode('give_profile_editor', 'give_profile_editor_shortcode'); |
|
330 | 330 | |
331 | 331 | /** |
332 | 332 | * Process Profile Updater Form. |
@@ -339,30 +339,30 @@ discard block |
||
339 | 339 | * |
340 | 340 | * @return bool |
341 | 341 | */ |
342 | -function give_process_profile_editor_updates( $data ) { |
|
342 | +function give_process_profile_editor_updates($data) { |
|
343 | 343 | // Profile field change request |
344 | - if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) { |
|
344 | + if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) { |
|
345 | 345 | return false; |
346 | 346 | } |
347 | 347 | |
348 | 348 | // Nonce security |
349 | - if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) { |
|
349 | + if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) { |
|
350 | 350 | return false; |
351 | 351 | } |
352 | 352 | |
353 | 353 | $user_id = get_current_user_id(); |
354 | - $old_user_data = get_userdata( $user_id ); |
|
355 | - |
|
356 | - $display_name = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name; |
|
357 | - $first_name = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name; |
|
358 | - $last_name = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name; |
|
359 | - $email = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email; |
|
360 | - $line1 = ( isset( $data['give_address_line1'] ) ? sanitize_text_field( $data['give_address_line1'] ) : '' ); |
|
361 | - $line2 = ( isset( $data['give_address_line2'] ) ? sanitize_text_field( $data['give_address_line2'] ) : '' ); |
|
362 | - $city = ( isset( $data['give_address_city'] ) ? sanitize_text_field( $data['give_address_city'] ) : '' ); |
|
363 | - $state = ( isset( $data['give_address_state'] ) ? sanitize_text_field( $data['give_address_state'] ) : '' ); |
|
364 | - $zip = ( isset( $data['give_address_zip'] ) ? sanitize_text_field( $data['give_address_zip'] ) : '' ); |
|
365 | - $country = ( isset( $data['give_address_country'] ) ? sanitize_text_field( $data['give_address_country'] ) : '' ); |
|
354 | + $old_user_data = get_userdata($user_id); |
|
355 | + |
|
356 | + $display_name = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name; |
|
357 | + $first_name = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name; |
|
358 | + $last_name = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name; |
|
359 | + $email = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email; |
|
360 | + $line1 = (isset($data['give_address_line1']) ? sanitize_text_field($data['give_address_line1']) : ''); |
|
361 | + $line2 = (isset($data['give_address_line2']) ? sanitize_text_field($data['give_address_line2']) : ''); |
|
362 | + $city = (isset($data['give_address_city']) ? sanitize_text_field($data['give_address_city']) : ''); |
|
363 | + $state = (isset($data['give_address_state']) ? sanitize_text_field($data['give_address_state']) : ''); |
|
364 | + $zip = (isset($data['give_address_zip']) ? sanitize_text_field($data['give_address_zip']) : ''); |
|
365 | + $country = (isset($data['give_address_country']) ? sanitize_text_field($data['give_address_country']) : ''); |
|
366 | 366 | |
367 | 367 | $userdata = array( |
368 | 368 | 'ID' => $user_id, |
@@ -390,46 +390,46 @@ discard block |
||
390 | 390 | * @param int $user_id The ID of the user. |
391 | 391 | * @param array $userdata User info, including ID, first name, last name, display name and email. |
392 | 392 | */ |
393 | - do_action( 'give_pre_update_user_profile', $user_id, $userdata ); |
|
393 | + do_action('give_pre_update_user_profile', $user_id, $userdata); |
|
394 | 394 | |
395 | 395 | // New password |
396 | - if ( ! empty( $data['give_new_user_pass1'] ) ) { |
|
397 | - if ( $data['give_new_user_pass1'] !== $data['give_new_user_pass2'] ) { |
|
398 | - give_set_error( 'password_mismatch', esc_html__( 'The passwords you entered do not match. Please try again.', 'give' ) ); |
|
396 | + if ( ! empty($data['give_new_user_pass1'])) { |
|
397 | + if ($data['give_new_user_pass1'] !== $data['give_new_user_pass2']) { |
|
398 | + give_set_error('password_mismatch', esc_html__('The passwords you entered do not match. Please try again.', 'give')); |
|
399 | 399 | } else { |
400 | 400 | $userdata['user_pass'] = $data['give_new_user_pass1']; |
401 | 401 | } |
402 | 402 | } |
403 | 403 | |
404 | - if ( empty( $email ) ) { |
|
404 | + if (empty($email)) { |
|
405 | 405 | // Make sure email should not be empty. |
406 | - give_set_error( 'email_empty', esc_html__( 'The email you entered is empty.', 'give' ) ); |
|
406 | + give_set_error('email_empty', esc_html__('The email you entered is empty.', 'give')); |
|
407 | 407 | |
408 | - } else if ( ! is_email( $email ) ) { |
|
408 | + } else if ( ! is_email($email)) { |
|
409 | 409 | // Make sure email should be valid. |
410 | - give_set_error( 'email_not_valid', esc_html__( 'The email you entered is not valid. Please use another', 'give' ) ); |
|
410 | + give_set_error('email_not_valid', esc_html__('The email you entered is not valid. Please use another', 'give')); |
|
411 | 411 | |
412 | - } else if ( $email != $old_user_data->user_email ) { |
|
412 | + } else if ($email != $old_user_data->user_email) { |
|
413 | 413 | // Make sure the new email doesn't belong to another user |
414 | - if ( email_exists( $email ) ) { |
|
415 | - give_set_error( 'email_exists', esc_html__( 'The email you entered belongs to another user. Please use another.', 'give' ) ); |
|
414 | + if (email_exists($email)) { |
|
415 | + give_set_error('email_exists', esc_html__('The email you entered belongs to another user. Please use another.', 'give')); |
|
416 | 416 | } |
417 | 417 | } |
418 | 418 | |
419 | 419 | // Check for errors |
420 | 420 | $errors = give_get_errors(); |
421 | 421 | |
422 | - if ( $errors ) { |
|
422 | + if ($errors) { |
|
423 | 423 | // Send back to the profile editor if there are errors |
424 | - wp_redirect( $data['give_redirect'] ); |
|
424 | + wp_redirect($data['give_redirect']); |
|
425 | 425 | give_die(); |
426 | 426 | } |
427 | 427 | |
428 | 428 | // Update the user |
429 | - $meta = update_user_meta( $user_id, '_give_user_address', $address ); |
|
430 | - $updated = wp_update_user( $userdata ); |
|
429 | + $meta = update_user_meta($user_id, '_give_user_address', $address); |
|
430 | + $updated = wp_update_user($userdata); |
|
431 | 431 | |
432 | - if ( $updated ) { |
|
432 | + if ($updated) { |
|
433 | 433 | |
434 | 434 | /** |
435 | 435 | * Fires after updating user profile. |
@@ -439,12 +439,12 @@ discard block |
||
439 | 439 | * @param int $user_id The ID of the user. |
440 | 440 | * @param array $userdata User info, including ID, first name, last name, display name and email. |
441 | 441 | */ |
442 | - do_action( 'give_user_profile_updated', $user_id, $userdata ); |
|
443 | - wp_redirect( add_query_arg( 'updated', 'true', $data['give_redirect'] ) ); |
|
442 | + do_action('give_user_profile_updated', $user_id, $userdata); |
|
443 | + wp_redirect(add_query_arg('updated', 'true', $data['give_redirect'])); |
|
444 | 444 | give_die(); |
445 | 445 | } |
446 | 446 | |
447 | 447 | return false; |
448 | 448 | } |
449 | 449 | |
450 | -add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' ); |
|
450 | +add_action('give_edit_user_profile', 'give_process_profile_editor_updates'); |