@@ -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 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @param $args array The array of arguments that can be passed in and used for setting up this payment query. |
87 | 87 | */ |
88 | - public function __construct( $args = array() ) { |
|
88 | + public function __construct($args = array()) { |
|
89 | 89 | $defaults = array( |
90 | 90 | 'number' => 20, |
91 | 91 | 'offset' => 0, |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | // 'form' => array(), |
104 | 104 | ); |
105 | 105 | |
106 | - $this->args = wp_parse_args( $args, $defaults ); |
|
106 | + $this->args = wp_parse_args($args, $defaults); |
|
107 | 107 | $this->table_name = Give()->donors->table_name; |
108 | 108 | $this->meta_table_name = Give()->donor_meta->table_name; |
109 | 109 | $this->meta_type = Give()->donor_meta->meta_type; |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | * |
146 | 146 | * @param Give_Donors_Query $this Donors query object. |
147 | 147 | */ |
148 | - do_action( 'give_pre_get_donors', $this ); |
|
148 | + do_action('give_pre_get_donors', $this); |
|
149 | 149 | |
150 | - if ( empty( $this->args['count'] ) ) { |
|
151 | - $this->donors = $wpdb->get_results( $this->get_sql() ); |
|
150 | + if (empty($this->args['count'])) { |
|
151 | + $this->donors = $wpdb->get_results($this->get_sql()); |
|
152 | 152 | } else { |
153 | - $this->donors = $wpdb->get_var( $this->get_sql() ); |
|
153 | + $this->donors = $wpdb->get_var($this->get_sql()); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * |
161 | 161 | * @param Give_Donors_Query $this Donors query object. |
162 | 162 | */ |
163 | - do_action( 'give_post_get_donors', $this ); |
|
163 | + do_action('give_post_get_donors', $this); |
|
164 | 164 | |
165 | 165 | return $this->donors; |
166 | 166 | } |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | public function get_sql() { |
178 | 178 | global $wpdb; |
179 | 179 | |
180 | - if ( $this->args['number'] < 1 ) { |
|
180 | + if ($this->args['number'] < 1) { |
|
181 | 181 | $this->args['number'] = 999999999999; |
182 | 182 | } |
183 | 183 | |
@@ -185,22 +185,22 @@ discard block |
||
185 | 185 | |
186 | 186 | |
187 | 187 | // Set offset. |
188 | - if ( empty( $this->args['offset'] ) && ( 0 < $this->args['paged'] ) ) { |
|
189 | - $this->args['offset'] = $this->args['number'] * ( $this->args['paged'] - 1 ); |
|
188 | + if (empty($this->args['offset']) && (0 < $this->args['paged'])) { |
|
189 | + $this->args['offset'] = $this->args['number'] * ($this->args['paged'] - 1); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | // Set fields. |
193 | 193 | $fields = "{$this->table_name}.*"; |
194 | - if ( ! empty( $this->args['fields'] ) && 'all' !== $this->args['fields'] ) { |
|
195 | - if ( is_string( $this->args['fields'] ) ) { |
|
194 | + if ( ! empty($this->args['fields']) && 'all' !== $this->args['fields']) { |
|
195 | + if (is_string($this->args['fields'])) { |
|
196 | 196 | $fields = "{$this->table_name}.{$this->args['fields']}"; |
197 | - } else if ( is_array( $this->args['fields'] ) ) { |
|
198 | - $fields = "{$this->table_name}." . implode( " , {$this->table_name}.", $this->args['fields'] ); |
|
197 | + } else if (is_array($this->args['fields'])) { |
|
198 | + $fields = "{$this->table_name}.".implode(" , {$this->table_name}.", $this->args['fields']); |
|
199 | 199 | } |
200 | 200 | } |
201 | 201 | |
202 | 202 | // Set count. |
203 | - if ( ! empty( $this->args['count'] ) ) { |
|
203 | + if ( ! empty($this->args['count'])) { |
|
204 | 204 | $fields = "COUNT({$this->table_name}.id)"; |
205 | 205 | } |
206 | 206 | |
@@ -208,13 +208,13 @@ discard block |
||
208 | 208 | |
209 | 209 | $sql = $wpdb->prepare( |
210 | 210 | "SELECT {$fields} FROM {$this->table_name} LIMIT %d,%d;", |
211 | - absint( $this->args['offset'] ), |
|
212 | - absint( $this->args['number'] ) |
|
211 | + absint($this->args['offset']), |
|
212 | + absint($this->args['number']) |
|
213 | 213 | ); |
214 | 214 | |
215 | 215 | // $where, $orderby and order already prepared query they can generate notice if you re prepare them in above. |
216 | 216 | // WordPress consider LIKE condition as placeholder if start with s,f, or d. |
217 | - $sql = str_replace( 'LIMIT', "{$where} {$orderby} {$this->args['order']} LIMIT", $sql ); |
|
217 | + $sql = str_replace('LIMIT', "{$where} {$orderby} {$this->args['order']} LIMIT", $sql); |
|
218 | 218 | |
219 | 219 | return $sql; |
220 | 220 | } |
@@ -232,15 +232,15 @@ discard block |
||
232 | 232 | $where = ''; |
233 | 233 | |
234 | 234 | // Get sql query for meta. |
235 | - if ( ! empty( $this->args['meta_query'] ) ) { |
|
236 | - $meta_query_object = new WP_Meta_Query( $this->args['meta_query'] ); |
|
235 | + if ( ! empty($this->args['meta_query'])) { |
|
236 | + $meta_query_object = new WP_Meta_Query($this->args['meta_query']); |
|
237 | 237 | $meta_query = $meta_query_object->get_sql( |
238 | 238 | $this->meta_type, |
239 | 239 | $this->table_name, |
240 | 240 | 'id' |
241 | 241 | ); |
242 | 242 | |
243 | - $where = implode( '', $meta_query ); |
|
243 | + $where = implode('', $meta_query); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | $where .= 'WHERE 1=1 '; |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $where .= $this->get_where_user(); |
251 | 251 | $where .= $this->get_where_date(); |
252 | 252 | |
253 | - return trim( $where ); |
|
253 | + return trim($where); |
|
254 | 254 | |
255 | 255 | } |
256 | 256 | |
@@ -268,17 +268,17 @@ discard block |
||
268 | 268 | |
269 | 269 | $where = ''; |
270 | 270 | |
271 | - if ( ! empty( $this->args['email'] ) ) { |
|
271 | + if ( ! empty($this->args['email'])) { |
|
272 | 272 | |
273 | - if ( is_array( $this->args['email'] ) ) { |
|
273 | + if (is_array($this->args['email'])) { |
|
274 | 274 | |
275 | - $emails_count = count( $this->args['email'] ); |
|
276 | - $emails_placeholder = array_fill( 0, $emails_count, '%s' ); |
|
277 | - $emails = implode( ', ', $emails_placeholder ); |
|
275 | + $emails_count = count($this->args['email']); |
|
276 | + $emails_placeholder = array_fill(0, $emails_count, '%s'); |
|
277 | + $emails = implode(', ', $emails_placeholder); |
|
278 | 278 | |
279 | - $where .= $wpdb->prepare( "AND {$this->table_name}.email IN( $emails )", $this->args['email'] ); |
|
279 | + $where .= $wpdb->prepare("AND {$this->table_name}.email IN( $emails )", $this->args['email']); |
|
280 | 280 | } else { |
281 | - $where .= $wpdb->prepare( "AND {$this->table_name}.email = %s", $this->args['email'] ); |
|
281 | + $where .= $wpdb->prepare("AND {$this->table_name}.email = %s", $this->args['email']); |
|
282 | 282 | } |
283 | 283 | } |
284 | 284 | |
@@ -298,11 +298,11 @@ discard block |
||
298 | 298 | $where = ''; |
299 | 299 | |
300 | 300 | // Specific donors. |
301 | - if ( ! empty( $this->args['donor'] ) ) { |
|
302 | - if ( ! is_array( $this->args['donor'] ) ) { |
|
303 | - $this->args['donor'] = explode( ',', $this->args['donor'] ); |
|
301 | + if ( ! empty($this->args['donor'])) { |
|
302 | + if ( ! is_array($this->args['donor'])) { |
|
303 | + $this->args['donor'] = explode(',', $this->args['donor']); |
|
304 | 304 | } |
305 | - $donor_ids = implode( ',', array_map( 'intval', $this->args['donor'] ) ); |
|
305 | + $donor_ids = implode(',', array_map('intval', $this->args['donor'])); |
|
306 | 306 | |
307 | 307 | $where .= "AND {$this->table_name}.id IN( {$donor_ids} )"; |
308 | 308 | } |
@@ -323,9 +323,9 @@ discard block |
||
323 | 323 | $where = ''; |
324 | 324 | |
325 | 325 | // Donors created for a specific date or in a date range |
326 | - if ( ! empty( $this->args['date_query'] ) ) { |
|
326 | + if ( ! empty($this->args['date_query'])) { |
|
327 | 327 | $date_query_object = new WP_Date_Query( |
328 | - is_array( $this->args['date_query'] ) ? $this->args['date_query'] : wp_parse_args( $this->args['date_query'] ), |
|
328 | + is_array($this->args['date_query']) ? $this->args['date_query'] : wp_parse_args($this->args['date_query']), |
|
329 | 329 | "{$this->table_name}.date_created" |
330 | 330 | ); |
331 | 331 | |
@@ -360,11 +360,11 @@ discard block |
||
360 | 360 | $where = ''; |
361 | 361 | |
362 | 362 | // Donors created for a specific date or in a date range |
363 | - if ( ! empty( $this->args['s'] ) && false !== strpos( $this->args['s'], ':' ) ) { |
|
364 | - $search_parts = explode( ':', $this->args['s'] ); |
|
363 | + if ( ! empty($this->args['s']) && false !== strpos($this->args['s'], ':')) { |
|
364 | + $search_parts = explode(':', $this->args['s']); |
|
365 | 365 | |
366 | - if ( ! empty( $search_parts[0] ) ) { |
|
367 | - switch ( $search_parts[0] ) { |
|
366 | + if ( ! empty($search_parts[0])) { |
|
367 | + switch ($search_parts[0]) { |
|
368 | 368 | case 'name': |
369 | 369 | $where = "AND {$this->table_name}.name LIKE '%{$search_parts[1]}%'"; |
370 | 370 | break; |
@@ -392,11 +392,11 @@ discard block |
||
392 | 392 | $where = ''; |
393 | 393 | |
394 | 394 | // Donors create for specific wp user. |
395 | - if ( ! empty( $this->args['user'] ) ) { |
|
396 | - if ( ! is_array( $this->args['user'] ) ) { |
|
397 | - $this->args['user'] = explode( ',', $this->args['user'] ); |
|
395 | + if ( ! empty($this->args['user'])) { |
|
396 | + if ( ! is_array($this->args['user'])) { |
|
397 | + $this->args['user'] = explode(',', $this->args['user']); |
|
398 | 398 | } |
399 | - $user_ids = implode( ',', array_map( 'intval', $this->args['user'] ) ); |
|
399 | + $user_ids = implode(',', array_map('intval', $this->args['user'])); |
|
400 | 400 | |
401 | 401 | $where .= "AND {$this->table_name}.user_id IN( {$user_ids} )"; |
402 | 402 | } |
@@ -415,14 +415,13 @@ discard block |
||
415 | 415 | private function get_order_query() { |
416 | 416 | $table_columns = Give()->donors->get_columns(); |
417 | 417 | |
418 | - $this->args['orderby'] = ! array_key_exists( $this->args['orderby'], $table_columns ) ? |
|
419 | - 'id' : |
|
420 | - $this->args['orderby']; |
|
418 | + $this->args['orderby'] = ! array_key_exists($this->args['orderby'], $table_columns) ? |
|
419 | + 'id' : $this->args['orderby']; |
|
421 | 420 | |
422 | - $this->args['orderby'] = esc_sql( $this->args['orderby'] ); |
|
423 | - $this->args['order'] = esc_sql( $this->args['order'] ); |
|
421 | + $this->args['orderby'] = esc_sql($this->args['orderby']); |
|
422 | + $this->args['order'] = esc_sql($this->args['order']); |
|
424 | 423 | |
425 | - switch ( $table_columns[ $this->args['orderby'] ] ) { |
|
424 | + switch ($table_columns[$this->args['orderby']]) { |
|
426 | 425 | case '%d': |
427 | 426 | case '%f': |
428 | 427 | $query = "ORDER BY {$this->table_name}.{$this->args['orderby']}+0"; |
@@ -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,15 +26,15 @@ discard block |
||
26 | 26 | * @global $wpdb |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_install( $network_wide = false ) { |
|
29 | +function give_install($network_wide = false) { |
|
30 | 30 | |
31 | 31 | global $wpdb; |
32 | 32 | |
33 | - if ( is_multisite() && $network_wide ) { |
|
33 | + if (is_multisite() && $network_wide) { |
|
34 | 34 | |
35 | - foreach ( $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs LIMIT 100" ) as $blog_id ) { |
|
35 | + foreach ($wpdb->get_col("SELECT blog_id FROM $wpdb->blogs LIMIT 100") as $blog_id) { |
|
36 | 36 | |
37 | - switch_to_blog( $blog_id ); |
|
37 | + switch_to_blog($blog_id); |
|
38 | 38 | give_run_install(); |
39 | 39 | restore_current_blog(); |
40 | 40 | |
@@ -61,31 +61,31 @@ discard block |
||
61 | 61 | give_setup_post_types(); |
62 | 62 | |
63 | 63 | // Add Upgraded From Option. |
64 | - $current_version = get_option( 'give_version' ); |
|
65 | - if ( $current_version ) { |
|
66 | - update_option( 'give_version_upgraded_from', $current_version ); |
|
64 | + $current_version = get_option('give_version'); |
|
65 | + if ($current_version) { |
|
66 | + update_option('give_version_upgraded_from', $current_version); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | // Setup some default options. |
70 | 70 | $options = array(); |
71 | 71 | |
72 | 72 | //Fresh Install? Setup Test Mode, Base Country (US), Test Gateway, Currency. |
73 | - if ( empty( $current_version ) ) { |
|
74 | - $options = array_merge( $options, give_get_default_settings() ); |
|
73 | + if (empty($current_version)) { |
|
74 | + $options = array_merge($options, give_get_default_settings()); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | // Populate the default values. |
78 | - update_option( 'give_settings', array_merge( $give_options, $options ) ); |
|
78 | + update_option('give_settings', array_merge($give_options, $options)); |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * Run plugin upgrades. |
82 | 82 | * |
83 | 83 | * @since 1.8 |
84 | 84 | */ |
85 | - do_action( 'give_upgrades' ); |
|
85 | + do_action('give_upgrades'); |
|
86 | 86 | |
87 | - if ( GIVE_VERSION !== get_option( 'give_version' ) ) { |
|
88 | - update_option( 'give_version', GIVE_VERSION ); |
|
87 | + if (GIVE_VERSION !== get_option('give_version')) { |
|
88 | + update_option('give_version', GIVE_VERSION); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | // Create Give roles. |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | // Set api version, end point and refresh permalink. |
97 | 97 | $api = new Give_API(); |
98 | 98 | $api->add_endpoint(); |
99 | - update_option( 'give_default_api_version', 'v' . $api->get_version() ); |
|
99 | + update_option('give_default_api_version', 'v'.$api->get_version()); |
|
100 | 100 | |
101 | 101 | flush_rewrite_rules(); |
102 | 102 | |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | $give_sessions->use_php_sessions(); |
106 | 106 | |
107 | 107 | // Add a temporary option to note that Give pages have been created. |
108 | - Give_Cache::set( '_give_installed', $options, 30, true ); |
|
108 | + Give_Cache::set('_give_installed', $options, 30, true); |
|
109 | 109 | |
110 | - if ( ! $current_version ) { |
|
110 | + if ( ! $current_version) { |
|
111 | 111 | |
112 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
112 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
113 | 113 | |
114 | 114 | // When new upgrade routines are added, mark them as complete on fresh install. |
115 | 115 | $upgrade_routines = array( |
@@ -129,18 +129,18 @@ discard block |
||
129 | 129 | 'v1818_give_worker_role_cleanup' |
130 | 130 | ); |
131 | 131 | |
132 | - foreach ( $upgrade_routines as $upgrade ) { |
|
133 | - give_set_upgrade_complete( $upgrade ); |
|
132 | + foreach ($upgrade_routines as $upgrade) { |
|
133 | + give_set_upgrade_complete($upgrade); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
137 | 137 | // Bail if activating from network, or bulk. |
138 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
138 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
139 | 139 | return; |
140 | 140 | } |
141 | 141 | |
142 | 142 | // Add the transient to redirect. |
143 | - Give_Cache::set( '_give_activation_redirect', true, 30, true ); |
|
143 | + Give_Cache::set('_give_activation_redirect', true, 30, true); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | * @param int $site_id The Site ID. |
158 | 158 | * @param array $meta Blog Meta. |
159 | 159 | */ |
160 | -function give_on_create_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) { |
|
160 | +function give_on_create_blog($blog_id, $user_id, $domain, $path, $site_id, $meta) { |
|
161 | 161 | |
162 | - if ( is_plugin_active_for_network( GIVE_PLUGIN_BASENAME ) ) { |
|
162 | + if (is_plugin_active_for_network(GIVE_PLUGIN_BASENAME)) { |
|
163 | 163 | |
164 | - switch_to_blog( $blog_id ); |
|
164 | + switch_to_blog($blog_id); |
|
165 | 165 | give_install(); |
166 | 166 | restore_current_blog(); |
167 | 167 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | } |
171 | 171 | |
172 | -add_action( 'wpmu_new_blog', 'give_on_create_blog', 10, 6 ); |
|
172 | +add_action('wpmu_new_blog', 'give_on_create_blog', 10, 6); |
|
173 | 173 | |
174 | 174 | |
175 | 175 | /** |
@@ -182,13 +182,13 @@ discard block |
||
182 | 182 | * |
183 | 183 | * @return array The tables to drop. |
184 | 184 | */ |
185 | -function give_wpmu_drop_tables( $tables, $blog_id ) { |
|
185 | +function give_wpmu_drop_tables($tables, $blog_id) { |
|
186 | 186 | |
187 | - switch_to_blog( $blog_id ); |
|
187 | + switch_to_blog($blog_id); |
|
188 | 188 | $donors_db = new Give_DB_Donors(); |
189 | 189 | $donor_meta_db = new Give_DB_Donor_Meta(); |
190 | 190 | |
191 | - if ( $donors_db->installed() ) { |
|
191 | + if ($donors_db->installed()) { |
|
192 | 192 | $tables[] = $donors_db->table_name; |
193 | 193 | $tables[] = $donor_meta_db->table_name; |
194 | 194 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | |
199 | 199 | } |
200 | 200 | |
201 | -add_filter( 'wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2 ); |
|
201 | +add_filter('wpmu_drop_tables', 'give_wpmu_drop_tables', 10, 2); |
|
202 | 202 | |
203 | 203 | /** |
204 | 204 | * Post-installation |
@@ -210,16 +210,16 @@ discard block |
||
210 | 210 | */ |
211 | 211 | function give_after_install() { |
212 | 212 | |
213 | - if ( ! is_admin() ) { |
|
213 | + if ( ! is_admin()) { |
|
214 | 214 | return; |
215 | 215 | } |
216 | 216 | |
217 | - $give_options = Give_Cache::get( '_give_installed', true ); |
|
218 | - $give_table_check = get_option( '_give_table_check', false ); |
|
217 | + $give_options = Give_Cache::get('_give_installed', true); |
|
218 | + $give_table_check = get_option('_give_table_check', false); |
|
219 | 219 | |
220 | - if ( false === $give_table_check || current_time( 'timestamp' ) > $give_table_check ) { |
|
220 | + if (false === $give_table_check || current_time('timestamp') > $give_table_check) { |
|
221 | 221 | |
222 | - if ( ! @Give()->donor_meta->installed() ) { |
|
222 | + if ( ! @Give()->donor_meta->installed()) { |
|
223 | 223 | |
224 | 224 | // Create the donor meta database. |
225 | 225 | // (this ensures it creates it on multisite instances where it is network activated). |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | } |
229 | 229 | |
230 | - if ( ! @Give()->donors->installed() ) { |
|
230 | + if ( ! @Give()->donors->installed()) { |
|
231 | 231 | // Create the donor database. |
232 | 232 | // (this ensures it creates it on multisite instances where it is network activated). |
233 | 233 | @Give()->donors->create_table(); |
@@ -239,22 +239,22 @@ discard block |
||
239 | 239 | * |
240 | 240 | * @param array $give_options Give plugin options. |
241 | 241 | */ |
242 | - do_action( 'give_after_install', $give_options ); |
|
242 | + do_action('give_after_install', $give_options); |
|
243 | 243 | } |
244 | 244 | |
245 | - update_option( '_give_table_check', ( current_time( 'timestamp' ) + WEEK_IN_SECONDS ) ); |
|
245 | + update_option('_give_table_check', (current_time('timestamp') + WEEK_IN_SECONDS)); |
|
246 | 246 | |
247 | 247 | } |
248 | 248 | |
249 | 249 | // Delete the transient |
250 | - if ( false !== $give_options ) { |
|
251 | - Give_Cache::delete( Give_Cache::get_key( '_give_installed' ) ); |
|
250 | + if (false !== $give_options) { |
|
251 | + Give_Cache::delete(Give_Cache::get_key('_give_installed')); |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | |
255 | 255 | } |
256 | 256 | |
257 | -add_action( 'admin_init', 'give_after_install' ); |
|
257 | +add_action('admin_init', 'give_after_install'); |
|
258 | 258 | |
259 | 259 | |
260 | 260 | /** |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | |
270 | 270 | global $wp_roles; |
271 | 271 | |
272 | - if ( ! is_object( $wp_roles ) ) { |
|
272 | + if ( ! is_object($wp_roles)) { |
|
273 | 273 | return; |
274 | 274 | } |
275 | 275 | |
276 | - if ( ! array_key_exists( 'give_manager', $wp_roles->roles ) ) { |
|
276 | + if ( ! array_key_exists('give_manager', $wp_roles->roles)) { |
|
277 | 277 | |
278 | 278 | // Create Give plugin roles |
279 | 279 | $roles = new Give_Roles(); |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | |
285 | 285 | } |
286 | 286 | |
287 | -add_action( 'admin_init', 'give_install_roles_on_network' ); |
|
287 | +add_action('admin_init', 'give_install_roles_on_network'); |
|
288 | 288 | |
289 | 289 | /** |
290 | 290 | * Default core setting values. |
@@ -322,14 +322,14 @@ discard block |
||
322 | 322 | 'uninstall_on_delete' => 'disabled', |
323 | 323 | 'the_content_filter' => 'enabled', |
324 | 324 | 'scripts_footer' => 'disabled', |
325 | - 'agree_to_terms_label' => __( 'Agree to Terms?', 'give' ), |
|
325 | + 'agree_to_terms_label' => __('Agree to Terms?', 'give'), |
|
326 | 326 | 'agreement_text' => give_get_default_agreement_text(), |
327 | 327 | |
328 | 328 | // Paypal IPN verification. |
329 | 329 | 'paypal_verification' => 'enabled', |
330 | 330 | |
331 | 331 | // Default is manual gateway. |
332 | - 'gateways' => array( 'manual' => 1, 'offline' => 1 ), |
|
332 | + 'gateways' => array('manual' => 1, 'offline' => 1), |
|
333 | 333 | 'default_gateway' => 'manual', |
334 | 334 | |
335 | 335 | // Offline gateway setup. |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | */ |
358 | 358 | function give_get_default_agreement_text() { |
359 | 359 | |
360 | - $org_name = get_bloginfo( 'name' ); |
|
360 | + $org_name = get_bloginfo('name'); |
|
361 | 361 | |
362 | 362 | $agreement = sprintf( |
363 | 363 | '<p>Acceptance of any contribution, gift or grant is at the discretion of the %1$s. The %1$s will not accept any gift unless it can be used or expended consistently with the purpose and mission of the %1$s.</p> |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | $org_name |
372 | 372 | ); |
373 | 373 | |
374 | - return apply_filters( 'give_get_default_agreement_text', $agreement, $org_name ); |
|
374 | + return apply_filters('give_get_default_agreement_text', $agreement, $org_name); |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | |
@@ -380,22 +380,22 @@ discard block |
||
380 | 380 | * |
381 | 381 | * @since 1.8.11 |
382 | 382 | */ |
383 | -function give_create_pages(){ |
|
383 | +function give_create_pages() { |
|
384 | 384 | |
385 | 385 | // Bailout if pages already created. |
386 | - if( get_option( 'give_install_pages_created') ) { |
|
386 | + if (get_option('give_install_pages_created')) { |
|
387 | 387 | return false; |
388 | 388 | } |
389 | 389 | |
390 | 390 | $options = array(); |
391 | 391 | |
392 | 392 | // Checks if the Success Page option exists AND that the page exists. |
393 | - if ( ! get_post( give_get_option( 'success_page' ) ) ) { |
|
393 | + if ( ! get_post(give_get_option('success_page'))) { |
|
394 | 394 | |
395 | 395 | // Donation Confirmation (Success) Page |
396 | 396 | $success = wp_insert_post( |
397 | 397 | array( |
398 | - 'post_title' => esc_html__( 'Donation Confirmation', 'give' ), |
|
398 | + 'post_title' => esc_html__('Donation Confirmation', 'give'), |
|
399 | 399 | 'post_content' => '[give_receipt]', |
400 | 400 | 'post_status' => 'publish', |
401 | 401 | 'post_author' => 1, |
@@ -409,13 +409,13 @@ discard block |
||
409 | 409 | } |
410 | 410 | |
411 | 411 | // Checks if the Failure Page option exists AND that the page exists. |
412 | - if ( ! get_post( give_get_option( 'failure_page' ) ) ) { |
|
412 | + if ( ! get_post(give_get_option('failure_page'))) { |
|
413 | 413 | |
414 | 414 | // Failed Donation Page |
415 | 415 | $failed = wp_insert_post( |
416 | 416 | array( |
417 | - 'post_title' => esc_html__( 'Donation Failed', 'give' ), |
|
418 | - 'post_content' => esc_html__( 'We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give' ), |
|
417 | + 'post_title' => esc_html__('Donation Failed', 'give'), |
|
418 | + 'post_content' => esc_html__('We\'re sorry, your donation failed to process. Please try again or contact site support.', 'give'), |
|
419 | 419 | 'post_status' => 'publish', |
420 | 420 | 'post_author' => 1, |
421 | 421 | 'post_type' => 'page', |
@@ -427,11 +427,11 @@ discard block |
||
427 | 427 | } |
428 | 428 | |
429 | 429 | // Checks if the History Page option exists AND that the page exists. |
430 | - if ( ! get_post( give_get_option( 'history_page' ) ) ) { |
|
430 | + if ( ! get_post(give_get_option('history_page'))) { |
|
431 | 431 | // Donation History Page |
432 | 432 | $history = wp_insert_post( |
433 | 433 | array( |
434 | - 'post_title' => esc_html__( 'Donation History', 'give' ), |
|
434 | + 'post_title' => esc_html__('Donation History', 'give'), |
|
435 | 435 | 'post_content' => '[donation_history]', |
436 | 436 | 'post_status' => 'publish', |
437 | 437 | 'post_author' => 1, |
@@ -443,10 +443,10 @@ discard block |
||
443 | 443 | $options['history_page'] = $history; |
444 | 444 | } |
445 | 445 | |
446 | - if( ! empty( $options ) ) { |
|
447 | - update_option( 'give_settings', array_merge( give_get_settings(), $options ) ); |
|
446 | + if ( ! empty($options)) { |
|
447 | + update_option('give_settings', array_merge(give_get_settings(), $options)); |
|
448 | 448 | } |
449 | 449 | |
450 | - add_option( 'give_install_pages_created', 1, '', 'no' ); |
|
450 | + add_option('give_install_pages_created', 1, '', 'no'); |
|
451 | 451 | } |
452 | -add_action( 'admin_init', 'give_create_pages', -1 ); |
|
452 | +add_action('admin_init', 'give_create_pages', -1); |
@@ -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,40 +23,40 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return string|bool |
25 | 25 | */ |
26 | -function give_donation_history( $atts ) { |
|
26 | +function give_donation_history($atts) { |
|
27 | 27 | |
28 | - $donation_history_args = shortcode_atts( array( |
|
28 | + $donation_history_args = shortcode_atts(array( |
|
29 | 29 | 'id' => true, |
30 | 30 | 'date' => true, |
31 | 31 | 'donor' => false, |
32 | 32 | 'amount' => true, |
33 | 33 | 'status' => false, |
34 | 34 | 'payment_method' => false, |
35 | - ), $atts, 'donation_history' ); |
|
35 | + ), $atts, 'donation_history'); |
|
36 | 36 | |
37 | 37 | // Always show receipt link. |
38 | 38 | $donation_history_args['details'] = true; |
39 | 39 | |
40 | 40 | // Set Donation History Shortcode Arguments in session variable. |
41 | - Give()->session->set( 'give_donation_history_args', $donation_history_args ); |
|
41 | + Give()->session->set('give_donation_history_args', $donation_history_args); |
|
42 | 42 | |
43 | 43 | // If payment_key query arg exists, return receipt instead of donation history. |
44 | - if ( isset( $_GET['payment_key'] ) ) { |
|
44 | + if (isset($_GET['payment_key'])) { |
|
45 | 45 | ob_start(); |
46 | - echo give_receipt_shortcode( array() ); |
|
46 | + echo give_receipt_shortcode(array()); |
|
47 | 47 | |
48 | 48 | // Display donation history link only if it is not accessed via Receipt Access Link. |
49 | - if ( give_get_receipt_session() ) { |
|
49 | + if (give_get_receipt_session()) { |
|
50 | 50 | echo sprintf( |
51 | 51 | '<a href="%s">%s</a>', |
52 | - esc_url( give_get_history_page_uri() ), |
|
53 | - __( '« Return to All Donations', 'give' ) |
|
52 | + esc_url(give_get_history_page_uri()), |
|
53 | + __('« Return to All Donations', 'give') |
|
54 | 54 | ); |
55 | 55 | } |
56 | 56 | return ob_get_clean(); |
57 | 57 | } |
58 | 58 | |
59 | - $email_access = give_get_option( 'email_access' ); |
|
59 | + $email_access = give_get_option('email_access'); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Determine access |
@@ -67,31 +67,31 @@ discard block |
||
67 | 67 | if ( |
68 | 68 | is_user_logged_in() || |
69 | 69 | false !== Give()->session->get_session_expiration() || |
70 | - ( give_is_setting_enabled( $email_access ) && Give()->email_access->token_exists ) || |
|
70 | + (give_is_setting_enabled($email_access) && Give()->email_access->token_exists) || |
|
71 | 71 | true === give_get_history_session() |
72 | 72 | ) { |
73 | 73 | ob_start(); |
74 | - give_get_template_part( 'history', 'donations' ); |
|
74 | + give_get_template_part('history', 'donations'); |
|
75 | 75 | |
76 | 76 | return ob_get_clean(); |
77 | 77 | |
78 | - } elseif ( give_is_setting_enabled( $email_access ) ) { |
|
78 | + } elseif (give_is_setting_enabled($email_access)) { |
|
79 | 79 | // Is Email-based access enabled? |
80 | 80 | ob_start(); |
81 | - give_get_template_part( 'email', 'login-form' ); |
|
81 | + give_get_template_part('email', 'login-form'); |
|
82 | 82 | |
83 | 83 | return ob_get_clean(); |
84 | 84 | |
85 | 85 | } else { |
86 | 86 | |
87 | - $output = apply_filters( 'give_donation_history_nonuser_message', Give()->notices->print_frontend_notice( __( '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' ), false ) ); |
|
88 | - $output .= do_shortcode( '[give_login]' ); |
|
87 | + $output = apply_filters('give_donation_history_nonuser_message', Give()->notices->print_frontend_notice(__('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'), false)); |
|
88 | + $output .= do_shortcode('[give_login]'); |
|
89 | 89 | |
90 | 90 | return $output; |
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | -add_shortcode( 'donation_history', 'give_donation_history' ); |
|
94 | +add_shortcode('donation_history', 'give_donation_history'); |
|
95 | 95 | |
96 | 96 | /** |
97 | 97 | * Donation Form Shortcode |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @return string |
106 | 106 | */ |
107 | -function give_form_shortcode( $atts ) { |
|
108 | - $atts = shortcode_atts( array( |
|
107 | +function give_form_shortcode($atts) { |
|
108 | + $atts = shortcode_atts(array( |
|
109 | 109 | 'id' => '', |
110 | 110 | 'show_title' => true, |
111 | 111 | 'show_goal' => true, |
@@ -113,21 +113,21 @@ discard block |
||
113 | 113 | 'float_labels' => '', |
114 | 114 | 'display_style' => '', |
115 | 115 | 'continue_button_title' => '', |
116 | - ), $atts, 'give_form' ); |
|
116 | + ), $atts, 'give_form'); |
|
117 | 117 | |
118 | 118 | // Convert string to bool. |
119 | - $atts['show_title'] = filter_var( $atts['show_title'], FILTER_VALIDATE_BOOLEAN ); |
|
120 | - $atts['show_goal'] = filter_var( $atts['show_goal'], FILTER_VALIDATE_BOOLEAN ); |
|
119 | + $atts['show_title'] = filter_var($atts['show_title'], FILTER_VALIDATE_BOOLEAN); |
|
120 | + $atts['show_goal'] = filter_var($atts['show_goal'], FILTER_VALIDATE_BOOLEAN); |
|
121 | 121 | |
122 | 122 | //get the Give Form |
123 | 123 | ob_start(); |
124 | - give_get_donation_form( $atts ); |
|
124 | + give_get_donation_form($atts); |
|
125 | 125 | $final_output = ob_get_clean(); |
126 | 126 | |
127 | - return apply_filters( 'give_donate_form', $final_output, $atts ); |
|
127 | + return apply_filters('give_donate_form', $final_output, $atts); |
|
128 | 128 | } |
129 | 129 | |
130 | -add_shortcode( 'give_form', 'give_form_shortcode' ); |
|
130 | +add_shortcode('give_form', 'give_form_shortcode'); |
|
131 | 131 | |
132 | 132 | /** |
133 | 133 | * Donation Form Goal Shortcode. |
@@ -140,37 +140,37 @@ discard block |
||
140 | 140 | * |
141 | 141 | * @return string |
142 | 142 | */ |
143 | -function give_goal_shortcode( $atts ) { |
|
144 | - $atts = shortcode_atts( array( |
|
143 | +function give_goal_shortcode($atts) { |
|
144 | + $atts = shortcode_atts(array( |
|
145 | 145 | 'id' => '', |
146 | 146 | 'show_text' => true, |
147 | 147 | 'show_bar' => true, |
148 | - ), $atts, 'give_goal' ); |
|
148 | + ), $atts, 'give_goal'); |
|
149 | 149 | |
150 | 150 | |
151 | 151 | //get the Give Form. |
152 | 152 | ob_start(); |
153 | 153 | |
154 | 154 | //Sanity check 1: ensure there is an ID Provided. |
155 | - if ( empty( $atts['id'] ) ) { |
|
156 | - Give()->notices->print_frontend_notice( __( 'The shortcode is missing Donation Form ID attribute.', 'give' ), true ); |
|
155 | + if (empty($atts['id'])) { |
|
156 | + Give()->notices->print_frontend_notice(__('The shortcode is missing Donation Form ID attribute.', 'give'), true); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | //Sanity check 2: Check the form even has Goals enabled. |
160 | - if ( ! give_is_setting_enabled( give_get_meta( $atts['id'], '_give_goal_option', true ) ) ) { |
|
160 | + if ( ! give_is_setting_enabled(give_get_meta($atts['id'], '_give_goal_option', true))) { |
|
161 | 161 | |
162 | - Give()->notices->print_frontend_notice( __( 'The form does not have Goals enabled.', 'give' ), true ); |
|
162 | + Give()->notices->print_frontend_notice(__('The form does not have Goals enabled.', 'give'), true); |
|
163 | 163 | } else { |
164 | 164 | //Passed all sanity checks: output Goal. |
165 | - give_show_goal_progress( $atts['id'], $atts ); |
|
165 | + give_show_goal_progress($atts['id'], $atts); |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | $final_output = ob_get_clean(); |
169 | 169 | |
170 | - return apply_filters( 'give_goal_shortcode_output', $final_output, $atts ); |
|
170 | + return apply_filters('give_goal_shortcode_output', $final_output, $atts); |
|
171 | 171 | } |
172 | 172 | |
173 | -add_shortcode( 'give_goal', 'give_goal_shortcode' ); |
|
173 | +add_shortcode('give_goal', 'give_goal_shortcode'); |
|
174 | 174 | |
175 | 175 | |
176 | 176 | /** |
@@ -187,22 +187,22 @@ discard block |
||
187 | 187 | * |
188 | 188 | * @return string |
189 | 189 | */ |
190 | -function give_login_form_shortcode( $atts ) { |
|
191 | - $atts = shortcode_atts( array( |
|
190 | +function give_login_form_shortcode($atts) { |
|
191 | + $atts = shortcode_atts(array( |
|
192 | 192 | // Add backward compatibility for redirect attribute. |
193 | 193 | 'redirect' => '', |
194 | 194 | |
195 | 195 | 'login-redirect' => '', |
196 | 196 | 'logout-redirect' => '', |
197 | - ), $atts, 'give_login' ); |
|
197 | + ), $atts, 'give_login'); |
|
198 | 198 | |
199 | 199 | // 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. |
200 | - $atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect'] ) ? $atts['redirect'] : '' ); |
|
200 | + $atts['login-redirect'] = ! empty($atts['login-redirect']) ? $atts['login-redirect'] : ( ! empty($atts['redirect']) ? $atts['redirect'] : ''); |
|
201 | 201 | |
202 | - return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] ); |
|
202 | + return give_login_form($atts['login-redirect'], $atts['logout-redirect']); |
|
203 | 203 | } |
204 | 204 | |
205 | -add_shortcode( 'give_login', 'give_login_form_shortcode' ); |
|
205 | +add_shortcode('give_login', 'give_login_form_shortcode'); |
|
206 | 206 | |
207 | 207 | /** |
208 | 208 | * Register Shortcode. |
@@ -217,15 +217,15 @@ discard block |
||
217 | 217 | * |
218 | 218 | * @return string |
219 | 219 | */ |
220 | -function give_register_form_shortcode( $atts ) { |
|
221 | - $atts = shortcode_atts( array( |
|
220 | +function give_register_form_shortcode($atts) { |
|
221 | + $atts = shortcode_atts(array( |
|
222 | 222 | 'redirect' => '', |
223 | - ), $atts, 'give_register' ); |
|
223 | + ), $atts, 'give_register'); |
|
224 | 224 | |
225 | - return give_register_form( $atts['redirect'] ); |
|
225 | + return give_register_form($atts['redirect']); |
|
226 | 226 | } |
227 | 227 | |
228 | -add_shortcode( 'give_register', 'give_register_form_shortcode' ); |
|
228 | +add_shortcode('give_register', 'give_register_form_shortcode'); |
|
229 | 229 | |
230 | 230 | /** |
231 | 231 | * Receipt Shortcode. |
@@ -238,12 +238,12 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @return string |
240 | 240 | */ |
241 | -function give_receipt_shortcode( $atts ) { |
|
241 | +function give_receipt_shortcode($atts) { |
|
242 | 242 | |
243 | 243 | global $give_receipt_args; |
244 | 244 | |
245 | - $give_receipt_args = shortcode_atts( array( |
|
246 | - 'error' => __( 'You are missing the payment key to view this donation receipt.', 'give' ), |
|
245 | + $give_receipt_args = shortcode_atts(array( |
|
246 | + 'error' => __('You are missing the payment key to view this donation receipt.', 'give'), |
|
247 | 247 | 'price' => true, |
248 | 248 | 'donor' => true, |
249 | 249 | 'date' => true, |
@@ -252,49 +252,49 @@ discard block |
||
252 | 252 | 'payment_id' => true, |
253 | 253 | 'payment_status' => false, |
254 | 254 | 'status_notice' => true, |
255 | - ), $atts, 'give_receipt' ); |
|
255 | + ), $atts, 'give_receipt'); |
|
256 | 256 | |
257 | 257 | //set $session var |
258 | 258 | $session = give_get_purchase_session(); |
259 | 259 | |
260 | 260 | //set payment key var |
261 | - if ( isset( $_GET['payment_key'] ) ) { |
|
262 | - $payment_key = urldecode( $_GET['payment_key'] ); |
|
263 | - } elseif ( $session ) { |
|
261 | + if (isset($_GET['payment_key'])) { |
|
262 | + $payment_key = urldecode($_GET['payment_key']); |
|
263 | + } elseif ($session) { |
|
264 | 264 | $payment_key = $session['purchase_key']; |
265 | - } elseif ( $give_receipt_args['payment_key'] ) { |
|
265 | + } elseif ($give_receipt_args['payment_key']) { |
|
266 | 266 | $payment_key = $give_receipt_args['payment_key']; |
267 | 267 | } |
268 | 268 | |
269 | - $email_access = give_get_option( 'email_access' ); |
|
269 | + $email_access = give_get_option('email_access'); |
|
270 | 270 | |
271 | 271 | // No payment_key found & Email Access is Turned on: |
272 | - if ( ! isset( $payment_key ) && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) { |
|
272 | + if ( ! isset($payment_key) && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) { |
|
273 | 273 | |
274 | 274 | ob_start(); |
275 | 275 | |
276 | - give_get_template_part( 'email-login-form' ); |
|
276 | + give_get_template_part('email-login-form'); |
|
277 | 277 | |
278 | 278 | return ob_get_clean(); |
279 | 279 | |
280 | - } elseif ( ! isset( $payment_key ) ) { |
|
280 | + } elseif ( ! isset($payment_key)) { |
|
281 | 281 | |
282 | - return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' ); |
|
282 | + return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error'); |
|
283 | 283 | |
284 | 284 | } |
285 | 285 | |
286 | - $user_can_view = give_can_view_receipt( $payment_key ); |
|
286 | + $user_can_view = give_can_view_receipt($payment_key); |
|
287 | 287 | |
288 | 288 | // Key was provided, but user is logged out. Offer them the ability to login and view the receipt. |
289 | - if ( ! $user_can_view && give_is_setting_enabled( $email_access ) && ! Give()->email_access->token_exists ) { |
|
289 | + if ( ! $user_can_view && give_is_setting_enabled($email_access) && ! Give()->email_access->token_exists) { |
|
290 | 290 | |
291 | 291 | ob_start(); |
292 | 292 | |
293 | - give_get_template_part( 'email-login-form' ); |
|
293 | + give_get_template_part('email-login-form'); |
|
294 | 294 | |
295 | 295 | return ob_get_clean(); |
296 | 296 | |
297 | - } elseif ( ! $user_can_view ) { |
|
297 | + } elseif ( ! $user_can_view) { |
|
298 | 298 | |
299 | 299 | global $give_login_redirect; |
300 | 300 | |
@@ -302,9 +302,9 @@ discard block |
||
302 | 302 | |
303 | 303 | ob_start(); |
304 | 304 | |
305 | - Give()->notices->print_frontend_notice( apply_filters( 'give_must_be_logged_in_error_message', __( 'You must be logged in to view this donation receipt.', 'give' ) ) ); |
|
305 | + Give()->notices->print_frontend_notice(apply_filters('give_must_be_logged_in_error_message', __('You must be logged in to view this donation receipt.', 'give'))); |
|
306 | 306 | |
307 | - give_get_template_part( 'shortcode', 'login' ); |
|
307 | + give_get_template_part('shortcode', 'login'); |
|
308 | 308 | |
309 | 309 | $login_form = ob_get_clean(); |
310 | 310 | |
@@ -318,20 +318,20 @@ discard block |
||
318 | 318 | * or if user is logged out and donation was made as a guest, the donation session is checked for |
319 | 319 | * or if user is logged in and the user can view sensitive shop data. |
320 | 320 | */ |
321 | - if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) { |
|
322 | - return Give()->notices->print_frontend_notice( $give_receipt_args['error'], false, 'error' ); |
|
321 | + if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) { |
|
322 | + return Give()->notices->print_frontend_notice($give_receipt_args['error'], false, 'error'); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | ob_start(); |
326 | 326 | |
327 | - give_get_template_part( 'shortcode', 'receipt' ); |
|
327 | + give_get_template_part('shortcode', 'receipt'); |
|
328 | 328 | |
329 | 329 | $display = ob_get_clean(); |
330 | 330 | |
331 | 331 | return $display; |
332 | 332 | } |
333 | 333 | |
334 | -add_shortcode( 'give_receipt', 'give_receipt_shortcode' ); |
|
334 | +add_shortcode('give_receipt', 'give_receipt_shortcode'); |
|
335 | 335 | |
336 | 336 | /** |
337 | 337 | * Profile Editor Shortcode. |
@@ -350,25 +350,25 @@ discard block |
||
350 | 350 | * |
351 | 351 | * @return string Output generated from the profile editor |
352 | 352 | */ |
353 | -function give_profile_editor_shortcode( $atts ) { |
|
353 | +function give_profile_editor_shortcode($atts) { |
|
354 | 354 | |
355 | 355 | ob_start(); |
356 | 356 | |
357 | 357 | // Restrict access to donor profile, if donor and user are disconnected. |
358 | - $is_donor_disconnected = get_user_meta( get_current_user_id(), '_give_is_donor_disconnected', true ); |
|
359 | - if( is_user_logged_in() && $is_donor_disconnected ) { |
|
360 | - Give()->notices->print_frontend_notice( __( 'Your Donor and User profile are no longer connected. Please contact the site administrator.', 'give' ), true, 'error' ); |
|
358 | + $is_donor_disconnected = get_user_meta(get_current_user_id(), '_give_is_donor_disconnected', true); |
|
359 | + if (is_user_logged_in() && $is_donor_disconnected) { |
|
360 | + Give()->notices->print_frontend_notice(__('Your Donor and User profile are no longer connected. Please contact the site administrator.', 'give'), true, 'error'); |
|
361 | 361 | return false; |
362 | 362 | } |
363 | 363 | |
364 | - give_get_template_part( 'shortcode', 'profile-editor' ); |
|
364 | + give_get_template_part('shortcode', 'profile-editor'); |
|
365 | 365 | |
366 | 366 | $display = ob_get_clean(); |
367 | 367 | |
368 | 368 | return $display; |
369 | 369 | } |
370 | 370 | |
371 | -add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' ); |
|
371 | +add_shortcode('give_profile_editor', 'give_profile_editor_shortcode'); |
|
372 | 372 | |
373 | 373 | /** |
374 | 374 | * Process Profile Updater Form. |
@@ -381,26 +381,26 @@ discard block |
||
381 | 381 | * |
382 | 382 | * @return bool |
383 | 383 | */ |
384 | -function give_process_profile_editor_updates( $data ) { |
|
384 | +function give_process_profile_editor_updates($data) { |
|
385 | 385 | // Profile field change request |
386 | - if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) { |
|
386 | + if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) { |
|
387 | 387 | return false; |
388 | 388 | } |
389 | 389 | |
390 | 390 | // Nonce security |
391 | - if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) { |
|
391 | + if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) { |
|
392 | 392 | return false; |
393 | 393 | } |
394 | 394 | |
395 | 395 | $user_id = get_current_user_id(); |
396 | - $old_user_data = get_userdata( $user_id ); |
|
396 | + $old_user_data = get_userdata($user_id); |
|
397 | 397 | |
398 | - $display_name = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name; |
|
399 | - $first_name = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name; |
|
400 | - $last_name = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name; |
|
401 | - $email = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email; |
|
402 | - $password = ! empty( $data['give_new_user_pass1'] ) ? $data['give_new_user_pass1'] : ''; |
|
403 | - $confirm_password = ! empty( $data['give_new_user_pass2'] ) ? $data['give_new_user_pass2'] : ''; |
|
398 | + $display_name = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name; |
|
399 | + $first_name = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name; |
|
400 | + $last_name = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name; |
|
401 | + $email = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email; |
|
402 | + $password = ! empty($data['give_new_user_pass1']) ? $data['give_new_user_pass1'] : ''; |
|
403 | + $confirm_password = ! empty($data['give_new_user_pass2']) ? $data['give_new_user_pass2'] : ''; |
|
404 | 404 | |
405 | 405 | $userdata = array( |
406 | 406 | 'ID' => $user_id, |
@@ -419,47 +419,47 @@ discard block |
||
419 | 419 | * @param int $user_id The ID of the user. |
420 | 420 | * @param array $userdata User info, including ID, first name, last name, display name and email. |
421 | 421 | */ |
422 | - do_action( 'give_pre_update_user_profile', $user_id, $userdata ); |
|
422 | + do_action('give_pre_update_user_profile', $user_id, $userdata); |
|
423 | 423 | |
424 | 424 | // Validate First Name. |
425 | - if( empty( $first_name ) ) { |
|
426 | - give_set_error( 'give-empty-first-name', __( 'Please enter first name.', 'give' ) ); |
|
425 | + if (empty($first_name)) { |
|
426 | + give_set_error('give-empty-first-name', __('Please enter first name.', 'give')); |
|
427 | 427 | } |
428 | 428 | |
429 | 429 | // Make sure to validate passwords for existing Donors. |
430 | - give_validate_user_password( $password, $confirm_password ); |
|
430 | + give_validate_user_password($password, $confirm_password); |
|
431 | 431 | |
432 | - if ( empty( $email ) ) { |
|
432 | + if (empty($email)) { |
|
433 | 433 | // Make sure email should not be empty. |
434 | - give_set_error( 'email_empty', __( 'The email you entered is empty.', 'give' ) ); |
|
434 | + give_set_error('email_empty', __('The email you entered is empty.', 'give')); |
|
435 | 435 | |
436 | - } else if ( ! is_email( $email ) ) { |
|
436 | + } else if ( ! is_email($email)) { |
|
437 | 437 | // Make sure email should be valid. |
438 | - give_set_error( 'email_not_valid', __( 'The email you entered is not valid. Please use another', 'give' ) ); |
|
438 | + give_set_error('email_not_valid', __('The email you entered is not valid. Please use another', 'give')); |
|
439 | 439 | |
440 | - } else if ( $email != $old_user_data->user_email ) { |
|
440 | + } else if ($email != $old_user_data->user_email) { |
|
441 | 441 | // Make sure the new email doesn't belong to another user |
442 | - if ( email_exists( $email ) ) { |
|
443 | - give_set_error( 'user_email_exists', __( 'The email you entered belongs to another user. Please use another.', 'give' ) ); |
|
444 | - } elseif ( Give()->donors->get_donor_by( 'email', $email ) ){ |
|
442 | + if (email_exists($email)) { |
|
443 | + give_set_error('user_email_exists', __('The email you entered belongs to another user. Please use another.', 'give')); |
|
444 | + } elseif (Give()->donors->get_donor_by('email', $email)) { |
|
445 | 445 | // Make sure the new email doesn't belong to another user |
446 | - give_set_error( 'donor_email_exists', __( 'The email you entered belongs to another donor. Please use another.', 'give' ) ); |
|
446 | + give_set_error('donor_email_exists', __('The email you entered belongs to another donor. Please use another.', 'give')); |
|
447 | 447 | } |
448 | 448 | } |
449 | 449 | |
450 | 450 | // Check for errors |
451 | 451 | $errors = give_get_errors(); |
452 | 452 | |
453 | - if ( $errors ) { |
|
453 | + if ($errors) { |
|
454 | 454 | // Send back to the profile editor if there are errors |
455 | - wp_redirect( $data['give_redirect'] ); |
|
455 | + wp_redirect($data['give_redirect']); |
|
456 | 456 | give_die(); |
457 | 457 | } |
458 | 458 | |
459 | 459 | // Update the user |
460 | - $updated = wp_update_user( $userdata ); |
|
460 | + $updated = wp_update_user($userdata); |
|
461 | 461 | |
462 | - if ( $updated ) { |
|
462 | + if ($updated) { |
|
463 | 463 | |
464 | 464 | /** |
465 | 465 | * Fires after updating user profile. |
@@ -469,12 +469,12 @@ discard block |
||
469 | 469 | * @param int $user_id The ID of the user. |
470 | 470 | * @param array $userdata User info, including ID, first name, last name, display name and email. |
471 | 471 | */ |
472 | - do_action( 'give_user_profile_updated', $user_id, $userdata ); |
|
473 | - wp_redirect( add_query_arg( 'updated', 'true', $data['give_redirect'] ) ); |
|
472 | + do_action('give_user_profile_updated', $user_id, $userdata); |
|
473 | + wp_redirect(add_query_arg('updated', 'true', $data['give_redirect'])); |
|
474 | 474 | give_die(); |
475 | 475 | } |
476 | 476 | |
477 | 477 | return false; |
478 | 478 | } |
479 | 479 | |
480 | -add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' ); |
|
480 | +add_action('give_edit_user_profile', 'give_process_profile_editor_updates'); |
@@ -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 | |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @param $args array The array of arguments that can be passed in and used for setting up this payment query. |
68 | 68 | */ |
69 | - public function __construct( $args = array() ) { |
|
69 | + public function __construct($args = array()) { |
|
70 | 70 | $defaults = array( |
71 | 71 | 'output' => 'payments', |
72 | - 'post_type' => array( 'give_payment' ), |
|
72 | + 'post_type' => array('give_payment'), |
|
73 | 73 | 'start_date' => false, |
74 | 74 | 'end_date' => false, |
75 | 75 | 'number' => 20, |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | 'count' => false, |
97 | 97 | ); |
98 | 98 | |
99 | - $this->args = $this->_args = wp_parse_args( $args, $defaults ); |
|
99 | + $this->args = $this->_args = wp_parse_args($args, $defaults); |
|
100 | 100 | |
101 | 101 | $this->init(); |
102 | 102 | } |
@@ -110,11 +110,11 @@ discard block |
||
110 | 110 | * @param $query_var |
111 | 111 | * @param $value |
112 | 112 | */ |
113 | - public function __set( $query_var, $value ) { |
|
114 | - if ( in_array( $query_var, array( 'meta_query', 'tax_query' ) ) ) { |
|
115 | - $this->args[ $query_var ][] = $value; |
|
113 | + public function __set($query_var, $value) { |
|
114 | + if (in_array($query_var, array('meta_query', 'tax_query'))) { |
|
115 | + $this->args[$query_var][] = $value; |
|
116 | 116 | } else { |
117 | - $this->args[ $query_var ] = $value; |
|
117 | + $this->args[$query_var] = $value; |
|
118 | 118 | } |
119 | 119 | } |
120 | 120 | |
@@ -126,8 +126,8 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @param $query_var |
128 | 128 | */ |
129 | - public function __unset( $query_var ) { |
|
130 | - unset( $this->args[ $query_var ] ); |
|
129 | + public function __unset($query_var) { |
|
130 | + unset($this->args[$query_var]); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $this->give_forms(); |
168 | 168 | $this->gateway_filter(); |
169 | 169 | |
170 | - add_filter( 'posts_orderby', array( $this, 'custom_orderby' ), 10, 2 ); |
|
170 | + add_filter('posts_orderby', array($this, 'custom_orderby'), 10, 2); |
|
171 | 171 | |
172 | 172 | /** |
173 | 173 | * Fires after setup filters. |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | * |
177 | 177 | * @param Give_Payments_Query $this Payments query object. |
178 | 178 | */ |
179 | - do_action( 'give_pre_get_payments', $this ); |
|
179 | + do_action('give_pre_get_payments', $this); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @access private |
187 | 187 | */ |
188 | 188 | private function unset_filters() { |
189 | - remove_filter( 'posts_orderby', array( $this, 'custom_orderby' ) ); |
|
189 | + remove_filter('posts_orderby', array($this, 'custom_orderby')); |
|
190 | 190 | |
191 | 191 | /** |
192 | 192 | * Fires after retrieving payments. |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * |
196 | 196 | * @param Give_Payments_Query $this Payments query object. |
197 | 197 | */ |
198 | - do_action( 'give_post_get_payments', $this ); |
|
198 | + do_action('give_post_get_payments', $this); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | // Modify the query/query arguments before we retrieve payments. |
216 | 216 | $this->set_filters(); |
217 | 217 | |
218 | - $query = new WP_Query( $this->args ); |
|
218 | + $query = new WP_Query($this->args); |
|
219 | 219 | $this->payments = array(); |
220 | 220 | |
221 | 221 | $custom_output = array( |
@@ -223,18 +223,18 @@ discard block |
||
223 | 223 | 'give_payments', |
224 | 224 | ); |
225 | 225 | |
226 | - if ( ! in_array( $this->args['output'], $custom_output ) ) { |
|
226 | + if ( ! in_array($this->args['output'], $custom_output)) { |
|
227 | 227 | return $query->posts; |
228 | 228 | } |
229 | 229 | |
230 | - if ( $query->have_posts() ) { |
|
231 | - while ( $query->have_posts() ) { |
|
230 | + if ($query->have_posts()) { |
|
231 | + while ($query->have_posts()) { |
|
232 | 232 | $query->the_post(); |
233 | 233 | |
234 | 234 | $payment_id = get_post()->ID; |
235 | - $payment = new Give_Payment( $payment_id ); |
|
235 | + $payment = new Give_Payment($payment_id); |
|
236 | 236 | |
237 | - $this->payments[] = apply_filters( 'give_payment', $payment, $payment_id, $this ); |
|
237 | + $this->payments[] = apply_filters('give_payment', $payment, $payment_id, $this); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | wp_reset_postdata(); |
@@ -257,31 +257,31 @@ discard block |
||
257 | 257 | public function get_payment_by_group() { |
258 | 258 | global $wpdb; |
259 | 259 | |
260 | - $allowed_groups = array( 'post_status' ); |
|
260 | + $allowed_groups = array('post_status'); |
|
261 | 261 | $result = array(); |
262 | 262 | |
263 | 263 | |
264 | - if ( in_array( $this->args['group_by'], $allowed_groups ) ) { |
|
264 | + if (in_array($this->args['group_by'], $allowed_groups)) { |
|
265 | 265 | // Set only count in result. |
266 | - if ( $this->args['count'] ) { |
|
266 | + if ($this->args['count']) { |
|
267 | 267 | |
268 | 268 | $this->set_filters(); |
269 | 269 | |
270 | - $new_results = $wpdb->get_results( $this->get_sql(), ARRAY_N ); |
|
270 | + $new_results = $wpdb->get_results($this->get_sql(), ARRAY_N); |
|
271 | 271 | |
272 | 272 | $this->unset_filters(); |
273 | 273 | |
274 | - foreach ( $new_results as $results ) { |
|
275 | - $result[ $results[0] ] = $results[1]; |
|
274 | + foreach ($new_results as $results) { |
|
275 | + $result[$results[0]] = $results[1]; |
|
276 | 276 | } |
277 | 277 | |
278 | - switch ( $this->args['group_by'] ) { |
|
278 | + switch ($this->args['group_by']) { |
|
279 | 279 | case 'post_status': |
280 | 280 | |
281 | 281 | /* @var Give_Payment $donation */ |
282 | - foreach ( give_get_payment_status_keys() as $status ) { |
|
283 | - if ( ! isset( $result[ $status ] ) ) { |
|
284 | - $result[ $status ] = 0; |
|
282 | + foreach (give_get_payment_status_keys() as $status) { |
|
283 | + if ( ! isset($result[$status])) { |
|
284 | + $result[$status] = 0; |
|
285 | 285 | } |
286 | 286 | } |
287 | 287 | |
@@ -291,8 +291,8 @@ discard block |
||
291 | 291 | $donations = $this->get_payments(); |
292 | 292 | |
293 | 293 | /* @var $donation Give_Payment */ |
294 | - foreach ( $donations as $donation ) { |
|
295 | - $result[ $donation->{$this->args['group_by']} ][] = $donation; |
|
294 | + foreach ($donations as $donation) { |
|
295 | + $result[$donation->{$this->args['group_by']}][] = $donation; |
|
296 | 296 | } |
297 | 297 | } |
298 | 298 | } |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | * |
304 | 304 | * @since 1.8.17 |
305 | 305 | */ |
306 | - return apply_filters( 'give_get_payment_by_group', $result, $this ); |
|
306 | + return apply_filters('give_get_payment_by_group', $result, $this); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | /** |
@@ -315,26 +315,26 @@ discard block |
||
315 | 315 | * @return void |
316 | 316 | */ |
317 | 317 | public function date_filter_pre() { |
318 | - if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) { |
|
318 | + if ( ! ($this->args['start_date'] || $this->args['end_date'])) { |
|
319 | 319 | return; |
320 | 320 | } |
321 | 321 | |
322 | - $this->setup_dates( $this->args['start_date'], $this->args['end_date'] ); |
|
323 | - $is_start_date = property_exists( __CLASS__, 'start_date' ); |
|
324 | - $is_end_date = property_exists( __CLASS__, 'end_date' ); |
|
322 | + $this->setup_dates($this->args['start_date'], $this->args['end_date']); |
|
323 | + $is_start_date = property_exists(__CLASS__, 'start_date'); |
|
324 | + $is_end_date = property_exists(__CLASS__, 'end_date'); |
|
325 | 325 | |
326 | - if ( $is_start_date || $is_end_date ) { |
|
326 | + if ($is_start_date || $is_end_date) { |
|
327 | 327 | $date_query = array(); |
328 | 328 | |
329 | - if ( $is_start_date && ! is_wp_error( $this->start_date ) ) { |
|
330 | - $date_query['after'] = date( 'Y-m-d H:i:s', $this->start_date ); |
|
329 | + if ($is_start_date && ! is_wp_error($this->start_date)) { |
|
330 | + $date_query['after'] = date('Y-m-d H:i:s', $this->start_date); |
|
331 | 331 | } |
332 | 332 | |
333 | - if ( $is_end_date && ! is_wp_error( $this->end_date ) ) { |
|
334 | - $date_query['before'] = date( 'Y-m-d H:i:s', $this->end_date ); |
|
333 | + if ($is_end_date && ! is_wp_error($this->end_date)) { |
|
334 | + $date_query['before'] = date('Y-m-d H:i:s', $this->end_date); |
|
335 | 335 | } |
336 | 336 | |
337 | - $this->__set( 'date_query', $date_query ); |
|
337 | + $this->__set('date_query', $date_query); |
|
338 | 338 | |
339 | 339 | } |
340 | 340 | |
@@ -349,12 +349,12 @@ discard block |
||
349 | 349 | * @return void |
350 | 350 | */ |
351 | 351 | public function status() { |
352 | - if ( ! isset( $this->args['status'] ) ) { |
|
352 | + if ( ! isset($this->args['status'])) { |
|
353 | 353 | return; |
354 | 354 | } |
355 | 355 | |
356 | - $this->__set( 'post_status', $this->args['status'] ); |
|
357 | - $this->__unset( 'status' ); |
|
356 | + $this->__set('post_status', $this->args['status']); |
|
357 | + $this->__unset('status'); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | /** |
@@ -366,12 +366,12 @@ discard block |
||
366 | 366 | * @return void |
367 | 367 | */ |
368 | 368 | public function page() { |
369 | - if ( ! isset( $this->args['page'] ) ) { |
|
369 | + if ( ! isset($this->args['page'])) { |
|
370 | 370 | return; |
371 | 371 | } |
372 | 372 | |
373 | - $this->__set( 'paged', $this->args['page'] ); |
|
374 | - $this->__unset( 'page' ); |
|
373 | + $this->__set('paged', $this->args['page']); |
|
374 | + $this->__unset('page'); |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | /** |
@@ -384,17 +384,17 @@ discard block |
||
384 | 384 | */ |
385 | 385 | public function per_page() { |
386 | 386 | |
387 | - if ( ! isset( $this->args['number'] ) ) { |
|
387 | + if ( ! isset($this->args['number'])) { |
|
388 | 388 | return; |
389 | 389 | } |
390 | 390 | |
391 | - if ( $this->args['number'] == - 1 ) { |
|
392 | - $this->__set( 'nopaging', true ); |
|
391 | + if ($this->args['number'] == - 1) { |
|
392 | + $this->__set('nopaging', true); |
|
393 | 393 | } else { |
394 | - $this->__set( 'posts_per_page', $this->args['number'] ); |
|
394 | + $this->__set('posts_per_page', $this->args['number']); |
|
395 | 395 | } |
396 | 396 | |
397 | - $this->__unset( 'number' ); |
|
397 | + $this->__unset('number'); |
|
398 | 398 | } |
399 | 399 | |
400 | 400 | /** |
@@ -406,12 +406,12 @@ discard block |
||
406 | 406 | * @return void |
407 | 407 | */ |
408 | 408 | public function month() { |
409 | - if ( ! isset( $this->args['month'] ) ) { |
|
409 | + if ( ! isset($this->args['month'])) { |
|
410 | 410 | return; |
411 | 411 | } |
412 | 412 | |
413 | - $this->__set( 'monthnum', $this->args['month'] ); |
|
414 | - $this->__unset( 'month' ); |
|
413 | + $this->__set('monthnum', $this->args['month']); |
|
414 | + $this->__unset('month'); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | /** |
@@ -423,23 +423,23 @@ discard block |
||
423 | 423 | * @return void |
424 | 424 | */ |
425 | 425 | public function orderby() { |
426 | - switch ( $this->args['orderby'] ) { |
|
426 | + switch ($this->args['orderby']) { |
|
427 | 427 | case 'amount': |
428 | - $this->__set( 'orderby', 'meta_value_num' ); |
|
429 | - $this->__set( 'meta_key', '_give_payment_total' ); |
|
428 | + $this->__set('orderby', 'meta_value_num'); |
|
429 | + $this->__set('meta_key', '_give_payment_total'); |
|
430 | 430 | break; |
431 | 431 | |
432 | 432 | case 'status': |
433 | - $this->__set( 'orderby', 'post_status' ); |
|
433 | + $this->__set('orderby', 'post_status'); |
|
434 | 434 | break; |
435 | 435 | |
436 | 436 | case 'donation_form': |
437 | - $this->__set( 'orderby', 'meta_value' ); |
|
438 | - $this->__set( 'meta_key', '_give_payment_form_title' ); |
|
437 | + $this->__set('orderby', 'meta_value'); |
|
438 | + $this->__set('meta_key', '_give_payment_form_title'); |
|
439 | 439 | break; |
440 | 440 | |
441 | 441 | default: |
442 | - $this->__set( 'orderby', $this->args['orderby'] ); |
|
442 | + $this->__set('orderby', $this->args['orderby']); |
|
443 | 443 | break; |
444 | 444 | } |
445 | 445 | } |
@@ -456,19 +456,19 @@ discard block |
||
456 | 456 | * |
457 | 457 | * @return mixed |
458 | 458 | */ |
459 | - public function custom_orderby( $order, $query ) { |
|
459 | + public function custom_orderby($order, $query) { |
|
460 | 460 | |
461 | - if ( ! empty( $query->query['post_type'] ) ) { |
|
462 | - $post_types = is_array( $query->query['post_type'] ) ? $query->query['post_type'] : array( $query->query['post_type'] ); |
|
461 | + if ( ! empty($query->query['post_type'])) { |
|
462 | + $post_types = is_array($query->query['post_type']) ? $query->query['post_type'] : array($query->query['post_type']); |
|
463 | 463 | |
464 | - if ( ! in_array( 'give_payment', $post_types ) || is_array( $query->query['orderby'] ) ) { |
|
464 | + if ( ! in_array('give_payment', $post_types) || is_array($query->query['orderby'])) { |
|
465 | 465 | return $order; |
466 | 466 | } |
467 | 467 | |
468 | 468 | global $wpdb; |
469 | - switch ( $query->query['orderby'] ) { |
|
469 | + switch ($query->query['orderby']) { |
|
470 | 470 | case 'post_status': |
471 | - $order = $wpdb->posts . '.post_status ' . strtoupper( $query->query['order'] ); |
|
471 | + $order = $wpdb->posts.'.post_status '.strtoupper($query->query['order']); |
|
472 | 472 | break; |
473 | 473 | } |
474 | 474 | } |
@@ -485,11 +485,11 @@ discard block |
||
485 | 485 | * @return void |
486 | 486 | */ |
487 | 487 | public function user() { |
488 | - if ( is_null( $this->args['user'] ) ) { |
|
488 | + if (is_null($this->args['user'])) { |
|
489 | 489 | return; |
490 | 490 | } |
491 | 491 | |
492 | - if ( is_numeric( $this->args['user'] ) ) { |
|
492 | + if (is_numeric($this->args['user'])) { |
|
493 | 493 | $user_key = '_give_payment_user_id'; |
494 | 494 | } else { |
495 | 495 | $user_key = '_give_payment_user_email'; |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | * @return void |
512 | 512 | */ |
513 | 513 | public function donor() { |
514 | - if ( is_null( $this->args['donor'] ) || ! is_numeric( $this->args['donor'] ) ) { |
|
514 | + if (is_null($this->args['donor']) || ! is_numeric($this->args['donor'])) { |
|
515 | 515 | return; |
516 | 516 | } |
517 | 517 | |
@@ -533,33 +533,33 @@ discard block |
||
533 | 533 | */ |
534 | 534 | public function search() { |
535 | 535 | |
536 | - if ( ! isset( $this->args['s'] ) ) { |
|
536 | + if ( ! isset($this->args['s'])) { |
|
537 | 537 | return; |
538 | 538 | } |
539 | 539 | |
540 | - $search = trim( $this->args['s'] ); |
|
540 | + $search = trim($this->args['s']); |
|
541 | 541 | |
542 | - if ( empty( $search ) ) { |
|
542 | + if (empty($search)) { |
|
543 | 543 | return; |
544 | 544 | } |
545 | 545 | |
546 | - $is_email = is_email( $search ) || strpos( $search, '@' ) !== false; |
|
547 | - $is_user = strpos( $search, strtolower( 'user:' ) ) !== false; |
|
546 | + $is_email = is_email($search) || strpos($search, '@') !== false; |
|
547 | + $is_user = strpos($search, strtolower('user:')) !== false; |
|
548 | 548 | |
549 | - if ( ! empty( $this->args['search_in_notes'] ) ) { |
|
549 | + if ( ! empty($this->args['search_in_notes'])) { |
|
550 | 550 | |
551 | - $notes = give_get_payment_notes( 0, $search ); |
|
551 | + $notes = give_get_payment_notes(0, $search); |
|
552 | 552 | |
553 | - if ( ! empty( $notes ) ) { |
|
553 | + if ( ! empty($notes)) { |
|
554 | 554 | |
555 | - $payment_ids = wp_list_pluck( (array) $notes, 'comment_post_ID' ); |
|
555 | + $payment_ids = wp_list_pluck((array) $notes, 'comment_post_ID'); |
|
556 | 556 | |
557 | - $this->__set( 'post__in', $payment_ids ); |
|
557 | + $this->__set('post__in', $payment_ids); |
|
558 | 558 | } |
559 | 559 | |
560 | - $this->__unset( 's' ); |
|
560 | + $this->__unset('s'); |
|
561 | 561 | |
562 | - } elseif ( $is_email || strlen( $search ) == 32 ) { |
|
562 | + } elseif ($is_email || strlen($search) == 32) { |
|
563 | 563 | |
564 | 564 | $key = $is_email ? '_give_payment_user_email' : '_give_payment_purchase_key'; |
565 | 565 | $search_meta = array( |
@@ -568,19 +568,19 @@ discard block |
||
568 | 568 | 'compare' => 'LIKE', |
569 | 569 | ); |
570 | 570 | |
571 | - $this->__set( 'meta_query', $search_meta ); |
|
572 | - $this->__unset( 's' ); |
|
571 | + $this->__set('meta_query', $search_meta); |
|
572 | + $this->__unset('s'); |
|
573 | 573 | |
574 | - } elseif ( $is_user ) { |
|
574 | + } elseif ($is_user) { |
|
575 | 575 | |
576 | 576 | $search_meta = array( |
577 | 577 | 'key' => '_give_payment_user_id', |
578 | - 'value' => trim( str_replace( 'user:', '', strtolower( $search ) ) ), |
|
578 | + 'value' => trim(str_replace('user:', '', strtolower($search))), |
|
579 | 579 | ); |
580 | 580 | |
581 | - $this->__set( 'meta_query', $search_meta ); |
|
581 | + $this->__set('meta_query', $search_meta); |
|
582 | 582 | |
583 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
583 | + if (give_get_option('enable_sequential')) { |
|
584 | 584 | |
585 | 585 | $search_meta = array( |
586 | 586 | 'key' => '_give_payment_number', |
@@ -588,19 +588,19 @@ discard block |
||
588 | 588 | 'compare' => 'LIKE', |
589 | 589 | ); |
590 | 590 | |
591 | - $this->__set( 'meta_query', $search_meta ); |
|
591 | + $this->__set('meta_query', $search_meta); |
|
592 | 592 | |
593 | 593 | $this->args['meta_query']['relation'] = 'OR'; |
594 | 594 | |
595 | 595 | } |
596 | 596 | |
597 | - $this->__unset( 's' ); |
|
597 | + $this->__unset('s'); |
|
598 | 598 | |
599 | 599 | } elseif ( |
600 | - give_get_option( 'enable_sequential' ) && |
|
600 | + give_get_option('enable_sequential') && |
|
601 | 601 | ( |
602 | - false !== strpos( $search, give_get_option( 'sequential_prefix' ) ) || |
|
603 | - false !== strpos( $search, give_get_option( 'sequential_postfix' ) ) |
|
602 | + false !== strpos($search, give_get_option('sequential_prefix')) || |
|
603 | + false !== strpos($search, give_get_option('sequential_postfix')) |
|
604 | 604 | ) |
605 | 605 | ) { |
606 | 606 | |
@@ -610,29 +610,29 @@ discard block |
||
610 | 610 | 'compare' => 'LIKE', |
611 | 611 | ); |
612 | 612 | |
613 | - $this->__set( 'meta_query', $search_meta ); |
|
614 | - $this->__unset( 's' ); |
|
613 | + $this->__set('meta_query', $search_meta); |
|
614 | + $this->__unset('s'); |
|
615 | 615 | |
616 | - } elseif ( is_numeric( $search ) ) { |
|
616 | + } elseif (is_numeric($search)) { |
|
617 | 617 | |
618 | - $post = get_post( $search ); |
|
618 | + $post = get_post($search); |
|
619 | 619 | |
620 | - if ( is_object( $post ) && $post->post_type == 'give_payment' ) { |
|
620 | + if (is_object($post) && $post->post_type == 'give_payment') { |
|
621 | 621 | |
622 | 622 | $arr = array(); |
623 | 623 | $arr[] = $search; |
624 | - $this->__set( 'post__in', $arr ); |
|
625 | - $this->__unset( 's' ); |
|
624 | + $this->__set('post__in', $arr); |
|
625 | + $this->__unset('s'); |
|
626 | 626 | } |
627 | - } elseif ( '#' == substr( $search, 0, 1 ) ) { |
|
627 | + } elseif ('#' == substr($search, 0, 1)) { |
|
628 | 628 | |
629 | - $search = str_replace( '#:', '', $search ); |
|
630 | - $search = str_replace( '#', '', $search ); |
|
631 | - $this->__set( 'give_forms', $search ); |
|
632 | - $this->__unset( 's' ); |
|
629 | + $search = str_replace('#:', '', $search); |
|
630 | + $search = str_replace('#', '', $search); |
|
631 | + $this->__set('give_forms', $search); |
|
632 | + $this->__unset('s'); |
|
633 | 633 | |
634 | 634 | } else { |
635 | - $this->__set( 's', $search ); |
|
635 | + $this->__set('s', $search); |
|
636 | 636 | |
637 | 637 | } |
638 | 638 | |
@@ -647,8 +647,8 @@ discard block |
||
647 | 647 | * @return void |
648 | 648 | */ |
649 | 649 | public function mode() { |
650 | - if ( empty( $this->args['mode'] ) || $this->args['mode'] == 'all' ) { |
|
651 | - $this->__unset( 'mode' ); |
|
650 | + if (empty($this->args['mode']) || $this->args['mode'] == 'all') { |
|
651 | + $this->__unset('mode'); |
|
652 | 652 | |
653 | 653 | return; |
654 | 654 | } |
@@ -670,10 +670,10 @@ discard block |
||
670 | 670 | * @return void |
671 | 671 | */ |
672 | 672 | public function children() { |
673 | - if ( empty( $this->args['children'] ) ) { |
|
674 | - $this->__set( 'post_parent', 0 ); |
|
673 | + if (empty($this->args['children'])) { |
|
674 | + $this->__set('post_parent', 0); |
|
675 | 675 | } |
676 | - $this->__unset( 'children' ); |
|
676 | + $this->__unset('children'); |
|
677 | 677 | } |
678 | 678 | |
679 | 679 | /** |
@@ -686,13 +686,13 @@ discard block |
||
686 | 686 | */ |
687 | 687 | public function give_forms() { |
688 | 688 | |
689 | - if ( empty( $this->args['give_forms'] ) ) { |
|
689 | + if (empty($this->args['give_forms'])) { |
|
690 | 690 | return; |
691 | 691 | } |
692 | 692 | |
693 | 693 | $compare = '='; |
694 | 694 | |
695 | - if ( is_array( $this->args['give_forms'] ) ) { |
|
695 | + if (is_array($this->args['give_forms'])) { |
|
696 | 696 | $compare = 'IN'; |
697 | 697 | } |
698 | 698 | |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | ) |
707 | 707 | ); |
708 | 708 | |
709 | - $this->__unset( 'give_forms' ); |
|
709 | + $this->__unset('give_forms'); |
|
710 | 710 | |
711 | 711 | } |
712 | 712 | |
@@ -720,13 +720,13 @@ discard block |
||
720 | 720 | */ |
721 | 721 | public function gateway_filter() { |
722 | 722 | |
723 | - if ( empty( $this->args['gateway'] ) ) { |
|
723 | + if (empty($this->args['gateway'])) { |
|
724 | 724 | return; |
725 | 725 | } |
726 | 726 | |
727 | 727 | $compare = '='; |
728 | 728 | |
729 | - if ( is_array( $this->args['gateway'] ) ) { |
|
729 | + if (is_array($this->args['gateway'])) { |
|
730 | 730 | $compare = 'IN'; |
731 | 731 | } |
732 | 732 | |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | ) |
741 | 741 | ); |
742 | 742 | |
743 | - $this->__unset( 'gateway' ); |
|
743 | + $this->__unset('gateway'); |
|
744 | 744 | |
745 | 745 | } |
746 | 746 | |
@@ -760,9 +760,9 @@ discard block |
||
760 | 760 | global $wpdb; |
761 | 761 | |
762 | 762 | $where = "WHERE {$wpdb->posts}.post_type = 'give_payment'"; |
763 | - $where .= " AND {$wpdb->posts}.post_status IN ('" . implode( "','", $this->args['post_status'] ) . "')"; |
|
763 | + $where .= " AND {$wpdb->posts}.post_status IN ('".implode("','", $this->args['post_status'])."')"; |
|
764 | 764 | |
765 | - if( is_numeric( $this->args['post_parent'] ) ) { |
|
765 | + if (is_numeric($this->args['post_parent'])) { |
|
766 | 766 | $where .= " AND {$wpdb->posts}.post_parent={$this->args['post_parent']}"; |
767 | 767 | } |
768 | 768 | |
@@ -771,42 +771,42 @@ discard block |
||
771 | 771 | $group_by = ''; |
772 | 772 | |
773 | 773 | // Set group by. |
774 | - if ( ! empty( $this->args['group_by'] ) ) { |
|
774 | + if ( ! empty($this->args['group_by'])) { |
|
775 | 775 | $group_by = "GROUP BY {$wpdb->posts}.{$this->args['group_by']}"; |
776 | 776 | } |
777 | 777 | |
778 | 778 | // Set offset. |
779 | 779 | if ( |
780 | - empty( $this->args['nopaging'] ) && |
|
781 | - empty( $this->args['offset'] ) && |
|
782 | - ( ! empty( $this->args['page'] ) && 0 < $this->args['page'] ) |
|
780 | + empty($this->args['nopaging']) && |
|
781 | + empty($this->args['offset']) && |
|
782 | + ( ! empty($this->args['page']) && 0 < $this->args['page']) |
|
783 | 783 | ) { |
784 | - $this->args['offset'] = $this->args['posts_per_page'] * ( $this->args['page'] - 1 ); |
|
784 | + $this->args['offset'] = $this->args['posts_per_page'] * ($this->args['page'] - 1); |
|
785 | 785 | } |
786 | 786 | |
787 | 787 | // Set fields. |
788 | 788 | $fields = "{$wpdb->posts}.*"; |
789 | - if ( ! empty( $this->args['fields'] ) && 'all' !== $this->args['fields'] ) { |
|
790 | - if ( is_string( $this->args['fields'] ) ) { |
|
789 | + if ( ! empty($this->args['fields']) && 'all' !== $this->args['fields']) { |
|
790 | + if (is_string($this->args['fields'])) { |
|
791 | 791 | $fields = "{$wpdb->posts}.{$this->args['fields']}"; |
792 | - } elseif ( is_array( $this->args['fields'] ) ) { |
|
793 | - $fields = "{$wpdb->posts}." . implode( " , {$wpdb->posts}.", $this->args['fields'] ); |
|
792 | + } elseif (is_array($this->args['fields'])) { |
|
793 | + $fields = "{$wpdb->posts}.".implode(" , {$wpdb->posts}.", $this->args['fields']); |
|
794 | 794 | } |
795 | 795 | } |
796 | 796 | |
797 | 797 | // Set count. |
798 | - if ( ! empty( $this->args['count'] ) ) { |
|
798 | + if ( ! empty($this->args['count'])) { |
|
799 | 799 | $fields = "COUNT({$wpdb->posts}.ID)"; |
800 | 800 | |
801 | - if ( ! empty( $this->args['group_by'] ) ) { |
|
801 | + if ( ! empty($this->args['group_by'])) { |
|
802 | 802 | $fields = "{$wpdb->posts}.{$this->args['group_by']}, {$fields}"; |
803 | 803 | } |
804 | 804 | } |
805 | 805 | |
806 | 806 | // Date query. |
807 | - if ( ! empty( $this->args['date_query'] ) ) { |
|
808 | - $date_query_obj = new WP_Date_Query( $this->args['date_query'] ); |
|
809 | - $where .= str_replace( |
|
807 | + if ( ! empty($this->args['date_query'])) { |
|
808 | + $date_query_obj = new WP_Date_Query($this->args['date_query']); |
|
809 | + $where .= str_replace( |
|
810 | 810 | array( |
811 | 811 | "\n", |
812 | 812 | '( (', |
@@ -822,21 +822,21 @@ discard block |
||
822 | 822 | } |
823 | 823 | |
824 | 824 | // Meta query. |
825 | - if ( ! empty( $this->args['meta_query'] ) ) { |
|
826 | - $meta_query_obj = new WP_Meta_Query( $this->args['meta_query'] ); |
|
827 | - $where = implode( ' ', $meta_query_obj->get_sql( 'post', $wpdb->posts, 'ID' ) ) . " {$where}"; |
|
825 | + if ( ! empty($this->args['meta_query'])) { |
|
826 | + $meta_query_obj = new WP_Meta_Query($this->args['meta_query']); |
|
827 | + $where = implode(' ', $meta_query_obj->get_sql('post', $wpdb->posts, 'ID'))." {$where}"; |
|
828 | 828 | } |
829 | 829 | |
830 | 830 | // Set sql query. |
831 | 831 | $sql = $wpdb->prepare( |
832 | 832 | "SELECT {$fields} FROM {$wpdb->posts} LIMIT %d,%d;", |
833 | - absint( $this->args['offset'] ), |
|
834 | - ( empty( $this->args['nopaging'] ) ? absint( $this->args['posts_per_page'] ) : 999999999999999 ) |
|
833 | + absint($this->args['offset']), |
|
834 | + (empty($this->args['nopaging']) ? absint($this->args['posts_per_page']) : 999999999999999) |
|
835 | 835 | ); |
836 | 836 | |
837 | 837 | // $where, $orderby and order already prepared query they can generate notice if you re prepare them in above. |
838 | 838 | // WordPress consider LIKE condition as placeholder if start with s,f, or d. |
839 | - $sql = str_replace( 'LIMIT', "{$where} {$group_by} {$orderby} {$this->args['order']} LIMIT", $sql ); |
|
839 | + $sql = str_replace('LIMIT', "{$where} {$group_by} {$orderby} {$this->args['order']} LIMIT", $sql); |
|
840 | 840 | |
841 | 841 | return $sql; |
842 | 842 | } |
@@ -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 | |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | * @param bool $_id Post id. Default is false. |
338 | 338 | * @param array $_args Arguments passed. |
339 | 339 | */ |
340 | - public function __construct( $_id = false, $_args = array() ) { |
|
340 | + public function __construct($_id = false, $_args = array()) { |
|
341 | 341 | |
342 | - $donation_form = WP_Post::get_instance( $_id ); |
|
342 | + $donation_form = WP_Post::get_instance($_id); |
|
343 | 343 | |
344 | - return $this->setup_donation_form( $donation_form ); |
|
344 | + return $this->setup_donation_form($donation_form); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | /** |
@@ -354,23 +354,23 @@ discard block |
||
354 | 354 | * |
355 | 355 | * @return bool If the setup was successful or not. |
356 | 356 | */ |
357 | - private function setup_donation_form( $donation_form ) { |
|
357 | + private function setup_donation_form($donation_form) { |
|
358 | 358 | |
359 | - if ( ! is_object( $donation_form ) ) { |
|
359 | + if ( ! is_object($donation_form)) { |
|
360 | 360 | return false; |
361 | 361 | } |
362 | 362 | |
363 | - if ( ! is_a( $donation_form, 'WP_Post' ) ) { |
|
363 | + if ( ! is_a($donation_form, 'WP_Post')) { |
|
364 | 364 | return false; |
365 | 365 | } |
366 | 366 | |
367 | - if ( 'give_forms' !== $donation_form->post_type ) { |
|
367 | + if ('give_forms' !== $donation_form->post_type) { |
|
368 | 368 | return false; |
369 | 369 | } |
370 | 370 | |
371 | - foreach ( $donation_form as $key => $value ) { |
|
371 | + foreach ($donation_form as $key => $value) { |
|
372 | 372 | |
373 | - switch ( $key ) { |
|
373 | + switch ($key) { |
|
374 | 374 | |
375 | 375 | default: |
376 | 376 | $this->$key = $value; |
@@ -394,16 +394,16 @@ discard block |
||
394 | 394 | * |
395 | 395 | * @return mixed |
396 | 396 | */ |
397 | - public function __get( $key ) { |
|
397 | + public function __get($key) { |
|
398 | 398 | |
399 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
399 | + if (method_exists($this, 'get_'.$key)) { |
|
400 | 400 | |
401 | - return call_user_func( array( $this, 'get_' . $key ) ); |
|
401 | + return call_user_func(array($this, 'get_'.$key)); |
|
402 | 402 | |
403 | 403 | } else { |
404 | 404 | |
405 | 405 | /* translators: %s: property key */ |
406 | - return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) ); |
|
406 | + return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key)); |
|
407 | 407 | |
408 | 408 | } |
409 | 409 | |
@@ -419,30 +419,30 @@ discard block |
||
419 | 419 | * |
420 | 420 | * @return bool|int False if data isn't passed and class not instantiated for creation, or New Form ID. |
421 | 421 | */ |
422 | - public function create( $data = array() ) { |
|
422 | + public function create($data = array()) { |
|
423 | 423 | |
424 | - if ( $this->id != 0 ) { |
|
424 | + if ($this->id != 0) { |
|
425 | 425 | return false; |
426 | 426 | } |
427 | 427 | |
428 | 428 | $defaults = array( |
429 | 429 | 'post_type' => 'give_forms', |
430 | 430 | 'post_status' => 'draft', |
431 | - 'post_title' => __( 'New Donation Form', 'give' ), |
|
431 | + 'post_title' => __('New Donation Form', 'give'), |
|
432 | 432 | ); |
433 | 433 | |
434 | - $args = wp_parse_args( $data, $defaults ); |
|
434 | + $args = wp_parse_args($data, $defaults); |
|
435 | 435 | |
436 | 436 | /** |
437 | 437 | * Fired before a donation form is created |
438 | 438 | * |
439 | 439 | * @param array $args The post object arguments used for creation. |
440 | 440 | */ |
441 | - do_action( 'give_form_pre_create', $args ); |
|
441 | + do_action('give_form_pre_create', $args); |
|
442 | 442 | |
443 | - $id = wp_insert_post( $args, true ); |
|
443 | + $id = wp_insert_post($args, true); |
|
444 | 444 | |
445 | - $donation_form = WP_Post::get_instance( $id ); |
|
445 | + $donation_form = WP_Post::get_instance($id); |
|
446 | 446 | |
447 | 447 | /** |
448 | 448 | * Fired after a donation form is created |
@@ -450,9 +450,9 @@ discard block |
||
450 | 450 | * @param int $id The post ID of the created item. |
451 | 451 | * @param array $args The post object arguments used for creation. |
452 | 452 | */ |
453 | - do_action( 'give_form_post_create', $id, $args ); |
|
453 | + do_action('give_form_post_create', $id, $args); |
|
454 | 454 | |
455 | - return $this->setup_donation_form( $donation_form ); |
|
455 | + return $this->setup_donation_form($donation_form); |
|
456 | 456 | |
457 | 457 | } |
458 | 458 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | * @return string Donation form name. |
478 | 478 | */ |
479 | 479 | public function get_name() { |
480 | - return get_the_title( $this->ID ); |
|
480 | + return get_the_title($this->ID); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | /** |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | */ |
491 | 491 | public function get_price() { |
492 | 492 | |
493 | - if ( ! isset( $this->price ) ) { |
|
493 | + if ( ! isset($this->price)) { |
|
494 | 494 | |
495 | 495 | $this->price = give_maybe_sanitize_amount( |
496 | 496 | give_get_meta( |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | ) |
501 | 501 | ); |
502 | 502 | |
503 | - if ( ! $this->price ) { |
|
503 | + if ( ! $this->price) { |
|
504 | 504 | $this->price = 0; |
505 | 505 | } |
506 | 506 | |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | * @param string $price The donation form price. |
515 | 515 | * @param string|int $id The form ID. |
516 | 516 | */ |
517 | - return apply_filters( 'give_get_set_price', $this->price, $this->ID ); |
|
517 | + return apply_filters('give_get_set_price', $this->price, $this->ID); |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | /** |
@@ -527,17 +527,17 @@ discard block |
||
527 | 527 | */ |
528 | 528 | public function get_minimum_price() { |
529 | 529 | |
530 | - if ( ! isset( $this->minimum_price ) ) { |
|
530 | + if ( ! isset($this->minimum_price)) { |
|
531 | 531 | |
532 | - $this->minimum_price = give_get_meta( $this->ID, '_give_custom_amount_minimum', true ); |
|
532 | + $this->minimum_price = give_get_meta($this->ID, '_give_custom_amount_minimum', true); |
|
533 | 533 | |
534 | - if ( ! $this->is_custom_price_mode() ) { |
|
534 | + if ( ! $this->is_custom_price_mode()) { |
|
535 | 535 | $this->minimum_price = 0; |
536 | 536 | } |
537 | 537 | |
538 | 538 | } |
539 | 539 | |
540 | - return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID ); |
|
540 | + return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | /** |
@@ -550,9 +550,9 @@ discard block |
||
550 | 550 | */ |
551 | 551 | public function get_prices() { |
552 | 552 | |
553 | - if ( ! isset( $this->prices ) ) { |
|
553 | + if ( ! isset($this->prices)) { |
|
554 | 554 | |
555 | - $this->prices = give_get_meta( $this->ID, '_give_donation_levels', true ); |
|
555 | + $this->prices = give_get_meta($this->ID, '_give_donation_levels', true); |
|
556 | 556 | |
557 | 557 | } |
558 | 558 | |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | * @param array $prices The array of mulit-level prices. |
565 | 565 | * @param int|string $ID The ID of the form. |
566 | 566 | */ |
567 | - return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID ); |
|
567 | + return apply_filters('give_get_donation_levels', $this->prices, $this->ID); |
|
568 | 568 | |
569 | 569 | } |
570 | 570 | |
@@ -578,17 +578,17 @@ discard block |
||
578 | 578 | */ |
579 | 579 | public function get_goal() { |
580 | 580 | |
581 | - if ( ! isset( $this->goal ) ) { |
|
581 | + if ( ! isset($this->goal)) { |
|
582 | 582 | |
583 | - $this->goal = give_get_meta( $this->ID, '_give_set_goal', true ); |
|
583 | + $this->goal = give_get_meta($this->ID, '_give_set_goal', true); |
|
584 | 584 | |
585 | - if ( ! $this->goal ) { |
|
585 | + if ( ! $this->goal) { |
|
586 | 586 | $this->goal = 0; |
587 | 587 | } |
588 | 588 | |
589 | 589 | } |
590 | 590 | |
591 | - return apply_filters( 'give_get_set_goal', $this->goal, $this->ID ); |
|
591 | + return apply_filters('give_get_set_goal', $this->goal, $this->ID); |
|
592 | 592 | |
593 | 593 | } |
594 | 594 | |
@@ -602,10 +602,10 @@ discard block |
||
602 | 602 | */ |
603 | 603 | public function is_single_price_mode() { |
604 | 604 | |
605 | - $option = give_get_meta( $this->ID, '_give_price_option', true ); |
|
605 | + $option = give_get_meta($this->ID, '_give_price_option', true); |
|
606 | 606 | $ret = 0; |
607 | 607 | |
608 | - if ( empty( $option ) || $option === 'set' ) { |
|
608 | + if (empty($option) || $option === 'set') { |
|
609 | 609 | $ret = 1; |
610 | 610 | } |
611 | 611 | |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | * @param bool $ret Is donation form in single price mode? |
618 | 618 | * @param int|string $ID The ID of the donation form. |
619 | 619 | */ |
620 | - return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID ); |
|
620 | + return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID); |
|
621 | 621 | |
622 | 622 | } |
623 | 623 | |
@@ -631,10 +631,10 @@ discard block |
||
631 | 631 | */ |
632 | 632 | public function is_custom_price_mode() { |
633 | 633 | |
634 | - $option = give_get_meta( $this->ID, '_give_custom_amount', true ); |
|
634 | + $option = give_get_meta($this->ID, '_give_custom_amount', true); |
|
635 | 635 | $ret = 0; |
636 | 636 | |
637 | - if ( give_is_setting_enabled( $option ) ) { |
|
637 | + if (give_is_setting_enabled($option)) { |
|
638 | 638 | $ret = 1; |
639 | 639 | } |
640 | 640 | |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | * @param bool $ret Is donation form in custom price mode? |
647 | 647 | * @param int|string $ID The ID of the donation form. |
648 | 648 | */ |
649 | - return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID ); |
|
649 | + return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID); |
|
650 | 650 | |
651 | 651 | } |
652 | 652 | |
@@ -660,20 +660,20 @@ discard block |
||
660 | 660 | * |
661 | 661 | * @return bool |
662 | 662 | */ |
663 | - public function is_custom_price( $amount ) { |
|
663 | + public function is_custom_price($amount) { |
|
664 | 664 | $result = false; |
665 | - $amount = give_maybe_sanitize_amount( $amount ); |
|
665 | + $amount = give_maybe_sanitize_amount($amount); |
|
666 | 666 | |
667 | - if ( $this->is_custom_price_mode() ) { |
|
667 | + if ($this->is_custom_price_mode()) { |
|
668 | 668 | |
669 | - if ( 'set' === $this->get_type() ) { |
|
670 | - if ( $amount !== $this->get_price() ) { |
|
669 | + if ('set' === $this->get_type()) { |
|
670 | + if ($amount !== $this->get_price()) { |
|
671 | 671 | $result = true; |
672 | 672 | } |
673 | 673 | |
674 | - } elseif ( 'multi' === $this->get_type() ) { |
|
675 | - $level_amounts = array_map( 'give_maybe_sanitize_amount', wp_list_pluck( $this->get_prices(), '_give_amount' ) ); |
|
676 | - $result = ! in_array( $amount, $level_amounts ); |
|
674 | + } elseif ('multi' === $this->get_type()) { |
|
675 | + $level_amounts = array_map('give_maybe_sanitize_amount', wp_list_pluck($this->get_prices(), '_give_amount')); |
|
676 | + $result = ! in_array($amount, $level_amounts); |
|
677 | 677 | } |
678 | 678 | } |
679 | 679 | |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | * |
687 | 687 | * @since 1.8.18 |
688 | 688 | */ |
689 | - return (bool) apply_filters( 'give_is_custom_price', $result, $amount, $this->ID ); |
|
689 | + return (bool) apply_filters('give_is_custom_price', $result, $amount, $this->ID); |
|
690 | 690 | } |
691 | 691 | |
692 | 692 | /** |
@@ -701,10 +701,10 @@ discard block |
||
701 | 701 | */ |
702 | 702 | public function has_variable_prices() { |
703 | 703 | |
704 | - $option = give_get_meta( $this->ID, '_give_price_option', true ); |
|
704 | + $option = give_get_meta($this->ID, '_give_price_option', true); |
|
705 | 705 | $ret = 0; |
706 | 706 | |
707 | - if ( $option === 'multi' ) { |
|
707 | + if ($option === 'multi') { |
|
708 | 708 | $ret = 1; |
709 | 709 | } |
710 | 710 | |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | * @param bool $ret Does donation form have variable prices? |
715 | 715 | * @param int|string $ID The ID of the donation form. |
716 | 716 | */ |
717 | - return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID ); |
|
717 | + return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID); |
|
718 | 718 | |
719 | 719 | } |
720 | 720 | |
@@ -728,17 +728,17 @@ discard block |
||
728 | 728 | */ |
729 | 729 | public function get_type() { |
730 | 730 | |
731 | - if ( ! isset( $this->type ) ) { |
|
731 | + if ( ! isset($this->type)) { |
|
732 | 732 | |
733 | - $this->type = give_get_meta( $this->ID, '_give_price_option', true ); |
|
733 | + $this->type = give_get_meta($this->ID, '_give_price_option', true); |
|
734 | 734 | |
735 | - if ( empty( $this->type ) ) { |
|
735 | + if (empty($this->type)) { |
|
736 | 736 | $this->type = 'set'; |
737 | 737 | } |
738 | 738 | |
739 | 739 | } |
740 | 740 | |
741 | - return apply_filters( 'give_get_form_type', $this->type, $this->ID ); |
|
741 | + return apply_filters('give_get_form_type', $this->type, $this->ID); |
|
742 | 742 | |
743 | 743 | } |
744 | 744 | |
@@ -754,23 +754,23 @@ discard block |
||
754 | 754 | * |
755 | 755 | * @return string |
756 | 756 | */ |
757 | - public function get_form_classes( $args ) { |
|
757 | + public function get_form_classes($args) { |
|
758 | 758 | |
759 | - $float_labels_option = give_is_float_labels_enabled( $args ) |
|
759 | + $float_labels_option = give_is_float_labels_enabled($args) |
|
760 | 760 | ? 'float-labels-enabled' |
761 | 761 | : ''; |
762 | 762 | |
763 | - $form_classes_array = apply_filters( 'give_form_classes', array( |
|
763 | + $form_classes_array = apply_filters('give_form_classes', array( |
|
764 | 764 | 'give-form', |
765 | - 'give-form-' . $this->ID, |
|
766 | - 'give-form-type-' . $this->get_type(), |
|
765 | + 'give-form-'.$this->ID, |
|
766 | + 'give-form-type-'.$this->get_type(), |
|
767 | 767 | $float_labels_option, |
768 | - ), $this->ID, $args ); |
|
768 | + ), $this->ID, $args); |
|
769 | 769 | |
770 | 770 | // Remove empty class names. |
771 | - $form_classes_array = array_filter( $form_classes_array ); |
|
771 | + $form_classes_array = array_filter($form_classes_array); |
|
772 | 772 | |
773 | - return implode( ' ', $form_classes_array ); |
|
773 | + return implode(' ', $form_classes_array); |
|
774 | 774 | |
775 | 775 | } |
776 | 776 | |
@@ -785,22 +785,22 @@ discard block |
||
785 | 785 | * |
786 | 786 | * @return string |
787 | 787 | */ |
788 | - public function get_form_wrap_classes( $args ) { |
|
788 | + public function get_form_wrap_classes($args) { |
|
789 | 789 | $custom_class = array( |
790 | 790 | 'give-form-wrap', |
791 | 791 | ); |
792 | 792 | |
793 | - if ( $this->is_close_donation_form() ) { |
|
793 | + if ($this->is_close_donation_form()) { |
|
794 | 794 | $custom_class[] = 'give-form-closed'; |
795 | - } else{ |
|
796 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
795 | + } else { |
|
796 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
797 | 797 | ? $args['display_style'] |
798 | - : give_get_meta( $this->ID, '_give_payment_display', true ); |
|
798 | + : give_get_meta($this->ID, '_give_payment_display', true); |
|
799 | 799 | |
800 | 800 | $custom_class[] = "give-display-{$display_option}"; |
801 | 801 | |
802 | 802 | // If admin want to show only button for form then user inbuilt modal functionality. |
803 | - if ( 'button' === $display_option ) { |
|
803 | + if ('button' === $display_option) { |
|
804 | 804 | $custom_class[] = 'give-display-button-only'; |
805 | 805 | } |
806 | 806 | } |
@@ -811,10 +811,10 @@ discard block |
||
811 | 811 | * |
812 | 812 | * @since 1.0 |
813 | 813 | */ |
814 | - $form_wrap_classes_array = (array) apply_filters( 'give_form_wrap_classes', $custom_class, $this->ID, $args ); |
|
814 | + $form_wrap_classes_array = (array) apply_filters('give_form_wrap_classes', $custom_class, $this->ID, $args); |
|
815 | 815 | |
816 | 816 | |
817 | - return implode( ' ', $form_wrap_classes_array ); |
|
817 | + return implode(' ', $form_wrap_classes_array); |
|
818 | 818 | |
819 | 819 | } |
820 | 820 | |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | public function is_set_type_donation_form() { |
830 | 830 | $form_type = $this->get_type(); |
831 | 831 | |
832 | - return ( 'set' === $form_type ? true : false ); |
|
832 | + return ('set' === $form_type ? true : false); |
|
833 | 833 | } |
834 | 834 | |
835 | 835 | /** |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | public function is_multi_type_donation_form() { |
844 | 844 | $form_type = $this->get_type(); |
845 | 845 | |
846 | - return ( 'multi' === $form_type ? true : false ); |
|
846 | + return ('multi' === $form_type ? true : false); |
|
847 | 847 | |
848 | 848 | } |
849 | 849 | |
@@ -857,15 +857,15 @@ discard block |
||
857 | 857 | */ |
858 | 858 | public function get_sales() { |
859 | 859 | |
860 | - if ( ! isset( $this->sales ) ) { |
|
860 | + if ( ! isset($this->sales)) { |
|
861 | 861 | |
862 | - if ( '' == give_get_meta( $this->ID, '_give_form_sales', true ) ) { |
|
863 | - add_post_meta( $this->ID, '_give_form_sales', 0 ); |
|
862 | + if ('' == give_get_meta($this->ID, '_give_form_sales', true)) { |
|
863 | + add_post_meta($this->ID, '_give_form_sales', 0); |
|
864 | 864 | } // End if |
865 | 865 | |
866 | - $this->sales = give_get_meta( $this->ID, '_give_form_sales', true ); |
|
866 | + $this->sales = give_get_meta($this->ID, '_give_form_sales', true); |
|
867 | 867 | |
868 | - if ( $this->sales < 0 ) { |
|
868 | + if ($this->sales < 0) { |
|
869 | 869 | // Never let sales be less than zero. |
870 | 870 | $this->sales = 0; |
871 | 871 | } |
@@ -886,13 +886,13 @@ discard block |
||
886 | 886 | * |
887 | 887 | * @return int|false New number of total sales. |
888 | 888 | */ |
889 | - public function increase_sales( $quantity = 1 ) { |
|
889 | + public function increase_sales($quantity = 1) { |
|
890 | 890 | |
891 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
892 | - $quantity = absint( $quantity ); |
|
891 | + $sales = give_get_form_sales_stats($this->ID); |
|
892 | + $quantity = absint($quantity); |
|
893 | 893 | $total_sales = $sales + $quantity; |
894 | 894 | |
895 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
895 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
896 | 896 | |
897 | 897 | $this->sales = $total_sales; |
898 | 898 | |
@@ -913,17 +913,17 @@ discard block |
||
913 | 913 | * |
914 | 914 | * @return int|false New number of total sales. |
915 | 915 | */ |
916 | - public function decrease_sales( $quantity = 1 ) { |
|
916 | + public function decrease_sales($quantity = 1) { |
|
917 | 917 | |
918 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
918 | + $sales = give_get_form_sales_stats($this->ID); |
|
919 | 919 | |
920 | 920 | // Only decrease if not already zero |
921 | - if ( $sales > 0 ) { |
|
921 | + if ($sales > 0) { |
|
922 | 922 | |
923 | - $quantity = absint( $quantity ); |
|
923 | + $quantity = absint($quantity); |
|
924 | 924 | $total_sales = $sales - $quantity; |
925 | 925 | |
926 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
926 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
927 | 927 | |
928 | 928 | $this->sales = $sales; |
929 | 929 | |
@@ -947,15 +947,15 @@ discard block |
||
947 | 947 | */ |
948 | 948 | public function get_earnings() { |
949 | 949 | |
950 | - if ( ! isset( $this->earnings ) ) { |
|
950 | + if ( ! isset($this->earnings)) { |
|
951 | 951 | |
952 | - if ( '' == give_get_meta( $this->ID, '_give_form_earnings', true ) ) { |
|
953 | - add_post_meta( $this->ID, '_give_form_earnings', 0 ); |
|
952 | + if ('' == give_get_meta($this->ID, '_give_form_earnings', true)) { |
|
953 | + add_post_meta($this->ID, '_give_form_earnings', 0); |
|
954 | 954 | } |
955 | 955 | |
956 | - $this->earnings = give_get_meta( $this->ID, '_give_form_earnings', true ); |
|
956 | + $this->earnings = give_get_meta($this->ID, '_give_form_earnings', true); |
|
957 | 957 | |
958 | - if ( $this->earnings < 0 ) { |
|
958 | + if ($this->earnings < 0) { |
|
959 | 959 | // Never let earnings be less than zero |
960 | 960 | $this->earnings = 0; |
961 | 961 | } |
@@ -976,12 +976,12 @@ discard block |
||
976 | 976 | * |
977 | 977 | * @return float|false |
978 | 978 | */ |
979 | - public function increase_earnings( $amount = 0 ) { |
|
979 | + public function increase_earnings($amount = 0) { |
|
980 | 980 | |
981 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
981 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
982 | 982 | $new_amount = $earnings + (float) $amount; |
983 | 983 | |
984 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
984 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
985 | 985 | |
986 | 986 | $this->earnings = $new_amount; |
987 | 987 | |
@@ -1003,16 +1003,16 @@ discard block |
||
1003 | 1003 | * |
1004 | 1004 | * @return float|false |
1005 | 1005 | */ |
1006 | - public function decrease_earnings( $amount ) { |
|
1006 | + public function decrease_earnings($amount) { |
|
1007 | 1007 | |
1008 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
1008 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
1009 | 1009 | |
1010 | - if ( $earnings > 0 ) { |
|
1010 | + if ($earnings > 0) { |
|
1011 | 1011 | // Only decrease if greater than zero |
1012 | 1012 | $new_amount = $earnings - (float) $amount; |
1013 | 1013 | |
1014 | 1014 | |
1015 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
1015 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
1016 | 1016 | |
1017 | 1017 | $this->earnings = $new_amount; |
1018 | 1018 | |
@@ -1036,22 +1036,22 @@ discard block |
||
1036 | 1036 | * |
1037 | 1037 | * @return bool |
1038 | 1038 | */ |
1039 | - public function is_free( $price_id = false ) { |
|
1039 | + public function is_free($price_id = false) { |
|
1040 | 1040 | |
1041 | 1041 | $is_free = false; |
1042 | - $variable_pricing = give_has_variable_prices( $this->ID ); |
|
1042 | + $variable_pricing = give_has_variable_prices($this->ID); |
|
1043 | 1043 | |
1044 | - if ( $variable_pricing && ! is_null( $price_id ) && $price_id !== false ) { |
|
1045 | - $price = give_get_price_option_amount( $this->ID, $price_id ); |
|
1046 | - } elseif ( ! $variable_pricing ) { |
|
1047 | - $price = give_get_meta( $this->ID, '_give_set_price', true ); |
|
1044 | + if ($variable_pricing && ! is_null($price_id) && $price_id !== false) { |
|
1045 | + $price = give_get_price_option_amount($this->ID, $price_id); |
|
1046 | + } elseif ( ! $variable_pricing) { |
|
1047 | + $price = give_get_meta($this->ID, '_give_set_price', true); |
|
1048 | 1048 | } |
1049 | 1049 | |
1050 | - if ( isset( $price ) && (float) $price == 0 ) { |
|
1050 | + if (isset($price) && (float) $price == 0) { |
|
1051 | 1051 | $is_free = true; |
1052 | 1052 | } |
1053 | 1053 | |
1054 | - return (bool) apply_filters( 'give_is_free_donation', $is_free, $this->ID, $price_id ); |
|
1054 | + return (bool) apply_filters('give_is_free_donation', $is_free, $this->ID, $price_id); |
|
1055 | 1055 | |
1056 | 1056 | } |
1057 | 1057 | |
@@ -1078,9 +1078,9 @@ discard block |
||
1078 | 1078 | $is_close_form = apply_filters( |
1079 | 1079 | 'give_is_close_donation_form', |
1080 | 1080 | ( |
1081 | - give_is_setting_enabled( give_get_meta( $this->ID, '_give_goal_option', true ) ) ) |
|
1082 | - && give_is_setting_enabled( give_get_meta( $this->ID, '_give_close_form_when_goal_achieved', true ) ) |
|
1083 | - && ( $this->get_goal() <= $this->get_earnings() |
|
1081 | + give_is_setting_enabled(give_get_meta($this->ID, '_give_goal_option', true)) ) |
|
1082 | + && give_is_setting_enabled(give_get_meta($this->ID, '_give_close_form_when_goal_achieved', true)) |
|
1083 | + && ($this->get_goal() <= $this->get_earnings() |
|
1084 | 1084 | ), |
1085 | 1085 | $this->ID |
1086 | 1086 | ); |
@@ -1099,29 +1099,29 @@ discard block |
||
1099 | 1099 | * |
1100 | 1100 | * @return bool The result of the update query. |
1101 | 1101 | */ |
1102 | - private function update_meta( $meta_key = '', $meta_value = '' ) { |
|
1102 | + private function update_meta($meta_key = '', $meta_value = '') { |
|
1103 | 1103 | |
1104 | 1104 | /* @var WPDB $wpdb */ |
1105 | 1105 | global $wpdb; |
1106 | 1106 | |
1107 | - if ( empty( $meta_key ) ) { |
|
1107 | + if (empty($meta_key)) { |
|
1108 | 1108 | return false; |
1109 | 1109 | } |
1110 | 1110 | |
1111 | 1111 | // Make sure if it needs to be serialized, we do |
1112 | - $meta_value = maybe_serialize( $meta_value ); |
|
1112 | + $meta_value = maybe_serialize($meta_value); |
|
1113 | 1113 | |
1114 | - if ( is_numeric( $meta_value ) ) { |
|
1115 | - $value_type = is_float( $meta_value ) ? '%f' : '%d'; |
|
1114 | + if (is_numeric($meta_value)) { |
|
1115 | + $value_type = is_float($meta_value) ? '%f' : '%d'; |
|
1116 | 1116 | } else { |
1117 | 1117 | $value_type = "'%s'"; |
1118 | 1118 | } |
1119 | 1119 | |
1120 | - $sql = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key ); |
|
1120 | + $sql = $wpdb->prepare("UPDATE $wpdb->postmeta SET meta_value = $value_type WHERE post_id = $this->ID AND meta_key = '%s'", $meta_value, $meta_key); |
|
1121 | 1121 | |
1122 | - if ( $wpdb->query( $sql ) ) { |
|
1122 | + if ($wpdb->query($sql)) { |
|
1123 | 1123 | |
1124 | - clean_post_cache( $this->ID ); |
|
1124 | + clean_post_cache($this->ID); |
|
1125 | 1125 | |
1126 | 1126 | return true; |
1127 | 1127 |
@@ -20,19 +20,19 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @return string The currency code |
22 | 22 | */ |
23 | -function give_get_currency( $donation_or_form_id = null, $args = array() ) { |
|
23 | +function give_get_currency($donation_or_form_id = null, $args = array()) { |
|
24 | 24 | |
25 | 25 | // Get currency from donation |
26 | - if ( is_numeric( $donation_or_form_id ) && 'give_payment' === get_post_type( $donation_or_form_id ) ) { |
|
27 | - $donation_meta = give_get_meta( $donation_or_form_id, '_give_payment_meta', true ); |
|
26 | + if (is_numeric($donation_or_form_id) && 'give_payment' === get_post_type($donation_or_form_id)) { |
|
27 | + $donation_meta = give_get_meta($donation_or_form_id, '_give_payment_meta', true); |
|
28 | 28 | |
29 | - if ( ! empty( $donation_meta['currency'] ) ) { |
|
29 | + if ( ! empty($donation_meta['currency'])) { |
|
30 | 30 | $currency = $donation_meta['currency']; |
31 | 31 | } else { |
32 | - $currency = give_get_option( 'currency', 'USD' ); |
|
32 | + $currency = give_get_option('currency', 'USD'); |
|
33 | 33 | } |
34 | 34 | } else { |
35 | - $currency = give_get_option( 'currency', 'USD' ); |
|
35 | + $currency = give_get_option('currency', 'USD'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @since 1.0 |
42 | 42 | */ |
43 | - return apply_filters( 'give_currency', $currency, $donation_or_form_id, $args ); |
|
43 | + return apply_filters('give_currency', $currency, $donation_or_form_id, $args); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | */ |
53 | 53 | function give_get_currency_position() { |
54 | 54 | |
55 | - $currency_pos = give_get_option( 'currency_position', 'before' ); |
|
55 | + $currency_pos = give_get_option('currency_position', 'before'); |
|
56 | 56 | |
57 | - return apply_filters( 'give_currency_position', $currency_pos ); |
|
57 | + return apply_filters('give_currency_position', $currency_pos); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | function give_get_currencies_list() { |
68 | 68 | $currencies = array( |
69 | 69 | 'USD' => array( |
70 | - 'admin_label' => __( 'US Dollars ($)', 'give' ), |
|
70 | + 'admin_label' => __('US Dollars ($)', 'give'), |
|
71 | 71 | 'symbol' => '$', |
72 | 72 | 'setting' => array( |
73 | 73 | 'currency_position' => 'before', |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | ), |
78 | 78 | ), |
79 | 79 | 'EUR' => array( |
80 | - 'admin_label' => __( 'Euros (€)', 'give' ), |
|
80 | + 'admin_label' => __('Euros (€)', 'give'), |
|
81 | 81 | 'symbol' => '€', |
82 | 82 | 'setting' => array( |
83 | 83 | 'currency_position' => 'before', |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | ), |
88 | 88 | ), |
89 | 89 | 'GBP' => array( |
90 | - 'admin_label' => __( 'Pounds Sterling (£)', 'give' ), |
|
90 | + 'admin_label' => __('Pounds Sterling (£)', 'give'), |
|
91 | 91 | 'symbol' => '£', |
92 | 92 | 'setting' => array( |
93 | 93 | 'currency_position' => 'before', |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | ), |
98 | 98 | ), |
99 | 99 | 'AUD' => array( |
100 | - 'admin_label' => __( 'Australian Dollars ($)', 'give' ), |
|
100 | + 'admin_label' => __('Australian Dollars ($)', 'give'), |
|
101 | 101 | 'symbol' => '$', |
102 | 102 | 'setting' => array( |
103 | 103 | 'currency_position' => 'before', |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | ), |
108 | 108 | ), |
109 | 109 | 'BRL' => array( |
110 | - 'admin_label' => __( 'Brazilian Real (R$)', 'give' ), |
|
110 | + 'admin_label' => __('Brazilian Real (R$)', 'give'), |
|
111 | 111 | 'symbol' => 'R$', |
112 | 112 | 'setting' => array( |
113 | 113 | 'currency_position' => 'before', |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | ), |
118 | 118 | ), |
119 | 119 | 'CAD' => array( |
120 | - 'admin_label' => __( 'Canadian Dollars ($)', 'give' ), |
|
120 | + 'admin_label' => __('Canadian Dollars ($)', 'give'), |
|
121 | 121 | 'symbol' => '$', |
122 | 122 | 'setting' => array( |
123 | 123 | 'currency_position' => 'before', |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | ), |
128 | 128 | ), |
129 | 129 | 'CZK' => array( |
130 | - 'admin_label' => __( 'Czech Koruna (Kč)', 'give' ), |
|
130 | + 'admin_label' => __('Czech Koruna (Kč)', 'give'), |
|
131 | 131 | 'symbol' => 'Kč', |
132 | 132 | 'setting' => array( |
133 | 133 | 'currency_position' => 'after', |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | ), |
138 | 138 | ), |
139 | 139 | 'DKK' => array( |
140 | - 'admin_label' => __( 'Danish Krone (kr.)', 'give' ), |
|
140 | + 'admin_label' => __('Danish Krone (kr.)', 'give'), |
|
141 | 141 | 'symbol' => ' kr. ', |
142 | 142 | 'setting' => array( |
143 | 143 | 'currency_position' => 'before', |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | ), |
148 | 148 | ), |
149 | 149 | 'HKD' => array( |
150 | - 'admin_label' => __( 'Hong Kong Dollar ($)', 'give' ), |
|
150 | + 'admin_label' => __('Hong Kong Dollar ($)', 'give'), |
|
151 | 151 | 'symbol' => '$', |
152 | 152 | 'setting' => array( |
153 | 153 | 'currency_position' => 'before', |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | ), |
158 | 158 | ), |
159 | 159 | 'HUF' => array( |
160 | - 'admin_label' => __( 'Hungarian Forint (Ft)', 'give' ), |
|
160 | + 'admin_label' => __('Hungarian Forint (Ft)', 'give'), |
|
161 | 161 | 'symbol' => 'Ft', |
162 | 162 | 'setting' => array( |
163 | 163 | 'currency_position' => 'after', |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | ), |
168 | 168 | ), |
169 | 169 | 'ILS' => array( |
170 | - 'admin_label' => __( 'Israeli Shekel (₪)', 'give' ), |
|
170 | + 'admin_label' => __('Israeli Shekel (₪)', 'give'), |
|
171 | 171 | 'symbol' => '₪', |
172 | 172 | 'setting' => array( |
173 | 173 | 'currency_position' => 'after', |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | ), |
178 | 178 | ), |
179 | 179 | 'JPY' => array( |
180 | - 'admin_label' => __( 'Japanese Yen (¥)', 'give' ), |
|
180 | + 'admin_label' => __('Japanese Yen (¥)', 'give'), |
|
181 | 181 | 'symbol' => '¥', |
182 | 182 | 'setting' => array( |
183 | 183 | 'currency_position' => 'before', |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | ), |
188 | 188 | ), |
189 | 189 | 'MYR' => array( |
190 | - 'admin_label' => __( 'Malaysian Ringgits (RM)', 'give' ), |
|
190 | + 'admin_label' => __('Malaysian Ringgits (RM)', 'give'), |
|
191 | 191 | 'symbol' => 'RM', |
192 | 192 | 'setting' => array( |
193 | 193 | 'currency_position' => 'before', |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | ), |
198 | 198 | ), |
199 | 199 | 'MXN' => array( |
200 | - 'admin_label' => __( 'Mexican Peso ($)', 'give' ), |
|
200 | + 'admin_label' => __('Mexican Peso ($)', 'give'), |
|
201 | 201 | 'symbol' => '$', |
202 | 202 | 'setting' => array( |
203 | 203 | 'currency_position' => 'before', |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | ), |
208 | 208 | ), |
209 | 209 | 'MAD' => array( |
210 | - 'admin_label' => __( 'Moroccan Dirham (.د.م)', 'give' ), |
|
210 | + 'admin_label' => __('Moroccan Dirham (.د.م)', 'give'), |
|
211 | 211 | 'symbol' => '.د.م', |
212 | 212 | 'setting' => array( |
213 | 213 | 'currency_position' => 'before', |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | ), |
218 | 218 | ), |
219 | 219 | 'NZD' => array( |
220 | - 'admin_label' => __( 'New Zealand Dollar ($)', 'give' ), |
|
220 | + 'admin_label' => __('New Zealand Dollar ($)', 'give'), |
|
221 | 221 | 'symbol' => '$', |
222 | 222 | 'setting' => array( |
223 | 223 | 'currency_position' => 'before', |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | ), |
228 | 228 | ), |
229 | 229 | 'NOK' => array( |
230 | - 'admin_label' => __( 'Norwegian Krone (Kr.)', 'give' ), |
|
230 | + 'admin_label' => __('Norwegian Krone (Kr.)', 'give'), |
|
231 | 231 | 'symbol' => 'kr.', |
232 | 232 | 'setting' => array( |
233 | 233 | 'currency_position' => 'before', |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | ), |
238 | 238 | ), |
239 | 239 | 'PHP' => array( |
240 | - 'admin_label' => __( 'Philippine Pesos (₱)', 'give' ), |
|
240 | + 'admin_label' => __('Philippine Pesos (₱)', 'give'), |
|
241 | 241 | 'symbol' => '₱', |
242 | 242 | 'setting' => array( |
243 | 243 | 'currency_position' => 'before', |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | ), |
248 | 248 | ), |
249 | 249 | 'PLN' => array( |
250 | - 'admin_label' => __( 'Polish Zloty (zł)', 'give' ), |
|
250 | + 'admin_label' => __('Polish Zloty (zł)', 'give'), |
|
251 | 251 | 'symbol' => 'zł', |
252 | 252 | 'setting' => array( |
253 | 253 | 'currency_position' => 'after', |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | ), |
258 | 258 | ), |
259 | 259 | 'SGD' => array( |
260 | - 'admin_label' => __( 'Singapore Dollar ($)', 'give' ), |
|
260 | + 'admin_label' => __('Singapore Dollar ($)', 'give'), |
|
261 | 261 | 'symbol' => '$', |
262 | 262 | 'setting' => array( |
263 | 263 | 'currency_position' => 'before', |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | ), |
268 | 268 | ), |
269 | 269 | 'KRW' => array( |
270 | - 'admin_label' => __( 'South Korean Won (₩)', 'give' ), |
|
270 | + 'admin_label' => __('South Korean Won (₩)', 'give'), |
|
271 | 271 | 'symbol' => '₩', |
272 | 272 | 'setting' => array( |
273 | 273 | 'currency_position' => 'before', |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | ), |
278 | 278 | ), |
279 | 279 | 'ZAR' => array( |
280 | - 'admin_label' => __( 'South African Rand (R)', 'give' ), |
|
280 | + 'admin_label' => __('South African Rand (R)', 'give'), |
|
281 | 281 | 'symbol' => 'R', |
282 | 282 | 'setting' => array( |
283 | 283 | 'currency_position' => 'before', |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | ), |
288 | 288 | ), |
289 | 289 | 'SEK' => array( |
290 | - 'admin_label' => __( 'Swedish Krona (kr)', 'give' ), |
|
290 | + 'admin_label' => __('Swedish Krona (kr)', 'give'), |
|
291 | 291 | 'symbol' => ' kr. ', |
292 | 292 | 'setting' => array( |
293 | 293 | 'currency_position' => 'before', |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | ), |
298 | 298 | ), |
299 | 299 | 'CHF' => array( |
300 | - 'admin_label' => __( 'Swiss Franc (Fr)', 'give' ), |
|
300 | + 'admin_label' => __('Swiss Franc (Fr)', 'give'), |
|
301 | 301 | 'symbol' => 'Fr', |
302 | 302 | 'setting' => array( |
303 | 303 | 'currency_position' => 'before', |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | ), |
308 | 308 | ), |
309 | 309 | 'TWD' => array( |
310 | - 'admin_label' => __( 'Taiwan New Dollars (NT$)', 'give' ), |
|
310 | + 'admin_label' => __('Taiwan New Dollars (NT$)', 'give'), |
|
311 | 311 | 'symbol' => 'NT$', |
312 | 312 | 'setting' => array( |
313 | 313 | 'currency_position' => 'before', |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | ), |
318 | 318 | ), |
319 | 319 | 'THB' => array( |
320 | - 'admin_label' => __( 'Thai Baht (฿)', 'give' ), |
|
320 | + 'admin_label' => __('Thai Baht (฿)', 'give'), |
|
321 | 321 | 'symbol' => '฿', |
322 | 322 | 'setting' => array( |
323 | 323 | 'currency_position' => 'before', |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | ), |
328 | 328 | ), |
329 | 329 | 'INR' => array( |
330 | - 'admin_label' => __( 'Indian Rupee (₹)', 'give' ), |
|
330 | + 'admin_label' => __('Indian Rupee (₹)', 'give'), |
|
331 | 331 | 'symbol' => '₹', |
332 | 332 | 'setting' => array( |
333 | 333 | 'currency_position' => 'before', |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | ), |
338 | 338 | ), |
339 | 339 | 'TRY' => array( |
340 | - 'admin_label' => __( 'Turkish Lira (₺)', 'give' ), |
|
340 | + 'admin_label' => __('Turkish Lira (₺)', 'give'), |
|
341 | 341 | 'symbol' => '₺', |
342 | 342 | 'setting' => array( |
343 | 343 | 'currency_position' => 'after', |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | ), |
348 | 348 | ), |
349 | 349 | 'IRR' => array( |
350 | - 'admin_label' => __( 'Iranian Rial (﷼)', 'give' ), |
|
350 | + 'admin_label' => __('Iranian Rial (﷼)', 'give'), |
|
351 | 351 | 'symbol' => '﷼', |
352 | 352 | 'setting' => array( |
353 | 353 | 'currency_position' => 'after', |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | ), |
358 | 358 | ), |
359 | 359 | 'RUB' => array( |
360 | - 'admin_label' => __( 'Russian Rubles (руб)', 'give' ), |
|
360 | + 'admin_label' => __('Russian Rubles (руб)', 'give'), |
|
361 | 361 | 'symbol' => '₽', |
362 | 362 | 'setting' => array( |
363 | 363 | 'currency_position' => 'before', |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | ), |
368 | 368 | ), |
369 | 369 | 'AED' => array( |
370 | - 'admin_label' => __( 'United Arab Emirates dirham (د.إ)', 'give' ), |
|
370 | + 'admin_label' => __('United Arab Emirates dirham (د.إ)', 'give'), |
|
371 | 371 | 'symbol' => 'د.إ', |
372 | 372 | 'setting' => array( |
373 | 373 | 'currency_position' => 'before', |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | ), |
378 | 378 | ), |
379 | 379 | 'AMD' => array( |
380 | - 'admin_label' => __( 'Armenian dram (AMD)', 'give' ), |
|
380 | + 'admin_label' => __('Armenian dram (AMD)', 'give'), |
|
381 | 381 | 'symbol' => 'AMD', // Add backward compatibility. Using AMD in place of ֏ |
382 | 382 | 'setting' => array( |
383 | 383 | 'currency_position' => 'before', |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | ), |
388 | 388 | ), |
389 | 389 | 'ANG' => array( |
390 | - 'admin_label' => __( 'Netherlands Antillean guilder (ƒ)', 'give' ), |
|
390 | + 'admin_label' => __('Netherlands Antillean guilder (ƒ)', 'give'), |
|
391 | 391 | 'symbol' => 'ƒ', |
392 | 392 | 'setting' => array( |
393 | 393 | 'currency_position' => 'before', |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | ), |
398 | 398 | ), |
399 | 399 | 'ARS' => array( |
400 | - 'admin_label' => __( 'Argentine peso ($)', 'give' ), |
|
400 | + 'admin_label' => __('Argentine peso ($)', 'give'), |
|
401 | 401 | 'symbol' => '$', |
402 | 402 | 'setting' => array( |
403 | 403 | 'currency_position' => 'before', |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | ), |
408 | 408 | ), |
409 | 409 | 'AWG' => array( |
410 | - 'admin_label' => __( 'Aruban florin (ƒ)', 'give' ), |
|
410 | + 'admin_label' => __('Aruban florin (ƒ)', 'give'), |
|
411 | 411 | 'symbol' => 'ƒ', |
412 | 412 | 'setting' => array( |
413 | 413 | 'currency_position' => 'before', |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | ), |
418 | 418 | ), |
419 | 419 | 'BAM' => array( |
420 | - 'admin_label' => __( 'Bosnia and Herzegovina convertible mark (KM)', 'give' ), |
|
420 | + 'admin_label' => __('Bosnia and Herzegovina convertible mark (KM)', 'give'), |
|
421 | 421 | 'symbol' => 'KM', |
422 | 422 | 'setting' => array( |
423 | 423 | 'currency_position' => 'before', |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | ), |
428 | 428 | ), |
429 | 429 | 'BDT' => array( |
430 | - 'admin_label' => __( 'Bangladeshi taka (৳)', 'give' ), |
|
430 | + 'admin_label' => __('Bangladeshi taka (৳)', 'give'), |
|
431 | 431 | 'symbol' => '৳', |
432 | 432 | 'setting' => array( |
433 | 433 | 'currency_position' => 'before', |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | ), |
438 | 438 | ), |
439 | 439 | 'BHD' => array( |
440 | - 'admin_label' => __( 'Bahraini dinar (.د.ب)', 'give' ), |
|
440 | + 'admin_label' => __('Bahraini dinar (.د.ب)', 'give'), |
|
441 | 441 | 'symbol' => '.د.ب', |
442 | 442 | 'setting' => array( |
443 | 443 | 'currency_position' => 'before', |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | ), |
448 | 448 | ), |
449 | 449 | 'BMD' => array( |
450 | - 'admin_label' => __( 'Bermudian dollar (BD$)', 'give' ), |
|
450 | + 'admin_label' => __('Bermudian dollar (BD$)', 'give'), |
|
451 | 451 | 'symbol' => 'BD$', |
452 | 452 | 'setting' => array( |
453 | 453 | 'currency_position' => 'before', |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | ), |
458 | 458 | ), |
459 | 459 | 'BND' => array( |
460 | - 'admin_label' => __( 'Brunei dollar (B$)', 'give' ), |
|
460 | + 'admin_label' => __('Brunei dollar (B$)', 'give'), |
|
461 | 461 | 'symbol' => 'B$', |
462 | 462 | 'setting' => array( |
463 | 463 | 'currency_position' => 'before', |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | ), |
468 | 468 | ), |
469 | 469 | 'BOB' => array( |
470 | - 'admin_label' => __( 'Bolivian boliviano (Bs.)', 'give' ), |
|
470 | + 'admin_label' => __('Bolivian boliviano (Bs.)', 'give'), |
|
471 | 471 | 'symbol' => 'Bs.', |
472 | 472 | 'setting' => array( |
473 | 473 | 'currency_position' => 'before', |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | ), |
478 | 478 | ), |
479 | 479 | 'BSD' => array( |
480 | - 'admin_label' => __( 'Bahamian dollar (B$)', 'give' ), |
|
480 | + 'admin_label' => __('Bahamian dollar (B$)', 'give'), |
|
481 | 481 | 'symbol' => 'B$', |
482 | 482 | 'setting' => array( |
483 | 483 | 'currency_position' => 'before', |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | ), |
488 | 488 | ), |
489 | 489 | 'BWP' => array( |
490 | - 'admin_label' => __( 'Botswana pula (P)', 'give' ), |
|
490 | + 'admin_label' => __('Botswana pula (P)', 'give'), |
|
491 | 491 | 'symbol' => 'P', |
492 | 492 | 'setting' => array( |
493 | 493 | 'currency_position' => 'before', |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | ), |
498 | 498 | ), |
499 | 499 | 'BZD' => array( |
500 | - 'admin_label' => __( 'Belizean dollar (BZ$)', 'give' ), |
|
500 | + 'admin_label' => __('Belizean dollar (BZ$)', 'give'), |
|
501 | 501 | 'symbol' => 'BZ$', |
502 | 502 | 'setting' => array( |
503 | 503 | 'currency_position' => 'before', |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | ), |
508 | 508 | ), |
509 | 509 | 'CLP' => array( |
510 | - 'admin_label' => __( 'Chilean peso ($)', 'give' ), |
|
510 | + 'admin_label' => __('Chilean peso ($)', 'give'), |
|
511 | 511 | 'symbol' => '$', |
512 | 512 | 'setting' => array( |
513 | 513 | 'currency_position' => 'before', |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | ), |
518 | 518 | ), |
519 | 519 | 'CNY' => array( |
520 | - 'admin_label' => __( 'Chinese yuan (¥)', 'give' ), |
|
520 | + 'admin_label' => __('Chinese yuan (¥)', 'give'), |
|
521 | 521 | 'symbol' => '¥', |
522 | 522 | 'setting' => array( |
523 | 523 | 'currency_position' => 'before', |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | ), |
528 | 528 | ), |
529 | 529 | 'COP' => array( |
530 | - 'admin_label' => __( 'Colombian peso ($)', 'give' ), |
|
530 | + 'admin_label' => __('Colombian peso ($)', 'give'), |
|
531 | 531 | 'symbol' => '$', |
532 | 532 | 'setting' => array( |
533 | 533 | 'currency_position' => 'before', |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | ), |
538 | 538 | ), |
539 | 539 | 'CRC' => array( |
540 | - 'admin_label' => __( 'Costa Rican colón (₡)', 'give' ), |
|
540 | + 'admin_label' => __('Costa Rican colón (₡)', 'give'), |
|
541 | 541 | 'symbol' => '₡', |
542 | 542 | 'setting' => array( |
543 | 543 | 'currency_position' => 'before', |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | ), |
548 | 548 | ), |
549 | 549 | 'CUC' => array( |
550 | - 'admin_label' => __( 'Cuban convertible peso (₱)', 'give' ), |
|
550 | + 'admin_label' => __('Cuban convertible peso (₱)', 'give'), |
|
551 | 551 | 'symbol' => '₱', |
552 | 552 | 'setting' => array( |
553 | 553 | 'currency_position' => 'before', |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | ), |
558 | 558 | ), |
559 | 559 | 'CUP' => array( |
560 | - 'admin_label' => __( 'Cuban convertible peso (₱)', 'give' ), |
|
560 | + 'admin_label' => __('Cuban convertible peso (₱)', 'give'), |
|
561 | 561 | 'symbol' => '₱', |
562 | 562 | 'setting' => array( |
563 | 563 | 'currency_position' => 'before', |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | ), |
568 | 568 | ), |
569 | 569 | 'DOP' => array( |
570 | - 'admin_label' => __( 'Dominican peso (RD$)', 'give' ), |
|
570 | + 'admin_label' => __('Dominican peso (RD$)', 'give'), |
|
571 | 571 | 'symbol' => 'RD$', |
572 | 572 | 'setting' => array( |
573 | 573 | 'currency_position' => 'before', |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | ), |
578 | 578 | ), |
579 | 579 | 'EGP' => array( |
580 | - 'admin_label' => __( 'Egyptian pound (E£)', 'give' ), |
|
580 | + 'admin_label' => __('Egyptian pound (E£)', 'give'), |
|
581 | 581 | 'symbol' => 'E£', |
582 | 582 | 'setting' => array( |
583 | 583 | 'currency_position' => 'before', |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | ), |
588 | 588 | ), |
589 | 589 | 'GIP' => array( |
590 | - 'admin_label' => __( 'Gibraltar pound (£)', 'give' ), |
|
590 | + 'admin_label' => __('Gibraltar pound (£)', 'give'), |
|
591 | 591 | 'symbol' => '£', |
592 | 592 | 'setting' => array( |
593 | 593 | 'currency_position' => 'before', |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | ), |
598 | 598 | ), |
599 | 599 | 'GTQ' => array( |
600 | - 'admin_label' => __( 'Guatemalan quetzal (Q)', 'give' ), |
|
600 | + 'admin_label' => __('Guatemalan quetzal (Q)', 'give'), |
|
601 | 601 | 'symbol' => 'Q', |
602 | 602 | 'setting' => array( |
603 | 603 | 'currency_position' => 'before', |
@@ -607,7 +607,7 @@ discard block |
||
607 | 607 | ), |
608 | 608 | ), |
609 | 609 | 'HNL' => array( |
610 | - 'admin_label' => __( 'Honduran lempira (L)', 'give' ), |
|
610 | + 'admin_label' => __('Honduran lempira (L)', 'give'), |
|
611 | 611 | 'symbol' => 'L', |
612 | 612 | 'setting' => array( |
613 | 613 | 'currency_position' => 'before', |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | ), |
618 | 618 | ), |
619 | 619 | 'HRK' => array( |
620 | - 'admin_label' => __( 'Croatian kuna (kn)', 'give' ), |
|
620 | + 'admin_label' => __('Croatian kuna (kn)', 'give'), |
|
621 | 621 | 'symbol' => 'kn', |
622 | 622 | 'setting' => array( |
623 | 623 | 'currency_position' => 'after', |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | ), |
628 | 628 | ), |
629 | 629 | 'IDR' => array( |
630 | - 'admin_label' => __( 'Indonesian rupiah (Rp)', 'give' ), |
|
630 | + 'admin_label' => __('Indonesian rupiah (Rp)', 'give'), |
|
631 | 631 | 'symbol' => 'Rp', |
632 | 632 | 'setting' => array( |
633 | 633 | 'currency_position' => 'before', |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | ), |
638 | 638 | ), |
639 | 639 | 'ISK' => array( |
640 | - 'admin_label' => __( 'Icelandic króna (kr)', 'give' ), |
|
640 | + 'admin_label' => __('Icelandic króna (kr)', 'give'), |
|
641 | 641 | 'symbol' => 'kr', |
642 | 642 | 'setting' => array( |
643 | 643 | 'currency_position' => 'after', |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | ), |
648 | 648 | ), |
649 | 649 | 'JMD' => array( |
650 | - 'admin_label' => __( 'Jamaican dollar (J$)', 'give' ), |
|
650 | + 'admin_label' => __('Jamaican dollar (J$)', 'give'), |
|
651 | 651 | 'symbol' => 'j$', |
652 | 652 | 'setting' => array( |
653 | 653 | 'currency_position' => 'before', |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | ), |
658 | 658 | ), |
659 | 659 | 'JOD' => array( |
660 | - 'admin_label' => __( 'Jordanian dinar (د.ا)', 'give' ), |
|
660 | + 'admin_label' => __('Jordanian dinar (د.ا)', 'give'), |
|
661 | 661 | 'symbol' => 'د.ا', |
662 | 662 | 'setting' => array( |
663 | 663 | 'currency_position' => 'before', |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | ), |
668 | 668 | ), |
669 | 669 | 'KES' => array( |
670 | - 'admin_label' => __( 'Kenyan shilling (KSh)', 'give' ), |
|
670 | + 'admin_label' => __('Kenyan shilling (KSh)', 'give'), |
|
671 | 671 | 'symbol' => 'KSh', |
672 | 672 | 'setting' => array( |
673 | 673 | 'currency_position' => 'before', |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | ), |
678 | 678 | ), |
679 | 679 | 'KWD' => array( |
680 | - 'admin_label' => __( 'Kuwaiti dinar (د.ك)', 'give' ), |
|
680 | + 'admin_label' => __('Kuwaiti dinar (د.ك)', 'give'), |
|
681 | 681 | 'symbol' => 'د.ك', |
682 | 682 | 'setting' => array( |
683 | 683 | 'currency_position' => 'before', |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | ), |
688 | 688 | ), |
689 | 689 | 'KYD' => array( |
690 | - 'admin_label' => __( 'Cayman Islands dollar (KY$)', 'give' ), |
|
690 | + 'admin_label' => __('Cayman Islands dollar (KY$)', 'give'), |
|
691 | 691 | 'symbol' => 'KY$', |
692 | 692 | 'setting' => array( |
693 | 693 | 'currency_position' => 'before', |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | ), |
698 | 698 | ), |
699 | 699 | 'MKD' => array( |
700 | - 'admin_label' => __( 'Macedonian denar (ден)', 'give' ), |
|
700 | + 'admin_label' => __('Macedonian denar (ден)', 'give'), |
|
701 | 701 | 'symbol' => 'ден', |
702 | 702 | 'setting' => array( |
703 | 703 | 'currency_position' => 'before', |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | ), |
708 | 708 | ), |
709 | 709 | 'NPR' => array( |
710 | - 'admin_label' => __( 'Nepalese rupee (NɌs)', 'give' ), |
|
710 | + 'admin_label' => __('Nepalese rupee (NɌs)', 'give'), |
|
711 | 711 | 'symbol' => '₨', |
712 | 712 | 'setting' => array( |
713 | 713 | 'currency_position' => 'before', |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | ), |
718 | 718 | ), |
719 | 719 | 'OMR' => array( |
720 | - 'admin_label' => __( 'Omani rial (ر.ع.)', 'give' ), |
|
720 | + 'admin_label' => __('Omani rial (ر.ع.)', 'give'), |
|
721 | 721 | 'symbol' => 'ر.ع.', |
722 | 722 | 'setting' => array( |
723 | 723 | 'currency_position' => 'before', |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | ), |
728 | 728 | ), |
729 | 729 | 'PEN' => array( |
730 | - 'admin_label' => __( 'Peruvian nuevo sol (S/.)', 'give' ), |
|
730 | + 'admin_label' => __('Peruvian nuevo sol (S/.)', 'give'), |
|
731 | 731 | 'symbol' => 'S/.', |
732 | 732 | 'setting' => array( |
733 | 733 | 'currency_position' => 'before', |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | ), |
738 | 738 | ), |
739 | 739 | 'PKR' => array( |
740 | - 'admin_label' => __( 'Pakistani rupee (Ɍs)', 'give' ), |
|
740 | + 'admin_label' => __('Pakistani rupee (Ɍs)', 'give'), |
|
741 | 741 | 'symbol' => '₨', |
742 | 742 | 'setting' => array( |
743 | 743 | 'currency_position' => 'before', |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | ), |
748 | 748 | ), |
749 | 749 | 'RON' => array( |
750 | - 'admin_label' => __( 'Romanian leu (L)', 'give' ), |
|
750 | + 'admin_label' => __('Romanian leu (L)', 'give'), |
|
751 | 751 | 'symbol' => 'L', |
752 | 752 | 'setting' => array( |
753 | 753 | 'currency_position' => 'after', |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | ), |
758 | 758 | ), |
759 | 759 | 'SAR' => array( |
760 | - 'admin_label' => __( 'Saudi riyal (ر.س)', 'give' ), |
|
760 | + 'admin_label' => __('Saudi riyal (ر.س)', 'give'), |
|
761 | 761 | 'symbol' => 'ر.س', |
762 | 762 | 'setting' => array( |
763 | 763 | 'currency_position' => 'before', |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | ), |
768 | 768 | ), |
769 | 769 | 'SZL' => array( |
770 | - 'admin_label' => __( 'Swazi lilangeni (L)', 'give' ), |
|
770 | + 'admin_label' => __('Swazi lilangeni (L)', 'give'), |
|
771 | 771 | 'symbol' => 'L', |
772 | 772 | 'setting' => array( |
773 | 773 | 'currency_position' => 'before', |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | ), |
778 | 778 | ), |
779 | 779 | 'TOP' => array( |
780 | - 'admin_label' => __( 'Tongan paʻanga (T$)', 'give' ), |
|
780 | + 'admin_label' => __('Tongan paʻanga (T$)', 'give'), |
|
781 | 781 | 'symbol' => 'T$', |
782 | 782 | 'setting' => array( |
783 | 783 | 'currency_position' => 'before', |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | ), |
788 | 788 | ), |
789 | 789 | 'TZS' => array( |
790 | - 'admin_label' => __( 'Tanzanian shilling (TSh)', 'give' ), |
|
790 | + 'admin_label' => __('Tanzanian shilling (TSh)', 'give'), |
|
791 | 791 | 'symbol' => 'TSh', |
792 | 792 | 'setting' => array( |
793 | 793 | 'currency_position' => 'before', |
@@ -797,7 +797,7 @@ discard block |
||
797 | 797 | ), |
798 | 798 | ), |
799 | 799 | 'UAH' => array( |
800 | - 'admin_label' => __( 'Ukrainian hryvnia (₴)', 'give' ), |
|
800 | + 'admin_label' => __('Ukrainian hryvnia (₴)', 'give'), |
|
801 | 801 | 'symbol' => '₴', |
802 | 802 | 'setting' => array( |
803 | 803 | 'currency_position' => 'before', |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | ), |
808 | 808 | ), |
809 | 809 | 'UYU' => array( |
810 | - 'admin_label' => __( 'Uruguayan peso ($U)', 'give' ), |
|
810 | + 'admin_label' => __('Uruguayan peso ($U)', 'give'), |
|
811 | 811 | 'symbol' => '$U', |
812 | 812 | 'setting' => array( |
813 | 813 | 'currency_position' => 'before', |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | ), |
818 | 818 | ), |
819 | 819 | 'VEF' => array( |
820 | - 'admin_label' => __( 'Venezuelan bolívar (Bs)', 'give' ), |
|
820 | + 'admin_label' => __('Venezuelan bolívar (Bs)', 'give'), |
|
821 | 821 | 'symbol' => 'Bs', |
822 | 822 | 'setting' => array( |
823 | 823 | 'currency_position' => 'before', |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | ), |
828 | 828 | ), |
829 | 829 | 'XCD' => array( |
830 | - 'admin_label' => __( 'East Caribbean dollar (EC$)', 'give' ), |
|
830 | + 'admin_label' => __('East Caribbean dollar (EC$)', 'give'), |
|
831 | 831 | 'symbol' => 'EC$', |
832 | 832 | 'setting' => array( |
833 | 833 | 'currency_position' => 'before', |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | * |
853 | 853 | * @param array $currencies |
854 | 854 | */ |
855 | - return (array) apply_filters( 'give_currencies', $currencies ); |
|
855 | + return (array) apply_filters('give_currencies', $currencies); |
|
856 | 856 | } |
857 | 857 | |
858 | 858 | /** |
@@ -864,22 +864,22 @@ discard block |
||
864 | 864 | * |
865 | 865 | * @return array $currencies A list of the available currencies |
866 | 866 | */ |
867 | -function give_get_currencies( $info = 'admin_label' ) { |
|
867 | +function give_get_currencies($info = 'admin_label') { |
|
868 | 868 | |
869 | 869 | $currencies = give_get_currencies_list(); |
870 | 870 | |
871 | 871 | // Backward compatibility: handle old way of currency registration. |
872 | 872 | // Backward compatibility: Return desired result. |
873 | - if ( ! empty( $currencies ) ) { |
|
874 | - foreach ( $currencies as $currency_code => $currency_setting ) { |
|
875 | - if ( is_string( $currency_setting ) ) { |
|
876 | - $currencies[ $currency_code ] = array( |
|
873 | + if ( ! empty($currencies)) { |
|
874 | + foreach ($currencies as $currency_code => $currency_setting) { |
|
875 | + if (is_string($currency_setting)) { |
|
876 | + $currencies[$currency_code] = array( |
|
877 | 877 | 'admin_label' => $currency_setting, |
878 | 878 | ); |
879 | 879 | } |
880 | 880 | |
881 | - $currencies[ $currency_code ] = wp_parse_args( |
|
882 | - $currencies[ $currency_code ], |
|
881 | + $currencies[$currency_code] = wp_parse_args( |
|
882 | + $currencies[$currency_code], |
|
883 | 883 | array( |
884 | 884 | 'admin_label' => '', |
885 | 885 | 'symbol' => $currency_code, |
@@ -888,8 +888,8 @@ discard block |
||
888 | 888 | ); |
889 | 889 | } |
890 | 890 | |
891 | - if ( ! empty( $info ) && is_string( $info ) && 'all' !== $info ) { |
|
892 | - $currencies = wp_list_pluck( $currencies, $info ); |
|
891 | + if ( ! empty($info) && is_string($info) && 'all' !== $info) { |
|
892 | + $currencies = wp_list_pluck($currencies, $info); |
|
893 | 893 | } |
894 | 894 | } |
895 | 895 | |
@@ -906,12 +906,12 @@ discard block |
||
906 | 906 | * |
907 | 907 | * @return array |
908 | 908 | */ |
909 | -function give_currency_symbols( $decode_currencies = false ) { |
|
910 | - $currencies = give_get_currencies( 'symbol' ); |
|
909 | +function give_currency_symbols($decode_currencies = false) { |
|
910 | + $currencies = give_get_currencies('symbol'); |
|
911 | 911 | |
912 | - if ( $decode_currencies ) { |
|
913 | - array_walk( $currencies, function ( &$currency_symbol ) { |
|
914 | - $currency_symbol = html_entity_decode( $currency_symbol, ENT_COMPAT, 'UTF-8' ); |
|
912 | + if ($decode_currencies) { |
|
913 | + array_walk($currencies, function(&$currency_symbol) { |
|
914 | + $currency_symbol = html_entity_decode($currency_symbol, ENT_COMPAT, 'UTF-8'); |
|
915 | 915 | } ); |
916 | 916 | } |
917 | 917 | |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | * |
923 | 923 | * @param array $currencies |
924 | 924 | */ |
925 | - return apply_filters( 'give_currency_symbols', $currencies ); |
|
925 | + return apply_filters('give_currency_symbols', $currencies); |
|
926 | 926 | } |
927 | 927 | |
928 | 928 | |
@@ -939,14 +939,14 @@ discard block |
||
939 | 939 | * |
940 | 940 | * @return string The symbol to use for the currency |
941 | 941 | */ |
942 | -function give_currency_symbol( $currency = '', $decode_currency = false ) { |
|
942 | +function give_currency_symbol($currency = '', $decode_currency = false) { |
|
943 | 943 | |
944 | - if ( empty( $currency ) ) { |
|
944 | + if (empty($currency)) { |
|
945 | 945 | $currency = give_get_currency(); |
946 | 946 | } |
947 | 947 | |
948 | - $currencies = give_currency_symbols( $decode_currency ); |
|
949 | - $symbol = array_key_exists( $currency, $currencies ) ? $currencies[ $currency ] : $currency; |
|
948 | + $currencies = give_currency_symbols($decode_currency); |
|
949 | + $symbol = array_key_exists($currency, $currencies) ? $currencies[$currency] : $currency; |
|
950 | 950 | |
951 | 951 | /** |
952 | 952 | * Filter the currency symbol |
@@ -956,7 +956,7 @@ discard block |
||
956 | 956 | * @param string $symbol |
957 | 957 | * @param string $currency |
958 | 958 | */ |
959 | - return apply_filters( 'give_currency_symbol', $symbol, $currency ); |
|
959 | + return apply_filters('give_currency_symbol', $symbol, $currency); |
|
960 | 960 | } |
961 | 961 | |
962 | 962 | |
@@ -969,13 +969,13 @@ discard block |
||
969 | 969 | * |
970 | 970 | * @return string |
971 | 971 | */ |
972 | -function give_get_currency_name( $currency_code ) { |
|
972 | +function give_get_currency_name($currency_code) { |
|
973 | 973 | $currency_name = ''; |
974 | 974 | $currency_names = give_get_currencies(); |
975 | 975 | |
976 | - if ( $currency_code && array_key_exists( $currency_code, $currency_names ) ) { |
|
977 | - $currency_name = explode( '(', $currency_names[ $currency_code ] ); |
|
978 | - $currency_name = trim( current( $currency_name ) ); |
|
976 | + if ($currency_code && array_key_exists($currency_code, $currency_names)) { |
|
977 | + $currency_name = explode('(', $currency_names[$currency_code]); |
|
978 | + $currency_name = trim(current($currency_name)); |
|
979 | 979 | } |
980 | 980 | |
981 | 981 | /** |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | * @param string $currency_name |
987 | 987 | * @param string $currency_code |
988 | 988 | */ |
989 | - return apply_filters( 'give_currency_name', $currency_name, $currency_code ); |
|
989 | + return apply_filters('give_currency_name', $currency_name, $currency_code); |
|
990 | 990 | } |
991 | 991 | |
992 | 992 | /** |
@@ -999,20 +999,20 @@ discard block |
||
999 | 999 | * |
1000 | 1000 | * @return mixed|string |
1001 | 1001 | */ |
1002 | -function give_currency_filter( $price = '', $args = array() ) { |
|
1002 | +function give_currency_filter($price = '', $args = array()) { |
|
1003 | 1003 | |
1004 | 1004 | // Get functions arguments. |
1005 | 1005 | $func_args = func_get_args(); |
1006 | 1006 | |
1007 | 1007 | // Backward compatibility: modify second param to array |
1008 | - if ( isset( $func_args[1] ) && is_string( $func_args[1] ) ) { |
|
1008 | + if (isset($func_args[1]) && is_string($func_args[1])) { |
|
1009 | 1009 | $args = array( |
1010 | - 'currency_code' => isset( $func_args[1] ) ? $func_args[1] : '', |
|
1011 | - 'decode_currency' => isset( $func_args[2] ) ? $func_args[2] : false, |
|
1012 | - 'form_id' => isset( $func_args[3] ) ? $func_args[3] : '', |
|
1010 | + 'currency_code' => isset($func_args[1]) ? $func_args[1] : '', |
|
1011 | + 'decode_currency' => isset($func_args[2]) ? $func_args[2] : false, |
|
1012 | + 'form_id' => isset($func_args[3]) ? $func_args[3] : '', |
|
1013 | 1013 | ); |
1014 | 1014 | |
1015 | - give_doing_it_wrong( __FUNCTION__, 'Pass second argument as Array.', GIVE_VERSION ); |
|
1015 | + give_doing_it_wrong(__FUNCTION__, 'Pass second argument as Array.', GIVE_VERSION); |
|
1016 | 1016 | } |
1017 | 1017 | |
1018 | 1018 | // Set default values. |
@@ -1025,22 +1025,22 @@ discard block |
||
1025 | 1025 | ) |
1026 | 1026 | ); |
1027 | 1027 | |
1028 | - if ( empty( $args['currency_code'] ) || ! array_key_exists( (string) $args['currency_code'], give_get_currencies() ) ) { |
|
1029 | - $args['currency_code'] = give_get_currency( $args['form_id'] ); |
|
1028 | + if (empty($args['currency_code']) || ! array_key_exists((string) $args['currency_code'], give_get_currencies())) { |
|
1029 | + $args['currency_code'] = give_get_currency($args['form_id']); |
|
1030 | 1030 | } |
1031 | 1031 | |
1032 | - $args['position'] = give_get_option( 'currency_position', 'before' ); |
|
1032 | + $args['position'] = give_get_option('currency_position', 'before'); |
|
1033 | 1033 | |
1034 | 1034 | $negative = $price < 0; |
1035 | 1035 | |
1036 | - if ( $negative ) { |
|
1036 | + if ($negative) { |
|
1037 | 1037 | // Remove proceeding "-". |
1038 | - $price = substr( $price, 1 ); |
|
1038 | + $price = substr($price, 1); |
|
1039 | 1039 | } |
1040 | 1040 | |
1041 | - $args['symbol'] = give_currency_symbol( $args['currency_code'], $args['decode_currency'] ); |
|
1041 | + $args['symbol'] = give_currency_symbol($args['currency_code'], $args['decode_currency']); |
|
1042 | 1042 | |
1043 | - switch ( $args['currency_code'] ) : |
|
1043 | + switch ($args['currency_code']) : |
|
1044 | 1044 | case 'GBP' : |
1045 | 1045 | case 'BRL' : |
1046 | 1046 | case 'EUR' : |
@@ -1070,13 +1070,13 @@ discard block |
||
1070 | 1070 | case 'MAD' : |
1071 | 1071 | case 'KRW' : |
1072 | 1072 | case 'ZAR' : |
1073 | - $formatted = ( 'before' === $args['position'] ? $args['symbol'] . $price : $price . $args['symbol'] ); |
|
1073 | + $formatted = ('before' === $args['position'] ? $args['symbol'].$price : $price.$args['symbol']); |
|
1074 | 1074 | break; |
1075 | 1075 | case 'NOK': |
1076 | - $formatted = ( 'before' === $args['position'] ? $args['symbol'] . ' ' . $price : $price . ' ' . $args['symbol'] ); |
|
1076 | + $formatted = ('before' === $args['position'] ? $args['symbol'].' '.$price : $price.' '.$args['symbol']); |
|
1077 | 1077 | break; |
1078 | 1078 | default: |
1079 | - $formatted = ( 'before' === $args['position'] ? $args['symbol'] . ' ' . $price : $price . ' ' . $args['symbol'] ); |
|
1079 | + $formatted = ('before' === $args['position'] ? $args['symbol'].' '.$price : $price.' '.$args['symbol']); |
|
1080 | 1080 | break; |
1081 | 1081 | endswitch; |
1082 | 1082 | |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | * |
1086 | 1086 | * @since 1.8.17 |
1087 | 1087 | */ |
1088 | - $formatted = apply_filters( 'give_currency_filter', $formatted, $args, $price ); |
|
1088 | + $formatted = apply_filters('give_currency_filter', $formatted, $args, $price); |
|
1089 | 1089 | |
1090 | 1090 | /** |
1091 | 1091 | * Filter formatted amount with currency |
@@ -1099,16 +1099,16 @@ discard block |
||
1099 | 1099 | * filter name will be give_usd_currency_filter_after |
1100 | 1100 | */ |
1101 | 1101 | $formatted = apply_filters( |
1102 | - 'give_' . strtolower( $args['currency_code'] ) . "_currency_filter_{$args['position']}", |
|
1102 | + 'give_'.strtolower($args['currency_code'])."_currency_filter_{$args['position']}", |
|
1103 | 1103 | $formatted, |
1104 | 1104 | $args['currency_code'], |
1105 | 1105 | $price, |
1106 | 1106 | $args |
1107 | 1107 | ); |
1108 | 1108 | |
1109 | - if ( $negative ) { |
|
1109 | + if ($negative) { |
|
1110 | 1110 | // Prepend the minus sign before the currency sign. |
1111 | - $formatted = '-' . $formatted; |
|
1111 | + $formatted = '-'.$formatted; |
|
1112 | 1112 | } |
1113 | 1113 | |
1114 | 1114 | return $formatted; |
@@ -1125,7 +1125,7 @@ discard block |
||
1125 | 1125 | * |
1126 | 1126 | * @return bool |
1127 | 1127 | */ |
1128 | -function give_is_zero_based_currency( $currency = '' ) { |
|
1128 | +function give_is_zero_based_currency($currency = '') { |
|
1129 | 1129 | $zero_based_currency = array( |
1130 | 1130 | 'PYG', // Paraguayan Guarani. |
1131 | 1131 | 'GNF', // Guinean Franc. |
@@ -1145,12 +1145,12 @@ discard block |
||
1145 | 1145 | ); |
1146 | 1146 | |
1147 | 1147 | // Set default currency. |
1148 | - if ( empty( $currency ) ) { |
|
1148 | + if (empty($currency)) { |
|
1149 | 1149 | $currency = give_get_currency(); |
1150 | 1150 | } |
1151 | 1151 | |
1152 | 1152 | // Check for Zero Based Currency. |
1153 | - if ( in_array( $currency, $zero_based_currency ) ) { |
|
1153 | + if (in_array($currency, $zero_based_currency)) { |
|
1154 | 1154 | return true; |
1155 | 1155 | } |
1156 | 1156 | |
@@ -1165,7 +1165,7 @@ discard block |
||
1165 | 1165 | * |
1166 | 1166 | * @return bool |
1167 | 1167 | */ |
1168 | -function give_is_right_to_left_supported_currency( $currency = '' ) { |
|
1168 | +function give_is_right_to_left_supported_currency($currency = '') { |
|
1169 | 1169 | $zero_based_currency = apply_filters( |
1170 | 1170 | 'give_right_to_left_supported_currency', |
1171 | 1171 | array( |
@@ -1181,12 +1181,12 @@ discard block |
||
1181 | 1181 | ); |
1182 | 1182 | |
1183 | 1183 | // Set default currency. |
1184 | - if ( empty( $currency ) ) { |
|
1184 | + if (empty($currency)) { |
|
1185 | 1185 | $currency = give_get_currency(); |
1186 | 1186 | } |
1187 | 1187 | |
1188 | 1188 | // Check for Zero Based Currency. |
1189 | - if ( in_array( $currency, $zero_based_currency ) ) { |
|
1189 | + if (in_array($currency, $zero_based_currency)) { |
|
1190 | 1190 | return true; |
1191 | 1191 | } |
1192 | 1192 |
@@ -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 | |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return string $message Fully formatted message |
43 | 43 | */ |
44 | -function give_email_template_tags( $message, $payment_data, $payment_id, $admin_notice = false ) { |
|
45 | - return give_do_email_tags( $message, $payment_id ); |
|
44 | +function give_email_template_tags($message, $payment_data, $payment_id, $admin_notice = false) { |
|
45 | + return give_do_email_tags($message, $payment_id); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -56,45 +56,45 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @return string $message Fully formatted message |
58 | 58 | */ |
59 | -function give_email_preview_template_tags( $message ) { |
|
59 | +function give_email_preview_template_tags($message) { |
|
60 | 60 | |
61 | - $price = give_currency_filter( give_format_amount( 10.50, array( 'sanitize' => false ) ) ); |
|
61 | + $price = give_currency_filter(give_format_amount(10.50, array('sanitize' => false))); |
|
62 | 62 | |
63 | 63 | $gateway = 'PayPal'; |
64 | 64 | |
65 | - $receipt_id = strtolower( md5( uniqid() ) ); |
|
65 | + $receipt_id = strtolower(md5(uniqid())); |
|
66 | 66 | |
67 | - $payment_id = rand( 1, 100 ); |
|
68 | - $receipt_link_url = esc_url( add_query_arg( array( 'payment_key' => $receipt_id ), give_get_history_page_uri() ) ); |
|
67 | + $payment_id = rand(1, 100); |
|
68 | + $receipt_link_url = esc_url(add_query_arg(array('payment_key' => $receipt_id), give_get_history_page_uri())); |
|
69 | 69 | |
70 | 70 | $receipt_link = sprintf( |
71 | 71 | '<a href="%1$s">%2$s</a>', |
72 | 72 | $receipt_link_url, |
73 | - esc_html__( 'View the receipt in your browser »', 'give' ) |
|
73 | + esc_html__('View the receipt in your browser »', 'give') |
|
74 | 74 | ); |
75 | 75 | |
76 | 76 | // Set user. |
77 | 77 | $user = wp_get_current_user(); |
78 | 78 | |
79 | - $message = str_replace( '{name}', $user->display_name, $message ); |
|
80 | - $message = str_replace( '{fullname}', $user->display_name, $message ); |
|
81 | - $message = str_replace( '{username}', $user->user_login, $message ); |
|
82 | - $message = str_replace( '{user_email}', $user->user_email, $message ); |
|
83 | - $message = str_replace( '{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message ); |
|
84 | - $message = str_replace( '{date}', date( give_date_format(), current_time( 'timestamp' ) ), $message ); |
|
85 | - $message = str_replace( '{amount}', $price, $message ); |
|
86 | - $message = str_replace( '{price}', $price, $message ); |
|
87 | - $message = str_replace( '{donation}', esc_html__( 'Sample Donation Form Title', 'give' ), $message ); |
|
88 | - $message = str_replace( '{form_title}', esc_html__( 'Sample Donation Form Title - Sample Donation Level', 'give' ), $message ); |
|
89 | - $message = str_replace( '{receipt_id}', $receipt_id, $message ); |
|
90 | - $message = str_replace( '{payment_method}', $gateway, $message ); |
|
91 | - $message = str_replace( '{sitename}', get_bloginfo( 'name' ), $message ); |
|
92 | - $message = str_replace( '{payment_id}', $payment_id, $message ); |
|
93 | - $message = str_replace( '{receipt_link}', $receipt_link, $message ); |
|
94 | - $message = str_replace( '{receipt_link_url}', $receipt_link_url, $message ); |
|
95 | - $message = str_replace( '{pdf_receipt}', '<a href="#">Download Receipt</a>', $message ); |
|
96 | - |
|
97 | - return wpautop( apply_filters( 'give_email_preview_template_tags', $message ) ); |
|
79 | + $message = str_replace('{name}', $user->display_name, $message); |
|
80 | + $message = str_replace('{fullname}', $user->display_name, $message); |
|
81 | + $message = str_replace('{username}', $user->user_login, $message); |
|
82 | + $message = str_replace('{user_email}', $user->user_email, $message); |
|
83 | + $message = str_replace('{billing_address}', "123 Test Street, Unit 222\nSomewhere Town, CA, 92101", $message); |
|
84 | + $message = str_replace('{date}', date(give_date_format(), current_time('timestamp')), $message); |
|
85 | + $message = str_replace('{amount}', $price, $message); |
|
86 | + $message = str_replace('{price}', $price, $message); |
|
87 | + $message = str_replace('{donation}', esc_html__('Sample Donation Form Title', 'give'), $message); |
|
88 | + $message = str_replace('{form_title}', esc_html__('Sample Donation Form Title - Sample Donation Level', 'give'), $message); |
|
89 | + $message = str_replace('{receipt_id}', $receipt_id, $message); |
|
90 | + $message = str_replace('{payment_method}', $gateway, $message); |
|
91 | + $message = str_replace('{sitename}', get_bloginfo('name'), $message); |
|
92 | + $message = str_replace('{payment_id}', $payment_id, $message); |
|
93 | + $message = str_replace('{receipt_link}', $receipt_link, $message); |
|
94 | + $message = str_replace('{receipt_link_url}', $receipt_link_url, $message); |
|
95 | + $message = str_replace('{pdf_receipt}', '<a href="#">Download Receipt</a>', $message); |
|
96 | + |
|
97 | + return wpautop(apply_filters('give_email_preview_template_tags', $message)); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -106,23 +106,23 @@ discard block |
||
106 | 106 | * @since 1.0 |
107 | 107 | * @return array|bool |
108 | 108 | */ |
109 | -function give_email_template_preview( $array ) { |
|
109 | +function give_email_template_preview($array) { |
|
110 | 110 | |
111 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
111 | + if ( ! current_user_can('manage_give_settings')) { |
|
112 | 112 | return false; |
113 | 113 | } |
114 | 114 | $custom_field = array( |
115 | - 'name' => esc_html__( 'Preview Email', 'give' ), |
|
116 | - 'desc' => esc_html__( 'Click the buttons to preview or send test emails.', 'give' ), |
|
115 | + 'name' => esc_html__('Preview Email', 'give'), |
|
116 | + 'desc' => esc_html__('Click the buttons to preview or send test emails.', 'give'), |
|
117 | 117 | 'id' => 'give_email_preview_buttons', |
118 | 118 | 'type' => 'email_preview_buttons', |
119 | 119 | ); |
120 | 120 | |
121 | - return give_settings_array_insert( $array, 'donation_subject', array( $custom_field ) ); |
|
121 | + return give_settings_array_insert($array, 'donation_subject', array($custom_field)); |
|
122 | 122 | |
123 | 123 | } |
124 | 124 | |
125 | -add_filter( 'give_settings_emails', 'give_email_template_preview' ); |
|
125 | +add_filter('give_settings_emails', 'give_email_template_preview'); |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * Output Email Template Preview Buttons. |
@@ -134,14 +134,14 @@ discard block |
||
134 | 134 | function give_email_preview_buttons_callback() { |
135 | 135 | ob_start(); |
136 | 136 | ?> |
137 | - <a href="<?php echo esc_url( add_query_arg( array( 'give_action' => 'preview_email' ), home_url() ) ); ?>" class="button-secondary" |
|
138 | - target="_blank"><?php esc_html_e( 'Preview Donation Receipt', 'give' ); ?></a> |
|
139 | - <a href="<?php echo wp_nonce_url( add_query_arg( array( |
|
137 | + <a href="<?php echo esc_url(add_query_arg(array('give_action' => 'preview_email'), home_url())); ?>" class="button-secondary" |
|
138 | + target="_blank"><?php esc_html_e('Preview Donation Receipt', 'give'); ?></a> |
|
139 | + <a href="<?php echo wp_nonce_url(add_query_arg(array( |
|
140 | 140 | 'give_action' => 'send_test_email', |
141 | 141 | 'give-message' => 'sent-test-email', |
142 | 142 | 'tag' => 'emails', |
143 | - ) ), 'give-test-email' ); ?>" aria-label="<?php esc_attr_e( 'Send demo donation receipt to the emails listed below.', 'give' ); ?>" |
|
144 | - class="button-secondary"><?php esc_html_e( 'Send Test Email', 'give' ); ?></a> |
|
143 | + )), 'give-test-email'); ?>" aria-label="<?php esc_attr_e('Send demo donation receipt to the emails listed below.', 'give'); ?>" |
|
144 | + class="button-secondary"><?php esc_html_e('Send Test Email', 'give'); ?></a> |
|
145 | 145 | <?php |
146 | 146 | echo ob_get_clean(); |
147 | 147 | } |
@@ -154,46 +154,46 @@ discard block |
||
154 | 154 | */ |
155 | 155 | function give_display_email_template_preview() { |
156 | 156 | |
157 | - if ( empty( $_GET['give_action'] ) ) { |
|
157 | + if (empty($_GET['give_action'])) { |
|
158 | 158 | return; |
159 | 159 | } |
160 | 160 | |
161 | - if ( 'preview_email' !== $_GET['give_action'] ) { |
|
161 | + if ('preview_email' !== $_GET['give_action']) { |
|
162 | 162 | return; |
163 | 163 | } |
164 | 164 | |
165 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
165 | + if ( ! current_user_can('manage_give_settings')) { |
|
166 | 166 | return; |
167 | 167 | } |
168 | 168 | |
169 | 169 | |
170 | - Give()->emails->heading = esc_html__( 'Donation Receipt', 'give' ); |
|
170 | + Give()->emails->heading = esc_html__('Donation Receipt', 'give'); |
|
171 | 171 | |
172 | - $payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : ''; |
|
172 | + $payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : ''; |
|
173 | 173 | |
174 | 174 | echo give_get_preview_email_header(); |
175 | 175 | |
176 | 176 | //Are we previewing an actual payment? |
177 | - if ( ! empty( $payment_id ) ) { |
|
177 | + if ( ! empty($payment_id)) { |
|
178 | 178 | |
179 | - $content = give_get_email_body_content( $payment_id ); |
|
179 | + $content = give_get_email_body_content($payment_id); |
|
180 | 180 | |
181 | - $preview_content = give_do_email_tags( $content, $payment_id ); |
|
181 | + $preview_content = give_do_email_tags($content, $payment_id); |
|
182 | 182 | |
183 | 183 | } else { |
184 | 184 | |
185 | 185 | //No payment ID, use sample preview content |
186 | - $preview_content = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
186 | + $preview_content = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | |
190 | - echo Give()->emails->build_email( $preview_content ); |
|
190 | + echo Give()->emails->build_email($preview_content); |
|
191 | 191 | |
192 | 192 | exit; |
193 | 193 | |
194 | 194 | } |
195 | 195 | |
196 | -add_action( 'init', 'give_display_email_template_preview' ); |
|
196 | +add_action('init', 'give_display_email_template_preview'); |
|
197 | 197 | |
198 | 198 | /** |
199 | 199 | * Email Template Body. |
@@ -205,18 +205,18 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @return string $email_body Body of the email |
207 | 207 | */ |
208 | -function give_get_email_body_content( $payment_id = 0, $payment_data = array() ) { |
|
208 | +function give_get_email_body_content($payment_id = 0, $payment_data = array()) { |
|
209 | 209 | |
210 | 210 | $default_email_body = give_get_default_donation_receipt_email(); |
211 | 211 | |
212 | - $email_content = give_get_option( 'donation_receipt' ); |
|
213 | - $email_content = ( $email_content ) ? stripslashes( $email_content ) : $default_email_body; |
|
212 | + $email_content = give_get_option('donation_receipt'); |
|
213 | + $email_content = ($email_content) ? stripslashes($email_content) : $default_email_body; |
|
214 | 214 | |
215 | - $email_body = wpautop( $email_content ); |
|
215 | + $email_body = wpautop($email_content); |
|
216 | 216 | |
217 | - $email_body = apply_filters( 'give_donation_receipt_' . Give()->emails->get_template(), $email_body, $payment_id, $payment_data ); |
|
217 | + $email_body = apply_filters('give_donation_receipt_'.Give()->emails->get_template(), $email_body, $payment_id, $payment_data); |
|
218 | 218 | |
219 | - return apply_filters( 'give_donation_receipt', $email_body, $payment_id, $payment_data ); |
|
219 | + return apply_filters('give_donation_receipt', $email_body, $payment_id, $payment_data); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -229,35 +229,35 @@ discard block |
||
229 | 229 | * |
230 | 230 | * @return string $email_body Body of the email |
231 | 231 | */ |
232 | -function give_get_donation_notification_body_content( $payment_id = 0, $payment_data = array() ) { |
|
232 | +function give_get_donation_notification_body_content($payment_id = 0, $payment_data = array()) { |
|
233 | 233 | |
234 | - $payment = new Give_Payment( $payment_id ); |
|
234 | + $payment = new Give_Payment($payment_id); |
|
235 | 235 | |
236 | - if ( $payment->user_id > 0 ) { |
|
237 | - $user_data = get_userdata( $payment->user_id ); |
|
236 | + if ($payment->user_id > 0) { |
|
237 | + $user_data = get_userdata($payment->user_id); |
|
238 | 238 | $name = $user_data->display_name; |
239 | - } elseif ( ! empty( $payment->first_name ) && ! empty( $payment->last_name ) ) { |
|
240 | - $name = $payment->first_name . ' ' . $payment->last_name; |
|
239 | + } elseif ( ! empty($payment->first_name) && ! empty($payment->last_name)) { |
|
240 | + $name = $payment->first_name.' '.$payment->last_name; |
|
241 | 241 | } else { |
242 | 242 | $name = $payment->email; |
243 | 243 | } |
244 | 244 | |
245 | - $gateway = give_get_gateway_admin_label( $payment->gateway ); |
|
245 | + $gateway = give_get_gateway_admin_label($payment->gateway); |
|
246 | 246 | |
247 | - $default_email_body = esc_html__( 'Hello', 'give' ) . "\n\n"; |
|
248 | - $default_email_body .= esc_html__( 'A donation has been made.', 'give' ) . "\n\n"; |
|
249 | - $default_email_body .= esc_html__( 'Donation:', 'give' ) . "\n\n"; |
|
250 | - $default_email_body .= esc_html__( 'Donor:', 'give' ) . ' ' . html_entity_decode( $name, ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
251 | - $default_email_body .= esc_html__( 'Amount:', 'give' ) . ' ' . html_entity_decode( give_currency_filter( give_format_amount( $payment->total, array( 'sanitize' => false ) ) ), ENT_COMPAT, 'UTF-8' ) . "\n"; |
|
252 | - $default_email_body .= esc_html__( 'Payment Method:', 'give' ) . ' ' . $gateway . "\n\n"; |
|
253 | - $default_email_body .= esc_html__( 'Thank you', 'give' ); |
|
247 | + $default_email_body = esc_html__('Hello', 'give')."\n\n"; |
|
248 | + $default_email_body .= esc_html__('A donation has been made.', 'give')."\n\n"; |
|
249 | + $default_email_body .= esc_html__('Donation:', 'give')."\n\n"; |
|
250 | + $default_email_body .= esc_html__('Donor:', 'give').' '.html_entity_decode($name, ENT_COMPAT, 'UTF-8')."\n"; |
|
251 | + $default_email_body .= esc_html__('Amount:', 'give').' '.html_entity_decode(give_currency_filter(give_format_amount($payment->total, array('sanitize' => false))), ENT_COMPAT, 'UTF-8')."\n"; |
|
252 | + $default_email_body .= esc_html__('Payment Method:', 'give').' '.$gateway."\n\n"; |
|
253 | + $default_email_body .= esc_html__('Thank you', 'give'); |
|
254 | 254 | |
255 | - $message = give_get_option( 'donation_notification' ); |
|
256 | - $message = isset( $message ) ? stripslashes( $message ) : $default_email_body; |
|
255 | + $message = give_get_option('donation_notification'); |
|
256 | + $message = isset($message) ? stripslashes($message) : $default_email_body; |
|
257 | 257 | |
258 | - $email_body = give_do_email_tags( $message, $payment_id ); |
|
258 | + $email_body = give_do_email_tags($message, $payment_id); |
|
259 | 259 | |
260 | - return apply_filters( 'give_donation_notification', wpautop( $email_body ), $payment_id, $payment_data ); |
|
260 | + return apply_filters('give_donation_notification', wpautop($email_body), $payment_id, $payment_data); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -272,29 +272,29 @@ discard block |
||
272 | 272 | |
273 | 273 | //Payment receipt switcher |
274 | 274 | $payment_count = give_count_payments()->publish; |
275 | - $payment_id = (int) isset( $_GET['preview_id'] ) ? $_GET['preview_id'] : ''; |
|
275 | + $payment_id = (int) isset($_GET['preview_id']) ? $_GET['preview_id'] : ''; |
|
276 | 276 | |
277 | - if ( $payment_count <= 0 ) { |
|
277 | + if ($payment_count <= 0) { |
|
278 | 278 | return false; |
279 | 279 | } |
280 | 280 | |
281 | 281 | //Get payments. |
282 | - $payments = new Give_Payments_Query( array( |
|
282 | + $payments = new Give_Payments_Query(array( |
|
283 | 283 | 'number' => 100, |
284 | - ) ); |
|
284 | + )); |
|
285 | 285 | $payments = $payments->get_payments(); |
286 | 286 | $options = array(); |
287 | 287 | |
288 | 288 | //Provide nice human readable options. |
289 | - if ( $payments ) { |
|
290 | - $options[0] = esc_html__( '- Select a donation -', 'give' ); |
|
291 | - foreach ( $payments as $payment ) { |
|
289 | + if ($payments) { |
|
290 | + $options[0] = esc_html__('- Select a donation -', 'give'); |
|
291 | + foreach ($payments as $payment) { |
|
292 | 292 | |
293 | - $options[ $payment->ID ] = esc_html( '#' . $payment->ID . ' - ' . $payment->email . ' - ' . $payment->form_title ); |
|
293 | + $options[$payment->ID] = esc_html('#'.$payment->ID.' - '.$payment->email.' - '.$payment->form_title); |
|
294 | 294 | |
295 | 295 | } |
296 | 296 | } else { |
297 | - $options[0] = esc_html__( 'No donations found.', 'give' ); |
|
297 | + $options[0] = esc_html__('No donations found.', 'give'); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | //Start constructing HTML output. |
@@ -307,16 +307,16 @@ discard block |
||
307 | 307 | var selected_trans = transactions.options[transactions.selectedIndex]; |
308 | 308 | console.log(selected_trans); |
309 | 309 | if (selected_trans){ |
310 | - var url_string = "' . get_bloginfo( 'url' ) . '?give_action=preview_email&preview_id=" + selected_trans.value; |
|
310 | + var url_string = "' . get_bloginfo('url').'?give_action=preview_email&preview_id=" + selected_trans.value; |
|
311 | 311 | window.location = url_string; |
312 | 312 | } |
313 | 313 | } |
314 | 314 | </script>'; |
315 | 315 | |
316 | - $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">' . esc_html__( 'Preview email with a donation:', 'give' ) . '</label>'; |
|
316 | + $transaction_header .= '<label for="give_preview_email_payment_id" style="font-size:12px;color:#333;margin:0 4px 0 0;">'.esc_html__('Preview email with a donation:', 'give').'</label>'; |
|
317 | 317 | |
318 | 318 | //The select field with 100 latest transactions |
319 | - $transaction_header .= Give()->html->select( array( |
|
319 | + $transaction_header .= Give()->html->select(array( |
|
320 | 320 | 'name' => 'preview_email_payment_id', |
321 | 321 | 'selected' => $payment_id, |
322 | 322 | 'id' => 'give_preview_email_payment_id', |
@@ -326,11 +326,11 @@ discard block |
||
326 | 326 | 'select_atts' => 'onchange="change_preview()">', |
327 | 327 | 'show_option_all' => false, |
328 | 328 | 'show_option_none' => false, |
329 | - ) ); |
|
329 | + )); |
|
330 | 330 | |
331 | 331 | //Closing tag |
332 | 332 | $transaction_header .= '</div>'; |
333 | 333 | |
334 | - return apply_filters( 'give_preview_email_receipt_header', $transaction_header ); |
|
334 | + return apply_filters('give_preview_email_receipt_header', $transaction_header); |
|
335 | 335 | |
336 | 336 | } |
337 | 337 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -87,12 +87,12 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function __construct() { |
89 | 89 | |
90 | - if ( 'none' === $this->get_template() ) { |
|
90 | + if ('none' === $this->get_template()) { |
|
91 | 91 | $this->html = false; |
92 | 92 | } |
93 | 93 | |
94 | - add_action( 'give_email_send_before', array( $this, 'send_before' ) ); |
|
95 | - add_action( 'give_email_send_after', array( $this, 'send_after' ) ); |
|
94 | + add_action('give_email_send_before', array($this, 'send_before')); |
|
95 | + add_action('give_email_send_after', array($this, 'send_after')); |
|
96 | 96 | |
97 | 97 | } |
98 | 98 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @param $key |
105 | 105 | * @param $value |
106 | 106 | */ |
107 | - public function __set( $key, $value ) { |
|
107 | + public function __set($key, $value) { |
|
108 | 108 | $this->$key = $value; |
109 | 109 | } |
110 | 110 | |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | * @since 1.0 |
115 | 115 | */ |
116 | 116 | public function get_from_name() { |
117 | - if ( ! $this->from_name ) { |
|
118 | - $this->from_name = give_get_option( 'from_name', get_bloginfo( 'name' ) ); |
|
117 | + if ( ! $this->from_name) { |
|
118 | + $this->from_name = give_get_option('from_name', get_bloginfo('name')); |
|
119 | 119 | } |
120 | 120 | |
121 | - return apply_filters( 'give_email_from_name', wp_specialchars_decode( $this->from_name ), $this ); |
|
121 | + return apply_filters('give_email_from_name', wp_specialchars_decode($this->from_name), $this); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -127,11 +127,11 @@ discard block |
||
127 | 127 | * @since 1.0 |
128 | 128 | */ |
129 | 129 | public function get_from_address() { |
130 | - if ( ! $this->from_address ) { |
|
131 | - $this->from_address = give_get_option( 'from_email', get_option( 'admin_email' ) ); |
|
130 | + if ( ! $this->from_address) { |
|
131 | + $this->from_address = give_get_option('from_email', get_option('admin_email')); |
|
132 | 132 | } |
133 | 133 | |
134 | - return apply_filters( 'give_email_from_address', $this->from_address, $this ); |
|
134 | + return apply_filters('give_email_from_address', $this->from_address, $this); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
@@ -140,13 +140,13 @@ discard block |
||
140 | 140 | * @since 1.0 |
141 | 141 | */ |
142 | 142 | public function get_content_type() { |
143 | - if ( ! $this->content_type && $this->html ) { |
|
144 | - $this->content_type = apply_filters( 'give_email_default_content_type', 'text/html', $this ); |
|
145 | - } else if ( ! $this->html ) { |
|
143 | + if ( ! $this->content_type && $this->html) { |
|
144 | + $this->content_type = apply_filters('give_email_default_content_type', 'text/html', $this); |
|
145 | + } else if ( ! $this->html) { |
|
146 | 146 | $this->content_type = 'text/plain'; |
147 | 147 | } |
148 | 148 | |
149 | - return apply_filters( 'give_email_content_type', $this->content_type, $this ); |
|
149 | + return apply_filters('give_email_content_type', $this->content_type, $this); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | /** |
@@ -155,13 +155,13 @@ discard block |
||
155 | 155 | * @since 1.0 |
156 | 156 | */ |
157 | 157 | public function get_headers() { |
158 | - if ( ! $this->headers ) { |
|
158 | + if ( ! $this->headers) { |
|
159 | 159 | $this->headers = "From: {$this->get_from_name()} <{$this->get_from_address()}>\r\n"; |
160 | 160 | $this->headers .= "Reply-To: {$this->get_from_address()}\r\n"; |
161 | 161 | $this->headers .= "Content-Type: {$this->get_content_type()}; charset=utf-8\r\n"; |
162 | 162 | } |
163 | 163 | |
164 | - return apply_filters( 'give_email_headers', $this->headers, $this ); |
|
164 | + return apply_filters('give_email_headers', $this->headers, $this); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
@@ -171,11 +171,11 @@ discard block |
||
171 | 171 | */ |
172 | 172 | public function get_templates() { |
173 | 173 | $templates = array( |
174 | - 'default' => esc_html__( 'Default Template', 'give' ), |
|
175 | - 'none' => esc_html__( 'No template, plain text only', 'give' ) |
|
174 | + 'default' => esc_html__('Default Template', 'give'), |
|
175 | + 'none' => esc_html__('No template, plain text only', 'give') |
|
176 | 176 | ); |
177 | 177 | |
178 | - return apply_filters( 'give_email_templates', $templates ); |
|
178 | + return apply_filters('give_email_templates', $templates); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | * @since 1.0 |
185 | 185 | */ |
186 | 186 | public function get_template() { |
187 | - if ( ! $this->template ) { |
|
188 | - $this->template = give_get_option( 'email_template', 'default' ); |
|
187 | + if ( ! $this->template) { |
|
188 | + $this->template = give_get_option('email_template', 'default'); |
|
189 | 189 | } |
190 | 190 | |
191 | - return apply_filters( 'give_email_template', $this->template ); |
|
191 | + return apply_filters('give_email_template', $this->template); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @since 1.0 |
198 | 198 | */ |
199 | 199 | public function get_heading() { |
200 | - return apply_filters( 'give_email_heading', $this->heading ); |
|
200 | + return apply_filters('give_email_heading', $this->heading); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @return mixed |
209 | 209 | */ |
210 | - public function parse_tags( $content ) { |
|
210 | + public function parse_tags($content) { |
|
211 | 211 | return $content; |
212 | 212 | } |
213 | 213 | |
@@ -220,33 +220,33 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @return string |
222 | 222 | */ |
223 | - public function build_email( $message ) { |
|
223 | + public function build_email($message) { |
|
224 | 224 | |
225 | - if ( false === $this->html ) { |
|
225 | + if (false === $this->html) { |
|
226 | 226 | |
227 | 227 | // Added Replacement check to simply behaviour of anchor tags. |
228 | 228 | $pattern = '/<a.+?href\=(?:["|\'])(.+?)(?:["|\']).*?>(.+?)<\/a>/i'; |
229 | 229 | $message = preg_replace_callback( |
230 | 230 | $pattern, |
231 | - function( $return ) { |
|
232 | - if ( $return[1] !== $return[2] ) { |
|
231 | + function($return) { |
|
232 | + if ($return[1] !== $return[2]) { |
|
233 | 233 | return "{$return[2]} ( {$return[1]} )"; |
234 | 234 | } |
235 | - return trailingslashit( $return[1] ); |
|
235 | + return trailingslashit($return[1]); |
|
236 | 236 | }, |
237 | 237 | $message |
238 | 238 | ); |
239 | 239 | |
240 | - return apply_filters( 'give_email_message', wp_strip_all_tags( $message ), $this ); |
|
240 | + return apply_filters('give_email_message', wp_strip_all_tags($message), $this); |
|
241 | 241 | } |
242 | 242 | |
243 | - $message = $this->text_to_html( $message ); |
|
243 | + $message = $this->text_to_html($message); |
|
244 | 244 | |
245 | 245 | $template = $this->get_template(); |
246 | 246 | |
247 | 247 | ob_start(); |
248 | 248 | |
249 | - give_get_template_part( 'emails/header', $template, true ); |
|
249 | + give_get_template_part('emails/header', $template, true); |
|
250 | 250 | |
251 | 251 | /** |
252 | 252 | * Fires in the email head. |
@@ -255,17 +255,17 @@ discard block |
||
255 | 255 | * |
256 | 256 | * @param Give_Emails $this The email object. |
257 | 257 | */ |
258 | - do_action( 'give_email_header', $this ); |
|
258 | + do_action('give_email_header', $this); |
|
259 | 259 | |
260 | - if ( has_action( 'give_email_template_' . $template ) ) { |
|
260 | + if (has_action('give_email_template_'.$template)) { |
|
261 | 261 | /** |
262 | 262 | * Fires in a specific email template. |
263 | 263 | * |
264 | 264 | * @since 1.0 |
265 | 265 | */ |
266 | - do_action( "give_email_template_{$template}" ); |
|
266 | + do_action("give_email_template_{$template}"); |
|
267 | 267 | } else { |
268 | - give_get_template_part( 'emails/body', $template, true ); |
|
268 | + give_get_template_part('emails/body', $template, true); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | /** |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | * |
276 | 276 | * @param Give_Emails $this The email object. |
277 | 277 | */ |
278 | - do_action( 'give_email_body', $this ); |
|
278 | + do_action('give_email_body', $this); |
|
279 | 279 | |
280 | - give_get_template_part( 'emails/footer', $template, true ); |
|
280 | + give_get_template_part('emails/footer', $template, true); |
|
281 | 281 | |
282 | 282 | /** |
283 | 283 | * Fires in the email footer. |
@@ -286,12 +286,12 @@ discard block |
||
286 | 286 | * |
287 | 287 | * @param Give_Emails $this The email object. |
288 | 288 | */ |
289 | - do_action( 'give_email_footer', $this ); |
|
289 | + do_action('give_email_footer', $this); |
|
290 | 290 | |
291 | 291 | $body = ob_get_clean(); |
292 | - $message = str_replace( '{email}', $message, $body ); |
|
292 | + $message = str_replace('{email}', $message, $body); |
|
293 | 293 | |
294 | - return apply_filters( 'give_email_message', $message, $this ); |
|
294 | + return apply_filters('give_email_message', $message, $this); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
@@ -304,10 +304,10 @@ discard block |
||
304 | 304 | * |
305 | 305 | * @return bool |
306 | 306 | */ |
307 | - public function send( $to, $subject, $message, $attachments = '' ) { |
|
307 | + public function send($to, $subject, $message, $attachments = '') { |
|
308 | 308 | |
309 | - if ( ! did_action( 'init' ) && ! did_action( 'admin_init' ) ) { |
|
310 | - give_doing_it_wrong( __FUNCTION__, esc_html__( 'You cannot send email with Give_Emails until init/admin_init has been reached.', 'give' ), null ); |
|
309 | + if ( ! did_action('init') && ! did_action('admin_init')) { |
|
310 | + give_doing_it_wrong(__FUNCTION__, esc_html__('You cannot send email with Give_Emails until init/admin_init has been reached.', 'give'), null); |
|
311 | 311 | |
312 | 312 | return false; |
313 | 313 | } |
@@ -319,16 +319,16 @@ discard block |
||
319 | 319 | * |
320 | 320 | * @param Give_Emails $this The email object. |
321 | 321 | */ |
322 | - do_action( 'give_email_send_before', $this ); |
|
322 | + do_action('give_email_send_before', $this); |
|
323 | 323 | |
324 | - $subject = $this->parse_tags( $subject ); |
|
325 | - $message = $this->parse_tags( $message ); |
|
324 | + $subject = $this->parse_tags($subject); |
|
325 | + $message = $this->parse_tags($message); |
|
326 | 326 | |
327 | - $message = $this->build_email( $message ); |
|
327 | + $message = $this->build_email($message); |
|
328 | 328 | |
329 | - $attachments = apply_filters( 'give_email_attachments', $attachments, $this ); |
|
329 | + $attachments = apply_filters('give_email_attachments', $attachments, $this); |
|
330 | 330 | |
331 | - $sent = wp_mail( $to, $subject, $message, $this->get_headers(), $attachments ); |
|
331 | + $sent = wp_mail($to, $subject, $message, $this->get_headers(), $attachments); |
|
332 | 332 | |
333 | 333 | /** |
334 | 334 | * Fires after sending an email. |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | * |
338 | 338 | * @param Give_Emails $this The email object. |
339 | 339 | */ |
340 | - do_action( 'give_email_send_after', $this ); |
|
340 | + do_action('give_email_send_after', $this); |
|
341 | 341 | |
342 | 342 | return $sent; |
343 | 343 | |
@@ -349,9 +349,9 @@ discard block |
||
349 | 349 | * @since 1.0 |
350 | 350 | */ |
351 | 351 | public function send_before() { |
352 | - add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
|
353 | - add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
|
354 | - add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
|
352 | + add_filter('wp_mail_from', array($this, 'get_from_address')); |
|
353 | + add_filter('wp_mail_from_name', array($this, 'get_from_name')); |
|
354 | + add_filter('wp_mail_content_type', array($this, 'get_content_type')); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | /** |
@@ -360,9 +360,9 @@ discard block |
||
360 | 360 | * @since 1.0 |
361 | 361 | */ |
362 | 362 | public function send_after() { |
363 | - remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) ); |
|
364 | - remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) ); |
|
365 | - remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) ); |
|
363 | + remove_filter('wp_mail_from', array($this, 'get_from_address')); |
|
364 | + remove_filter('wp_mail_from_name', array($this, 'get_from_name')); |
|
365 | + remove_filter('wp_mail_content_type', array($this, 'get_content_type')); |
|
366 | 366 | |
367 | 367 | // Reset heading to an empty string |
368 | 368 | $this->heading = ''; |
@@ -373,10 +373,10 @@ discard block |
||
373 | 373 | * |
374 | 374 | * @since 1.0 |
375 | 375 | */ |
376 | - public function text_to_html( $message ) { |
|
376 | + public function text_to_html($message) { |
|
377 | 377 | |
378 | - if ( 'text/html' == $this->content_type || true === $this->html ) { |
|
379 | - $message = wpautop( $message ); |
|
378 | + if ('text/html' == $this->content_type || true === $this->html) { |
|
379 | + $message = wpautop($message); |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | return $message; |
@@ -6,25 +6,25 @@ discard block |
||
6 | 6 | global $give_receipt_args, $payment; |
7 | 7 | |
8 | 8 | // Validation: Ensure $payment var is set. |
9 | -if ( empty( $payment ) ) { |
|
10 | - $payment = ! empty( $give_receipt_args['id'] ) ? get_post( $give_receipt_args['id'] ) : 0; |
|
9 | +if (empty($payment)) { |
|
10 | + $payment = ! empty($give_receipt_args['id']) ? get_post($give_receipt_args['id']) : 0; |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | // Double-Validation: Check for $payment global. |
14 | -if ( empty( $payment ) ) { |
|
15 | - Give()->notices->print_frontend_notice( __( 'The specified receipt ID appears to be invalid.', 'give' ) ); |
|
14 | +if (empty($payment)) { |
|
15 | + Give()->notices->print_frontend_notice(__('The specified receipt ID appears to be invalid.', 'give')); |
|
16 | 16 | |
17 | 17 | return; |
18 | 18 | } |
19 | 19 | |
20 | 20 | $donation_id = $payment->ID; |
21 | -$form_id = give_get_payment_meta( $donation_id, '_give_payment_form_id', true ); |
|
22 | -$meta = give_get_payment_meta( $donation_id ); |
|
23 | -$donation = give_get_payment_form_title( $meta ); |
|
24 | -$user = give_get_payment_meta_user_info( $donation_id ); |
|
25 | -$email = give_get_payment_user_email( $donation_id ); |
|
21 | +$form_id = give_get_payment_meta($donation_id, '_give_payment_form_id', true); |
|
22 | +$meta = give_get_payment_meta($donation_id); |
|
23 | +$donation = give_get_payment_form_title($meta); |
|
24 | +$user = give_get_payment_meta_user_info($donation_id); |
|
25 | +$email = give_get_payment_user_email($donation_id); |
|
26 | 26 | $status = $payment->post_status; |
27 | -$status_label = give_get_payment_status( $payment, true ); |
|
27 | +$status_label = give_get_payment_status($payment, true); |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Generate Donation Receipt Arguments. |
@@ -35,50 +35,50 @@ discard block |
||
35 | 35 | * @since 1.8.8 |
36 | 36 | */ |
37 | 37 | $give_receipt_args['donation_receipt']['donor'] = array( |
38 | - 'name' => __( 'Donor', 'give' ), |
|
39 | - 'value' => $user['first_name'] . ' ' . $user['last_name'], |
|
38 | + 'name' => __('Donor', 'give'), |
|
39 | + 'value' => $user['first_name'].' '.$user['last_name'], |
|
40 | 40 | 'display' => $give_receipt_args['donor'], |
41 | 41 | ); |
42 | 42 | |
43 | 43 | $give_receipt_args['donation_receipt']['date'] = array( |
44 | - 'name' => __( 'Date', 'give' ), |
|
45 | - 'value' => date_i18n( give_date_format(), strtotime( $meta['date'] ) ), |
|
44 | + 'name' => __('Date', 'give'), |
|
45 | + 'value' => date_i18n(give_date_format(), strtotime($meta['date'])), |
|
46 | 46 | 'display' => $give_receipt_args['date'], |
47 | 47 | ); |
48 | 48 | |
49 | 49 | $give_receipt_args['donation_receipt']['total_donation'] = array( |
50 | - 'name' => __( 'Total Donation', 'give' ), |
|
51 | - 'value' => give_donation_amount( $donation_id, array( 'currency' => true, 'amount' => true, 'type' => 'receipt' ) ), |
|
50 | + 'name' => __('Total Donation', 'give'), |
|
51 | + 'value' => give_donation_amount($donation_id, array('currency' => true, 'amount' => true, 'type' => 'receipt')), |
|
52 | 52 | 'display' => $give_receipt_args['price'], |
53 | 53 | ); |
54 | 54 | |
55 | 55 | $give_receipt_args['donation_receipt']['donation'] = array( |
56 | - 'name' => __( 'Donation', 'give' ), |
|
56 | + 'name' => __('Donation', 'give'), |
|
57 | 57 | 'value' => $donation, |
58 | 58 | 'display' => true, |
59 | 59 | ); |
60 | 60 | |
61 | 61 | $give_receipt_args['donation_receipt']['donation_status'] = array( |
62 | - 'name' => __( 'Donation Status', 'give' ), |
|
63 | - 'value' => esc_attr( $status_label ), |
|
62 | + 'name' => __('Donation Status', 'give'), |
|
63 | + 'value' => esc_attr($status_label), |
|
64 | 64 | 'display' => $give_receipt_args['payment_status'], |
65 | 65 | ); |
66 | 66 | |
67 | 67 | $give_receipt_args['donation_receipt']['donation_id'] = array( |
68 | - 'name' => __( 'Donation ID', 'give' ), |
|
68 | + 'name' => __('Donation ID', 'give'), |
|
69 | 69 | 'value' => $donation_id, |
70 | 70 | 'display' => $give_receipt_args['payment_id'], |
71 | 71 | ); |
72 | 72 | |
73 | 73 | $give_receipt_args['donation_receipt']['payment_key'] = array( |
74 | - 'name' => __( 'Payment Key', 'give' ), |
|
75 | - 'value' => get_post_meta( $donation_id, '_give_payment_purchase_key', true ), |
|
74 | + 'name' => __('Payment Key', 'give'), |
|
75 | + 'value' => get_post_meta($donation_id, '_give_payment_purchase_key', true), |
|
76 | 76 | 'display' => $give_receipt_args['payment_key'], |
77 | 77 | ); |
78 | 78 | |
79 | 79 | $give_receipt_args['donation_receipt']['payment_method'] = array( |
80 | - 'name' => __( 'Payment Method', 'give' ), |
|
81 | - 'value' => give_get_gateway_checkout_label( give_get_payment_gateway( $donation_id ) ), |
|
80 | + 'name' => __('Payment Method', 'give'), |
|
81 | + 'value' => give_get_gateway_checkout_label(give_get_payment_gateway($donation_id)), |
|
82 | 82 | 'display' => $give_receipt_args['payment_method'], |
83 | 83 | ); |
84 | 84 | |
@@ -93,10 +93,10 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @since 1.8.8 |
95 | 95 | */ |
96 | -$give_receipt_args['donation_receipt'] = apply_filters( 'give_donation_receipt_args', $give_receipt_args['donation_receipt'], $donation_id, $form_id ); |
|
96 | +$give_receipt_args['donation_receipt'] = apply_filters('give_donation_receipt_args', $give_receipt_args['donation_receipt'], $donation_id, $form_id); |
|
97 | 97 | |
98 | 98 | // When the donation were made through offline donation, We won't show receipt and payment status though. |
99 | -if ( 'offline' === give_get_payment_gateway( $payment->ID ) && 'pending' === $status ) { |
|
99 | +if ('offline' === give_get_payment_gateway($payment->ID) && 'pending' === $status) { |
|
100 | 100 | |
101 | 101 | /** |
102 | 102 | * Before the offline donation receipt content starts. |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | * @param Give_Payment $payment Donation payment object. |
107 | 107 | * @param array $give_receipt_args Receipt Arguments. |
108 | 108 | */ |
109 | - do_action( 'give_receipt_before_offline_payment', $payment, $give_receipt_args ); |
|
109 | + do_action('give_receipt_before_offline_payment', $payment, $give_receipt_args); |
|
110 | 110 | ?> |
111 | - <h2><?php echo apply_filters( 'give_receipt_offline_payment_heading', __( 'Your Donation is Almost Complete!', 'give' ) ); ?></h2> |
|
112 | - <div id="give_donation_receipt" class="<?php echo esc_attr( apply_filters( 'give_receipt_offline_payment_classes', 'give_receipt_offline_payment' ) ); ?>"> |
|
111 | + <h2><?php echo apply_filters('give_receipt_offline_payment_heading', __('Your Donation is Almost Complete!', 'give')); ?></h2> |
|
112 | + <div id="give_donation_receipt" class="<?php echo esc_attr(apply_filters('give_receipt_offline_payment_classes', 'give_receipt_offline_payment')); ?>"> |
|
113 | 113 | <?php |
114 | 114 | // Instruction for offline donation. |
115 | - $offline_instruction = give_get_offline_payment_instruction( $form_id, true ); |
|
115 | + $offline_instruction = give_get_offline_payment_instruction($form_id, true); |
|
116 | 116 | |
117 | 117 | /** |
118 | 118 | * Instruction for the offline donation. |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | * @param Give_Payment $payment Payment object. |
124 | 124 | * @param integer $form_id Donation form id. |
125 | 125 | */ |
126 | - echo apply_filters( 'give_receipt_offline_payment_instruction', $offline_instruction, $payment, $form_id ); |
|
126 | + echo apply_filters('give_receipt_offline_payment_instruction', $offline_instruction, $payment, $form_id); |
|
127 | 127 | ?> |
128 | 128 | </div> |
129 | 129 | <?php |
@@ -135,52 +135,52 @@ discard block |
||
135 | 135 | * @param Give_Payment $payment Donation payment object. |
136 | 136 | * @param array $give_receipt_args Receipt Arguments. |
137 | 137 | */ |
138 | - do_action( 'give_receipt_after_offline_payment', $payment, $give_receipt_args ); |
|
138 | + do_action('give_receipt_after_offline_payment', $payment, $give_receipt_args); |
|
139 | 139 | |
140 | 140 | return; |
141 | 141 | } |
142 | 142 | |
143 | 143 | // Show payment status notice based on shortcode attribute. |
144 | -if ( filter_var( $give_receipt_args['status_notice'], FILTER_VALIDATE_BOOLEAN ) ) { |
|
144 | +if (filter_var($give_receipt_args['status_notice'], FILTER_VALIDATE_BOOLEAN)) { |
|
145 | 145 | $notice_message = ''; |
146 | 146 | $notice_type = 'warning'; |
147 | 147 | |
148 | - switch ( $status ) { |
|
148 | + switch ($status) { |
|
149 | 149 | case 'publish': |
150 | - $notice_message = __( 'Payment Complete: Thank you for your donation.', 'give' ); |
|
150 | + $notice_message = __('Payment Complete: Thank you for your donation.', 'give'); |
|
151 | 151 | $notice_type = 'success'; |
152 | 152 | break; |
153 | 153 | case 'pending': |
154 | - $notice_message = __( 'Payment Pending: Your donation is currently processing.', 'give' ); |
|
154 | + $notice_message = __('Payment Pending: Your donation is currently processing.', 'give'); |
|
155 | 155 | $notice_type = 'warning'; |
156 | 156 | break; |
157 | 157 | case 'refunded': |
158 | - $notice_message = __( 'Payment Refunded: Your donation has been refunded.', 'give' ); |
|
158 | + $notice_message = __('Payment Refunded: Your donation has been refunded.', 'give'); |
|
159 | 159 | $notice_type = 'warning'; |
160 | 160 | break; |
161 | 161 | case 'preapproval': |
162 | - $notice_message = __( 'Payment Preapproved: Thank you for your donation.', 'give' ); |
|
162 | + $notice_message = __('Payment Preapproved: Thank you for your donation.', 'give'); |
|
163 | 163 | $notice_type = 'warning'; |
164 | 164 | break; |
165 | 165 | case 'failed': |
166 | - $notice_message = __( 'Payment Failed: Please contact the site owner for assistance.', 'give' ); |
|
166 | + $notice_message = __('Payment Failed: Please contact the site owner for assistance.', 'give'); |
|
167 | 167 | $notice_type = 'error'; |
168 | 168 | break; |
169 | 169 | case 'cancelled': |
170 | - $notice_message = __( 'Payment Cancelled: Your donation has been cancelled.', 'give' ); |
|
170 | + $notice_message = __('Payment Cancelled: Your donation has been cancelled.', 'give'); |
|
171 | 171 | $notice_type = 'error'; |
172 | 172 | break; |
173 | 173 | case 'abandoned': |
174 | - $notice_message = __( 'Payment Abandoned: This donation has not been completed.', 'give' ); |
|
174 | + $notice_message = __('Payment Abandoned: This donation has not been completed.', 'give'); |
|
175 | 175 | $notice_type = 'error'; |
176 | 176 | break; |
177 | 177 | case 'revoked': |
178 | - $notice_message = __( 'Payment Revoked: Please contact the site owner for assistance.', 'give' ); |
|
178 | + $notice_message = __('Payment Revoked: Please contact the site owner for assistance.', 'give'); |
|
179 | 179 | $notice_type = 'error'; |
180 | 180 | break; |
181 | 181 | } |
182 | 182 | |
183 | - if ( ! empty( $notice_message ) ) { |
|
183 | + if ( ! empty($notice_message)) { |
|
184 | 184 | /** |
185 | 185 | * Filters payment status notice for receipts. |
186 | 186 | * |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | * @param string $status Payment status. |
196 | 196 | * @param array $meta Array of meta data related to the payment. |
197 | 197 | */ |
198 | - echo apply_filters( 'give_receipt_status_notice', Give()->notices->print_frontend_notice( $notice_message, false, $notice_type ), $id, $status, $meta ); |
|
198 | + echo apply_filters('give_receipt_status_notice', Give()->notices->print_frontend_notice($notice_message, false, $notice_type), $id, $status, $meta); |
|
199 | 199 | } |
200 | 200 | }// End if(). |
201 | 201 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @param object $payment The payment object. |
210 | 210 | * @param array $give_receipt_args Receipt_argument. |
211 | 211 | */ |
212 | -do_action( 'give_payment_receipt_before_table', $payment, $give_receipt_args ); |
|
212 | +do_action('give_payment_receipt_before_table', $payment, $give_receipt_args); |
|
213 | 213 | ?> |
214 | 214 | |
215 | 215 | <table id="give_donation_receipt" class="give-table"> |
@@ -225,11 +225,11 @@ discard block |
||
225 | 225 | * @param object $payment The payment object. |
226 | 226 | * @param array $give_receipt_args Receipt_argument. |
227 | 227 | */ |
228 | - do_action( 'give_payment_receipt_header_before', $payment, $give_receipt_args ); |
|
228 | + do_action('give_payment_receipt_header_before', $payment, $give_receipt_args); |
|
229 | 229 | ?> |
230 | 230 | <tr> |
231 | 231 | <th scope="colgroup" colspan="2"> |
232 | - <span class="give-receipt-thead-text"><?php esc_html_e( 'Donation Receipt', 'give' ) ?></span> |
|
232 | + <span class="give-receipt-thead-text"><?php esc_html_e('Donation Receipt', 'give') ?></span> |
|
233 | 233 | </th> |
234 | 234 | </tr> |
235 | 235 | <?php |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * @param object $payment The payment object. |
244 | 244 | * @param array $give_receipt_args Receipt_argument. |
245 | 245 | */ |
246 | - do_action( 'give_payment_receipt_header_after', $payment, $give_receipt_args ); |
|
246 | + do_action('give_payment_receipt_header_after', $payment, $give_receipt_args); |
|
247 | 247 | ?> |
248 | 248 | </thead> |
249 | 249 | |
@@ -259,11 +259,11 @@ discard block |
||
259 | 259 | * @param object $payment The payment object. |
260 | 260 | * @param array $give_receipt_args Receipt_argument. |
261 | 261 | */ |
262 | - do_action( 'give_payment_receipt_before', $payment, $give_receipt_args ); |
|
262 | + do_action('give_payment_receipt_before', $payment, $give_receipt_args); |
|
263 | 263 | ?> |
264 | 264 | |
265 | - <?php foreach ( $give_receipt_args['donation_receipt'] as $receipt_item ) { ?> |
|
266 | - <?php if ( filter_var( $receipt_item['display'], FILTER_VALIDATE_BOOLEAN ) ) : ?> |
|
265 | + <?php foreach ($give_receipt_args['donation_receipt'] as $receipt_item) { ?> |
|
266 | + <?php if (filter_var($receipt_item['display'], FILTER_VALIDATE_BOOLEAN)) : ?> |
|
267 | 267 | <tr> |
268 | 268 | <td scope="row"><strong><?php echo $receipt_item['name']; ?></strong></td> |
269 | 269 | <td><?php echo $receipt_item['value']; ?></td> |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | * @param object $payment The payment object. |
283 | 283 | * @param array $give_receipt_args Receipt_argument. |
284 | 284 | */ |
285 | - do_action( 'give_payment_receipt_after', $payment, $give_receipt_args ); |
|
285 | + do_action('give_payment_receipt_after', $payment, $give_receipt_args); |
|
286 | 286 | ?> |
287 | 287 | </tbody> |
288 | 288 | </table> |
@@ -298,5 +298,5 @@ discard block |
||
298 | 298 | * @param object $payment The payment object. |
299 | 299 | * @param array $give_receipt_args Receipt_argument. |
300 | 300 | */ |
301 | -do_action( 'give_payment_receipt_after_table', $payment, $give_receipt_args ); |
|
301 | +do_action('give_payment_receipt_after_table', $payment, $give_receipt_args); |
|
302 | 302 | ?> |