@@ -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,34 +26,34 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_set_settings_with_disable_prefix( $old_settings, $settings ) { |
|
29 | +function give_set_settings_with_disable_prefix($old_settings, $settings) { |
|
30 | 30 | // Bailout. |
31 | - if ( ! function_exists( 'give_v18_renamed_core_settings' ) ) { |
|
31 | + if ( ! function_exists('give_v18_renamed_core_settings')) { |
|
32 | 32 | return; |
33 | 33 | } |
34 | 34 | |
35 | 35 | // Get old setting names. |
36 | - $old_settings = array_flip( give_v18_renamed_core_settings() ); |
|
36 | + $old_settings = array_flip(give_v18_renamed_core_settings()); |
|
37 | 37 | $update_setting = false; |
38 | 38 | |
39 | - foreach ( $settings as $key => $value ) { |
|
39 | + foreach ($settings as $key => $value) { |
|
40 | 40 | |
41 | 41 | // Check 1. Check if new option is really updated or not. |
42 | 42 | // Check 2. Continue if key is not renamed. |
43 | - if ( ! isset( $old_settings[ $key ] ) ) { |
|
43 | + if ( ! isset($old_settings[$key])) { |
|
44 | 44 | continue; |
45 | 45 | } |
46 | 46 | |
47 | 47 | // Set old setting. |
48 | - $settings[ $old_settings[ $key ] ] = 'on'; |
|
48 | + $settings[$old_settings[$key]] = 'on'; |
|
49 | 49 | |
50 | 50 | // Do not need to set old setting if new setting is not set. |
51 | 51 | if ( |
52 | - ( give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'disable_' ) ) ) |
|
53 | - || ( ! give_is_setting_enabled( $value ) && ( false !== strpos( $old_settings[ $key ], 'enable_' ) ) ) |
|
52 | + (give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'disable_'))) |
|
53 | + || ( ! give_is_setting_enabled($value) && (false !== strpos($old_settings[$key], 'enable_'))) |
|
54 | 54 | |
55 | 55 | ) { |
56 | - unset( $settings[ $old_settings[ $key ] ] ); |
|
56 | + unset($settings[$old_settings[$key]]); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // Tell bot to update setting. |
@@ -61,12 +61,12 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | // Update setting if any old setting set. |
64 | - if ( $update_setting ) { |
|
65 | - update_option( 'give_settings', $settings ); |
|
64 | + if ($update_setting) { |
|
65 | + update_option('give_settings', $settings); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
69 | -add_action( 'update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2 ); |
|
69 | +add_action('update_option_give_settings', 'give_set_settings_with_disable_prefix', 10, 2); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Check spam through Akismet. |
@@ -80,45 +80,45 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return bool|mixed |
82 | 82 | */ |
83 | -function give_akismet( $spam ) { |
|
83 | +function give_akismet($spam) { |
|
84 | 84 | |
85 | 85 | // Bail out, If spam. |
86 | - if ( $spam ) { |
|
86 | + if ($spam) { |
|
87 | 87 | return $spam; |
88 | 88 | } |
89 | 89 | |
90 | 90 | // Bail out, if Akismet key not exist. |
91 | - if ( ! give_check_akismet_key() ) { |
|
91 | + if ( ! give_check_akismet_key()) { |
|
92 | 92 | return false; |
93 | 93 | } |
94 | 94 | |
95 | 95 | // Build args array. |
96 | 96 | $args = array(); |
97 | 97 | |
98 | - $args['comment_author'] = isset( $_POST['give_first'] ) ? strip_tags( trim( $_POST['give_first'] ) ) : ''; |
|
99 | - $args['comment_author_email'] = isset( $_POST['give_email'] ) ? $_POST['give_email'] : false; |
|
100 | - $args['blog'] = get_option( 'home' ); |
|
98 | + $args['comment_author'] = isset($_POST['give_first']) ? strip_tags(trim($_POST['give_first'])) : ''; |
|
99 | + $args['comment_author_email'] = isset($_POST['give_email']) ? $_POST['give_email'] : false; |
|
100 | + $args['blog'] = get_option('home'); |
|
101 | 101 | $args['blog_lang'] = get_locale(); |
102 | - $args['blog_charset'] = get_option( 'blog_charset' ); |
|
102 | + $args['blog_charset'] = get_option('blog_charset'); |
|
103 | 103 | $args['user_ip'] = $_SERVER['REMOTE_ADDR']; |
104 | 104 | $args['user_agent'] = $_SERVER['HTTP_USER_AGENT']; |
105 | 105 | $args['referrer'] = $_SERVER['HTTP_REFERER']; |
106 | 106 | $args['comment_type'] = 'contact-form'; |
107 | 107 | |
108 | - $ignore = array( 'HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW' ); |
|
108 | + $ignore = array('HTTP_COOKIE', 'HTTP_COOKIE2', 'PHP_AUTH_PW'); |
|
109 | 109 | |
110 | - foreach ( $_SERVER as $key => $value ) { |
|
111 | - if ( ! in_array( $key, (array) $ignore ) ) { |
|
110 | + foreach ($_SERVER as $key => $value) { |
|
111 | + if ( ! in_array($key, (array) $ignore)) { |
|
112 | 112 | $args["$key"] = $value; |
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | 116 | // It will return Akismet spam detect API response. |
117 | - return give_akismet_spam_check( $args ); |
|
117 | + return give_akismet_spam_check($args); |
|
118 | 118 | |
119 | 119 | } |
120 | 120 | |
121 | -add_filter( 'give_spam', 'give_akismet' ); |
|
121 | +add_filter('give_spam', 'give_akismet'); |
|
122 | 122 | |
123 | 123 | /** |
124 | 124 | * Check Akismet API Key. |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | * @return bool |
129 | 129 | */ |
130 | 130 | function give_check_akismet_key() { |
131 | - if ( is_callable( array( 'Akismet', 'get_api_key' ) ) ) { // Akismet v3.0+ |
|
131 | + if (is_callable(array('Akismet', 'get_api_key'))) { // Akismet v3.0+ |
|
132 | 132 | return (bool) Akismet::get_api_key(); |
133 | 133 | } |
134 | 134 | |
135 | - if ( function_exists( 'akismet_get_key' ) ) { |
|
135 | + if (function_exists('akismet_get_key')) { |
|
136 | 136 | return (bool) akismet_get_key(); |
137 | 137 | } |
138 | 138 | |
@@ -148,26 +148,26 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return bool|mixed |
150 | 150 | */ |
151 | -function give_akismet_spam_check( $args ) { |
|
151 | +function give_akismet_spam_check($args) { |
|
152 | 152 | global $akismet_api_host, $akismet_api_port; |
153 | 153 | |
154 | 154 | $spam = false; |
155 | - $query_string = http_build_query( $args ); |
|
155 | + $query_string = http_build_query($args); |
|
156 | 156 | |
157 | - if ( is_callable( array( 'Akismet', 'http_post' ) ) ) { // Akismet v3.0+ |
|
158 | - $response = Akismet::http_post( $query_string, 'comment-check' ); |
|
157 | + if (is_callable(array('Akismet', 'http_post'))) { // Akismet v3.0+ |
|
158 | + $response = Akismet::http_post($query_string, 'comment-check'); |
|
159 | 159 | } else { |
160 | - $response = akismet_http_post( $query_string, $akismet_api_host, |
|
161 | - '/1.1/comment-check', $akismet_api_port ); |
|
160 | + $response = akismet_http_post($query_string, $akismet_api_host, |
|
161 | + '/1.1/comment-check', $akismet_api_port); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | // It's spam if response status is true. |
165 | - if ( 'true' === $response[1] ) { |
|
165 | + if ('true' === $response[1]) { |
|
166 | 166 | $spam = true; |
167 | 167 | } |
168 | 168 | |
169 | 169 | // Allow developer to modified Akismet spam detection response. |
170 | - return apply_filters( 'give_akismet_spam_check', $spam, $args ); |
|
170 | + return apply_filters('give_akismet_spam_check', $spam, $args); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | /** |
@@ -180,15 +180,15 @@ discard block |
||
180 | 180 | * |
181 | 181 | * @return array |
182 | 182 | */ |
183 | -function give_bc_v1817_iranian_currency_code( $currencies ) { |
|
184 | - if ( ! give_has_upgrade_completed( 'v1817_update_donation_iranian_currency_code' ) ) { |
|
183 | +function give_bc_v1817_iranian_currency_code($currencies) { |
|
184 | + if ( ! give_has_upgrade_completed('v1817_update_donation_iranian_currency_code')) { |
|
185 | 185 | $currencies['RIAL'] = $currencies['IRR']; |
186 | 186 | } |
187 | 187 | |
188 | 188 | return $currencies; |
189 | 189 | } |
190 | 190 | |
191 | -add_filter( 'give_currencies', 'give_bc_v1817_iranian_currency_code', 0 ); |
|
191 | +add_filter('give_currencies', 'give_bc_v1817_iranian_currency_code', 0); |
|
192 | 192 | |
193 | 193 | |
194 | 194 | /** |
@@ -202,25 +202,23 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @return string |
204 | 204 | */ |
205 | -function give_format_price_for_right_to_left_supported_currency( $formatted_amount, $currency_args, $price ) { |
|
206 | - if ( ! give_is_right_to_left_supported_currency( $currency_args['currency_code'] ) ) { |
|
205 | +function give_format_price_for_right_to_left_supported_currency($formatted_amount, $currency_args, $price) { |
|
206 | + if ( ! give_is_right_to_left_supported_currency($currency_args['currency_code'])) { |
|
207 | 207 | return $formatted_amount; |
208 | 208 | } |
209 | 209 | |
210 | 210 | $formatted_amount = ( |
211 | 211 | 'before' === (string) $currency_args['position'] ? |
212 | - '‫' . $price . $currency_args['symbol'] . '‬' : |
|
213 | - '‪' . $price . $currency_args['symbol'] . '‬' |
|
212 | + '‫'.$price.$currency_args['symbol'].'‬' : '‪'.$price.$currency_args['symbol'].'‬' |
|
214 | 213 | ); |
215 | 214 | |
216 | 215 | $formatted_amount = $currency_args['decode_currency'] ? |
217 | - html_entity_decode( $formatted_amount, ENT_COMPAT, 'UTF-8' ) : |
|
218 | - $formatted_amount; |
|
216 | + html_entity_decode($formatted_amount, ENT_COMPAT, 'UTF-8') : $formatted_amount; |
|
219 | 217 | |
220 | 218 | return $formatted_amount; |
221 | 219 | } |
222 | 220 | |
223 | -add_filter( 'give_currency_filter', 'give_format_price_for_right_to_left_supported_currency', 10, 3 ); |
|
221 | +add_filter('give_currency_filter', 'give_format_price_for_right_to_left_supported_currency', 10, 3); |
|
224 | 222 | |
225 | 223 | /** |
226 | 224 | * Validate active gateway value before returning result. |
@@ -231,31 +229,31 @@ discard block |
||
231 | 229 | * |
232 | 230 | * @return array |
233 | 231 | */ |
234 | -function __give_validate_active_gateways( $value ) { |
|
235 | - $gateways = array_keys( give_get_payment_gateways() ); |
|
236 | - $active_gateways = is_array( $value ) ? array_keys( $value ) : array(); |
|
232 | +function __give_validate_active_gateways($value) { |
|
233 | + $gateways = array_keys(give_get_payment_gateways()); |
|
234 | + $active_gateways = is_array($value) ? array_keys($value) : array(); |
|
237 | 235 | |
238 | 236 | // Remove deactivated payment gateways. |
239 | - if( ! empty( $active_gateways ) ) { |
|
240 | - foreach ( $active_gateways as $index => $gateway_id ) { |
|
241 | - if( ! in_array( $gateway_id, $gateways ) ) { |
|
242 | - unset( $value[$gateway_id] ); |
|
237 | + if ( ! empty($active_gateways)) { |
|
238 | + foreach ($active_gateways as $index => $gateway_id) { |
|
239 | + if ( ! in_array($gateway_id, $gateways)) { |
|
240 | + unset($value[$gateway_id]); |
|
243 | 241 | } |
244 | 242 | } |
245 | 243 | } |
246 | 244 | |
247 | - if ( empty( $value ) ) { |
|
245 | + if (empty($value)) { |
|
248 | 246 | /** |
249 | 247 | * Filter the default active gateway |
250 | 248 | * |
251 | 249 | * @since 2.1.0 |
252 | 250 | */ |
253 | - $value = apply_filters( 'give_default_active_gateways', array( |
|
251 | + $value = apply_filters('give_default_active_gateways', array( |
|
254 | 252 | 'manual' => 1, |
255 | - ) ); |
|
253 | + )); |
|
256 | 254 | } |
257 | 255 | |
258 | 256 | return $value; |
259 | 257 | } |
260 | 258 | |
261 | -add_filter( 'give_get_option_gateways', '__give_validate_active_gateways', 10, 1 ); |
|
262 | 259 | \ No newline at end of file |
260 | +add_filter('give_get_option_gateways', '__give_validate_active_gateways', 10, 1); |
|
263 | 261 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -53,21 +53,21 @@ discard block |
||
53 | 53 | * @since 1.8.9 |
54 | 54 | */ |
55 | 55 | public function __construct() { |
56 | - add_action( 'admin_notices', array( $this, 'render_admin_notices' ), 999 ); |
|
57 | - add_action( 'give_dismiss_notices', array( $this, 'dismiss_notices' ) ); |
|
56 | + add_action('admin_notices', array($this, 'render_admin_notices'), 999); |
|
57 | + add_action('give_dismiss_notices', array($this, 'dismiss_notices')); |
|
58 | 58 | |
59 | - add_action( 'give_frontend_notices', array( $this, 'render_frontend_notices' ), 999 ); |
|
60 | - add_action( 'give_pre_form', array( $this, 'render_frontend_notices' ), 11 ); |
|
61 | - add_action( 'give_ajax_donation_errors', array( $this, 'render_frontend_notices' ) ); |
|
59 | + add_action('give_frontend_notices', array($this, 'render_frontend_notices'), 999); |
|
60 | + add_action('give_pre_form', array($this, 'render_frontend_notices'), 11); |
|
61 | + add_action('give_ajax_donation_errors', array($this, 'render_frontend_notices')); |
|
62 | 62 | |
63 | 63 | /** |
64 | 64 | * Backward compatibility for deprecated params. |
65 | 65 | * |
66 | 66 | * @since 1.8.14 |
67 | 67 | */ |
68 | - add_filter( 'give_register_notice_args', array( $this, 'bc_deprecated_params' ) ); |
|
69 | - add_filter( 'give_frontend_errors_args', array( $this, 'bc_deprecated_params' ) ); |
|
70 | - add_filter( 'give_frontend_notice_args', array( $this, 'bc_deprecated_params' ) ); |
|
68 | + add_filter('give_register_notice_args', array($this, 'bc_deprecated_params')); |
|
69 | + add_filter('give_frontend_errors_args', array($this, 'bc_deprecated_params')); |
|
70 | + add_filter('give_frontend_notice_args', array($this, 'bc_deprecated_params')); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -80,19 +80,19 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @return array |
82 | 82 | */ |
83 | - public function bc_deprecated_params( $args ) { |
|
83 | + public function bc_deprecated_params($args) { |
|
84 | 84 | /** |
85 | 85 | * Param: auto_dismissible |
86 | 86 | * deprecated in 1.8.14 |
87 | 87 | * |
88 | 88 | * Check if auto_dismissible is set and it true then unset and change dismissible parameter value to auto |
89 | 89 | */ |
90 | - if ( isset( $args['auto_dismissible'] ) ) { |
|
91 | - if ( ! empty( $args['auto_dismissible'] ) ) { |
|
90 | + if (isset($args['auto_dismissible'])) { |
|
91 | + if ( ! empty($args['auto_dismissible'])) { |
|
92 | 92 | $args['dismissible'] = 'auto'; |
93 | 93 | } |
94 | 94 | // unset auto_dismissible as it has been deprecated. |
95 | - unset( $args['auto_dismissible'] ); |
|
95 | + unset($args['auto_dismissible']); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | return $args; |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return bool |
110 | 110 | */ |
111 | - public function register_notice( $notice_args ) { |
|
111 | + public function register_notice($notice_args) { |
|
112 | 112 | // Bailout. |
113 | - if ( empty( $notice_args['id'] ) || array_key_exists( $notice_args['id'], self::$notices ) ) { |
|
113 | + if (empty($notice_args['id']) || array_key_exists($notice_args['id'], self::$notices)) { |
|
114 | 114 | return false; |
115 | 115 | } |
116 | 116 | |
@@ -159,39 +159,39 @@ discard block |
||
159 | 159 | * |
160 | 160 | * @since 1.8.14 |
161 | 161 | */ |
162 | - $notice_args = apply_filters( 'give_register_notice_args', $notice_args ); |
|
162 | + $notice_args = apply_filters('give_register_notice_args', $notice_args); |
|
163 | 163 | |
164 | 164 | // Set extra dismiss links if any. |
165 | - if ( false !== strpos( $notice_args['description'], 'data-dismiss-interval' ) ) { |
|
165 | + if (false !== strpos($notice_args['description'], 'data-dismiss-interval')) { |
|
166 | 166 | |
167 | - preg_match_all( "/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link ); |
|
167 | + preg_match_all("/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link); |
|
168 | 168 | |
169 | - if ( ! empty( $extra_notice_dismiss_link ) ) { |
|
170 | - $extra_notice_dismiss_links = array_chunk( current( $extra_notice_dismiss_link ), 3 ); |
|
171 | - foreach ( $extra_notice_dismiss_links as $extra_notice_dismiss_link ) { |
|
169 | + if ( ! empty($extra_notice_dismiss_link)) { |
|
170 | + $extra_notice_dismiss_links = array_chunk(current($extra_notice_dismiss_link), 3); |
|
171 | + foreach ($extra_notice_dismiss_links as $extra_notice_dismiss_link) { |
|
172 | 172 | // Create array og key ==> value by parsing query string created after renaming data attributes. |
173 | - $data_attribute_query_str = str_replace( array( 'data-', '-', '"' ), array( |
|
173 | + $data_attribute_query_str = str_replace(array('data-', '-', '"'), array( |
|
174 | 174 | '', |
175 | 175 | '_', |
176 | 176 | '', |
177 | - ), implode( '&', $extra_notice_dismiss_link ) ); |
|
177 | + ), implode('&', $extra_notice_dismiss_link)); |
|
178 | 178 | |
179 | - $notice_args['extra_links'][] = wp_parse_args( $data_attribute_query_str ); |
|
179 | + $notice_args['extra_links'][] = wp_parse_args($data_attribute_query_str); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
184 | 184 | |
185 | - self::$notices[ $notice_args['id'] ] = $notice_args; |
|
185 | + self::$notices[$notice_args['id']] = $notice_args; |
|
186 | 186 | |
187 | 187 | // Auto set show param if not already set. |
188 | - if ( ! isset( self::$notices[ $notice_args['id'] ]['show'] ) ) { |
|
189 | - self::$notices[ $notice_args['id'] ]['show'] = $this->is_notice_dismissed( $notice_args ) ? false : true; |
|
188 | + if ( ! isset(self::$notices[$notice_args['id']]['show'])) { |
|
189 | + self::$notices[$notice_args['id']]['show'] = $this->is_notice_dismissed($notice_args) ? false : true; |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | // Auto set time interval for shortly. |
193 | - if ( 'shortly' === self::$notices[ $notice_args['id'] ]['dismiss_interval'] ) { |
|
194 | - self::$notices[ $notice_args['id'] ]['dismiss_interval_time'] = DAY_IN_SECONDS; |
|
193 | + if ('shortly' === self::$notices[$notice_args['id']]['dismiss_interval']) { |
|
194 | + self::$notices[$notice_args['id']]['dismiss_interval_time'] = DAY_IN_SECONDS; |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | return true; |
@@ -205,51 +205,51 @@ discard block |
||
205 | 205 | */ |
206 | 206 | public function render_admin_notices() { |
207 | 207 | // Bailout. |
208 | - if ( empty( self::$notices ) ) { |
|
208 | + if (empty(self::$notices)) { |
|
209 | 209 | return; |
210 | 210 | } |
211 | 211 | |
212 | 212 | $output = ''; |
213 | 213 | |
214 | - foreach ( self::$notices as $notice_id => $notice ) { |
|
214 | + foreach (self::$notices as $notice_id => $notice) { |
|
215 | 215 | // Check flag set to true to show notice. |
216 | - if ( ! $notice['show'] ) { |
|
216 | + if ( ! $notice['show']) { |
|
217 | 217 | continue; |
218 | 218 | } |
219 | 219 | |
220 | 220 | |
221 | 221 | // Render custom html. |
222 | - if( ! empty( $notice['description_html'] ) ) { |
|
222 | + if ( ! empty($notice['description_html'])) { |
|
223 | 223 | $output .= "{$notice['description_html']} \n"; |
224 | 224 | continue; |
225 | 225 | } |
226 | 226 | |
227 | 227 | // Check if notice dismissible or not. |
228 | - if ( ! self::$has_auto_dismissible_notice ) { |
|
229 | - self::$has_auto_dismissible_notice = ( 'auto' === $notice['dismissible'] ); |
|
228 | + if ( ! self::$has_auto_dismissible_notice) { |
|
229 | + self::$has_auto_dismissible_notice = ('auto' === $notice['dismissible']); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | // Check if notice dismissible or not. |
233 | - if ( ! self::$has_dismiss_interval_notice ) { |
|
233 | + if ( ! self::$has_dismiss_interval_notice) { |
|
234 | 234 | self::$has_dismiss_interval_notice = $notice['dismiss_interval']; |
235 | 235 | } |
236 | 236 | |
237 | - $css_id = ( false === strpos( $notice['id'], 'give' ) ? "give-{$notice['id']}" : $notice['id'] ); |
|
237 | + $css_id = (false === strpos($notice['id'], 'give') ? "give-{$notice['id']}" : $notice['id']); |
|
238 | 238 | |
239 | - $css_class = 'give-notice notice ' . ( empty( $notice['dismissible'] ) ? 'non' : 'is' ) . "-dismissible {$notice['type']} notice-{$notice['type']}"; |
|
240 | - $output .= sprintf( |
|
241 | - '<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s" style="display: none">' . " \n", |
|
239 | + $css_class = 'give-notice notice '.(empty($notice['dismissible']) ? 'non' : 'is')."-dismissible {$notice['type']} notice-{$notice['type']}"; |
|
240 | + $output .= sprintf( |
|
241 | + '<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s" style="display: none">'." \n", |
|
242 | 242 | $css_id, |
243 | 243 | $css_class, |
244 | - give_clean( $notice['dismissible'] ), |
|
244 | + give_clean($notice['dismissible']), |
|
245 | 245 | $notice['dismissible_type'], |
246 | 246 | $notice['dismiss_interval'], |
247 | 247 | $notice['id'], |
248 | - empty( $notice['dismissible_type'] ) ? '' : wp_create_nonce( "give_edit_{$notice_id}_notice" ), |
|
248 | + empty($notice['dismissible_type']) ? '' : wp_create_nonce("give_edit_{$notice_id}_notice"), |
|
249 | 249 | $notice['dismiss_interval_time'] |
250 | 250 | ); |
251 | 251 | |
252 | - $output .= ( 0 === strpos( $notice['description'], '<div' ) || 0 === strpos( $notice['description'], '<p' ) ? $notice['description'] : "<p>{$notice['description']}</p>" ); |
|
252 | + $output .= (0 === strpos($notice['description'], '<div') || 0 === strpos($notice['description'], '<p') ? $notice['description'] : "<p>{$notice['description']}</p>"); |
|
253 | 253 | $output .= "</div> \n"; |
254 | 254 | } |
255 | 255 | |
@@ -267,18 +267,18 @@ discard block |
||
267 | 267 | * |
268 | 268 | * @param int $form_id |
269 | 269 | */ |
270 | - public function render_frontend_notices( $form_id = 0 ) { |
|
270 | + public function render_frontend_notices($form_id = 0) { |
|
271 | 271 | $errors = give_get_errors(); |
272 | 272 | |
273 | - $request_form_id = isset( $_REQUEST['form-id'] ) ? absint( $_REQUEST['form-id'] ) : 0; |
|
273 | + $request_form_id = isset($_REQUEST['form-id']) ? absint($_REQUEST['form-id']) : 0; |
|
274 | 274 | |
275 | 275 | // Sanity checks first: Ensure that gateway returned errors display on the appropriate form. |
276 | - if ( ! isset( $_POST['give_ajax'] ) && $request_form_id !== $form_id ) { |
|
276 | + if ( ! isset($_POST['give_ajax']) && $request_form_id !== $form_id) { |
|
277 | 277 | return; |
278 | 278 | } |
279 | 279 | |
280 | - if ( $errors ) { |
|
281 | - self::print_frontend_errors( $errors ); |
|
280 | + if ($errors) { |
|
281 | + self::print_frontend_errors($errors); |
|
282 | 282 | |
283 | 283 | give_clear_errors(); |
284 | 284 | } |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | * @access private |
292 | 292 | */ |
293 | 293 | private function print_js() { |
294 | - if ( self::$has_auto_dismissible_notice ) : |
|
294 | + if (self::$has_auto_dismissible_notice) : |
|
295 | 295 | ?> |
296 | 296 | <script> |
297 | 297 | jQuery(document).ready(function () { |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | <?php |
308 | 308 | endif; |
309 | 309 | |
310 | - if ( self::$has_dismiss_interval_notice ) : |
|
310 | + if (self::$has_dismiss_interval_notice) : |
|
311 | 311 | ?> |
312 | 312 | <script> |
313 | 313 | jQuery(document).ready(function () { |
@@ -386,36 +386,36 @@ discard block |
||
386 | 386 | * @access public |
387 | 387 | */ |
388 | 388 | public function dismiss_notices() { |
389 | - $_post = give_clean( $_POST ); |
|
390 | - $notice_id = esc_attr( $_post['notice_id'] ); |
|
389 | + $_post = give_clean($_POST); |
|
390 | + $notice_id = esc_attr($_post['notice_id']); |
|
391 | 391 | |
392 | 392 | // Bailout. |
393 | 393 | if ( |
394 | - empty( $notice_id ) || |
|
395 | - empty( $_post['dismissible_type'] ) || |
|
396 | - empty( $_post['dismiss_interval'] ) || |
|
397 | - ! check_ajax_referer( "give_edit_{$notice_id}_notice", '_wpnonce' ) |
|
394 | + empty($notice_id) || |
|
395 | + empty($_post['dismissible_type']) || |
|
396 | + empty($_post['dismiss_interval']) || |
|
397 | + ! check_ajax_referer("give_edit_{$notice_id}_notice", '_wpnonce') |
|
398 | 398 | ) { |
399 | 399 | wp_send_json_error(); |
400 | 400 | } |
401 | 401 | |
402 | - $notice_key = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'] ); |
|
403 | - if ( 'user' === $_post['dismissible_type'] ) { |
|
402 | + $notice_key = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval']); |
|
403 | + if ('user' === $_post['dismissible_type']) { |
|
404 | 404 | $current_user = wp_get_current_user(); |
405 | - $notice_key = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'], $current_user->ID ); |
|
405 | + $notice_key = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval'], $current_user->ID); |
|
406 | 406 | } |
407 | 407 | |
408 | - $notice_dismiss_time = ! empty( $_post['dismiss_interval_time'] ) ? $_post['dismiss_interval_time'] : null; |
|
408 | + $notice_dismiss_time = ! empty($_post['dismiss_interval_time']) ? $_post['dismiss_interval_time'] : null; |
|
409 | 409 | |
410 | 410 | // Save option to hide notice. |
411 | - Give_Cache::set( $notice_key, true, $notice_dismiss_time, true ); |
|
411 | + Give_Cache::set($notice_key, true, $notice_dismiss_time, true); |
|
412 | 412 | |
413 | 413 | /** |
414 | 414 | * Fire the action when notice dismissed |
415 | 415 | * |
416 | 416 | * @since 2.0 |
417 | 417 | */ |
418 | - do_action( 'give_dismiss_notices', $_post ); |
|
418 | + do_action('give_dismiss_notices', $_post); |
|
419 | 419 | |
420 | 420 | wp_send_json_success(); |
421 | 421 | } |
@@ -433,18 +433,18 @@ discard block |
||
433 | 433 | * |
434 | 434 | * @return string |
435 | 435 | */ |
436 | - public function get_notice_key( $notice_id, $dismiss_interval = null, $user_id = 0 ) { |
|
436 | + public function get_notice_key($notice_id, $dismiss_interval = null, $user_id = 0) { |
|
437 | 437 | $notice_key = "_give_notice_{$notice_id}"; |
438 | 438 | |
439 | - if ( ! empty( $dismiss_interval ) ) { |
|
439 | + if ( ! empty($dismiss_interval)) { |
|
440 | 440 | $notice_key .= "_{$dismiss_interval}"; |
441 | 441 | } |
442 | 442 | |
443 | - if ( $user_id ) { |
|
443 | + if ($user_id) { |
|
444 | 444 | $notice_key .= "_{$user_id}"; |
445 | 445 | } |
446 | 446 | |
447 | - $notice_key = sanitize_key( $notice_key ); |
|
447 | + $notice_key = sanitize_key($notice_key); |
|
448 | 448 | |
449 | 449 | return $notice_key; |
450 | 450 | } |
@@ -457,11 +457,11 @@ discard block |
||
457 | 457 | * |
458 | 458 | * @return string |
459 | 459 | */ |
460 | - public function get_dismiss_link( $notice_args ) { |
|
460 | + public function get_dismiss_link($notice_args) { |
|
461 | 461 | $notice_args = wp_parse_args( |
462 | 462 | $notice_args, |
463 | 463 | array( |
464 | - 'title' => __( 'Click here', 'give' ), |
|
464 | + 'title' => __('Click here', 'give'), |
|
465 | 465 | 'dismissible_type' => '', |
466 | 466 | 'dismiss_interval' => '', |
467 | 467 | 'dismiss_interval_time' => null, |
@@ -488,31 +488,31 @@ discard block |
||
488 | 488 | * |
489 | 489 | * @return bool|null |
490 | 490 | */ |
491 | - public function is_notice_dismissed( $notice ) { |
|
492 | - $notice_key = $this->get_notice_key( $notice['id'], $notice['dismiss_interval'] ); |
|
491 | + public function is_notice_dismissed($notice) { |
|
492 | + $notice_key = $this->get_notice_key($notice['id'], $notice['dismiss_interval']); |
|
493 | 493 | $is_notice_dismissed = false; |
494 | 494 | |
495 | - if ( 'user' === $notice['dismissible_type'] ) { |
|
495 | + if ('user' === $notice['dismissible_type']) { |
|
496 | 496 | $current_user = wp_get_current_user(); |
497 | - $notice_key = Give()->notices->get_notice_key( $notice['id'], $notice['dismiss_interval'], $current_user->ID ); |
|
497 | + $notice_key = Give()->notices->get_notice_key($notice['id'], $notice['dismiss_interval'], $current_user->ID); |
|
498 | 498 | } |
499 | 499 | |
500 | - $notice_data = Give_Cache::get( $notice_key, true ); |
|
500 | + $notice_data = Give_Cache::get($notice_key, true); |
|
501 | 501 | |
502 | 502 | // Find notice dismiss link status if notice has extra dismissible links. |
503 | - if ( ( empty( $notice_data ) || is_wp_error( $notice_data ) ) && ! empty( $notice['extra_links'] ) ) { |
|
503 | + if ((empty($notice_data) || is_wp_error($notice_data)) && ! empty($notice['extra_links'])) { |
|
504 | 504 | |
505 | - foreach ( $notice['extra_links'] as $extra_link ) { |
|
506 | - $new_notice_data = wp_parse_args( $extra_link, $notice ); |
|
507 | - unset( $new_notice_data['extra_links'] ); |
|
505 | + foreach ($notice['extra_links'] as $extra_link) { |
|
506 | + $new_notice_data = wp_parse_args($extra_link, $notice); |
|
507 | + unset($new_notice_data['extra_links']); |
|
508 | 508 | |
509 | - if ( $is_notice_dismissed = $this->is_notice_dismissed( $new_notice_data ) ) { |
|
509 | + if ($is_notice_dismissed = $this->is_notice_dismissed($new_notice_data)) { |
|
510 | 510 | return $is_notice_dismissed; |
511 | 511 | } |
512 | 512 | } |
513 | 513 | } |
514 | 514 | |
515 | - $is_notice_dismissed = ! empty( $notice_data ) && ! is_wp_error( $notice_data ); |
|
515 | + $is_notice_dismissed = ! empty($notice_data) && ! is_wp_error($notice_data); |
|
516 | 516 | |
517 | 517 | return $is_notice_dismissed; |
518 | 518 | } |
@@ -526,9 +526,9 @@ discard block |
||
526 | 526 | * |
527 | 527 | * @param array $errors |
528 | 528 | */ |
529 | - public static function print_frontend_errors( $errors ) { |
|
529 | + public static function print_frontend_errors($errors) { |
|
530 | 530 | // Bailout. |
531 | - if ( ! $errors ) { |
|
531 | + if ( ! $errors) { |
|
532 | 532 | return; |
533 | 533 | } |
534 | 534 | |
@@ -543,37 +543,37 @@ discard block |
||
543 | 543 | ); |
544 | 544 | |
545 | 545 | // Note: we will remove give_errors class in future. |
546 | - $classes = apply_filters( 'give_error_class', array( 'give_notices', 'give_errors' ) ); |
|
546 | + $classes = apply_filters('give_error_class', array('give_notices', 'give_errors')); |
|
547 | 547 | |
548 | - echo sprintf( '<div class="%s">', implode( ' ', $classes ) ); |
|
548 | + echo sprintf('<div class="%s">', implode(' ', $classes)); |
|
549 | 549 | |
550 | 550 | // Loop error codes and display errors. |
551 | - foreach ( $errors as $error_id => $error ) { |
|
551 | + foreach ($errors as $error_id => $error) { |
|
552 | 552 | // Backward compatibility v<1.8.11 |
553 | - if ( is_string( $error ) ) { |
|
553 | + if (is_string($error)) { |
|
554 | 554 | $error = array( |
555 | 555 | 'message' => $error, |
556 | 556 | 'notice_args' => array(), |
557 | 557 | ); |
558 | 558 | } |
559 | 559 | |
560 | - $notice_args = wp_parse_args( $error['notice_args'], $default_notice_args ); |
|
560 | + $notice_args = wp_parse_args($error['notice_args'], $default_notice_args); |
|
561 | 561 | |
562 | 562 | /** |
563 | 563 | * Filter to modify Frontend Errors args before errors is display. |
564 | 564 | * |
565 | 565 | * @since 1.8.14 |
566 | 566 | */ |
567 | - $notice_args = apply_filters( 'give_frontend_errors_args', $notice_args ); |
|
567 | + $notice_args = apply_filters('give_frontend_errors_args', $notice_args); |
|
568 | 568 | |
569 | 569 | echo sprintf( |
570 | 570 | '<div class="give_error give_notice" id="give_error_%1$s" data-dismissible="%2$s" data-dismiss-interval="%3$d"> |
571 | 571 | <p><strong>%4$s</strong>: %5$s</p> |
572 | 572 | </div>', |
573 | 573 | $error_id, |
574 | - give_clean( $notice_args['dismissible'] ), |
|
575 | - absint( $notice_args['dismiss_interval'] ), |
|
576 | - esc_html__( 'Error', 'give' ), |
|
574 | + give_clean($notice_args['dismissible']), |
|
575 | + absint($notice_args['dismiss_interval']), |
|
576 | + esc_html__('Error', 'give'), |
|
577 | 577 | $error['message'] |
578 | 578 | ); |
579 | 579 | } |
@@ -595,8 +595,8 @@ discard block |
||
595 | 595 | * |
596 | 596 | * @return string |
597 | 597 | */ |
598 | - public static function print_frontend_notice( $message, $echo = true, $notice_type = 'warning', $notice_args = array() ) { |
|
599 | - if ( empty( $message ) ) { |
|
598 | + public static function print_frontend_notice($message, $echo = true, $notice_type = 'warning', $notice_args = array()) { |
|
599 | + if (empty($message)) { |
|
600 | 600 | return ''; |
601 | 601 | } |
602 | 602 | |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | 'dismiss_interval' => 5000, |
612 | 612 | ); |
613 | 613 | |
614 | - $notice_args = wp_parse_args( $notice_args, $default_notice_args ); |
|
614 | + $notice_args = wp_parse_args($notice_args, $default_notice_args); |
|
615 | 615 | |
616 | 616 | // Notice dismissible must be true for dismiss type. |
617 | 617 | $notice_args['dismiss_type'] = ! $notice_args['dismissible'] ? '' : $notice_args['dismiss_type']; |
@@ -621,15 +621,14 @@ discard block |
||
621 | 621 | * |
622 | 622 | * @since 1.8.14 |
623 | 623 | */ |
624 | - $notice_args = apply_filters( 'give_frontend_notice_args', $notice_args ); |
|
624 | + $notice_args = apply_filters('give_frontend_notice_args', $notice_args); |
|
625 | 625 | |
626 | 626 | $close_icon = 'manual' === $notice_args['dismiss_type'] ? |
627 | 627 | sprintf( |
628 | 628 | '<img class="notice-dismiss give-notice-close" src="%s" />', |
629 | - esc_url( GIVE_PLUGIN_URL . 'assets/dist/images/close.svg' ) |
|
629 | + esc_url(GIVE_PLUGIN_URL.'assets/dist/images/close.svg') |
|
630 | 630 | |
631 | - ) : |
|
632 | - ''; |
|
631 | + ) : ''; |
|
633 | 632 | |
634 | 633 | // Note: we will remove give_errors class in future. |
635 | 634 | $error = sprintf( |
@@ -640,15 +639,15 @@ discard block |
||
640 | 639 | %6$s |
641 | 640 | </div>', |
642 | 641 | $notice_type, |
643 | - give_clean( $notice_args['dismissible'] ), |
|
644 | - absint( $notice_args['dismiss_interval'] ), |
|
645 | - give_clean( $notice_args['dismiss_type'] ), |
|
642 | + give_clean($notice_args['dismissible']), |
|
643 | + absint($notice_args['dismiss_interval']), |
|
644 | + give_clean($notice_args['dismiss_type']), |
|
646 | 645 | $message, |
647 | 646 | $close_icon |
648 | 647 | |
649 | 648 | ); |
650 | 649 | |
651 | - if ( ! $echo ) { |
|
650 | + if ( ! $echo) { |
|
652 | 651 | return $error; |
653 | 652 | } |
654 | 653 | |
@@ -668,24 +667,24 @@ discard block |
||
668 | 667 | * |
669 | 668 | * @return string |
670 | 669 | */ |
671 | - public function print_admin_notices( $notice_args = array() ) { |
|
670 | + public function print_admin_notices($notice_args = array()) { |
|
672 | 671 | // Bailout. |
673 | - if ( empty( $notice_args['description'] ) ) { |
|
672 | + if (empty($notice_args['description'])) { |
|
674 | 673 | return ''; |
675 | 674 | } |
676 | 675 | |
677 | - $defaults = array( |
|
676 | + $defaults = array( |
|
678 | 677 | 'id' => '', |
679 | 678 | 'echo' => true, |
680 | 679 | 'notice_type' => 'warning', |
681 | 680 | 'dismissible' => true, |
682 | 681 | ); |
683 | - $notice_args = wp_parse_args( $notice_args, $defaults ); |
|
682 | + $notice_args = wp_parse_args($notice_args, $defaults); |
|
684 | 683 | |
685 | 684 | $output = ''; |
686 | - $css_id = ! empty( $notice_args['id'] ) ? $notice_args['id'] : uniqid( 'give-inline-notice-' ); |
|
685 | + $css_id = ! empty($notice_args['id']) ? $notice_args['id'] : uniqid('give-inline-notice-'); |
|
687 | 686 | $css_class = "notice-{$notice_args['notice_type']} give-notice notice inline"; |
688 | - $css_class .= ( $notice_args['dismissible'] ) ? ' is-dismissible' : ''; |
|
687 | + $css_class .= ($notice_args['dismissible']) ? ' is-dismissible' : ''; |
|
689 | 688 | $output .= sprintf( |
690 | 689 | '<div id="%1$s" class="%2$s"><p>%3$s</p></div>', |
691 | 690 | $css_id, |
@@ -693,7 +692,7 @@ discard block |
||
693 | 692 | $notice_args['description'] |
694 | 693 | ); |
695 | 694 | |
696 | - if ( ! $notice_args['echo'] ) { |
|
695 | + if ( ! $notice_args['echo']) { |
|
697 | 696 | return $output; |
698 | 697 | } |
699 | 698 |
@@ -20,17 +20,17 @@ 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 | - $currency = give_get_meta( $donation_or_form_id, '_give_payment_currency', true ); |
|
26 | + if (is_numeric($donation_or_form_id) && 'give_payment' === get_post_type($donation_or_form_id)) { |
|
27 | + $currency = give_get_meta($donation_or_form_id, '_give_payment_currency', true); |
|
28 | 28 | |
29 | - if ( empty( $currency ) ) { |
|
30 | - $currency = give_get_option( 'currency', 'USD' ); |
|
29 | + if (empty($currency)) { |
|
30 | + $currency = give_get_option('currency', 'USD'); |
|
31 | 31 | } |
32 | 32 | } else { |
33 | - $currency = give_get_option( 'currency', 'USD' ); |
|
33 | + $currency = give_get_option('currency', 'USD'); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * |
39 | 39 | * @since 1.0 |
40 | 40 | */ |
41 | - return apply_filters( 'give_currency', $currency, $donation_or_form_id, $args ); |
|
41 | + return apply_filters('give_currency', $currency, $donation_or_form_id, $args); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | */ |
51 | 51 | function give_get_currency_position() { |
52 | 52 | |
53 | - $currency_pos = give_get_option( 'currency_position', 'before' ); |
|
53 | + $currency_pos = give_get_option('currency_position', 'before'); |
|
54 | 54 | |
55 | - return apply_filters( 'give_currency_position', $currency_pos ); |
|
55 | + return apply_filters('give_currency_position', $currency_pos); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | function give_get_currencies_list() { |
66 | 66 | $currencies = array( |
67 | 67 | 'USD' => array( |
68 | - 'admin_label' => sprintf( __('US Dollars (%1$s)', 'give'), '$'), |
|
68 | + 'admin_label' => sprintf(__('US Dollars (%1$s)', 'give'), '$'), |
|
69 | 69 | 'symbol' => '$', |
70 | 70 | 'setting' => array( |
71 | 71 | 'currency_position' => 'before', |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | ), |
76 | 76 | ), |
77 | 77 | 'EUR' => array( |
78 | - 'admin_label' => sprintf( __('Euros (%1$s)', 'give'), '€'), |
|
78 | + 'admin_label' => sprintf(__('Euros (%1$s)', 'give'), '€'), |
|
79 | 79 | 'symbol' => '€', |
80 | 80 | 'setting' => array( |
81 | 81 | 'currency_position' => 'before', |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | ), |
86 | 86 | ), |
87 | 87 | 'GBP' => array( |
88 | - 'admin_label' => sprintf( __('Pounds Sterling (%1$s)', 'give'), '£'), |
|
88 | + 'admin_label' => sprintf(__('Pounds Sterling (%1$s)', 'give'), '£'), |
|
89 | 89 | 'symbol' => '£', |
90 | 90 | 'setting' => array( |
91 | 91 | 'currency_position' => 'before', |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ), |
96 | 96 | ), |
97 | 97 | 'AUD' => array( |
98 | - 'admin_label' => sprintf( __('Australian Dollars (%1$s)', 'give'), '$'), |
|
98 | + 'admin_label' => sprintf(__('Australian Dollars (%1$s)', 'give'), '$'), |
|
99 | 99 | 'symbol' => '$', |
100 | 100 | 'setting' => array( |
101 | 101 | 'currency_position' => 'before', |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | ), |
106 | 106 | ), |
107 | 107 | 'BRL' => array( |
108 | - 'admin_label' => sprintf( __('Brazilian Real (%1$s)', 'give'), 'R$'), |
|
108 | + 'admin_label' => sprintf(__('Brazilian Real (%1$s)', 'give'), 'R$'), |
|
109 | 109 | 'symbol' => 'R$', |
110 | 110 | 'setting' => array( |
111 | 111 | 'currency_position' => 'before', |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | ), |
116 | 116 | ), |
117 | 117 | 'CAD' => array( |
118 | - 'admin_label' => sprintf( __('Canadian Dollars (%1$s)', 'give'), '$'), |
|
118 | + 'admin_label' => sprintf(__('Canadian Dollars (%1$s)', 'give'), '$'), |
|
119 | 119 | 'symbol' => '$', |
120 | 120 | 'setting' => array( |
121 | 121 | 'currency_position' => 'before', |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | ), |
126 | 126 | ), |
127 | 127 | 'CZK' => array( |
128 | - 'admin_label' => sprintf( __('Czech Koruna (%1$s)', 'give'), 'Kč'), |
|
128 | + 'admin_label' => sprintf(__('Czech Koruna (%1$s)', 'give'), 'Kč'), |
|
129 | 129 | 'symbol' => 'Kč', |
130 | 130 | 'setting' => array( |
131 | 131 | 'currency_position' => 'after', |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | ), |
136 | 136 | ), |
137 | 137 | 'DKK' => array( |
138 | - 'admin_label' => sprintf( __('Danish Krone (%1$s)', 'give'), ' kr. '), |
|
138 | + 'admin_label' => sprintf(__('Danish Krone (%1$s)', 'give'), ' kr. '), |
|
139 | 139 | 'symbol' => ' kr. ', |
140 | 140 | 'setting' => array( |
141 | 141 | 'currency_position' => 'before', |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | ), |
146 | 146 | ), |
147 | 147 | 'HKD' => array( |
148 | - 'admin_label' => sprintf( __('Hong Kong Dollar (%1$s)', 'give'), '$'), |
|
148 | + 'admin_label' => sprintf(__('Hong Kong Dollar (%1$s)', 'give'), '$'), |
|
149 | 149 | 'symbol' => '$', |
150 | 150 | 'setting' => array( |
151 | 151 | 'currency_position' => 'before', |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | ), |
156 | 156 | ), |
157 | 157 | 'HUF' => array( |
158 | - 'admin_label' => sprintf( __('Hungarian Forint (%1$s)', 'give'), 'Ft'), |
|
158 | + 'admin_label' => sprintf(__('Hungarian Forint (%1$s)', 'give'), 'Ft'), |
|
159 | 159 | 'symbol' => 'Ft', |
160 | 160 | 'setting' => array( |
161 | 161 | 'currency_position' => 'after', |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | ), |
166 | 166 | ), |
167 | 167 | 'ILS' => array( |
168 | - 'admin_label' => sprintf( __('Israeli Shekel (%1$s)', 'give'), '₪'), |
|
168 | + 'admin_label' => sprintf(__('Israeli Shekel (%1$s)', 'give'), '₪'), |
|
169 | 169 | 'symbol' => '₪', |
170 | 170 | 'setting' => array( |
171 | 171 | 'currency_position' => 'after', |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | ), |
176 | 176 | ), |
177 | 177 | 'JPY' => array( |
178 | - 'admin_label' => sprintf( __('Japanese Yen (%1$s)', 'give'), '¥'), |
|
178 | + 'admin_label' => sprintf(__('Japanese Yen (%1$s)', 'give'), '¥'), |
|
179 | 179 | 'symbol' => '¥', |
180 | 180 | 'setting' => array( |
181 | 181 | 'currency_position' => 'before', |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | ), |
186 | 186 | ), |
187 | 187 | 'MYR' => array( |
188 | - 'admin_label' => sprintf( __('Malaysian Ringgits (%1$s)', 'give'), 'RM'), |
|
188 | + 'admin_label' => sprintf(__('Malaysian Ringgits (%1$s)', 'give'), 'RM'), |
|
189 | 189 | 'symbol' => 'RM', |
190 | 190 | 'setting' => array( |
191 | 191 | 'currency_position' => 'before', |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | ), |
196 | 196 | ), |
197 | 197 | 'MXN' => array( |
198 | - 'admin_label' => sprintf( __('Mexican Peso (%1$s)', 'give'), '$'), |
|
198 | + 'admin_label' => sprintf(__('Mexican Peso (%1$s)', 'give'), '$'), |
|
199 | 199 | 'symbol' => '$', |
200 | 200 | 'setting' => array( |
201 | 201 | 'currency_position' => 'before', |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | ), |
206 | 206 | ), |
207 | 207 | 'MAD' => array( |
208 | - 'admin_label' => sprintf( __('Moroccan Dirham (%1$s)', 'give'), '.د.م'), |
|
208 | + 'admin_label' => sprintf(__('Moroccan Dirham (%1$s)', 'give'), '.د.م'), |
|
209 | 209 | 'symbol' => '.د.م', |
210 | 210 | 'setting' => array( |
211 | 211 | 'currency_position' => 'before', |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | ), |
216 | 216 | ), |
217 | 217 | 'NZD' => array( |
218 | - 'admin_label' => sprintf( __('New Zealand Dollar (%1$s)', 'give'), '$'), |
|
218 | + 'admin_label' => sprintf(__('New Zealand Dollar (%1$s)', 'give'), '$'), |
|
219 | 219 | 'symbol' => '$', |
220 | 220 | 'setting' => array( |
221 | 221 | 'currency_position' => 'before', |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | ), |
226 | 226 | ), |
227 | 227 | 'NOK' => array( |
228 | - 'admin_label' => sprintf( __('Norwegian Krone (%1$s)', 'give'), 'kr.'), |
|
228 | + 'admin_label' => sprintf(__('Norwegian Krone (%1$s)', 'give'), 'kr.'), |
|
229 | 229 | 'symbol' => 'kr.', |
230 | 230 | 'setting' => array( |
231 | 231 | 'currency_position' => 'before', |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | ), |
236 | 236 | ), |
237 | 237 | 'PHP' => array( |
238 | - 'admin_label' => sprintf( __('Philippine Pesos (%1$s)', 'give'), '₱'), |
|
238 | + 'admin_label' => sprintf(__('Philippine Pesos (%1$s)', 'give'), '₱'), |
|
239 | 239 | 'symbol' => '₱', |
240 | 240 | 'setting' => array( |
241 | 241 | 'currency_position' => 'before', |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | ), |
246 | 246 | ), |
247 | 247 | 'PLN' => array( |
248 | - 'admin_label' => sprintf( __('Polish Zloty (%1$s)', 'give'), 'zł'), |
|
248 | + 'admin_label' => sprintf(__('Polish Zloty (%1$s)', 'give'), 'zł'), |
|
249 | 249 | 'symbol' => 'zł', |
250 | 250 | 'setting' => array( |
251 | 251 | 'currency_position' => 'after', |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | ), |
256 | 256 | ), |
257 | 257 | 'SGD' => array( |
258 | - 'admin_label' => sprintf( __('Singapore Dollar (%1$s)', 'give'), '$'), |
|
258 | + 'admin_label' => sprintf(__('Singapore Dollar (%1$s)', 'give'), '$'), |
|
259 | 259 | 'symbol' => '$', |
260 | 260 | 'setting' => array( |
261 | 261 | 'currency_position' => 'before', |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | ), |
266 | 266 | ), |
267 | 267 | 'KRW' => array( |
268 | - 'admin_label' => sprintf( __('South Korean Won (%1$s)', 'give'), '₩'), |
|
268 | + 'admin_label' => sprintf(__('South Korean Won (%1$s)', 'give'), '₩'), |
|
269 | 269 | 'symbol' => '₩', |
270 | 270 | 'setting' => array( |
271 | 271 | 'currency_position' => 'before', |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | ), |
276 | 276 | ), |
277 | 277 | 'ZAR' => array( |
278 | - 'admin_label' => sprintf( __('South African Rand (%1$s)', 'give'), 'R'), |
|
278 | + 'admin_label' => sprintf(__('South African Rand (%1$s)', 'give'), 'R'), |
|
279 | 279 | 'symbol' => 'R', |
280 | 280 | 'setting' => array( |
281 | 281 | 'currency_position' => 'before', |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | ), |
286 | 286 | ), |
287 | 287 | 'SEK' => array( |
288 | - 'admin_label' => sprintf( __('Swedish Krona (%1$s)', 'give'), ' kr. '), |
|
288 | + 'admin_label' => sprintf(__('Swedish Krona (%1$s)', 'give'), ' kr. '), |
|
289 | 289 | 'symbol' => ' kr. ', |
290 | 290 | 'setting' => array( |
291 | 291 | 'currency_position' => 'before', |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | ), |
296 | 296 | ), |
297 | 297 | 'CHF' => array( |
298 | - 'admin_label' => sprintf( __('Swiss Franc (%1$s)', 'give'), 'Fr'), |
|
298 | + 'admin_label' => sprintf(__('Swiss Franc (%1$s)', 'give'), 'Fr'), |
|
299 | 299 | 'symbol' => 'Fr', |
300 | 300 | 'setting' => array( |
301 | 301 | 'currency_position' => 'before', |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | ), |
306 | 306 | ), |
307 | 307 | 'TWD' => array( |
308 | - 'admin_label' => sprintf( __('Taiwan New Dollars (%1$s)', 'give'), 'NT$'), |
|
308 | + 'admin_label' => sprintf(__('Taiwan New Dollars (%1$s)', 'give'), 'NT$'), |
|
309 | 309 | 'symbol' => 'NT$', |
310 | 310 | 'setting' => array( |
311 | 311 | 'currency_position' => 'before', |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | ), |
316 | 316 | ), |
317 | 317 | 'THB' => array( |
318 | - 'admin_label' => sprintf( __('Thai Baht (%1$s)', 'give'), '฿'), |
|
318 | + 'admin_label' => sprintf(__('Thai Baht (%1$s)', 'give'), '฿'), |
|
319 | 319 | 'symbol' => '฿', |
320 | 320 | 'setting' => array( |
321 | 321 | 'currency_position' => 'before', |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | ), |
326 | 326 | ), |
327 | 327 | 'INR' => array( |
328 | - 'admin_label' => sprintf( __('Indian Rupee (%1$s)', 'give'), '₹'), |
|
328 | + 'admin_label' => sprintf(__('Indian Rupee (%1$s)', 'give'), '₹'), |
|
329 | 329 | 'symbol' => '₹', |
330 | 330 | 'setting' => array( |
331 | 331 | 'currency_position' => 'before', |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | ), |
336 | 336 | ), |
337 | 337 | 'TRY' => array( |
338 | - 'admin_label' => sprintf( __('Turkish Lira (%1$s)', 'give'), '₺'), |
|
338 | + 'admin_label' => sprintf(__('Turkish Lira (%1$s)', 'give'), '₺'), |
|
339 | 339 | 'symbol' => '₺', |
340 | 340 | 'setting' => array( |
341 | 341 | 'currency_position' => 'after', |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | ), |
346 | 346 | ), |
347 | 347 | 'IRR' => array( |
348 | - 'admin_label' => sprintf( __('Iranian Rial (%1$s)', 'give'), '﷼'), |
|
348 | + 'admin_label' => sprintf(__('Iranian Rial (%1$s)', 'give'), '﷼'), |
|
349 | 349 | 'symbol' => '﷼', |
350 | 350 | 'setting' => array( |
351 | 351 | 'currency_position' => 'after', |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | ), |
356 | 356 | ), |
357 | 357 | 'RUB' => array( |
358 | - 'admin_label' => sprintf( __('Russian Rubles (%1$s)', 'give'), '₽'), |
|
358 | + 'admin_label' => sprintf(__('Russian Rubles (%1$s)', 'give'), '₽'), |
|
359 | 359 | 'symbol' => '₽', |
360 | 360 | 'setting' => array( |
361 | 361 | 'currency_position' => 'before', |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | ), |
366 | 366 | ), |
367 | 367 | 'AED' => array( |
368 | - 'admin_label' => sprintf( __('United Arab Emirates dirham (%1$s)', 'give'), 'د.إ'), |
|
368 | + 'admin_label' => sprintf(__('United Arab Emirates dirham (%1$s)', 'give'), 'د.إ'), |
|
369 | 369 | 'symbol' => 'د.إ', |
370 | 370 | 'setting' => array( |
371 | 371 | 'currency_position' => 'before', |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | ), |
376 | 376 | ), |
377 | 377 | 'AMD' => array( |
378 | - 'admin_label' => sprintf( __('Armenian dram (%1$s)', 'give'), 'AMD'), |
|
378 | + 'admin_label' => sprintf(__('Armenian dram (%1$s)', 'give'), 'AMD'), |
|
379 | 379 | 'symbol' => 'AMD', // Add backward compatibility. Using AMD in place of ֏ |
380 | 380 | 'setting' => array( |
381 | 381 | 'currency_position' => 'before', |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | ), |
386 | 386 | ), |
387 | 387 | 'ANG' => array( |
388 | - 'admin_label' => sprintf( __('Netherlands Antillean guilder (%1$s)', 'give'), 'ƒ'), |
|
388 | + 'admin_label' => sprintf(__('Netherlands Antillean guilder (%1$s)', 'give'), 'ƒ'), |
|
389 | 389 | 'symbol' => 'ƒ', |
390 | 390 | 'setting' => array( |
391 | 391 | 'currency_position' => 'before', |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | ), |
396 | 396 | ), |
397 | 397 | 'ARS' => array( |
398 | - 'admin_label' => sprintf( __('Argentine peso (%1$s)', 'give'), '$'), |
|
398 | + 'admin_label' => sprintf(__('Argentine peso (%1$s)', 'give'), '$'), |
|
399 | 399 | 'symbol' => '$', |
400 | 400 | 'setting' => array( |
401 | 401 | 'currency_position' => 'before', |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | ), |
406 | 406 | ), |
407 | 407 | 'AWG' => array( |
408 | - 'admin_label' => sprintf( __( 'Aruban florin (%1$s)', 'give' ), 'ƒ' ), |
|
408 | + 'admin_label' => sprintf(__('Aruban florin (%1$s)', 'give'), 'ƒ'), |
|
409 | 409 | 'symbol' => 'ƒ', |
410 | 410 | 'setting' => array( |
411 | 411 | 'currency_position' => 'before', |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | ), |
416 | 416 | ), |
417 | 417 | 'BAM' => array( |
418 | - 'admin_label' => sprintf( __( 'Bosnia and Herzegovina convertible mark (%1$s)', 'give' ), 'KM' ), |
|
418 | + 'admin_label' => sprintf(__('Bosnia and Herzegovina convertible mark (%1$s)', 'give'), 'KM'), |
|
419 | 419 | 'symbol' => 'KM', |
420 | 420 | 'setting' => array( |
421 | 421 | 'currency_position' => 'before', |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | ), |
426 | 426 | ), |
427 | 427 | 'BDT' => array( |
428 | - 'admin_label' => sprintf( __( 'Bangladeshi taka (%1$s)', 'give' ), '৳' ), |
|
428 | + 'admin_label' => sprintf(__('Bangladeshi taka (%1$s)', 'give'), '৳'), |
|
429 | 429 | 'symbol' => '৳', |
430 | 430 | 'setting' => array( |
431 | 431 | 'currency_position' => 'before', |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | ), |
436 | 436 | ), |
437 | 437 | 'BHD' => array( |
438 | - 'admin_label' => sprintf( __( 'Bahraini dinar (%1$s)', 'give' ), '.د.ب' ), |
|
438 | + 'admin_label' => sprintf(__('Bahraini dinar (%1$s)', 'give'), '.د.ب'), |
|
439 | 439 | 'symbol' => '.د.ب', |
440 | 440 | 'setting' => array( |
441 | 441 | 'currency_position' => 'before', |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | ), |
446 | 446 | ), |
447 | 447 | 'BMD' => array( |
448 | - 'admin_label' => sprintf( __( 'Bermudian dollar (%1$s)', 'give' ), 'BD$' ), |
|
448 | + 'admin_label' => sprintf(__('Bermudian dollar (%1$s)', 'give'), 'BD$'), |
|
449 | 449 | 'symbol' => 'BD$', |
450 | 450 | 'setting' => array( |
451 | 451 | 'currency_position' => 'before', |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | ), |
456 | 456 | ), |
457 | 457 | 'BND' => array( |
458 | - 'admin_label' => sprintf( __( 'Brunei dollar (%1$s)', 'give' ), 'B$' ), |
|
458 | + 'admin_label' => sprintf(__('Brunei dollar (%1$s)', 'give'), 'B$'), |
|
459 | 459 | 'symbol' => 'B$', |
460 | 460 | 'setting' => array( |
461 | 461 | 'currency_position' => 'before', |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | ), |
466 | 466 | ), |
467 | 467 | 'BOB' => array( |
468 | - 'admin_label' => sprintf( __( 'Bolivian boliviano (%1$s)', 'give' ), 'Bs.' ), |
|
468 | + 'admin_label' => sprintf(__('Bolivian boliviano (%1$s)', 'give'), 'Bs.'), |
|
469 | 469 | 'symbol' => 'Bs.', |
470 | 470 | 'setting' => array( |
471 | 471 | 'currency_position' => 'before', |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | ), |
476 | 476 | ), |
477 | 477 | 'BSD' => array( |
478 | - 'admin_label' => sprintf( __( 'Bahamian dollar (%1$s)', 'give' ), 'B$' ), |
|
478 | + 'admin_label' => sprintf(__('Bahamian dollar (%1$s)', 'give'), 'B$'), |
|
479 | 479 | 'symbol' => 'B$', |
480 | 480 | 'setting' => array( |
481 | 481 | 'currency_position' => 'before', |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | ), |
486 | 486 | ), |
487 | 487 | 'BWP' => array( |
488 | - 'admin_label' => sprintf( __( 'Botswana pula (%1$s)', 'give' ), 'P' ), |
|
488 | + 'admin_label' => sprintf(__('Botswana pula (%1$s)', 'give'), 'P'), |
|
489 | 489 | 'symbol' => 'P', |
490 | 490 | 'setting' => array( |
491 | 491 | 'currency_position' => 'before', |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | ), |
496 | 496 | ), |
497 | 497 | 'BZD' => array( |
498 | - 'admin_label' => sprintf( __( 'Belizean dollar (%1$s)', 'give' ), 'BZ$' ), |
|
498 | + 'admin_label' => sprintf(__('Belizean dollar (%1$s)', 'give'), 'BZ$'), |
|
499 | 499 | 'symbol' => 'BZ$', |
500 | 500 | 'setting' => array( |
501 | 501 | 'currency_position' => 'before', |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | ), |
506 | 506 | ), |
507 | 507 | 'CLP' => array( |
508 | - 'admin_label' => sprintf( __( 'Chilean peso (%1$s)', 'give' ), '$' ), |
|
508 | + 'admin_label' => sprintf(__('Chilean peso (%1$s)', 'give'), '$'), |
|
509 | 509 | 'symbol' => '$', |
510 | 510 | 'setting' => array( |
511 | 511 | 'currency_position' => 'before', |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | ), |
516 | 516 | ), |
517 | 517 | 'CNY' => array( |
518 | - 'admin_label' => sprintf( __( 'Chinese yuan (%1$s)', 'give' ), '¥' ), |
|
518 | + 'admin_label' => sprintf(__('Chinese yuan (%1$s)', 'give'), '¥'), |
|
519 | 519 | 'symbol' => '¥', |
520 | 520 | 'setting' => array( |
521 | 521 | 'currency_position' => 'before', |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | ), |
526 | 526 | ), |
527 | 527 | 'COP' => array( |
528 | - 'admin_label' => sprintf( __( 'Colombian peso (%1$s)', 'give' ), '$' ), |
|
528 | + 'admin_label' => sprintf(__('Colombian peso (%1$s)', 'give'), '$'), |
|
529 | 529 | 'symbol' => '$', |
530 | 530 | 'setting' => array( |
531 | 531 | 'currency_position' => 'before', |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | ), |
536 | 536 | ), |
537 | 537 | 'CRC' => array( |
538 | - 'admin_label' => sprintf( __( 'Costa Rican colón (%1$s)', 'give' ), '₡' ), |
|
538 | + 'admin_label' => sprintf(__('Costa Rican colón (%1$s)', 'give'), '₡'), |
|
539 | 539 | 'symbol' => '₡', |
540 | 540 | 'setting' => array( |
541 | 541 | 'currency_position' => 'before', |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | ), |
546 | 546 | ), |
547 | 547 | 'CUC' => array( |
548 | - 'admin_label' => sprintf( __( 'Cuban convertible peso (%1$s)', 'give' ), '₱' ), |
|
548 | + 'admin_label' => sprintf(__('Cuban convertible peso (%1$s)', 'give'), '₱'), |
|
549 | 549 | 'symbol' => '₱', |
550 | 550 | 'setting' => array( |
551 | 551 | 'currency_position' => 'before', |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | ), |
556 | 556 | ), |
557 | 557 | 'CUP' => array( |
558 | - 'admin_label' => sprintf( __( 'Cuban convertible peso (%1$s)', 'give' ), '₱' ), |
|
558 | + 'admin_label' => sprintf(__('Cuban convertible peso (%1$s)', 'give'), '₱'), |
|
559 | 559 | 'symbol' => '₱', |
560 | 560 | 'setting' => array( |
561 | 561 | 'currency_position' => 'before', |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | ), |
566 | 566 | ), |
567 | 567 | 'DOP' => array( |
568 | - 'admin_label' => sprintf( __( 'Dominican peso (%1$s)', 'give' ), 'RD$' ), |
|
568 | + 'admin_label' => sprintf(__('Dominican peso (%1$s)', 'give'), 'RD$'), |
|
569 | 569 | 'symbol' => 'RD$', |
570 | 570 | 'setting' => array( |
571 | 571 | 'currency_position' => 'before', |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | ), |
576 | 576 | ), |
577 | 577 | 'EGP' => array( |
578 | - 'admin_label' => sprintf( __( 'Egyptian pound (%1$s)', 'give' ), 'E£' ), |
|
578 | + 'admin_label' => sprintf(__('Egyptian pound (%1$s)', 'give'), 'E£'), |
|
579 | 579 | 'symbol' => 'E£', |
580 | 580 | 'setting' => array( |
581 | 581 | 'currency_position' => 'before', |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | ), |
586 | 586 | ), |
587 | 587 | 'GIP' => array( |
588 | - 'admin_label' => sprintf( __( 'Gibraltar pound (%1$s)', 'give' ), '£' ), |
|
588 | + 'admin_label' => sprintf(__('Gibraltar pound (%1$s)', 'give'), '£'), |
|
589 | 589 | 'symbol' => '£', |
590 | 590 | 'setting' => array( |
591 | 591 | 'currency_position' => 'before', |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | ), |
596 | 596 | ), |
597 | 597 | 'GTQ' => array( |
598 | - 'admin_label' => sprintf( __( 'Guatemalan quetzal (%1$s)', 'give' ), 'Q' ), |
|
598 | + 'admin_label' => sprintf(__('Guatemalan quetzal (%1$s)', 'give'), 'Q'), |
|
599 | 599 | 'symbol' => 'Q', |
600 | 600 | 'setting' => array( |
601 | 601 | 'currency_position' => 'before', |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | ), |
606 | 606 | ), |
607 | 607 | 'HNL' => array( |
608 | - 'admin_label' => sprintf( __( 'Honduran lempira (%1$s)', 'give' ), 'L' ), |
|
608 | + 'admin_label' => sprintf(__('Honduran lempira (%1$s)', 'give'), 'L'), |
|
609 | 609 | 'symbol' => 'L', |
610 | 610 | 'setting' => array( |
611 | 611 | 'currency_position' => 'before', |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | ), |
616 | 616 | ), |
617 | 617 | 'HRK' => array( |
618 | - 'admin_label' => sprintf( __( 'Croatian kuna (%1$s)', 'give' ), 'kn' ), |
|
618 | + 'admin_label' => sprintf(__('Croatian kuna (%1$s)', 'give'), 'kn'), |
|
619 | 619 | 'symbol' => 'kn', |
620 | 620 | 'setting' => array( |
621 | 621 | 'currency_position' => 'after', |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | ), |
626 | 626 | ), |
627 | 627 | 'IDR' => array( |
628 | - 'admin_label' => sprintf( __( 'Indonesian rupiah (%1$s)', 'give' ), 'Rp' ), |
|
628 | + 'admin_label' => sprintf(__('Indonesian rupiah (%1$s)', 'give'), 'Rp'), |
|
629 | 629 | 'symbol' => 'Rp', |
630 | 630 | 'setting' => array( |
631 | 631 | 'currency_position' => 'before', |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | ), |
636 | 636 | ), |
637 | 637 | 'ISK' => array( |
638 | - 'admin_label' => sprintf( __( 'Icelandic króna (%1$s)', 'give' ), 'kr' ), |
|
638 | + 'admin_label' => sprintf(__('Icelandic króna (%1$s)', 'give'), 'kr'), |
|
639 | 639 | 'symbol' => 'kr', |
640 | 640 | 'setting' => array( |
641 | 641 | 'currency_position' => 'after', |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | ), |
646 | 646 | ), |
647 | 647 | 'JMD' => array( |
648 | - 'admin_label' => sprintf( __( 'Jamaican dollar (%1$s)', 'give' ), 'j$' ), |
|
648 | + 'admin_label' => sprintf(__('Jamaican dollar (%1$s)', 'give'), 'j$'), |
|
649 | 649 | 'symbol' => 'j$', |
650 | 650 | 'setting' => array( |
651 | 651 | 'currency_position' => 'before', |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | ), |
656 | 656 | ), |
657 | 657 | 'JOD' => array( |
658 | - 'admin_label' => sprintf( __( 'Jordanian dinar (%1$s)', 'give' ), 'د.ا' ), |
|
658 | + 'admin_label' => sprintf(__('Jordanian dinar (%1$s)', 'give'), 'د.ا'), |
|
659 | 659 | 'symbol' => 'د.ا', |
660 | 660 | 'setting' => array( |
661 | 661 | 'currency_position' => 'before', |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | ), |
666 | 666 | ), |
667 | 667 | 'KES' => array( |
668 | - 'admin_label' => sprintf( __( 'Kenyan shilling (%1$s)', 'give' ), 'KSh' ), |
|
668 | + 'admin_label' => sprintf(__('Kenyan shilling (%1$s)', 'give'), 'KSh'), |
|
669 | 669 | 'symbol' => 'KSh', |
670 | 670 | 'setting' => array( |
671 | 671 | 'currency_position' => 'before', |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | ), |
676 | 676 | ), |
677 | 677 | 'KWD' => array( |
678 | - 'admin_label' => sprintf( __( 'Kuwaiti dinar (%1$s)', 'give' ), 'د.ك' ), |
|
678 | + 'admin_label' => sprintf(__('Kuwaiti dinar (%1$s)', 'give'), 'د.ك'), |
|
679 | 679 | 'symbol' => 'د.ك', |
680 | 680 | 'setting' => array( |
681 | 681 | 'currency_position' => 'before', |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | ), |
686 | 686 | ), |
687 | 687 | 'KYD' => array( |
688 | - 'admin_label' => sprintf( __( 'Cayman Islands dollar (%1$s)', 'give' ), 'KY$' ), |
|
688 | + 'admin_label' => sprintf(__('Cayman Islands dollar (%1$s)', 'give'), 'KY$'), |
|
689 | 689 | 'symbol' => 'KY$', |
690 | 690 | 'setting' => array( |
691 | 691 | 'currency_position' => 'before', |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | ), |
696 | 696 | ), |
697 | 697 | 'MKD' => array( |
698 | - 'admin_label' => sprintf( __( 'Macedonian denar (%1$s)', 'give' ), 'ден' ), |
|
698 | + 'admin_label' => sprintf(__('Macedonian denar (%1$s)', 'give'), 'ден'), |
|
699 | 699 | 'symbol' => 'ден', |
700 | 700 | 'setting' => array( |
701 | 701 | 'currency_position' => 'before', |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | ), |
706 | 706 | ), |
707 | 707 | 'NPR' => array( |
708 | - 'admin_label' => sprintf( __( 'Nepalese rupee (%1$s)', 'give' ), '₨' ), |
|
708 | + 'admin_label' => sprintf(__('Nepalese rupee (%1$s)', 'give'), '₨'), |
|
709 | 709 | 'symbol' => '₨', |
710 | 710 | 'setting' => array( |
711 | 711 | 'currency_position' => 'before', |
@@ -715,7 +715,7 @@ discard block |
||
715 | 715 | ), |
716 | 716 | ), |
717 | 717 | 'OMR' => array( |
718 | - 'admin_label' => sprintf( __( 'Omani rial (%1$s)', 'give' ), 'ر.ع.' ), |
|
718 | + 'admin_label' => sprintf(__('Omani rial (%1$s)', 'give'), 'ر.ع.'), |
|
719 | 719 | 'symbol' => 'ر.ع.', |
720 | 720 | 'setting' => array( |
721 | 721 | 'currency_position' => 'before', |
@@ -725,7 +725,7 @@ discard block |
||
725 | 725 | ), |
726 | 726 | ), |
727 | 727 | 'PEN' => array( |
728 | - 'admin_label' => sprintf( __( 'Peruvian nuevo sol (%1$s)', 'give' ), 'S/.' ), |
|
728 | + 'admin_label' => sprintf(__('Peruvian nuevo sol (%1$s)', 'give'), 'S/.'), |
|
729 | 729 | 'symbol' => 'S/.', |
730 | 730 | 'setting' => array( |
731 | 731 | 'currency_position' => 'before', |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | ), |
736 | 736 | ), |
737 | 737 | 'PKR' => array( |
738 | - 'admin_label' => sprintf( __( 'Pakistani rupee (%1$s)', 'give' ), '₨' ), |
|
738 | + 'admin_label' => sprintf(__('Pakistani rupee (%1$s)', 'give'), '₨'), |
|
739 | 739 | 'symbol' => '₨', |
740 | 740 | 'setting' => array( |
741 | 741 | 'currency_position' => 'before', |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | ), |
746 | 746 | ), |
747 | 747 | 'RON' => array( |
748 | - 'admin_label' => sprintf( __( 'Romanian leu (%1$s)', 'give' ), 'L' ), |
|
748 | + 'admin_label' => sprintf(__('Romanian leu (%1$s)', 'give'), 'L'), |
|
749 | 749 | 'symbol' => 'L', |
750 | 750 | 'setting' => array( |
751 | 751 | 'currency_position' => 'after', |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | ), |
756 | 756 | ), |
757 | 757 | 'SAR' => array( |
758 | - 'admin_label' => sprintf( __( 'Saudi riyal (%1$s)', 'give' ), 'ر.س' ), |
|
758 | + 'admin_label' => sprintf(__('Saudi riyal (%1$s)', 'give'), 'ر.س'), |
|
759 | 759 | 'symbol' => 'ر.س', |
760 | 760 | 'setting' => array( |
761 | 761 | 'currency_position' => 'before', |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | ), |
766 | 766 | ), |
767 | 767 | 'SZL' => array( |
768 | - 'admin_label' => sprintf( __( 'Swazi lilangeni (%1$s)', 'give' ), 'L'), |
|
768 | + 'admin_label' => sprintf(__('Swazi lilangeni (%1$s)', 'give'), 'L'), |
|
769 | 769 | 'symbol' => 'L', |
770 | 770 | 'setting' => array( |
771 | 771 | 'currency_position' => 'before', |
@@ -775,7 +775,7 @@ discard block |
||
775 | 775 | ), |
776 | 776 | ), |
777 | 777 | 'TOP' => array( |
778 | - 'admin_label' => sprintf( __( 'Tongan paʻanga (%1$s)', 'give' ), 'T$'), |
|
778 | + 'admin_label' => sprintf(__('Tongan paʻanga (%1$s)', 'give'), 'T$'), |
|
779 | 779 | 'symbol' => 'T$', |
780 | 780 | 'setting' => array( |
781 | 781 | 'currency_position' => 'before', |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | ), |
786 | 786 | ), |
787 | 787 | 'TZS' => array( |
788 | - 'admin_label' => sprintf( __( 'Tanzanian shilling (%1$s)', 'give' ), 'TSh'), |
|
788 | + 'admin_label' => sprintf(__('Tanzanian shilling (%1$s)', 'give'), 'TSh'), |
|
789 | 789 | 'symbol' => 'TSh', |
790 | 790 | 'setting' => array( |
791 | 791 | 'currency_position' => 'before', |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | ), |
796 | 796 | ), |
797 | 797 | 'UAH' => array( |
798 | - 'admin_label' => sprintf( __( 'Ukrainian hryvnia (%1$s)', 'give' ), '₴'), |
|
798 | + 'admin_label' => sprintf(__('Ukrainian hryvnia (%1$s)', 'give'), '₴'), |
|
799 | 799 | 'symbol' => '₴', |
800 | 800 | 'setting' => array( |
801 | 801 | 'currency_position' => 'before', |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | ), |
806 | 806 | ), |
807 | 807 | 'UYU' => array( |
808 | - 'admin_label' => sprintf( __( 'Uruguayan peso (%1$s)', 'give' ), '$U'), |
|
808 | + 'admin_label' => sprintf(__('Uruguayan peso (%1$s)', 'give'), '$U'), |
|
809 | 809 | 'symbol' => '$U', |
810 | 810 | 'setting' => array( |
811 | 811 | 'currency_position' => 'before', |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | ), |
816 | 816 | ), |
817 | 817 | 'VEF' => array( |
818 | - 'admin_label' => sprintf( __( 'Venezuelan bolívar (%1$s)', 'give' ), 'Bs'), |
|
818 | + 'admin_label' => sprintf(__('Venezuelan bolívar (%1$s)', 'give'), 'Bs'), |
|
819 | 819 | 'symbol' => 'Bs', |
820 | 820 | 'setting' => array( |
821 | 821 | 'currency_position' => 'before', |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | ), |
826 | 826 | ), |
827 | 827 | 'XCD' => array( |
828 | - 'admin_label' => sprintf( __( 'East Caribbean dollar (%1$s)', 'give' ), 'EC$'), |
|
828 | + 'admin_label' => sprintf(__('East Caribbean dollar (%1$s)', 'give'), 'EC$'), |
|
829 | 829 | 'symbol' => 'EC$', |
830 | 830 | 'setting' => array( |
831 | 831 | 'currency_position' => 'before', |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | * |
851 | 851 | * @param array $currencies |
852 | 852 | */ |
853 | - return (array) apply_filters( 'give_currencies', $currencies ); |
|
853 | + return (array) apply_filters('give_currencies', $currencies); |
|
854 | 854 | } |
855 | 855 | |
856 | 856 | /** |
@@ -862,22 +862,22 @@ discard block |
||
862 | 862 | * |
863 | 863 | * @return array $currencies A list of the available currencies |
864 | 864 | */ |
865 | -function give_get_currencies( $info = 'admin_label' ) { |
|
865 | +function give_get_currencies($info = 'admin_label') { |
|
866 | 866 | |
867 | 867 | $currencies = give_get_currencies_list(); |
868 | 868 | |
869 | 869 | // Backward compatibility: handle old way of currency registration. |
870 | 870 | // Backward compatibility: Return desired result. |
871 | - if ( ! empty( $currencies ) ) { |
|
872 | - foreach ( $currencies as $currency_code => $currency_setting ) { |
|
873 | - if ( is_string( $currency_setting ) ) { |
|
874 | - $currencies[ $currency_code ] = array( |
|
871 | + if ( ! empty($currencies)) { |
|
872 | + foreach ($currencies as $currency_code => $currency_setting) { |
|
873 | + if (is_string($currency_setting)) { |
|
874 | + $currencies[$currency_code] = array( |
|
875 | 875 | 'admin_label' => $currency_setting, |
876 | 876 | ); |
877 | 877 | } |
878 | 878 | |
879 | - $currencies[ $currency_code ] = wp_parse_args( |
|
880 | - $currencies[ $currency_code ], |
|
879 | + $currencies[$currency_code] = wp_parse_args( |
|
880 | + $currencies[$currency_code], |
|
881 | 881 | array( |
882 | 882 | 'admin_label' => '', |
883 | 883 | 'symbol' => $currency_code, |
@@ -886,8 +886,8 @@ discard block |
||
886 | 886 | ); |
887 | 887 | } |
888 | 888 | |
889 | - if ( ! empty( $info ) && is_string( $info ) && 'all' !== $info ) { |
|
890 | - $currencies = wp_list_pluck( $currencies, $info ); |
|
889 | + if ( ! empty($info) && is_string($info) && 'all' !== $info) { |
|
890 | + $currencies = wp_list_pluck($currencies, $info); |
|
891 | 891 | } |
892 | 892 | } |
893 | 893 | |
@@ -904,12 +904,12 @@ discard block |
||
904 | 904 | * |
905 | 905 | * @return array |
906 | 906 | */ |
907 | -function give_currency_symbols( $decode_currencies = false ) { |
|
908 | - $currencies = give_get_currencies( 'symbol' ); |
|
907 | +function give_currency_symbols($decode_currencies = false) { |
|
908 | + $currencies = give_get_currencies('symbol'); |
|
909 | 909 | |
910 | - if ( $decode_currencies ) { |
|
911 | - array_walk( $currencies, function ( &$currency_symbol ) { |
|
912 | - $currency_symbol = html_entity_decode( $currency_symbol, ENT_COMPAT, 'UTF-8' ); |
|
910 | + if ($decode_currencies) { |
|
911 | + array_walk($currencies, function(&$currency_symbol) { |
|
912 | + $currency_symbol = html_entity_decode($currency_symbol, ENT_COMPAT, 'UTF-8'); |
|
913 | 913 | } ); |
914 | 914 | } |
915 | 915 | |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | * |
921 | 921 | * @param array $currencies |
922 | 922 | */ |
923 | - return apply_filters( 'give_currency_symbols', $currencies ); |
|
923 | + return apply_filters('give_currency_symbols', $currencies); |
|
924 | 924 | } |
925 | 925 | |
926 | 926 | |
@@ -937,14 +937,14 @@ discard block |
||
937 | 937 | * |
938 | 938 | * @return string The symbol to use for the currency |
939 | 939 | */ |
940 | -function give_currency_symbol( $currency = '', $decode_currency = false ) { |
|
940 | +function give_currency_symbol($currency = '', $decode_currency = false) { |
|
941 | 941 | |
942 | - if ( empty( $currency ) ) { |
|
942 | + if (empty($currency)) { |
|
943 | 943 | $currency = give_get_currency(); |
944 | 944 | } |
945 | 945 | |
946 | - $currencies = give_currency_symbols( $decode_currency ); |
|
947 | - $symbol = array_key_exists( $currency, $currencies ) ? $currencies[ $currency ] : $currency; |
|
946 | + $currencies = give_currency_symbols($decode_currency); |
|
947 | + $symbol = array_key_exists($currency, $currencies) ? $currencies[$currency] : $currency; |
|
948 | 948 | |
949 | 949 | /** |
950 | 950 | * Filter the currency symbol |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | * @param string $symbol |
955 | 955 | * @param string $currency |
956 | 956 | */ |
957 | - return apply_filters( 'give_currency_symbol', $symbol, $currency ); |
|
957 | + return apply_filters('give_currency_symbol', $symbol, $currency); |
|
958 | 958 | } |
959 | 959 | |
960 | 960 | |
@@ -967,13 +967,13 @@ discard block |
||
967 | 967 | * |
968 | 968 | * @return string |
969 | 969 | */ |
970 | -function give_get_currency_name( $currency_code ) { |
|
970 | +function give_get_currency_name($currency_code) { |
|
971 | 971 | $currency_name = ''; |
972 | 972 | $currency_names = give_get_currencies(); |
973 | 973 | |
974 | - if ( $currency_code && array_key_exists( $currency_code, $currency_names ) ) { |
|
975 | - $currency_name = explode( '(', $currency_names[ $currency_code ] ); |
|
976 | - $currency_name = trim( current( $currency_name ) ); |
|
974 | + if ($currency_code && array_key_exists($currency_code, $currency_names)) { |
|
975 | + $currency_name = explode('(', $currency_names[$currency_code]); |
|
976 | + $currency_name = trim(current($currency_name)); |
|
977 | 977 | } |
978 | 978 | |
979 | 979 | /** |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | * @param string $currency_name |
985 | 985 | * @param string $currency_code |
986 | 986 | */ |
987 | - return apply_filters( 'give_currency_name', $currency_name, $currency_code ); |
|
987 | + return apply_filters('give_currency_name', $currency_name, $currency_code); |
|
988 | 988 | } |
989 | 989 | |
990 | 990 | /** |
@@ -997,20 +997,20 @@ discard block |
||
997 | 997 | * |
998 | 998 | * @return mixed|string |
999 | 999 | */ |
1000 | -function give_currency_filter( $price = '', $args = array() ) { |
|
1000 | +function give_currency_filter($price = '', $args = array()) { |
|
1001 | 1001 | |
1002 | 1002 | // Get functions arguments. |
1003 | 1003 | $func_args = func_get_args(); |
1004 | 1004 | |
1005 | 1005 | // Backward compatibility: modify second param to array |
1006 | - if ( isset( $func_args[1] ) && is_string( $func_args[1] ) ) { |
|
1006 | + if (isset($func_args[1]) && is_string($func_args[1])) { |
|
1007 | 1007 | $args = array( |
1008 | - 'currency_code' => isset( $func_args[1] ) ? $func_args[1] : '', |
|
1009 | - 'decode_currency' => isset( $func_args[2] ) ? $func_args[2] : false, |
|
1010 | - 'form_id' => isset( $func_args[3] ) ? $func_args[3] : '', |
|
1008 | + 'currency_code' => isset($func_args[1]) ? $func_args[1] : '', |
|
1009 | + 'decode_currency' => isset($func_args[2]) ? $func_args[2] : false, |
|
1010 | + 'form_id' => isset($func_args[3]) ? $func_args[3] : '', |
|
1011 | 1011 | ); |
1012 | 1012 | |
1013 | - give_doing_it_wrong( __FUNCTION__, 'Pass second argument as Array.', GIVE_VERSION ); |
|
1013 | + give_doing_it_wrong(__FUNCTION__, 'Pass second argument as Array.', GIVE_VERSION); |
|
1014 | 1014 | } |
1015 | 1015 | |
1016 | 1016 | // Set default values. |
@@ -1023,22 +1023,22 @@ discard block |
||
1023 | 1023 | ) |
1024 | 1024 | ); |
1025 | 1025 | |
1026 | - if ( empty( $args['currency_code'] ) || ! array_key_exists( (string) $args['currency_code'], give_get_currencies() ) ) { |
|
1027 | - $args['currency_code'] = give_get_currency( $args['form_id'] ); |
|
1026 | + if (empty($args['currency_code']) || ! array_key_exists((string) $args['currency_code'], give_get_currencies())) { |
|
1027 | + $args['currency_code'] = give_get_currency($args['form_id']); |
|
1028 | 1028 | } |
1029 | 1029 | |
1030 | - $args['position'] = give_get_option( 'currency_position', 'before' ); |
|
1030 | + $args['position'] = give_get_option('currency_position', 'before'); |
|
1031 | 1031 | |
1032 | 1032 | $negative = $price < 0; |
1033 | 1033 | |
1034 | - if ( $negative ) { |
|
1034 | + if ($negative) { |
|
1035 | 1035 | // Remove proceeding "-". |
1036 | - $price = substr( $price, 1 ); |
|
1036 | + $price = substr($price, 1); |
|
1037 | 1037 | } |
1038 | 1038 | |
1039 | - $args['symbol'] = give_currency_symbol( $args['currency_code'], $args['decode_currency'] ); |
|
1039 | + $args['symbol'] = give_currency_symbol($args['currency_code'], $args['decode_currency']); |
|
1040 | 1040 | |
1041 | - switch ( $args['currency_code'] ) : |
|
1041 | + switch ($args['currency_code']) : |
|
1042 | 1042 | case 'GBP' : |
1043 | 1043 | case 'BRL' : |
1044 | 1044 | case 'EUR' : |
@@ -1068,13 +1068,13 @@ discard block |
||
1068 | 1068 | case 'MAD' : |
1069 | 1069 | case 'KRW' : |
1070 | 1070 | case 'ZAR' : |
1071 | - $formatted = ( 'before' === $args['position'] ? $args['symbol'] . $price : $price . $args['symbol'] ); |
|
1071 | + $formatted = ('before' === $args['position'] ? $args['symbol'].$price : $price.$args['symbol']); |
|
1072 | 1072 | break; |
1073 | 1073 | case 'NOK': |
1074 | - $formatted = ( 'before' === $args['position'] ? $args['symbol'] . ' ' . $price : $price . ' ' . $args['symbol'] ); |
|
1074 | + $formatted = ('before' === $args['position'] ? $args['symbol'].' '.$price : $price.' '.$args['symbol']); |
|
1075 | 1075 | break; |
1076 | 1076 | default: |
1077 | - $formatted = ( 'before' === $args['position'] ? $args['symbol'] . ' ' . $price : $price . ' ' . $args['symbol'] ); |
|
1077 | + $formatted = ('before' === $args['position'] ? $args['symbol'].' '.$price : $price.' '.$args['symbol']); |
|
1078 | 1078 | break; |
1079 | 1079 | endswitch; |
1080 | 1080 | |
@@ -1083,7 +1083,7 @@ discard block |
||
1083 | 1083 | * |
1084 | 1084 | * @since 1.8.17 |
1085 | 1085 | */ |
1086 | - $formatted = apply_filters( 'give_currency_filter', $formatted, $args, $price ); |
|
1086 | + $formatted = apply_filters('give_currency_filter', $formatted, $args, $price); |
|
1087 | 1087 | |
1088 | 1088 | /** |
1089 | 1089 | * Filter formatted amount with currency |
@@ -1097,16 +1097,16 @@ discard block |
||
1097 | 1097 | * filter name will be give_usd_currency_filter_after |
1098 | 1098 | */ |
1099 | 1099 | $formatted = apply_filters( |
1100 | - 'give_' . strtolower( $args['currency_code'] ) . "_currency_filter_{$args['position']}", |
|
1100 | + 'give_'.strtolower($args['currency_code'])."_currency_filter_{$args['position']}", |
|
1101 | 1101 | $formatted, |
1102 | 1102 | $args['currency_code'], |
1103 | 1103 | $price, |
1104 | 1104 | $args |
1105 | 1105 | ); |
1106 | 1106 | |
1107 | - if ( $negative ) { |
|
1107 | + if ($negative) { |
|
1108 | 1108 | // Prepend the minus sign before the currency sign. |
1109 | - $formatted = '-' . $formatted; |
|
1109 | + $formatted = '-'.$formatted; |
|
1110 | 1110 | } |
1111 | 1111 | |
1112 | 1112 | return $formatted; |
@@ -1123,7 +1123,7 @@ discard block |
||
1123 | 1123 | * |
1124 | 1124 | * @return bool |
1125 | 1125 | */ |
1126 | -function give_is_zero_based_currency( $currency = '' ) { |
|
1126 | +function give_is_zero_based_currency($currency = '') { |
|
1127 | 1127 | $zero_based_currency = array( |
1128 | 1128 | 'PYG', // Paraguayan Guarani. |
1129 | 1129 | 'GNF', // Guinean Franc. |
@@ -1143,12 +1143,12 @@ discard block |
||
1143 | 1143 | ); |
1144 | 1144 | |
1145 | 1145 | // Set default currency. |
1146 | - if ( empty( $currency ) ) { |
|
1146 | + if (empty($currency)) { |
|
1147 | 1147 | $currency = give_get_currency(); |
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 | // Check for Zero Based Currency. |
1151 | - if ( in_array( $currency, $zero_based_currency ) ) { |
|
1151 | + if (in_array($currency, $zero_based_currency)) { |
|
1152 | 1152 | return true; |
1153 | 1153 | } |
1154 | 1154 | |
@@ -1163,7 +1163,7 @@ discard block |
||
1163 | 1163 | * |
1164 | 1164 | * @return bool |
1165 | 1165 | */ |
1166 | -function give_is_right_to_left_supported_currency( $currency = '' ) { |
|
1166 | +function give_is_right_to_left_supported_currency($currency = '') { |
|
1167 | 1167 | $zero_based_currency = apply_filters( |
1168 | 1168 | 'give_right_to_left_supported_currency', |
1169 | 1169 | array( |
@@ -1179,12 +1179,12 @@ discard block |
||
1179 | 1179 | ); |
1180 | 1180 | |
1181 | 1181 | // Set default currency. |
1182 | - if ( empty( $currency ) ) { |
|
1182 | + if (empty($currency)) { |
|
1183 | 1183 | $currency = give_get_currency(); |
1184 | 1184 | } |
1185 | 1185 | |
1186 | 1186 | // Check for Zero Based Currency. |
1187 | - if ( in_array( $currency, $zero_based_currency ) ) { |
|
1187 | + if (in_array($currency, $zero_based_currency)) { |
|
1188 | 1188 | return true; |
1189 | 1189 | } |
1190 | 1190 |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Exit if accessed directly. |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; |
14 | 14 | } |
15 | 15 | |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function __construct() { |
25 | 25 | |
26 | - $this->shortcode['title'] = esc_html__( 'Donation Form Grid', 'give' ); |
|
27 | - $this->shortcode['label'] = esc_html__( 'Donation Form Grid', 'give' ); |
|
26 | + $this->shortcode['title'] = esc_html__('Donation Form Grid', 'give'); |
|
27 | + $this->shortcode['label'] = esc_html__('Donation Form Grid', 'give'); |
|
28 | 28 | |
29 | - parent::__construct( 'give_form_grid' ); |
|
29 | + parent::__construct('give_form_grid'); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -39,73 +39,73 @@ discard block |
||
39 | 39 | return array( |
40 | 40 | array( |
41 | 41 | 'type' => 'container', |
42 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ), |
|
42 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html__('Optional settings', 'give')), |
|
43 | 43 | ), |
44 | 44 | array( |
45 | 45 | 'type' => 'textbox', |
46 | 46 | 'name' => 'ids', |
47 | - 'label' => esc_attr__( 'Form IDs:', 'give' ), |
|
48 | - 'tooltip' => esc_attr__( 'Enter a comma-separated list of form IDs. If empty, all published forms are displayed.', 'give' ), |
|
49 | - 'placeholder' => esc_html__( 'All Forms', 'give' ) |
|
47 | + 'label' => esc_attr__('Form IDs:', 'give'), |
|
48 | + 'tooltip' => esc_attr__('Enter a comma-separated list of form IDs. If empty, all published forms are displayed.', 'give'), |
|
49 | + 'placeholder' => esc_html__('All Forms', 'give') |
|
50 | 50 | ), |
51 | 51 | array( |
52 | 52 | 'type' => 'listbox', |
53 | 53 | 'name' => 'columns', |
54 | - 'label' => esc_attr__( 'Columns:', 'give' ), |
|
55 | - 'tooltip' => esc_attr__( 'Sets the number of donations per row.', 'give' ), |
|
54 | + 'label' => esc_attr__('Columns:', 'give'), |
|
55 | + 'tooltip' => esc_attr__('Sets the number of donations per row.', 'give'), |
|
56 | 56 | 'options' => array( |
57 | - '1' => esc_html__( '1', 'give' ), |
|
58 | - '2' => esc_html__( '2', 'give' ), |
|
59 | - '3' => esc_html__( '3', 'give' ), |
|
60 | - '4' => esc_html__( '4', 'give' ), |
|
57 | + '1' => esc_html__('1', 'give'), |
|
58 | + '2' => esc_html__('2', 'give'), |
|
59 | + '3' => esc_html__('3', 'give'), |
|
60 | + '4' => esc_html__('4', 'give'), |
|
61 | 61 | ), |
62 | - 'placeholder' => esc_html__( 'Best Fit', 'give' ) |
|
62 | + 'placeholder' => esc_html__('Best Fit', 'give') |
|
63 | 63 | ), |
64 | 64 | array( |
65 | 65 | 'type' => 'listbox', |
66 | 66 | 'name' => 'show_goal', |
67 | - 'label' => esc_attr__( 'Show Goal:', 'give' ), |
|
68 | - 'tooltip' => __( 'Do you want to display the goal\'s progress bar?', 'give' ), |
|
67 | + 'label' => esc_attr__('Show Goal:', 'give'), |
|
68 | + 'tooltip' => __('Do you want to display the goal\'s progress bar?', 'give'), |
|
69 | 69 | 'options' => array( |
70 | - 'true' => esc_html__( 'Show', 'give' ), |
|
71 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
70 | + 'true' => esc_html__('Show', 'give'), |
|
71 | + 'false' => esc_html__('Hide', 'give'), |
|
72 | 72 | ), |
73 | 73 | ), |
74 | 74 | array( |
75 | 75 | 'type' => 'listbox', |
76 | 76 | 'name' => 'show_excerpt', |
77 | - 'label' => esc_attr__( 'Show Excerpt:', 'give' ), |
|
78 | - 'tooltip' => esc_attr__( 'Do you want to display the excerpt?', 'give' ), |
|
77 | + 'label' => esc_attr__('Show Excerpt:', 'give'), |
|
78 | + 'tooltip' => esc_attr__('Do you want to display the excerpt?', 'give'), |
|
79 | 79 | 'options' => array( |
80 | - 'true' => esc_html__( 'Show', 'give' ), |
|
81 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
80 | + 'true' => esc_html__('Show', 'give'), |
|
81 | + 'false' => esc_html__('Hide', 'give'), |
|
82 | 82 | ), |
83 | 83 | ), |
84 | 84 | array( |
85 | 85 | 'type' => 'listbox', |
86 | 86 | 'name' => 'show_featured_image', |
87 | - 'label' => esc_attr__( 'Show Featured Image:', 'give' ), |
|
88 | - 'tooltip' => esc_attr__( 'Do you want to display the featured image?', 'give' ), |
|
87 | + 'label' => esc_attr__('Show Featured Image:', 'give'), |
|
88 | + 'tooltip' => esc_attr__('Do you want to display the featured image?', 'give'), |
|
89 | 89 | 'options' => array( |
90 | - 'true' => esc_html__( 'Show', 'give' ), |
|
91 | - 'false' => esc_html__( 'Hide', 'give' ), |
|
90 | + 'true' => esc_html__('Show', 'give'), |
|
91 | + 'false' => esc_html__('Hide', 'give'), |
|
92 | 92 | ), |
93 | 93 | ), |
94 | 94 | array( |
95 | 95 | 'type' => 'listbox', |
96 | 96 | 'name' => 'display_style', |
97 | - 'label' => esc_attr__( 'Display Style:', 'give' ), |
|
98 | - 'tooltip' => esc_attr__( 'Show form as modal window or redirect to a new page?', 'give' ), |
|
97 | + 'label' => esc_attr__('Display Style:', 'give'), |
|
98 | + 'tooltip' => esc_attr__('Show form as modal window or redirect to a new page?', 'give'), |
|
99 | 99 | 'options' => array( |
100 | - 'redirect' => esc_html__( 'Redirect', 'give' ), |
|
101 | - 'modal_reveal' => esc_html__( 'Modal', 'give' ), |
|
100 | + 'redirect' => esc_html__('Redirect', 'give'), |
|
101 | + 'modal_reveal' => esc_html__('Modal', 'give'), |
|
102 | 102 | ), |
103 | 103 | ), |
104 | 104 | array( |
105 | 105 | 'type' => 'textbox', |
106 | 106 | 'name' => 'forms_per_page', |
107 | - 'label' => esc_attr__( 'Forms Per Page:', 'give' ), |
|
108 | - 'tooltip' => esc_attr__( 'Sets the number of donations form per row.', 'give' ), |
|
107 | + 'label' => esc_attr__('Forms Per Page:', 'give'), |
|
108 | + 'tooltip' => esc_attr__('Sets the number of donations form per row.', 'give'), |
|
109 | 109 | 'value' => 12, |
110 | 110 | ), |
111 | 111 | ); |
@@ -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 | |
@@ -18,56 +18,55 @@ discard block |
||
18 | 18 | ?> |
19 | 19 | <div class="wrap" id="poststuff"> |
20 | 20 | <div id="give-updates"> |
21 | - <h1 id="give-updates-h1"><?php esc_html_e( 'Give - Updates', 'give' ); ?></h1> |
|
21 | + <h1 id="give-updates-h1"><?php esc_html_e('Give - Updates', 'give'); ?></h1> |
|
22 | 22 | <hr class="wp-header-end" |
23 | 23 | |
24 | 24 | <?php $db_updates = $give_updates->get_pending_db_update_count(); ?> |
25 | - <?php if ( ! empty( $db_updates ) ) : ?> |
|
25 | + <?php if ( ! empty($db_updates)) : ?> |
|
26 | 26 | <?php |
27 | 27 | $is_doing_updates = $give_updates->is_doing_updates(); |
28 | - $db_update_url = add_query_arg( array( 'type' => 'database', ) ); |
|
29 | - $resume_updates = get_option( 'give_doing_upgrade' ); |
|
30 | - $width = ! empty( $resume_updates ) ? $resume_updates['percentage'] : 0; |
|
28 | + $db_update_url = add_query_arg(array('type' => 'database',)); |
|
29 | + $resume_updates = get_option('give_doing_upgrade'); |
|
30 | + $width = ! empty($resume_updates) ? $resume_updates['percentage'] : 0; |
|
31 | 31 | ?> |
32 | 32 | <div class="give-update-panel-content"> |
33 | - <p><?php printf( __( 'Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons. Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give' ), 'https://givewp.com/my-account/' ); ?></p> |
|
33 | + <p><?php printf(__('Give regularly receives new features, bug fixes, and enhancements. It is important to always stay up-to-date with latest version of Give core and its add-ons. Please create a backup of your site before updating. To update add-ons be sure your <a href="%1$s">license keys</a> are activated.', 'give'), 'https://givewp.com/my-account/'); ?></p> |
|
34 | 34 | </div> |
35 | 35 | |
36 | - <div id="give-db-updates" data-resume-update="<?php echo absint( $give_updates->is_doing_updates() ); ?>"> |
|
36 | + <div id="give-db-updates" data-resume-update="<?php echo absint($give_updates->is_doing_updates()); ?>"> |
|
37 | 37 | <div class="postbox-container"> |
38 | 38 | <div class="postbox"> |
39 | - <h2 class="hndle"><?php _e( 'Database Updates', 'give' ); ?></h2> |
|
39 | + <h2 class="hndle"><?php _e('Database Updates', 'give'); ?></h2> |
|
40 | 40 | <div class="inside"> |
41 | 41 | <div class="panel-content"> |
42 | 42 | <p class="give-update-button"> |
43 | - <span class="give-doing-update-text-p" <?php echo Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>> |
|
43 | + <span class="give-doing-update-text-p" <?php echo Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>> |
|
44 | 44 | <?php echo sprintf( |
45 | - __( '%1$s <a href="%2$s" class="give-update-now %3$s">%4$s</a>', 'give' ), |
|
45 | + __('%1$s <a href="%2$s" class="give-update-now %3$s">%4$s</a>', 'give'), |
|
46 | 46 | $is_doing_updates ? |
47 | - __( 'Give is currently updating the database in the background.', 'give' ) : |
|
48 | - __( 'Give needs to update the database.', 'give' ), |
|
47 | + __('Give is currently updating the database in the background.', 'give') : __('Give needs to update the database.', 'give'), |
|
49 | 48 | $db_update_url, |
50 | - ( $is_doing_updates ? 'give-hidden' : '' ), |
|
51 | - __( 'Update now', 'give' ) |
|
49 | + ($is_doing_updates ? 'give-hidden' : ''), |
|
50 | + __('Update now', 'give') |
|
52 | 51 | ); |
53 | 52 | ?> |
54 | 53 | </span> |
55 | - <span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>> |
|
56 | - <?php if ( get_option( 'give_upgrade_error' ) ) : ?> |
|
57 | - <?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?> |
|
54 | + <span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>> |
|
55 | + <?php if (get_option('give_upgrade_error')) : ?> |
|
56 | + <?php _e('An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give'); ?> |
|
58 | 57 | <?php else : ?> |
59 | - <?php _e( 'The updates have been paused.', 'give' ); ?> |
|
58 | + <?php _e('The updates have been paused.', 'give'); ?> |
|
60 | 59 | |
61 | 60 | <?php endif; ?> |
62 | 61 | </span> |
63 | 62 | |
64 | - <?php if ( Give_Updates::$background_updater->is_paused_process() ) : ?> |
|
65 | - <?php $is_disabled = isset( $_GET['give-restart-db-upgrades'] ) ? ' disabled' : ''; ?> |
|
66 | - <button id="give-restart-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url( admin_url( '/edit.php?post_type=give_forms&page=give-updates&give-restart-db-upgrades=1' ) ); ?>"<?php echo $is_disabled; ?>><?php _e( 'Restart Upgrades', 'give' ); ?></button> |
|
67 | - <?php elseif( $give_updates->is_doing_updates() ): ?> |
|
68 | - <?php $is_disabled = isset( $_GET['give-pause-db-upgrades'] ) ? ' disabled' : ''; ?> |
|
69 | - <button id="give-pause-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url( admin_url( '/edit.php?post_type=give_forms&page=give-updates&give-pause-db-upgrades=1' ) ); ?>"<?php echo $is_disabled; ?>> |
|
70 | - <?php _e( 'Pause Upgrades', 'give' ); ?> |
|
63 | + <?php if (Give_Updates::$background_updater->is_paused_process()) : ?> |
|
64 | + <?php $is_disabled = isset($_GET['give-restart-db-upgrades']) ? ' disabled' : ''; ?> |
|
65 | + <button id="give-restart-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url(admin_url('/edit.php?post_type=give_forms&page=give-updates&give-restart-db-upgrades=1')); ?>"<?php echo $is_disabled; ?>><?php _e('Restart Upgrades', 'give'); ?></button> |
|
66 | + <?php elseif ($give_updates->is_doing_updates()): ?> |
|
67 | + <?php $is_disabled = isset($_GET['give-pause-db-upgrades']) ? ' disabled' : ''; ?> |
|
68 | + <button id="give-pause-upgrades" class="button button-primary alignright" data-redirect-url="<?php echo esc_url(admin_url('/edit.php?post_type=give_forms&page=give-updates&give-pause-db-upgrades=1')); ?>"<?php echo $is_disabled; ?>> |
|
69 | + <?php _e('Pause Upgrades', 'give'); ?> |
|
71 | 70 | </button> |
72 | 71 | <?php endif; ?> |
73 | 72 | </p> |
@@ -77,7 +76,7 @@ discard block |
||
77 | 76 | <strong> |
78 | 77 | <?php |
79 | 78 | echo sprintf( |
80 | - __( 'Update %s of %s', 'give' ), |
|
79 | + __('Update %s of %s', 'give'), |
|
81 | 80 | $give_updates->get_running_db_update(), |
82 | 81 | $give_updates->get_total_new_db_update_count() |
83 | 82 | ); |
@@ -85,10 +84,10 @@ discard block |
||
85 | 84 | </strong> |
86 | 85 | </p> |
87 | 86 | <div class="progress-content"> |
88 | - <?php if ( $is_doing_updates ) : ?> |
|
87 | + <?php if ($is_doing_updates) : ?> |
|
89 | 88 | <div class="notice-wrap give-clearfix"> |
90 | 89 | |
91 | - <?php if ( ! Give_Updates::$background_updater->is_paused_process() ) : ?> |
|
90 | + <?php if ( ! Give_Updates::$background_updater->is_paused_process()) : ?> |
|
92 | 91 | <span class="spinner is-active"></span> |
93 | 92 | <?php endif; ?> |
94 | 93 | |
@@ -100,7 +99,7 @@ discard block |
||
100 | 99 | </div> |
101 | 100 | </div> |
102 | 101 | |
103 | - <?php if ( ! $is_doing_updates ) : ?> |
|
102 | + <?php if ( ! $is_doing_updates) : ?> |
|
104 | 103 | <div class="give-run-database-update"></div> |
105 | 104 | <?php endif; ?> |
106 | 105 | </div> |
@@ -108,18 +107,18 @@ discard block |
||
108 | 107 | </div><!-- .postbox --> |
109 | 108 | </div> |
110 | 109 | </div> |
111 | - <?php else: include GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/db-upgrades-complete-metabox.php';?> |
|
110 | + <?php else: include GIVE_PLUGIN_DIR.'includes/admin/upgrades/views/db-upgrades-complete-metabox.php'; ?> |
|
112 | 111 | <?php endif; ?> |
113 | 112 | |
114 | 113 | <?php $plugin_updates = $give_updates->get_total_plugin_update_count(); ?> |
115 | - <?php if ( ! empty( $plugin_updates ) ) : ?> |
|
116 | - <?php $plugin_update_url = add_query_arg( array( |
|
114 | + <?php if ( ! empty($plugin_updates)) : ?> |
|
115 | + <?php $plugin_update_url = add_query_arg(array( |
|
117 | 116 | 'plugin_status' => 'give', |
118 | - ), admin_url( '/plugins.php' ) ); ?> |
|
117 | + ), admin_url('/plugins.php')); ?> |
|
119 | 118 | <div id="give-plugin-updates"> |
120 | 119 | <div class="postbox-container"> |
121 | 120 | <div class="postbox"> |
122 | - <h2 class="hndle"><?php _e( 'Add-on Updates', 'give' ); ?></h2> |
|
121 | + <h2 class="hndle"><?php _e('Add-on Updates', 'give'); ?></h2> |
|
123 | 122 | <div class="inside"> |
124 | 123 | <div class="panel-content"> |
125 | 124 | <p> |
@@ -55,8 +55,11 @@ discard block |
||
55 | 55 | <span class="give-update-paused-text-p" <?php echo ! Give_Updates::$background_updater->is_paused_process() ? 'style="display:none;"' : ''; ?>> |
56 | 56 | <?php if ( get_option( 'give_upgrade_error' ) ) : ?> |
57 | 57 | <?php _e( 'An unexpected issue occurred during the database update which caused it to stop automatically. Please contact support for assistance.', 'give' ); ?> |
58 | - <?php else : ?> |
|
59 | - <?php _e( 'The updates have been paused.', 'give' ); ?> |
|
58 | + <?php else { |
|
59 | + : ?> |
|
60 | + <?php _e( 'The updates have been paused.', 'give' ); |
|
61 | +} |
|
62 | +?> |
|
60 | 63 | |
61 | 64 | <?php endif; ?> |
62 | 65 | </span> |
@@ -108,7 +111,10 @@ discard block |
||
108 | 111 | </div><!-- .postbox --> |
109 | 112 | </div> |
110 | 113 | </div> |
111 | - <?php else: include GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/db-upgrades-complete-metabox.php';?> |
|
114 | + <?php else { |
|
115 | + : include GIVE_PLUGIN_DIR . 'includes/admin/upgrades/views/db-upgrades-complete-metabox.php'; |
|
116 | +} |
|
117 | +?> |
|
112 | 118 | <?php endif; ?> |
113 | 119 | |
114 | 120 | <?php $plugin_updates = $give_updates->get_total_plugin_update_count(); ?> |
@@ -1,14 +1,14 @@ discard block |
||
1 | 1 | <div id="give-db-updates" data-resume-update="0"> |
2 | 2 | <div class="postbox-container"> |
3 | 3 | <div class="postbox"> |
4 | - <h2 class="hndle"><?php esc_html_e( 'Database Updates', 'give' ); ?></h2> |
|
4 | + <h2 class="hndle"><?php esc_html_e('Database Updates', 'give'); ?></h2> |
|
5 | 5 | <div class="inside"> |
6 | 6 | <div class="progress-container"> |
7 | - <p class="update-message"><strong><?php esc_html_e( 'Updates Completed.', 'give' ) ?></strong></p> |
|
7 | + <p class="update-message"><strong><?php esc_html_e('Updates Completed.', 'give') ?></strong></p> |
|
8 | 8 | <div class="progress-content"> |
9 | 9 | <div class="notice-wrap give-clearfix"> |
10 | 10 | <div class="notice notice-success is-dismissible inline"> |
11 | - <p><?php esc_html_e( 'Give database updates completed successfully. Thank you for updating to the latest version!', 'give' ) ?> |
|
11 | + <p><?php esc_html_e('Give database updates completed successfully. Thank you for updating to the latest version!', 'give') ?> |
|
12 | 12 | </p> |
13 | 13 | <button type="button" class="notice-dismiss"></button> |
14 | 14 | </div> |
@@ -20,4 +20,4 @@ discard block |
||
20 | 20 | </div><!-- .postbox --> |
21 | 21 | </div> |
22 | 22 | </div> |
23 | -<?php delete_option( 'give_show_db_upgrade_complete_notice' ); ?> |
|
24 | 23 | \ No newline at end of file |
24 | +<?php delete_option('give_show_db_upgrade_complete_notice'); ?> |
|
25 | 25 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -93,19 +93,19 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function get_predefined_dates() { |
95 | 95 | $predefined = array( |
96 | - 'today' => esc_html__( 'Today', 'give' ), |
|
97 | - 'yesterday' => esc_html__( 'Yesterday', 'give' ), |
|
98 | - 'this_week' => esc_html__( 'This Week', 'give' ), |
|
99 | - 'last_week' => esc_html__( 'Last Week', 'give' ), |
|
100 | - 'this_month' => esc_html__( 'This Month', 'give' ), |
|
101 | - 'last_month' => esc_html__( 'Last Month', 'give' ), |
|
102 | - 'this_quarter' => esc_html__( 'This Quarter', 'give' ), |
|
103 | - 'last_quarter' => esc_html__( 'Last Quarter', 'give' ), |
|
104 | - 'this_year' => esc_html__( 'This Year', 'give' ), |
|
105 | - 'last_year' => esc_html__( 'Last Year', 'give' ), |
|
96 | + 'today' => esc_html__('Today', 'give'), |
|
97 | + 'yesterday' => esc_html__('Yesterday', 'give'), |
|
98 | + 'this_week' => esc_html__('This Week', 'give'), |
|
99 | + 'last_week' => esc_html__('Last Week', 'give'), |
|
100 | + 'this_month' => esc_html__('This Month', 'give'), |
|
101 | + 'last_month' => esc_html__('Last Month', 'give'), |
|
102 | + 'this_quarter' => esc_html__('This Quarter', 'give'), |
|
103 | + 'last_quarter' => esc_html__('Last Quarter', 'give'), |
|
104 | + 'this_year' => esc_html__('This Year', 'give'), |
|
105 | + 'last_year' => esc_html__('Last Year', 'give'), |
|
106 | 106 | ); |
107 | 107 | |
108 | - return apply_filters( 'give_stats_predefined_dates', $predefined ); |
|
108 | + return apply_filters('give_stats_predefined_dates', $predefined); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -121,18 +121,18 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @return void |
123 | 123 | */ |
124 | - public function setup_dates( $_start_date = 'this_month', $_end_date = false ) { |
|
124 | + public function setup_dates($_start_date = 'this_month', $_end_date = false) { |
|
125 | 125 | |
126 | - if ( empty( $_start_date ) ) { |
|
126 | + if (empty($_start_date)) { |
|
127 | 127 | $_start_date = 'this_month'; |
128 | 128 | } |
129 | 129 | |
130 | - if ( empty( $_end_date ) ) { |
|
130 | + if (empty($_end_date)) { |
|
131 | 131 | $_end_date = $_start_date; |
132 | 132 | } |
133 | 133 | |
134 | - $this->start_date = $this->convert_date( $_start_date ); |
|
135 | - $this->end_date = $this->convert_date( $_end_date, true ); |
|
134 | + $this->start_date = $this->convert_date($_start_date); |
|
135 | + $this->end_date = $this->convert_date($_end_date, true); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -148,26 +148,26 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return array|WP_Error If the date is invalid, a WP_Error object will be returned. |
150 | 150 | */ |
151 | - public function convert_date( $date, $end_date = false ) { |
|
151 | + public function convert_date($date, $end_date = false) { |
|
152 | 152 | |
153 | 153 | $this->timestamp = false; |
154 | 154 | $second = $end_date ? 59 : 0; |
155 | 155 | $minute = $end_date ? 59 : 0; |
156 | 156 | $hour = $end_date ? 23 : 0; |
157 | 157 | $day = 1; |
158 | - $month = date( 'n', current_time( 'timestamp' ) ); |
|
159 | - $year = date( 'Y', current_time( 'timestamp' ) ); |
|
158 | + $month = date('n', current_time('timestamp')); |
|
159 | + $year = date('Y', current_time('timestamp')); |
|
160 | 160 | |
161 | - if ( array_key_exists( (string) $date, $this->get_predefined_dates() ) ) { |
|
161 | + if (array_key_exists((string) $date, $this->get_predefined_dates())) { |
|
162 | 162 | |
163 | 163 | // This is a predefined date rate, such as last_week |
164 | - switch ( $date ) { |
|
164 | + switch ($date) { |
|
165 | 165 | |
166 | 166 | case 'this_month' : |
167 | 167 | |
168 | - if ( $end_date ) { |
|
168 | + if ($end_date) { |
|
169 | 169 | |
170 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
170 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
171 | 171 | $hour = 23; |
172 | 172 | $minute = 59; |
173 | 173 | $second = 59; |
@@ -177,28 +177,28 @@ discard block |
||
177 | 177 | |
178 | 178 | case 'last_month' : |
179 | 179 | |
180 | - if ( $month == 1 ) { |
|
180 | + if ($month == 1) { |
|
181 | 181 | |
182 | 182 | $month = 12; |
183 | - $year --; |
|
183 | + $year--; |
|
184 | 184 | |
185 | 185 | } else { |
186 | 186 | |
187 | - $month --; |
|
187 | + $month--; |
|
188 | 188 | |
189 | 189 | } |
190 | 190 | |
191 | - if ( $end_date ) { |
|
192 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
191 | + if ($end_date) { |
|
192 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | break; |
196 | 196 | |
197 | 197 | case 'today' : |
198 | 198 | |
199 | - $day = date( 'd', current_time( 'timestamp' ) ); |
|
199 | + $day = date('d', current_time('timestamp')); |
|
200 | 200 | |
201 | - if ( $end_date ) { |
|
201 | + if ($end_date) { |
|
202 | 202 | $hour = 23; |
203 | 203 | $minute = 59; |
204 | 204 | $second = 59; |
@@ -208,23 +208,23 @@ discard block |
||
208 | 208 | |
209 | 209 | case 'yesterday' : |
210 | 210 | |
211 | - $day = date( 'd', current_time( 'timestamp' ) ) - 1; |
|
211 | + $day = date('d', current_time('timestamp')) - 1; |
|
212 | 212 | |
213 | 213 | // Check if Today is the first day of the month (meaning subtracting one will get us 0) |
214 | - if ( $day < 1 ) { |
|
214 | + if ($day < 1) { |
|
215 | 215 | |
216 | 216 | // If current month is 1 |
217 | - if ( 1 == $month ) { |
|
217 | + if (1 == $month) { |
|
218 | 218 | |
219 | 219 | $year -= 1; // Today is January 1, so skip back to last day of December |
220 | 220 | $month = 12; |
221 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
221 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
222 | 222 | |
223 | 223 | } else { |
224 | 224 | |
225 | 225 | // Go back one month and get the last day of the month |
226 | 226 | $month -= 1; |
227 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
227 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
228 | 228 | |
229 | 229 | } |
230 | 230 | } |
@@ -233,12 +233,12 @@ discard block |
||
233 | 233 | |
234 | 234 | case 'this_week' : |
235 | 235 | |
236 | - $days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24; |
|
237 | - $today = date( 'j', current_time( 'timestamp' ) ) * 60 * 60 * 24; |
|
236 | + $days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24; |
|
237 | + $today = date('j', current_time('timestamp')) * 60 * 60 * 24; |
|
238 | 238 | |
239 | - if ( $today <= $days_to_week_start ) { |
|
239 | + if ($today <= $days_to_week_start) { |
|
240 | 240 | |
241 | - if ( $month > 1 ) { |
|
241 | + if ($month > 1) { |
|
242 | 242 | $month -= 1; |
243 | 243 | } else { |
244 | 244 | $month = 12; |
@@ -246,19 +246,19 @@ discard block |
||
246 | 246 | |
247 | 247 | } |
248 | 248 | |
249 | - if ( ! $end_date ) { |
|
249 | + if ( ! $end_date) { |
|
250 | 250 | |
251 | 251 | // Getting the start day |
252 | 252 | |
253 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1; |
|
254 | - $day += get_option( 'start_of_week' ); |
|
253 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 1; |
|
254 | + $day += get_option('start_of_week'); |
|
255 | 255 | |
256 | 256 | } else { |
257 | 257 | |
258 | 258 | // Getting the end day |
259 | 259 | |
260 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1; |
|
261 | - $day += get_option( 'start_of_week' ) + 6; |
|
260 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 1; |
|
261 | + $day += get_option('start_of_week') + 6; |
|
262 | 262 | |
263 | 263 | } |
264 | 264 | |
@@ -266,12 +266,12 @@ discard block |
||
266 | 266 | |
267 | 267 | case 'last_week' : |
268 | 268 | |
269 | - $days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24; |
|
270 | - $today = date( 'j', current_time( 'timestamp' ) ) * 60 * 60 * 24; |
|
269 | + $days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24; |
|
270 | + $today = date('j', current_time('timestamp')) * 60 * 60 * 24; |
|
271 | 271 | |
272 | - if ( $today <= $days_to_week_start ) { |
|
272 | + if ($today <= $days_to_week_start) { |
|
273 | 273 | |
274 | - if ( $month > 1 ) { |
|
274 | + if ($month > 1) { |
|
275 | 275 | $month -= 1; |
276 | 276 | } else { |
277 | 277 | $month = 12; |
@@ -279,19 +279,19 @@ discard block |
||
279 | 279 | |
280 | 280 | } |
281 | 281 | |
282 | - if ( ! $end_date ) { |
|
282 | + if ( ! $end_date) { |
|
283 | 283 | |
284 | 284 | // Getting the start day |
285 | 285 | |
286 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8; |
|
287 | - $day += get_option( 'start_of_week' ); |
|
286 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 8; |
|
287 | + $day += get_option('start_of_week'); |
|
288 | 288 | |
289 | 289 | } else { |
290 | 290 | |
291 | 291 | // Getting the end day |
292 | 292 | |
293 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8; |
|
294 | - $day += get_option( 'start_of_week' ) + 6; |
|
293 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 8; |
|
294 | + $day += get_option('start_of_week') + 6; |
|
295 | 295 | |
296 | 296 | } |
297 | 297 | |
@@ -299,39 +299,39 @@ discard block |
||
299 | 299 | |
300 | 300 | case 'this_quarter' : |
301 | 301 | |
302 | - $month_now = date( 'n', current_time( 'timestamp' ) ); |
|
302 | + $month_now = date('n', current_time('timestamp')); |
|
303 | 303 | |
304 | - if ( $month_now <= 3 ) { |
|
304 | + if ($month_now <= 3) { |
|
305 | 305 | |
306 | - if ( ! $end_date ) { |
|
306 | + if ( ! $end_date) { |
|
307 | 307 | $month = 1; |
308 | 308 | } else { |
309 | 309 | $month = 3; |
310 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
310 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
311 | 311 | $hour = 23; |
312 | 312 | $minute = 59; |
313 | 313 | $second = 59; |
314 | 314 | } |
315 | 315 | |
316 | - } else if ( $month_now <= 6 ) { |
|
316 | + } else if ($month_now <= 6) { |
|
317 | 317 | |
318 | - if ( ! $end_date ) { |
|
318 | + if ( ! $end_date) { |
|
319 | 319 | $month = 4; |
320 | 320 | } else { |
321 | 321 | $month = 6; |
322 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
322 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
323 | 323 | $hour = 23; |
324 | 324 | $minute = 59; |
325 | 325 | $second = 59; |
326 | 326 | } |
327 | 327 | |
328 | - } else if ( $month_now <= 9 ) { |
|
328 | + } else if ($month_now <= 9) { |
|
329 | 329 | |
330 | - if ( ! $end_date ) { |
|
330 | + if ( ! $end_date) { |
|
331 | 331 | $month = 7; |
332 | 332 | } else { |
333 | 333 | $month = 9; |
334 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
334 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
335 | 335 | $hour = 23; |
336 | 336 | $minute = 59; |
337 | 337 | $second = 59; |
@@ -339,11 +339,11 @@ discard block |
||
339 | 339 | |
340 | 340 | } else { |
341 | 341 | |
342 | - if ( ! $end_date ) { |
|
342 | + if ( ! $end_date) { |
|
343 | 343 | $month = 10; |
344 | 344 | } else { |
345 | 345 | $month = 12; |
346 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
346 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
347 | 347 | $hour = 23; |
348 | 348 | $minute = 59; |
349 | 349 | $second = 59; |
@@ -355,40 +355,40 @@ discard block |
||
355 | 355 | |
356 | 356 | case 'last_quarter' : |
357 | 357 | |
358 | - $month_now = date( 'n', current_time( 'timestamp' ) ); |
|
358 | + $month_now = date('n', current_time('timestamp')); |
|
359 | 359 | |
360 | - if ( $month_now <= 3 ) { |
|
360 | + if ($month_now <= 3) { |
|
361 | 361 | |
362 | - if ( ! $end_date ) { |
|
362 | + if ( ! $end_date) { |
|
363 | 363 | $month = 10; |
364 | 364 | } else { |
365 | 365 | $year -= 1; |
366 | 366 | $month = 12; |
367 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
367 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
368 | 368 | $hour = 23; |
369 | 369 | $minute = 59; |
370 | 370 | $second = 59; |
371 | 371 | } |
372 | 372 | |
373 | - } else if ( $month_now <= 6 ) { |
|
373 | + } else if ($month_now <= 6) { |
|
374 | 374 | |
375 | - if ( ! $end_date ) { |
|
375 | + if ( ! $end_date) { |
|
376 | 376 | $month = 1; |
377 | 377 | } else { |
378 | 378 | $month = 3; |
379 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
379 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
380 | 380 | $hour = 23; |
381 | 381 | $minute = 59; |
382 | 382 | $second = 59; |
383 | 383 | } |
384 | 384 | |
385 | - } else if ( $month_now <= 9 ) { |
|
385 | + } else if ($month_now <= 9) { |
|
386 | 386 | |
387 | - if ( ! $end_date ) { |
|
387 | + if ( ! $end_date) { |
|
388 | 388 | $month = 4; |
389 | 389 | } else { |
390 | 390 | $month = 6; |
391 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
391 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
392 | 392 | $hour = 23; |
393 | 393 | $minute = 59; |
394 | 394 | $second = 59; |
@@ -396,11 +396,11 @@ discard block |
||
396 | 396 | |
397 | 397 | } else { |
398 | 398 | |
399 | - if ( ! $end_date ) { |
|
399 | + if ( ! $end_date) { |
|
400 | 400 | $month = 7; |
401 | 401 | } else { |
402 | 402 | $month = 9; |
403 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
403 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
404 | 404 | $hour = 23; |
405 | 405 | $minute = 59; |
406 | 406 | $second = 59; |
@@ -412,11 +412,11 @@ discard block |
||
412 | 412 | |
413 | 413 | case 'this_year' : |
414 | 414 | |
415 | - if ( ! $end_date ) { |
|
415 | + if ( ! $end_date) { |
|
416 | 416 | $month = 1; |
417 | 417 | } else { |
418 | 418 | $month = 12; |
419 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
419 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
420 | 420 | $hour = 23; |
421 | 421 | $minute = 59; |
422 | 422 | $second = 59; |
@@ -427,11 +427,11 @@ discard block |
||
427 | 427 | case 'last_year' : |
428 | 428 | |
429 | 429 | $year -= 1; |
430 | - if ( ! $end_date ) { |
|
430 | + if ( ! $end_date) { |
|
431 | 431 | $month = 1; |
432 | 432 | } else { |
433 | 433 | $month = 12; |
434 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
434 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
435 | 435 | $hour = 23; |
436 | 436 | $minute = 59; |
437 | 437 | $second = 59; |
@@ -442,30 +442,30 @@ discard block |
||
442 | 442 | } |
443 | 443 | |
444 | 444 | |
445 | - } else if ( is_numeric( $date ) ) { |
|
445 | + } else if (is_numeric($date)) { |
|
446 | 446 | |
447 | 447 | // return $date unchanged since it is a timestamp |
448 | 448 | $this->timestamp = true; |
449 | 449 | |
450 | - } else if ( false !== strtotime( $date ) ) { |
|
450 | + } else if (false !== strtotime($date)) { |
|
451 | 451 | |
452 | - $date = strtotime( $date, current_time( 'timestamp' ) ); |
|
453 | - $year = date( 'Y', $date ); |
|
454 | - $month = date( 'm', $date ); |
|
455 | - $day = date( 'd', $date ); |
|
452 | + $date = strtotime($date, current_time('timestamp')); |
|
453 | + $year = date('Y', $date); |
|
454 | + $month = date('m', $date); |
|
455 | + $day = date('d', $date); |
|
456 | 456 | |
457 | 457 | } else { |
458 | 458 | |
459 | - return new WP_Error( 'invalid_date', esc_html__( 'Improper date provided.', 'give' ) ); |
|
459 | + return new WP_Error('invalid_date', esc_html__('Improper date provided.', 'give')); |
|
460 | 460 | |
461 | 461 | } |
462 | 462 | |
463 | - if ( false === $this->timestamp ) { |
|
463 | + if (false === $this->timestamp) { |
|
464 | 464 | // Create an exact timestamp |
465 | - $date = mktime( $hour, $minute, $second, $month, $day, $year ); |
|
465 | + $date = mktime($hour, $minute, $second, $month, $day, $year); |
|
466 | 466 | } |
467 | 467 | |
468 | - return apply_filters( 'give_stats_date', $date, $end_date, $this ); |
|
468 | + return apply_filters('give_stats_date', $date, $end_date, $this); |
|
469 | 469 | |
470 | 470 | } |
471 | 471 | |
@@ -481,33 +481,33 @@ discard block |
||
481 | 481 | * |
482 | 482 | * @return string |
483 | 483 | */ |
484 | - public function count_where( $where = '' ) { |
|
484 | + public function count_where($where = '') { |
|
485 | 485 | // Only get payments in our date range |
486 | 486 | |
487 | 487 | $start_where = ''; |
488 | 488 | $end_where = ''; |
489 | 489 | |
490 | - if ( $this->start_date ) { |
|
490 | + if ($this->start_date) { |
|
491 | 491 | |
492 | - if ( $this->timestamp ) { |
|
492 | + if ($this->timestamp) { |
|
493 | 493 | $format = 'Y-m-d H:i:s'; |
494 | 494 | } else { |
495 | 495 | $format = 'Y-m-d 00:00:00'; |
496 | 496 | } |
497 | 497 | |
498 | - $start_date = date( $format, $this->start_date ); |
|
498 | + $start_date = date($format, $this->start_date); |
|
499 | 499 | $start_where = " AND p.post_date >= '{$start_date}'"; |
500 | 500 | } |
501 | 501 | |
502 | - if ( $this->end_date ) { |
|
502 | + if ($this->end_date) { |
|
503 | 503 | |
504 | - if ( $this->timestamp ) { |
|
504 | + if ($this->timestamp) { |
|
505 | 505 | $format = 'Y-m-d H:i:s'; |
506 | 506 | } else { |
507 | 507 | $format = 'Y-m-d 23:59:59'; |
508 | 508 | } |
509 | 509 | |
510 | - $end_date = date( $format, $this->end_date ); |
|
510 | + $end_date = date($format, $this->end_date); |
|
511 | 511 | |
512 | 512 | $end_where = " AND p.post_date <= '{$end_date}'"; |
513 | 513 | } |
@@ -529,34 +529,34 @@ discard block |
||
529 | 529 | * |
530 | 530 | * @return string |
531 | 531 | */ |
532 | - public function payments_where( $where = '' ) { |
|
532 | + public function payments_where($where = '') { |
|
533 | 533 | |
534 | 534 | global $wpdb; |
535 | 535 | |
536 | 536 | $start_where = ''; |
537 | 537 | $end_where = ''; |
538 | 538 | |
539 | - if ( ! is_wp_error( $this->start_date ) ) { |
|
539 | + if ( ! is_wp_error($this->start_date)) { |
|
540 | 540 | |
541 | - if ( $this->timestamp ) { |
|
541 | + if ($this->timestamp) { |
|
542 | 542 | $format = 'Y-m-d H:i:s'; |
543 | 543 | } else { |
544 | 544 | $format = 'Y-m-d 00:00:00'; |
545 | 545 | } |
546 | 546 | |
547 | - $start_date = date( $format, $this->start_date ); |
|
547 | + $start_date = date($format, $this->start_date); |
|
548 | 548 | $start_where = " AND $wpdb->posts.post_date >= '{$start_date}'"; |
549 | 549 | } |
550 | 550 | |
551 | - if ( ! is_wp_error( $this->end_date ) ) { |
|
551 | + if ( ! is_wp_error($this->end_date)) { |
|
552 | 552 | |
553 | - if ( $this->timestamp ) { |
|
553 | + if ($this->timestamp) { |
|
554 | 554 | $format = 'Y-m-d H:i:s'; |
555 | 555 | } else { |
556 | 556 | $format = 'Y-m-d 23:59:59'; |
557 | 557 | } |
558 | 558 | |
559 | - $end_date = date( $format, $this->end_date ); |
|
559 | + $end_date = date($format, $this->end_date); |
|
560 | 560 | |
561 | 561 | $end_where = " AND $wpdb->posts.post_date <= '{$end_date}'"; |
562 | 562 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | |
25 | 25 | // Exit if accessed directly. |
26 | -if ( ! defined( 'ABSPATH' ) ) { |
|
26 | +if ( ! defined('ABSPATH')) { |
|
27 | 27 | exit; |
28 | 28 | } |
29 | 29 | |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | * @param callable $func Hook to run when email tag is found |
57 | 57 | * @param string $context Email tag category |
58 | 58 | */ |
59 | - public function add( $tag, $description, $func, $context = '' ) { |
|
60 | - if ( is_callable( $func ) ) { |
|
61 | - $this->tags[ $tag ] = array( |
|
59 | + public function add($tag, $description, $func, $context = '') { |
|
60 | + if (is_callable($func)) { |
|
61 | + $this->tags[$tag] = array( |
|
62 | 62 | 'tag' => $tag, |
63 | 63 | 'description' => $description, |
64 | 64 | 'func' => $func, |
65 | - 'context' => give_check_variable( $context, 'empty', 'general' ), |
|
65 | + 'context' => give_check_variable($context, 'empty', 'general'), |
|
66 | 66 | ); |
67 | 67 | } |
68 | 68 | } |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @param string $tag Email tag to remove hook from |
76 | 76 | */ |
77 | - public function remove( $tag ) { |
|
78 | - unset( $this->tags[ $tag ] ); |
|
77 | + public function remove($tag) { |
|
78 | + unset($this->tags[$tag]); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @return bool |
89 | 89 | */ |
90 | - public function email_tag_exists( $tag ) { |
|
91 | - return array_key_exists( $tag, $this->tags ); |
|
90 | + public function email_tag_exists($tag) { |
|
91 | + return array_key_exists($tag, $this->tags); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -102,23 +102,23 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @return array |
104 | 104 | */ |
105 | - public function get_tags( $context_type = 'all', $field = '' ) { |
|
105 | + public function get_tags($context_type = 'all', $field = '') { |
|
106 | 106 | $tags = $this->tags; |
107 | 107 | |
108 | - if ( 'all' !== $context_type ) { |
|
108 | + if ('all' !== $context_type) { |
|
109 | 109 | $tags = array(); |
110 | 110 | |
111 | - foreach ( $this->tags as $tag ) { |
|
112 | - if ( empty( $tag['context'] ) || $context_type !== $tag['context'] ) { |
|
111 | + foreach ($this->tags as $tag) { |
|
112 | + if (empty($tag['context']) || $context_type !== $tag['context']) { |
|
113 | 113 | continue; |
114 | 114 | } |
115 | 115 | |
116 | - $tags[ $tag['tag'] ] = $tag; |
|
116 | + $tags[$tag['tag']] = $tag; |
|
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | - if ( ! empty( $tags ) && ! empty( $field ) ) { |
|
121 | - $tags = wp_list_pluck( $tags, $field ); |
|
120 | + if ( ! empty($tags) && ! empty($field)) { |
|
121 | + $tags = wp_list_pluck($tags, $field); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | return $tags; |
@@ -136,16 +136,16 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @return string Content with email tags filtered out. |
138 | 138 | */ |
139 | - public function do_tags( $content, $tag_args ) { |
|
139 | + public function do_tags($content, $tag_args) { |
|
140 | 140 | |
141 | 141 | // Check if there is at least one tag added. |
142 | - if ( empty( $this->tags ) || ! is_array( $this->tags ) ) { |
|
142 | + if (empty($this->tags) || ! is_array($this->tags)) { |
|
143 | 143 | return $content; |
144 | 144 | } |
145 | 145 | |
146 | 146 | $this->tag_args = $tag_args; |
147 | 147 | |
148 | - $new_content = preg_replace_callback( "/{([A-z0-9\-\_]+)}/s", array( $this, 'do_tag' ), $content ); |
|
148 | + $new_content = preg_replace_callback("/{([A-z0-9\-\_]+)}/s", array($this, 'do_tag'), $content); |
|
149 | 149 | |
150 | 150 | $this->tag_args = null; |
151 | 151 | |
@@ -161,17 +161,17 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @return mixed |
163 | 163 | */ |
164 | - public function do_tag( $m ) { |
|
164 | + public function do_tag($m) { |
|
165 | 165 | |
166 | 166 | // Get tag |
167 | 167 | $tag = $m[1]; |
168 | 168 | |
169 | 169 | // Return tag if tag not set |
170 | - if ( ! $this->email_tag_exists( $tag ) ) { |
|
170 | + if ( ! $this->email_tag_exists($tag)) { |
|
171 | 171 | return $m[0]; |
172 | 172 | } |
173 | 173 | |
174 | - return call_user_func( $this->tags[ $tag ]['func'], $this->tag_args, $tag ); |
|
174 | + return call_user_func($this->tags[$tag]['func'], $this->tag_args, $tag); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | } |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | * @param callable $func Hook to run when email tag is found |
187 | 187 | * @param string $context Email tag category |
188 | 188 | */ |
189 | -function give_add_email_tag( $tag, $description, $func, $context = '' ) { |
|
190 | - Give()->email_tags->add( $tag, $description, $func, $context ); |
|
189 | +function give_add_email_tag($tag, $description, $func, $context = '') { |
|
190 | + Give()->email_tags->add($tag, $description, $func, $context); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @param string $tag Email tag to remove hook from |
199 | 199 | */ |
200 | -function give_remove_email_tag( $tag ) { |
|
201 | - Give()->email_tags->remove( $tag ); |
|
200 | +function give_remove_email_tag($tag) { |
|
201 | + Give()->email_tags->remove($tag); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | /** |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | * |
211 | 211 | * @return bool |
212 | 212 | */ |
213 | -function give_email_tag_exists( $tag ) { |
|
214 | - return Give()->email_tags->email_tag_exists( $tag ); |
|
213 | +function give_email_tag_exists($tag) { |
|
214 | + return Give()->email_tags->email_tag_exists($tag); |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -238,9 +238,9 @@ discard block |
||
238 | 238 | $email_tags = give_get_email_tags(); |
239 | 239 | |
240 | 240 | ob_start(); |
241 | - if ( count( $email_tags ) > 0 ) : ?> |
|
241 | + if (count($email_tags) > 0) : ?> |
|
242 | 242 | <div class="give-email-tags-wrap"> |
243 | - <?php foreach ( $email_tags as $email_tag ) : ?> |
|
243 | + <?php foreach ($email_tags as $email_tag) : ?> |
|
244 | 244 | <span class="give_<?php echo $email_tag['tag']; ?>_tag"> |
245 | 245 | <code>{<?php echo $email_tag['tag']; ?>}</code> - <?php echo $email_tag['description']; ?> |
246 | 246 | </span> |
@@ -264,14 +264,14 @@ discard block |
||
264 | 264 | * |
265 | 265 | * @return string Content with email tags filtered out. |
266 | 266 | */ |
267 | -function give_do_email_tags( $content, $tag_args ) { |
|
267 | +function give_do_email_tags($content, $tag_args) { |
|
268 | 268 | // Backward compatibility < 2.0 |
269 | - if ( ! is_array( $tag_args ) ) { |
|
270 | - $tag_args = array( 'payment_id' => $tag_args ); |
|
269 | + if ( ! is_array($tag_args)) { |
|
270 | + $tag_args = array('payment_id' => $tag_args); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | // Replace all tags |
274 | - $content = Give()->email_tags->do_tags( $content, $tag_args ); |
|
274 | + $content = Give()->email_tags->do_tags($content, $tag_args); |
|
275 | 275 | |
276 | 276 | /** |
277 | 277 | * Filter the filtered content text. |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | * @since 1.0 |
280 | 280 | * @since 2.0 $payment_meta, $payment_id removed and $tag_args added. |
281 | 281 | */ |
282 | - $content = apply_filters( 'give_email_template_tags', $content, $tag_args ); |
|
282 | + $content = apply_filters('give_email_template_tags', $content, $tag_args); |
|
283 | 283 | |
284 | 284 | // Return content |
285 | 285 | return $content; |
@@ -298,10 +298,10 @@ discard block |
||
298 | 298 | * |
299 | 299 | * @since 1.0 |
300 | 300 | */ |
301 | - do_action( 'give_add_email_tags' ); |
|
301 | + do_action('give_add_email_tags'); |
|
302 | 302 | } |
303 | 303 | |
304 | -add_action( 'init', 'give_load_email_tags', - 999 ); |
|
304 | +add_action('init', 'give_load_email_tags', - 999); |
|
305 | 305 | |
306 | 306 | |
307 | 307 | /** |
@@ -316,67 +316,67 @@ discard block |
||
316 | 316 | /* Donation Payment */ |
317 | 317 | array( |
318 | 318 | 'tag' => 'donation', |
319 | - 'description' => esc_html__( 'The donation form name, and the donation level (if applicable).', 'give' ), |
|
319 | + 'description' => esc_html__('The donation form name, and the donation level (if applicable).', 'give'), |
|
320 | 320 | 'function' => 'give_email_tag_donation', |
321 | 321 | 'context' => 'donation', |
322 | 322 | ), |
323 | 323 | array( |
324 | 324 | 'tag' => 'amount', |
325 | - 'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ), |
|
325 | + 'description' => esc_html__('The total donation amount with currency sign.', 'give'), |
|
326 | 326 | 'function' => 'give_email_tag_amount', |
327 | 327 | 'context' => 'donation', |
328 | 328 | ), |
329 | 329 | array( |
330 | 330 | 'tag' => 'price', |
331 | - 'description' => esc_html__( 'The total donation amount with currency sign.', 'give' ), |
|
331 | + 'description' => esc_html__('The total donation amount with currency sign.', 'give'), |
|
332 | 332 | 'function' => 'give_email_tag_price', |
333 | 333 | 'context' => 'donation', |
334 | 334 | ), |
335 | 335 | array( |
336 | 336 | 'tag' => 'billing_address', |
337 | - 'description' => esc_html__( 'The donor\'s billing address.', 'give' ), |
|
337 | + 'description' => esc_html__('The donor\'s billing address.', 'give'), |
|
338 | 338 | 'function' => 'give_email_tag_billing_address', |
339 | 339 | 'context' => 'donation', |
340 | 340 | ), |
341 | 341 | array( |
342 | 342 | 'tag' => 'date', |
343 | - 'description' => esc_html__( 'The date of the donation.', 'give' ), |
|
343 | + 'description' => esc_html__('The date of the donation.', 'give'), |
|
344 | 344 | 'function' => 'give_email_tag_date', |
345 | 345 | 'context' => 'donation', |
346 | 346 | ), |
347 | 347 | array( |
348 | 348 | 'tag' => 'payment_id', |
349 | - 'description' => esc_html__( 'The unique ID number for this donation.', 'give' ), |
|
349 | + 'description' => esc_html__('The unique ID number for this donation.', 'give'), |
|
350 | 350 | 'function' => 'give_email_tag_payment_id', |
351 | 351 | 'context' => 'donation', |
352 | 352 | ), |
353 | 353 | array( |
354 | 354 | 'tag' => 'payment_method', |
355 | - 'description' => esc_html__( 'The method of payment used for this donation.', 'give' ), |
|
355 | + 'description' => esc_html__('The method of payment used for this donation.', 'give'), |
|
356 | 356 | 'function' => 'give_email_tag_payment_method', |
357 | 357 | 'context' => 'donation', |
358 | 358 | ), |
359 | 359 | array( |
360 | 360 | 'tag' => 'payment_total', |
361 | - 'description' => esc_html__( 'The payment total for this donation.', 'give' ), |
|
361 | + 'description' => esc_html__('The payment total for this donation.', 'give'), |
|
362 | 362 | 'function' => 'give_email_tag_payment_total', |
363 | 363 | 'context' => 'donation', |
364 | 364 | ), |
365 | 365 | array( |
366 | 366 | 'tag' => 'receipt_id', |
367 | - 'description' => esc_html__( 'The unique ID number for this donation receipt.', 'give' ), |
|
367 | + 'description' => esc_html__('The unique ID number for this donation receipt.', 'give'), |
|
368 | 368 | 'function' => 'give_email_tag_receipt_id', |
369 | 369 | 'context' => 'donation', |
370 | 370 | ), |
371 | 371 | array( |
372 | 372 | 'tag' => 'receipt_link', |
373 | - 'description' => esc_html__( 'The donation receipt direct link, to view the receipt on the website.', 'give' ), |
|
373 | + 'description' => esc_html__('The donation receipt direct link, to view the receipt on the website.', 'give'), |
|
374 | 374 | 'function' => 'give_email_tag_receipt_link', |
375 | 375 | 'context' => 'donation', |
376 | 376 | ), |
377 | 377 | array( |
378 | 378 | 'tag' => 'receipt_link_url', |
379 | - 'description' => esc_html__( 'The donation receipt direct URL, to view the receipt on the website.', 'give' ), |
|
379 | + 'description' => esc_html__('The donation receipt direct URL, to view the receipt on the website.', 'give'), |
|
380 | 380 | 'function' => 'give_email_tag_receipt_link_url', |
381 | 381 | 'context' => 'donation', |
382 | 382 | ), |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | /* Donation Form */ |
385 | 385 | array( |
386 | 386 | 'tag' => 'form_title', |
387 | - 'description' => esc_html__( 'The donation form name.', 'give' ), |
|
387 | + 'description' => esc_html__('The donation form name.', 'give'), |
|
388 | 388 | 'function' => 'give_email_tag_form_title', |
389 | 389 | 'context' => 'form', |
390 | 390 | ), |
@@ -392,37 +392,37 @@ discard block |
||
392 | 392 | /* Donor */ |
393 | 393 | array( |
394 | 394 | 'tag' => 'name', |
395 | - 'description' => esc_html__( 'The donor\'s first name.', 'give' ), |
|
395 | + 'description' => esc_html__('The donor\'s first name.', 'give'), |
|
396 | 396 | 'function' => 'give_email_tag_first_name', |
397 | 397 | 'context' => 'donor', |
398 | 398 | ), |
399 | 399 | array( |
400 | 400 | 'tag' => 'fullname', |
401 | - 'description' => esc_html__( 'The donor\'s full name, first and last.', 'give' ), |
|
401 | + 'description' => esc_html__('The donor\'s full name, first and last.', 'give'), |
|
402 | 402 | 'function' => 'give_email_tag_fullname', |
403 | 403 | 'context' => 'donor', |
404 | 404 | ), |
405 | 405 | array( |
406 | 406 | 'tag' => 'username', |
407 | - 'description' => esc_html__( 'The donor\'s user name on the site, if they registered an account.', 'give' ), |
|
407 | + 'description' => esc_html__('The donor\'s user name on the site, if they registered an account.', 'give'), |
|
408 | 408 | 'function' => 'give_email_tag_username', |
409 | 409 | 'context' => 'donor', |
410 | 410 | ), |
411 | 411 | array( |
412 | 412 | 'tag' => 'company_name', |
413 | - 'description' => esc_html__( 'Company name.', 'give' ), |
|
413 | + 'description' => esc_html__('Company name.', 'give'), |
|
414 | 414 | 'function' => 'give_email_tag_company_name', |
415 | 415 | 'context' => 'donation', |
416 | 416 | ), |
417 | 417 | array( |
418 | 418 | 'tag' => 'user_email', |
419 | - 'description' => esc_html__( 'The donor\'s email address.', 'give' ), |
|
419 | + 'description' => esc_html__('The donor\'s email address.', 'give'), |
|
420 | 420 | 'function' => 'give_email_tag_user_email', |
421 | 421 | 'context' => 'donor', |
422 | 422 | ), |
423 | 423 | array( |
424 | 424 | 'tag' => 'email_access_link', |
425 | - 'description' => esc_html__( 'The donor\'s email access link.', 'give' ), |
|
425 | + 'description' => esc_html__('The donor\'s email access link.', 'give'), |
|
426 | 426 | 'function' => 'give_email_tag_email_access_link', |
427 | 427 | 'context' => 'donor', |
428 | 428 | ), |
@@ -430,14 +430,14 @@ discard block |
||
430 | 430 | /* General */ |
431 | 431 | array( |
432 | 432 | 'tag' => 'sitename', |
433 | - 'description' => esc_html__( 'The name of your site.', 'give' ), |
|
433 | + 'description' => esc_html__('The name of your site.', 'give'), |
|
434 | 434 | 'function' => 'give_email_tag_sitename', |
435 | 435 | 'context' => 'general', |
436 | 436 | ), |
437 | 437 | |
438 | 438 | array( |
439 | 439 | 'tag' => 'reset_password_link', |
440 | - 'description' => esc_html__( 'The reset password link for user.', 'give' ), |
|
440 | + 'description' => esc_html__('The reset password link for user.', 'give'), |
|
441 | 441 | 'function' => 'give_email_tag_reset_password_link', |
442 | 442 | 'context' => 'general', |
443 | 443 | ), |
@@ -445,21 +445,21 @@ discard block |
||
445 | 445 | ); |
446 | 446 | |
447 | 447 | // Apply give_email_tags filter |
448 | - $email_tags = apply_filters( 'give_email_tags', $email_tags ); |
|
448 | + $email_tags = apply_filters('give_email_tags', $email_tags); |
|
449 | 449 | |
450 | 450 | // Add email tags |
451 | - foreach ( $email_tags as $email_tag ) { |
|
451 | + foreach ($email_tags as $email_tag) { |
|
452 | 452 | give_add_email_tag( |
453 | 453 | $email_tag['tag'], |
454 | 454 | $email_tag['description'], |
455 | 455 | $email_tag['function'], |
456 | - ( ! empty( $email_tag['context'] ) ? $email_tag['context'] : '' ) |
|
456 | + ( ! empty($email_tag['context']) ? $email_tag['context'] : '') |
|
457 | 457 | ); |
458 | 458 | } |
459 | 459 | |
460 | 460 | } |
461 | 461 | |
462 | -add_action( 'give_add_email_tags', 'give_setup_email_tags' ); |
|
462 | +add_action('give_add_email_tags', 'give_setup_email_tags'); |
|
463 | 463 | |
464 | 464 | |
465 | 465 | /** |
@@ -471,24 +471,24 @@ discard block |
||
471 | 471 | * |
472 | 472 | * @return string $firstname |
473 | 473 | */ |
474 | -function give_email_tag_first_name( $tag_args ) { |
|
474 | +function give_email_tag_first_name($tag_args) { |
|
475 | 475 | $user_info = array(); |
476 | 476 | $firstname = ''; |
477 | 477 | |
478 | 478 | // Backward compatibility. |
479 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
479 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
480 | 480 | |
481 | - switch ( true ) { |
|
482 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
483 | - $donor_info = give_get_payment_meta_user_info( $tag_args['payment_id'] ); |
|
484 | - $email_names = give_get_email_names( $donor_info ); |
|
481 | + switch (true) { |
|
482 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
483 | + $donor_info = give_get_payment_meta_user_info($tag_args['payment_id']); |
|
484 | + $email_names = give_get_email_names($donor_info); |
|
485 | 485 | $firstname = $email_names['name']; |
486 | 486 | |
487 | 487 | break; |
488 | 488 | |
489 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
489 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
490 | 490 | $firstname = Give()->donor_meta->get_meta( |
491 | - Give()->donors->get_column_by( 'id', 'user_id', $tag_args['user_id'] ), |
|
491 | + Give()->donors->get_column_by('id', 'user_id', $tag_args['user_id']), |
|
492 | 492 | '_give_donor_first_name', |
493 | 493 | true |
494 | 494 | ); |
@@ -499,8 +499,8 @@ discard block |
||
499 | 499 | * |
500 | 500 | * @since 2.0 |
501 | 501 | */ |
502 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
503 | - $firstname = Give()->donor_meta->get_meta( $tag_args['donor_id'], '_give_donor_first_name', true ); |
|
502 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
503 | + $firstname = Give()->donor_meta->get_meta($tag_args['donor_id'], '_give_donor_first_name', true); |
|
504 | 504 | break; |
505 | 505 | } |
506 | 506 | |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | * @param string $firstname |
513 | 513 | * @param array $tag_args |
514 | 514 | */ |
515 | - $firstname = apply_filters( 'give_email_tag_first_name', $firstname, $tag_args ); |
|
515 | + $firstname = apply_filters('give_email_tag_first_name', $firstname, $tag_args); |
|
516 | 516 | |
517 | 517 | return $firstname; |
518 | 518 | } |
@@ -526,21 +526,21 @@ discard block |
||
526 | 526 | * |
527 | 527 | * @return string $fullname |
528 | 528 | */ |
529 | -function give_email_tag_fullname( $tag_args ) { |
|
529 | +function give_email_tag_fullname($tag_args) { |
|
530 | 530 | $fullname = ''; |
531 | 531 | |
532 | 532 | // Backward compatibility. |
533 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
533 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
534 | 534 | |
535 | - switch ( true ) { |
|
536 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
537 | - $donor_info = give_get_payment_meta_user_info( $tag_args['payment_id'] ); |
|
538 | - $email_names = give_get_email_names( $donor_info ); |
|
535 | + switch (true) { |
|
536 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
537 | + $donor_info = give_get_payment_meta_user_info($tag_args['payment_id']); |
|
538 | + $email_names = give_get_email_names($donor_info); |
|
539 | 539 | $fullname = $email_names['fullname']; |
540 | 540 | break; |
541 | 541 | |
542 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
543 | - $fullname = Give()->donors->get_column_by( 'name', 'user_id', $tag_args['user_id'] ); |
|
542 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
543 | + $fullname = Give()->donors->get_column_by('name', 'user_id', $tag_args['user_id']); |
|
544 | 544 | break; |
545 | 545 | |
546 | 546 | /** |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | * |
549 | 549 | * @since 2.0 |
550 | 550 | */ |
551 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
552 | - $fullname = Give()->donors->get_column( 'name', $tag_args['donor_id'] ); |
|
551 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
552 | + $fullname = Give()->donors->get_column('name', $tag_args['donor_id']); |
|
553 | 553 | break; |
554 | 554 | } |
555 | 555 | |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | * @param string $fullname |
562 | 562 | * @param array $tag_args |
563 | 563 | */ |
564 | - $fullname = apply_filters( 'give_email_tag_fullname', $fullname, $tag_args ); |
|
564 | + $fullname = apply_filters('give_email_tag_fullname', $fullname, $tag_args); |
|
565 | 565 | |
566 | 566 | return $fullname; |
567 | 567 | } |
@@ -575,21 +575,21 @@ discard block |
||
575 | 575 | * |
576 | 576 | * @return string username. |
577 | 577 | */ |
578 | -function give_email_tag_username( $tag_args ) { |
|
578 | +function give_email_tag_username($tag_args) { |
|
579 | 579 | $username = ''; |
580 | 580 | |
581 | 581 | // Backward compatibility. |
582 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
582 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
583 | 583 | |
584 | - switch ( true ) { |
|
585 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
586 | - $donor_info = give_get_payment_meta_user_info( $tag_args['payment_id'] ); |
|
587 | - $email_names = give_get_email_names( $donor_info ); |
|
584 | + switch (true) { |
|
585 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
586 | + $donor_info = give_get_payment_meta_user_info($tag_args['payment_id']); |
|
587 | + $email_names = give_get_email_names($donor_info); |
|
588 | 588 | $username = $email_names['username']; |
589 | 589 | break; |
590 | 590 | |
591 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
592 | - $user_info = get_user_by( 'id', $tag_args['user_id'] ); |
|
591 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
592 | + $user_info = get_user_by('id', $tag_args['user_id']); |
|
593 | 593 | $username = $user_info->user_login; |
594 | 594 | break; |
595 | 595 | |
@@ -598,9 +598,9 @@ discard block |
||
598 | 598 | * |
599 | 599 | * @since 2.0 |
600 | 600 | */ |
601 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
602 | - if ( $user_id = Give()->donors->get_column( 'user_id', $tag_args['donor_id'] ) ) { |
|
603 | - $user_info = get_user_by( 'id', $user_id ); |
|
601 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
602 | + if ($user_id = Give()->donors->get_column('user_id', $tag_args['donor_id'])) { |
|
603 | + $user_info = get_user_by('id', $user_id); |
|
604 | 604 | $username = $user_info->user_login; |
605 | 605 | } |
606 | 606 | break; |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | * @param string $username |
615 | 615 | * @param array $tag_args |
616 | 616 | */ |
617 | - $username = apply_filters( 'give_email_tag_username', $username, $tag_args ); |
|
617 | + $username = apply_filters('give_email_tag_username', $username, $tag_args); |
|
618 | 618 | |
619 | 619 | return $username; |
620 | 620 | } |
@@ -628,19 +628,19 @@ discard block |
||
628 | 628 | * |
629 | 629 | * @return string user_email |
630 | 630 | */ |
631 | -function give_email_tag_user_email( $tag_args ) { |
|
631 | +function give_email_tag_user_email($tag_args) { |
|
632 | 632 | $email = ''; |
633 | 633 | |
634 | 634 | // Backward compatibility. |
635 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
635 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
636 | 636 | |
637 | - switch ( true ) { |
|
638 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
639 | - $email = give_get_donation_donor_email( $tag_args['payment_id'] ); |
|
637 | + switch (true) { |
|
638 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
639 | + $email = give_get_donation_donor_email($tag_args['payment_id']); |
|
640 | 640 | break; |
641 | 641 | |
642 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
643 | - $user_info = get_user_by( 'id', $tag_args['user_id'] ); |
|
642 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
643 | + $user_info = get_user_by('id', $tag_args['user_id']); |
|
644 | 644 | $email = $user_info->user_email; |
645 | 645 | break; |
646 | 646 | |
@@ -649,8 +649,8 @@ discard block |
||
649 | 649 | * |
650 | 650 | * @since 2.0 |
651 | 651 | */ |
652 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
653 | - $email = Give()->donors->get_column( 'email', $tag_args['donor_id'] ); |
|
652 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
653 | + $email = Give()->donors->get_column('email', $tag_args['donor_id']); |
|
654 | 654 | break; |
655 | 655 | } |
656 | 656 | |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | * @param string $email |
663 | 663 | * @param array $tag_args |
664 | 664 | */ |
665 | - $email = apply_filters( 'give_email_tag_user_email', $email, $tag_args ); |
|
665 | + $email = apply_filters('give_email_tag_user_email', $email, $tag_args); |
|
666 | 666 | |
667 | 667 | return $email; |
668 | 668 | } |
@@ -676,22 +676,22 @@ discard block |
||
676 | 676 | * |
677 | 677 | * @return string billing_address |
678 | 678 | */ |
679 | -function give_email_tag_billing_address( $tag_args ) { |
|
679 | +function give_email_tag_billing_address($tag_args) { |
|
680 | 680 | $address = ''; |
681 | 681 | |
682 | 682 | // Backward compatibility. |
683 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
683 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
684 | 684 | |
685 | - switch ( true ) { |
|
686 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
687 | - $donation_address = give_get_donation_address( $tag_args['payment_id'] ); |
|
688 | - $address = $donation_address['line1'] . "\n"; |
|
685 | + switch (true) { |
|
686 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
687 | + $donation_address = give_get_donation_address($tag_args['payment_id']); |
|
688 | + $address = $donation_address['line1']."\n"; |
|
689 | 689 | |
690 | - if ( ! empty( $donation_address['line2'] ) ) { |
|
691 | - $address .= $donation_address['line2'] . "\n"; |
|
690 | + if ( ! empty($donation_address['line2'])) { |
|
691 | + $address .= $donation_address['line2']."\n"; |
|
692 | 692 | } |
693 | 693 | |
694 | - $address .= $donation_address['city'] . ' ' . $donation_address['zip'] . ' ' . $donation_address['state'] . "\n"; |
|
694 | + $address .= $donation_address['city'].' '.$donation_address['zip'].' '.$donation_address['state']."\n"; |
|
695 | 695 | $address .= $donation_address['country']; |
696 | 696 | break; |
697 | 697 | } |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | * @param string $address |
705 | 705 | * @param array $tag_args |
706 | 706 | */ |
707 | - $address = apply_filters( 'give_email_tag_billing_address', $address, $tag_args ); |
|
707 | + $address = apply_filters('give_email_tag_billing_address', $address, $tag_args); |
|
708 | 708 | |
709 | 709 | return $address; |
710 | 710 | } |
@@ -718,15 +718,15 @@ discard block |
||
718 | 718 | * |
719 | 719 | * @return string $date Post Date. |
720 | 720 | */ |
721 | -function give_email_tag_date( $tag_args ) { |
|
721 | +function give_email_tag_date($tag_args) { |
|
722 | 722 | $date = ''; |
723 | 723 | |
724 | 724 | // Backward compatibility. |
725 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
725 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
726 | 726 | |
727 | - switch ( true ) { |
|
728 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
729 | - $date = date_i18n( give_date_format(), get_the_date( 'U', $tag_args['payment_id'] ) ); |
|
727 | + switch (true) { |
|
728 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
729 | + $date = date_i18n(give_date_format(), get_the_date('U', $tag_args['payment_id'])); |
|
730 | 730 | break; |
731 | 731 | } |
732 | 732 | |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | * @param string $date |
739 | 739 | * @param array $tag_args |
740 | 740 | */ |
741 | - $date = apply_filters( 'give_email_tag_date', $date, $tag_args ); |
|
741 | + $date = apply_filters('give_email_tag_date', $date, $tag_args); |
|
742 | 742 | |
743 | 743 | return $date; |
744 | 744 | } |
@@ -752,16 +752,16 @@ discard block |
||
752 | 752 | * |
753 | 753 | * @return string amount |
754 | 754 | */ |
755 | -function give_email_tag_amount( $tag_args ) { |
|
755 | +function give_email_tag_amount($tag_args) { |
|
756 | 756 | $amount = ''; |
757 | 757 | |
758 | 758 | // Backward compatibility. |
759 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
759 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
760 | 760 | |
761 | - switch ( true ) { |
|
762 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
763 | - $give_amount = give_donation_amount( $tag_args['payment_id'], true ); |
|
764 | - $amount = html_entity_decode( $give_amount, ENT_COMPAT, 'UTF-8' ); |
|
761 | + switch (true) { |
|
762 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
763 | + $give_amount = give_donation_amount($tag_args['payment_id'], true); |
|
764 | + $amount = html_entity_decode($give_amount, ENT_COMPAT, 'UTF-8'); |
|
765 | 765 | break; |
766 | 766 | } |
767 | 767 | |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | * @param string $amount |
774 | 774 | * @param array $tag_args |
775 | 775 | */ |
776 | - $amount = apply_filters( 'give_email_tag_amount', $amount, $tag_args ); |
|
776 | + $amount = apply_filters('give_email_tag_amount', $amount, $tag_args); |
|
777 | 777 | |
778 | 778 | return $amount; |
779 | 779 | } |
@@ -787,8 +787,8 @@ discard block |
||
787 | 787 | * |
788 | 788 | * @return string price |
789 | 789 | */ |
790 | -function give_email_tag_price( $tag_args ) { |
|
791 | - return give_email_tag_amount( $tag_args ); |
|
790 | +function give_email_tag_price($tag_args) { |
|
791 | + return give_email_tag_amount($tag_args); |
|
792 | 792 | } |
793 | 793 | |
794 | 794 | /** |
@@ -800,15 +800,15 @@ discard block |
||
800 | 800 | * |
801 | 801 | * @return int payment_id |
802 | 802 | */ |
803 | -function give_email_tag_payment_id( $tag_args ) { |
|
803 | +function give_email_tag_payment_id($tag_args) { |
|
804 | 804 | $payment_id = ''; |
805 | 805 | |
806 | 806 | // Backward compatibility. |
807 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
807 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
808 | 808 | |
809 | - switch ( true ) { |
|
810 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
811 | - $payment_id = Give()->seq_donation_number->get_serial_code( $tag_args['payment_id'] ); |
|
809 | + switch (true) { |
|
810 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
811 | + $payment_id = Give()->seq_donation_number->get_serial_code($tag_args['payment_id']); |
|
812 | 812 | break; |
813 | 813 | } |
814 | 814 | |
@@ -820,7 +820,7 @@ discard block |
||
820 | 820 | * @param string $payment_id |
821 | 821 | * @param array $tag_args |
822 | 822 | */ |
823 | - return apply_filters( 'give_email_tag_payment_id', $payment_id, $tag_args ); |
|
823 | + return apply_filters('give_email_tag_payment_id', $payment_id, $tag_args); |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | /** |
@@ -832,15 +832,15 @@ discard block |
||
832 | 832 | * |
833 | 833 | * @return string receipt_id |
834 | 834 | */ |
835 | -function give_email_tag_receipt_id( $tag_args ) { |
|
835 | +function give_email_tag_receipt_id($tag_args) { |
|
836 | 836 | $receipt_id = ''; |
837 | 837 | |
838 | 838 | // Backward compatibility. |
839 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
839 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
840 | 840 | |
841 | - switch ( true ) { |
|
842 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
843 | - $receipt_id = give_get_payment_key( $tag_args['payment_id'] ); |
|
841 | + switch (true) { |
|
842 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
843 | + $receipt_id = give_get_payment_key($tag_args['payment_id']); |
|
844 | 844 | break; |
845 | 845 | } |
846 | 846 | |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | * @param string $receipt_id |
853 | 853 | * @param array $tag_args |
854 | 854 | */ |
855 | - return apply_filters( 'give_email_tag_receipt_id', $receipt_id, $tag_args ); |
|
855 | + return apply_filters('give_email_tag_receipt_id', $receipt_id, $tag_args); |
|
856 | 856 | } |
857 | 857 | |
858 | 858 | /** |
@@ -864,21 +864,21 @@ discard block |
||
864 | 864 | * |
865 | 865 | * @return string $form_title |
866 | 866 | */ |
867 | -function give_email_tag_donation( $tag_args ) { |
|
867 | +function give_email_tag_donation($tag_args) { |
|
868 | 868 | $donation_form_title = ''; |
869 | 869 | |
870 | 870 | // Backward compatibility. |
871 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
871 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
872 | 872 | |
873 | - switch ( true ) { |
|
874 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
875 | - $level_title = give_has_variable_prices( give_get_payment_form_id( $tag_args['payment_id'] ) ); |
|
873 | + switch (true) { |
|
874 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
875 | + $level_title = give_has_variable_prices(give_get_payment_form_id($tag_args['payment_id'])); |
|
876 | 876 | $separator = $level_title ? '-' : ''; |
877 | 877 | $donation_form_title = strip_tags( |
878 | 878 | give_check_variable( |
879 | 879 | give_get_donation_form_title( |
880 | 880 | $tag_args['payment_id'], |
881 | - array( 'separator' => $separator, ) |
|
881 | + array('separator' => $separator,) |
|
882 | 882 | ), |
883 | 883 | 'empty', |
884 | 884 | '' |
@@ -911,15 +911,15 @@ discard block |
||
911 | 911 | * |
912 | 912 | * @return string $form_title |
913 | 913 | */ |
914 | -function give_email_tag_form_title( $tag_args ) { |
|
914 | +function give_email_tag_form_title($tag_args) { |
|
915 | 915 | $donation_form_title = ''; |
916 | 916 | |
917 | 917 | // Backward compatibility. |
918 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
918 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
919 | 919 | |
920 | - switch ( true ) { |
|
921 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
922 | - $donation_form_title = give_get_payment_meta( $tag_args['payment_id'], '_give_payment_form_title' ); |
|
920 | + switch (true) { |
|
921 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
922 | + $donation_form_title = give_get_payment_meta($tag_args['payment_id'], '_give_payment_form_title'); |
|
923 | 923 | break; |
924 | 924 | } |
925 | 925 | |
@@ -948,15 +948,15 @@ discard block |
||
948 | 948 | * |
949 | 949 | * @return string $company_name |
950 | 950 | */ |
951 | -function give_email_tag_company_name( $tag_args ) { |
|
951 | +function give_email_tag_company_name($tag_args) { |
|
952 | 952 | $company_name = ''; |
953 | 953 | |
954 | 954 | // Backward compatibility. |
955 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
955 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
956 | 956 | |
957 | - switch ( true ) { |
|
958 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
959 | - $company_name = give_get_payment_meta( $tag_args['payment_id'], '_give_donation_company', true ); |
|
957 | + switch (true) { |
|
958 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
959 | + $company_name = give_get_payment_meta($tag_args['payment_id'], '_give_donation_company', true); |
|
960 | 960 | break; |
961 | 961 | } |
962 | 962 | |
@@ -984,18 +984,18 @@ discard block |
||
984 | 984 | * |
985 | 985 | * @return string gateway |
986 | 986 | */ |
987 | -function give_email_tag_payment_method( $tag_args ) { |
|
987 | +function give_email_tag_payment_method($tag_args) { |
|
988 | 988 | $payment_method = ''; |
989 | 989 | |
990 | 990 | // Backward compatibility. |
991 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
991 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
992 | 992 | |
993 | 993 | // Backward compatibility. |
994 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
994 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
995 | 995 | |
996 | - switch ( true ) { |
|
997 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
998 | - $payment_method = give_get_gateway_checkout_label( give_get_payment_gateway( $tag_args['payment_id'] ) ); |
|
996 | + switch (true) { |
|
997 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
998 | + $payment_method = give_get_gateway_checkout_label(give_get_payment_gateway($tag_args['payment_id'])); |
|
999 | 999 | break; |
1000 | 1000 | } |
1001 | 1001 | |
@@ -1026,15 +1026,15 @@ discard block |
||
1026 | 1026 | * |
1027 | 1027 | * @return string |
1028 | 1028 | */ |
1029 | -function give_email_tag_payment_total( $tag_args ) { |
|
1029 | +function give_email_tag_payment_total($tag_args) { |
|
1030 | 1030 | $payment_total = ''; |
1031 | 1031 | |
1032 | 1032 | // Backward compatibility. |
1033 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1033 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1034 | 1034 | |
1035 | - switch ( true ) { |
|
1036 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
1037 | - $payment_total = give_currency_filter( give_get_payment_total( $tag_args['payment_id'] ) ); |
|
1035 | + switch (true) { |
|
1036 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
1037 | + $payment_total = give_currency_filter(give_get_payment_total($tag_args['payment_id'])); |
|
1038 | 1038 | break; |
1039 | 1039 | } |
1040 | 1040 | |
@@ -1062,11 +1062,11 @@ discard block |
||
1062 | 1062 | * |
1063 | 1063 | * @return string |
1064 | 1064 | */ |
1065 | -function give_email_tag_sitename( $tag_args = array() ) { |
|
1066 | - $sitename = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); |
|
1065 | +function give_email_tag_sitename($tag_args = array()) { |
|
1066 | + $sitename = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES); |
|
1067 | 1067 | |
1068 | 1068 | // Backward compatibility. |
1069 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1069 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1070 | 1070 | |
1071 | 1071 | /** |
1072 | 1072 | * Filter the {sitename} email template tag output. |
@@ -1092,26 +1092,26 @@ discard block |
||
1092 | 1092 | * |
1093 | 1093 | * @return string receipt_link |
1094 | 1094 | */ |
1095 | -function give_email_tag_receipt_link( $tag_args ) { |
|
1095 | +function give_email_tag_receipt_link($tag_args) { |
|
1096 | 1096 | // Backward compatibility. |
1097 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1097 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1098 | 1098 | |
1099 | - $receipt_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) ); |
|
1099 | + $receipt_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id')); |
|
1100 | 1100 | |
1101 | 1101 | // Bailout. |
1102 | - if ( give_get_option( 'email_template' ) === 'none' ) { |
|
1102 | + if (give_get_option('email_template') === 'none') { |
|
1103 | 1103 | return $receipt_url; |
1104 | 1104 | } |
1105 | 1105 | |
1106 | 1106 | |
1107 | - $receipt_url = esc_url( add_query_arg( array( |
|
1108 | - 'payment_key' => give_get_payment_key( $tag_args['payment_id'] ), |
|
1109 | - ), give_get_history_page_uri() ) ); |
|
1107 | + $receipt_url = esc_url(add_query_arg(array( |
|
1108 | + 'payment_key' => give_get_payment_key($tag_args['payment_id']), |
|
1109 | + ), give_get_history_page_uri())); |
|
1110 | 1110 | |
1111 | 1111 | $formatted = sprintf( |
1112 | 1112 | '<a href="%1$s">%2$s</a>', |
1113 | 1113 | $receipt_url, |
1114 | - __( 'View it in your browser »', 'give' ) |
|
1114 | + __('View it in your browser »', 'give') |
|
1115 | 1115 | ); |
1116 | 1116 | |
1117 | 1117 | /** |
@@ -1140,11 +1140,11 @@ discard block |
||
1140 | 1140 | * |
1141 | 1141 | * @return string receipt_url |
1142 | 1142 | */ |
1143 | -function give_email_tag_receipt_link_url( $tag_args ) { |
|
1143 | +function give_email_tag_receipt_link_url($tag_args) { |
|
1144 | 1144 | // Backward compatibility. |
1145 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1145 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1146 | 1146 | |
1147 | - $receipt_link_url = give_get_receipt_url( give_check_variable( $tag_args, 'empty', 0, 'payment_id' ) ); |
|
1147 | + $receipt_link_url = give_get_receipt_url(give_check_variable($tag_args, 'empty', 0, 'payment_id')); |
|
1148 | 1148 | |
1149 | 1149 | /** |
1150 | 1150 | * Filter the {receipt_link_url} email template tag output. |
@@ -1171,13 +1171,13 @@ discard block |
||
1171 | 1171 | * |
1172 | 1172 | * @return string |
1173 | 1173 | */ |
1174 | -function give_get_receipt_url( $payment_id ) { |
|
1174 | +function give_get_receipt_url($payment_id) { |
|
1175 | 1175 | $receipt_url = ''; |
1176 | 1176 | |
1177 | - if ( $payment_id ) { |
|
1178 | - $receipt_url = esc_url( add_query_arg( array( |
|
1179 | - 'payment_key' => give_get_payment_key( $payment_id ), |
|
1180 | - ), give_get_history_page_uri() ) ); |
|
1177 | + if ($payment_id) { |
|
1178 | + $receipt_url = esc_url(add_query_arg(array( |
|
1179 | + 'payment_key' => give_get_payment_key($payment_id), |
|
1180 | + ), give_get_history_page_uri())); |
|
1181 | 1181 | } |
1182 | 1182 | |
1183 | 1183 | return $receipt_url; |
@@ -1193,22 +1193,22 @@ discard block |
||
1193 | 1193 | * |
1194 | 1194 | * @return string |
1195 | 1195 | */ |
1196 | -function give_email_tag_email_access_link( $tag_args ) { |
|
1196 | +function give_email_tag_email_access_link($tag_args) { |
|
1197 | 1197 | $donor_id = 0; |
1198 | 1198 | $donor = array(); |
1199 | 1199 | $email_access_link = ''; |
1200 | 1200 | |
1201 | 1201 | // Backward compatibility. |
1202 | - $tag_args = __give_20_bc_str_type_email_tag_param( $tag_args ); |
|
1202 | + $tag_args = __give_20_bc_str_type_email_tag_param($tag_args); |
|
1203 | 1203 | |
1204 | - switch ( true ) { |
|
1205 | - case ! empty( $tag_args['donor_id'] ): |
|
1204 | + switch (true) { |
|
1205 | + case ! empty($tag_args['donor_id']): |
|
1206 | 1206 | $donor_id = $tag_args['donor_id']; |
1207 | - $donor = Give()->donors->get_by( 'id', $tag_args['donor_id'] ); |
|
1207 | + $donor = Give()->donors->get_by('id', $tag_args['donor_id']); |
|
1208 | 1208 | break; |
1209 | 1209 | |
1210 | - case ! empty( $tag_args['user_id'] ): |
|
1211 | - $donor = Give()->donors->get_by( 'user_id', $tag_args['user_id'] ); |
|
1210 | + case ! empty($tag_args['user_id']): |
|
1211 | + $donor = Give()->donors->get_by('user_id', $tag_args['user_id']); |
|
1212 | 1212 | $donor_id = $donor->id; |
1213 | 1213 | break; |
1214 | 1214 | |
@@ -1217,11 +1217,11 @@ discard block |
||
1217 | 1217 | } |
1218 | 1218 | |
1219 | 1219 | // Set email access link if donor exist. |
1220 | - if ( $donor_id ) { |
|
1221 | - $verify_key = wp_generate_password( 20, false ); |
|
1220 | + if ($donor_id) { |
|
1221 | + $verify_key = wp_generate_password(20, false); |
|
1222 | 1222 | |
1223 | 1223 | // Generate a new verify key |
1224 | - Give()->email_access->set_verify_key( $donor_id, $donor->email, $verify_key ); |
|
1224 | + Give()->email_access->set_verify_key($donor_id, $donor->email, $verify_key); |
|
1225 | 1225 | |
1226 | 1226 | $access_url = add_query_arg( |
1227 | 1227 | array( |
@@ -1231,28 +1231,28 @@ discard block |
||
1231 | 1231 | ); |
1232 | 1232 | |
1233 | 1233 | // Add Payment Key to email access url, if it exists. |
1234 | - if ( ! empty( $_GET['payment_key'] ) ) { |
|
1234 | + if ( ! empty($_GET['payment_key'])) { |
|
1235 | 1235 | $access_url = add_query_arg( |
1236 | 1236 | array( |
1237 | - 'payment_key' => give_clean( $_GET['payment_key'] ), |
|
1237 | + 'payment_key' => give_clean($_GET['payment_key']), |
|
1238 | 1238 | ), |
1239 | 1239 | $access_url |
1240 | 1240 | ); |
1241 | 1241 | } |
1242 | 1242 | |
1243 | - if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) { |
|
1243 | + if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) { |
|
1244 | 1244 | $email_access_link = sprintf( |
1245 | 1245 | '<a href="%1$s" target="_blank">%2$s</a>', |
1246 | - esc_url( $access_url ), |
|
1247 | - __( 'View your donation history »', 'give' ) |
|
1246 | + esc_url($access_url), |
|
1247 | + __('View your donation history »', 'give') |
|
1248 | 1248 | ); |
1249 | 1249 | |
1250 | 1250 | } else { |
1251 | 1251 | |
1252 | 1252 | $email_access_link = sprintf( |
1253 | 1253 | '%1$s: %2$s', |
1254 | - __( 'View your donation history', 'give' ), |
|
1255 | - esc_url( $access_url ) |
|
1254 | + __('View your donation history', 'give'), |
|
1255 | + esc_url($access_url) |
|
1256 | 1256 | ); |
1257 | 1257 | } |
1258 | 1258 | } |
@@ -1284,23 +1284,23 @@ discard block |
||
1284 | 1284 | * |
1285 | 1285 | * @return array |
1286 | 1286 | */ |
1287 | -function __give_20_bc_str_type_email_tag_param( $tag_args ) { |
|
1288 | - if ( ! is_array( $tag_args ) ) { |
|
1289 | - switch ( true ) { |
|
1290 | - case ( 'give_payment' === get_post_type( $tag_args ) ): |
|
1291 | - $tag_args = array( 'payment_id' => $tag_args ); |
|
1287 | +function __give_20_bc_str_type_email_tag_param($tag_args) { |
|
1288 | + if ( ! is_array($tag_args)) { |
|
1289 | + switch (true) { |
|
1290 | + case ('give_payment' === get_post_type($tag_args)): |
|
1291 | + $tag_args = array('payment_id' => $tag_args); |
|
1292 | 1292 | break; |
1293 | 1293 | |
1294 | - case ( ! is_wp_error( get_user_by( 'id', $tag_args ) ) ): |
|
1295 | - $tag_args = array( 'user_id' => $tag_args ); |
|
1294 | + case ( ! is_wp_error(get_user_by('id', $tag_args))): |
|
1295 | + $tag_args = array('user_id' => $tag_args); |
|
1296 | 1296 | break; |
1297 | 1297 | |
1298 | - case ( Give()->donors->get_by( 'id', $tag_args ) ): |
|
1299 | - $tag_args = array( 'donor_id' => $tag_args ); |
|
1298 | + case (Give()->donors->get_by('id', $tag_args)): |
|
1299 | + $tag_args = array('donor_id' => $tag_args); |
|
1300 | 1300 | break; |
1301 | 1301 | |
1302 | - case ( Give()->donors->get_by( 'user_id', $tag_args ) ): |
|
1303 | - $tag_args = array( 'user_id' => $tag_args ); |
|
1302 | + case (Give()->donors->get_by('user_id', $tag_args)): |
|
1303 | + $tag_args = array('user_id' => $tag_args); |
|
1304 | 1304 | break; |
1305 | 1305 | } |
1306 | 1306 | } |
@@ -1318,36 +1318,36 @@ discard block |
||
1318 | 1318 | * |
1319 | 1319 | * @return array |
1320 | 1320 | */ |
1321 | -function give_email_tag_reset_password_link( $tag_args, $payment_id ) { |
|
1321 | +function give_email_tag_reset_password_link($tag_args, $payment_id) { |
|
1322 | 1322 | |
1323 | 1323 | $reset_password_url = ''; |
1324 | 1324 | |
1325 | - switch ( true ) { |
|
1326 | - case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): |
|
1327 | - $payment_id = Give()->seq_donation_number->get_serial_code( $tag_args['payment_id'] ); |
|
1325 | + switch (true) { |
|
1326 | + case give_check_variable($tag_args, 'isset', 0, 'payment_id'): |
|
1327 | + $payment_id = Give()->seq_donation_number->get_serial_code($tag_args['payment_id']); |
|
1328 | 1328 | break; |
1329 | 1329 | |
1330 | - case give_check_variable( $tag_args, 'isset', 0, 'user_id' ): |
|
1331 | - $reset_password_url = give_get_reset_password_url( $tag_args['user_id'] ); |
|
1330 | + case give_check_variable($tag_args, 'isset', 0, 'user_id'): |
|
1331 | + $reset_password_url = give_get_reset_password_url($tag_args['user_id']); |
|
1332 | 1332 | break; |
1333 | 1333 | |
1334 | - case give_check_variable( $tag_args, 'isset', 0, 'donor_id' ): |
|
1335 | - $reset_password_url = give_get_reset_password_url( Give()->donors->get_column( 'user_id', $tag_args['donor_id'] ) ); |
|
1334 | + case give_check_variable($tag_args, 'isset', 0, 'donor_id'): |
|
1335 | + $reset_password_url = give_get_reset_password_url(Give()->donors->get_column('user_id', $tag_args['donor_id'])); |
|
1336 | 1336 | break; |
1337 | 1337 | } |
1338 | 1338 | |
1339 | - if ( empty( $tag_args['email_content_type'] ) || 'text/html' === $tag_args['email_content_type'] ) { |
|
1339 | + if (empty($tag_args['email_content_type']) || 'text/html' === $tag_args['email_content_type']) { |
|
1340 | 1340 | // Generate link, if Email content type is html. |
1341 | 1341 | $reset_password_link = sprintf( |
1342 | 1342 | '<a href="%1$s" target="_blank">%2$s</a>', |
1343 | - esc_url( $reset_password_url ), |
|
1344 | - __( 'Reset your password »', 'give' ) |
|
1343 | + esc_url($reset_password_url), |
|
1344 | + __('Reset your password »', 'give') |
|
1345 | 1345 | ); |
1346 | 1346 | } else { |
1347 | 1347 | $reset_password_link = sprintf( |
1348 | 1348 | '%1$s: %2$s', |
1349 | - __( 'Reset your password', 'give' ), |
|
1350 | - esc_url( $reset_password_url ) |
|
1349 | + __('Reset your password', 'give'), |
|
1350 | + esc_url($reset_password_url) |
|
1351 | 1351 | ); |
1352 | 1352 | } |
1353 | 1353 | |
@@ -1376,21 +1376,21 @@ discard block |
||
1376 | 1376 | * |
1377 | 1377 | * @return mixed|string |
1378 | 1378 | */ |
1379 | -function give_get_reset_password_url( $user_id ) { |
|
1379 | +function give_get_reset_password_url($user_id) { |
|
1380 | 1380 | $reset_password_url = ''; |
1381 | 1381 | |
1382 | 1382 | // Proceed further only, if user_id exists. |
1383 | - if ( $user_id ) { |
|
1383 | + if ($user_id) { |
|
1384 | 1384 | |
1385 | 1385 | // Get User Object Details. |
1386 | - $user = get_user_by( 'ID', $user_id ); |
|
1386 | + $user = get_user_by('ID', $user_id); |
|
1387 | 1387 | |
1388 | 1388 | // Prepare Reset Password URL. |
1389 | - $reset_password_url = esc_url( add_query_arg( array( |
|
1389 | + $reset_password_url = esc_url(add_query_arg(array( |
|
1390 | 1390 | 'action' => 'rp', |
1391 | - 'key' => get_password_reset_key( $user ), |
|
1391 | + 'key' => get_password_reset_key($user), |
|
1392 | 1392 | 'login' => $user->user_login, |
1393 | - ), wp_login_url() ) ); |
|
1393 | + ), wp_login_url())); |
|
1394 | 1394 | } |
1395 | 1395 | |
1396 | 1396 | return $reset_password_url; |
@@ -1409,94 +1409,94 @@ discard block |
||
1409 | 1409 | * |
1410 | 1410 | * @return mixed |
1411 | 1411 | */ |
1412 | -function __give_render_metadata_email_tag( $content, $tag_args ) { |
|
1413 | - preg_match_all( "/{meta_([A-z0-9\-\_\ ]+)}/s", $content, $matches ); |
|
1412 | +function __give_render_metadata_email_tag($content, $tag_args) { |
|
1413 | + preg_match_all("/{meta_([A-z0-9\-\_\ ]+)}/s", $content, $matches); |
|
1414 | 1414 | |
1415 | - if ( ! empty( $matches[0] ) ) { |
|
1415 | + if ( ! empty($matches[0])) { |
|
1416 | 1416 | $search = $replace = array(); |
1417 | - foreach ( $matches[0] as $index => $meta_tag ) { |
|
1418 | - if ( in_array( $meta_tag, $search ) ) { |
|
1417 | + foreach ($matches[0] as $index => $meta_tag) { |
|
1418 | + if (in_array($meta_tag, $search)) { |
|
1419 | 1419 | continue; |
1420 | 1420 | } |
1421 | 1421 | |
1422 | 1422 | $search[] = $meta_tag; |
1423 | 1423 | |
1424 | - $meta_tag = str_replace( array( '{', 'meta_', '}' ), '', $meta_tag ); |
|
1425 | - $meta_tag_arr = array_map( 'trim', explode( ' ', $meta_tag, 2 ) ); |
|
1426 | - $meta_tag = current( $meta_tag_arr ); |
|
1424 | + $meta_tag = str_replace(array('{', 'meta_', '}'), '', $meta_tag); |
|
1425 | + $meta_tag_arr = array_map('trim', explode(' ', $meta_tag, 2)); |
|
1426 | + $meta_tag = current($meta_tag_arr); |
|
1427 | 1427 | |
1428 | - $meta_tag = str_replace( array( '{', 'meta_', '}' ), '', $meta_tag ); |
|
1429 | - $type = current( explode( '_', $meta_tag, 2 ) ); |
|
1430 | - $meta_name = preg_replace( "/^{$type}_/", '', $meta_tag ); |
|
1428 | + $meta_tag = str_replace(array('{', 'meta_', '}'), '', $meta_tag); |
|
1429 | + $type = current(explode('_', $meta_tag, 2)); |
|
1430 | + $meta_name = preg_replace("/^{$type}_/", '', $meta_tag); |
|
1431 | 1431 | |
1432 | - switch ( $type ) { |
|
1432 | + switch ($type) { |
|
1433 | 1433 | case 'donation': |
1434 | 1434 | |
1435 | 1435 | //Bailout. |
1436 | - if ( ! isset( $tag_args['payment_id'] ) ) { |
|
1436 | + if ( ! isset($tag_args['payment_id'])) { |
|
1437 | 1437 | $replace[] = ''; |
1438 | 1438 | continue; |
1439 | 1439 | } |
1440 | 1440 | |
1441 | - $meta_data = give_get_meta( absint( $tag_args['payment_id'] ), $meta_name, true, '' ); |
|
1441 | + $meta_data = give_get_meta(absint($tag_args['payment_id']), $meta_name, true, ''); |
|
1442 | 1442 | |
1443 | - if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) { |
|
1443 | + if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) { |
|
1444 | 1444 | $replace[] = $meta_data; |
1445 | - } elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) { |
|
1446 | - $replace[] = $meta_data[ $meta_tag_arr[1] ]; |
|
1445 | + } elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) { |
|
1446 | + $replace[] = $meta_data[$meta_tag_arr[1]]; |
|
1447 | 1447 | } |
1448 | 1448 | |
1449 | 1449 | break; |
1450 | 1450 | |
1451 | 1451 | case 'form': |
1452 | - $form_id = isset( $tag_args['form_id'] ) ? absint( $tag_args['form_id'] ) : 0; |
|
1452 | + $form_id = isset($tag_args['form_id']) ? absint($tag_args['form_id']) : 0; |
|
1453 | 1453 | |
1454 | 1454 | // Bailout. |
1455 | - if ( ! $form_id && isset( $tag_args['payment_id'] ) ) { |
|
1456 | - $form_id = give_get_payment_form_id( $tag_args['payment_id'] ); |
|
1455 | + if ( ! $form_id && isset($tag_args['payment_id'])) { |
|
1456 | + $form_id = give_get_payment_form_id($tag_args['payment_id']); |
|
1457 | 1457 | } |
1458 | 1458 | |
1459 | - $meta_data = give_get_meta( $form_id, $meta_name, true, '' ); |
|
1460 | - if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) { |
|
1459 | + $meta_data = give_get_meta($form_id, $meta_name, true, ''); |
|
1460 | + if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) { |
|
1461 | 1461 | $replace[] = $meta_data; |
1462 | - } elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) { |
|
1463 | - $replace[] = $meta_data[ $meta_tag_arr[1] ]; |
|
1462 | + } elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) { |
|
1463 | + $replace[] = $meta_data[$meta_tag_arr[1]]; |
|
1464 | 1464 | } |
1465 | 1465 | break; |
1466 | 1466 | |
1467 | 1467 | case 'donor': |
1468 | - $donor_id = isset( $tag_args['donor_id'] ) ? absint( $tag_args['donor_id'] ) : 0; |
|
1468 | + $donor_id = isset($tag_args['donor_id']) ? absint($tag_args['donor_id']) : 0; |
|
1469 | 1469 | |
1470 | 1470 | // Bailout. |
1471 | - if ( ! $donor_id ) { |
|
1472 | - if ( isset( $tag_args['payment_id'] ) ) { |
|
1473 | - $donor_id = give_get_payment_donor_id( $tag_args['payment_id'] ); |
|
1474 | - } elseif ( isset( $tag_args['user_id'] ) ) { |
|
1475 | - $donor_id = Give()->donors->get_column_by( 'id', 'user_id', $tag_args['user_id'] ); |
|
1471 | + if ( ! $donor_id) { |
|
1472 | + if (isset($tag_args['payment_id'])) { |
|
1473 | + $donor_id = give_get_payment_donor_id($tag_args['payment_id']); |
|
1474 | + } elseif (isset($tag_args['user_id'])) { |
|
1475 | + $donor_id = Give()->donors->get_column_by('id', 'user_id', $tag_args['user_id']); |
|
1476 | 1476 | } |
1477 | 1477 | } |
1478 | 1478 | |
1479 | - $meta_data = Give()->donor_meta->get_meta( $donor_id, $meta_name, true ); |
|
1479 | + $meta_data = Give()->donor_meta->get_meta($donor_id, $meta_name, true); |
|
1480 | 1480 | |
1481 | - if( empty( $meta_data ) && in_array( $meta_name, array_keys( Give()->donors->get_columns() ) ) ) { |
|
1482 | - $meta_data = Give()->donors->get_column_by( $meta_name, 'id', $donor_id ); |
|
1481 | + if (empty($meta_data) && in_array($meta_name, array_keys(Give()->donors->get_columns()))) { |
|
1482 | + $meta_data = Give()->donors->get_column_by($meta_name, 'id', $donor_id); |
|
1483 | 1483 | } |
1484 | 1484 | |
1485 | - if ( ! isset( $meta_tag_arr[1] ) || ! is_array( $meta_data ) ) { |
|
1485 | + if ( ! isset($meta_tag_arr[1]) || ! is_array($meta_data)) { |
|
1486 | 1486 | $replace[] = $meta_data; |
1487 | - } elseif ( in_array( $meta_tag_arr[1], array_keys( $meta_data ) ) ) { |
|
1488 | - $replace[] = $meta_data[ $meta_tag_arr[1] ]; |
|
1487 | + } elseif (in_array($meta_tag_arr[1], array_keys($meta_data))) { |
|
1488 | + $replace[] = $meta_data[$meta_tag_arr[1]]; |
|
1489 | 1489 | } |
1490 | 1490 | |
1491 | 1491 | break; |
1492 | 1492 | |
1493 | 1493 | default: |
1494 | - $replace[] = end( $search ); |
|
1494 | + $replace[] = end($search); |
|
1495 | 1495 | } |
1496 | 1496 | } |
1497 | 1497 | |
1498 | - if ( ! empty( $search ) && ! empty( $replace ) ) { |
|
1499 | - $content = str_replace( $search, $replace, $content ); |
|
1498 | + if ( ! empty($search) && ! empty($replace)) { |
|
1499 | + $content = str_replace($search, $replace, $content); |
|
1500 | 1500 | } |
1501 | 1501 | } |
1502 | 1502 | |
@@ -1504,4 +1504,4 @@ discard block |
||
1504 | 1504 | return $content; |
1505 | 1505 | } |
1506 | 1506 | |
1507 | -add_filter( 'give_email_template_tags', '__give_render_metadata_email_tag', 10, 2 ); |
|
1507 | +add_filter('give_email_template_tags', '__give_render_metadata_email_tag', 10, 2); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -348,11 +348,11 @@ discard block |
||
348 | 348 | * @param int|bool $_id Post id. Default is false. |
349 | 349 | * @param array $_args Arguments passed. |
350 | 350 | */ |
351 | - public function __construct( $_id = false, $_args = array() ) { |
|
351 | + public function __construct($_id = false, $_args = array()) { |
|
352 | 352 | |
353 | - $donation_form = WP_Post::get_instance( $_id ); |
|
353 | + $donation_form = WP_Post::get_instance($_id); |
|
354 | 354 | |
355 | - return $this->setup_donation_form( $donation_form ); |
|
355 | + return $this->setup_donation_form($donation_form); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | /** |
@@ -365,23 +365,23 @@ discard block |
||
365 | 365 | * |
366 | 366 | * @return bool If the setup was successful or not. |
367 | 367 | */ |
368 | - private function setup_donation_form( $donation_form ) { |
|
368 | + private function setup_donation_form($donation_form) { |
|
369 | 369 | |
370 | - if ( ! is_object( $donation_form ) ) { |
|
370 | + if ( ! is_object($donation_form)) { |
|
371 | 371 | return false; |
372 | 372 | } |
373 | 373 | |
374 | - if ( ! is_a( $donation_form, 'WP_Post' ) ) { |
|
374 | + if ( ! is_a($donation_form, 'WP_Post')) { |
|
375 | 375 | return false; |
376 | 376 | } |
377 | 377 | |
378 | - if ( 'give_forms' !== $donation_form->post_type ) { |
|
378 | + if ('give_forms' !== $donation_form->post_type) { |
|
379 | 379 | return false; |
380 | 380 | } |
381 | 381 | |
382 | - foreach ( $donation_form as $key => $value ) { |
|
382 | + foreach ($donation_form as $key => $value) { |
|
383 | 383 | |
384 | - switch ( $key ) { |
|
384 | + switch ($key) { |
|
385 | 385 | |
386 | 386 | default: |
387 | 387 | $this->$key = $value; |
@@ -405,16 +405,16 @@ discard block |
||
405 | 405 | * |
406 | 406 | * @return mixed |
407 | 407 | */ |
408 | - public function __get( $key ) { |
|
408 | + public function __get($key) { |
|
409 | 409 | |
410 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
410 | + if (method_exists($this, 'get_'.$key)) { |
|
411 | 411 | |
412 | - return call_user_func( array( $this, 'get_' . $key ) ); |
|
412 | + return call_user_func(array($this, 'get_'.$key)); |
|
413 | 413 | |
414 | 414 | } else { |
415 | 415 | |
416 | 416 | /* translators: %s: property key */ |
417 | - return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) ); |
|
417 | + return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key)); |
|
418 | 418 | |
419 | 419 | } |
420 | 420 | |
@@ -430,30 +430,30 @@ discard block |
||
430 | 430 | * |
431 | 431 | * @return bool|int False if data isn't passed and class not instantiated for creation, or New Form ID. |
432 | 432 | */ |
433 | - public function create( $data = array() ) { |
|
433 | + public function create($data = array()) { |
|
434 | 434 | |
435 | - if ( $this->id != 0 ) { |
|
435 | + if ($this->id != 0) { |
|
436 | 436 | return false; |
437 | 437 | } |
438 | 438 | |
439 | 439 | $defaults = array( |
440 | 440 | 'post_type' => 'give_forms', |
441 | 441 | 'post_status' => 'draft', |
442 | - 'post_title' => __( 'New Donation Form', 'give' ), |
|
442 | + 'post_title' => __('New Donation Form', 'give'), |
|
443 | 443 | ); |
444 | 444 | |
445 | - $args = wp_parse_args( $data, $defaults ); |
|
445 | + $args = wp_parse_args($data, $defaults); |
|
446 | 446 | |
447 | 447 | /** |
448 | 448 | * Fired before a donation form is created |
449 | 449 | * |
450 | 450 | * @param array $args The post object arguments used for creation. |
451 | 451 | */ |
452 | - do_action( 'give_form_pre_create', $args ); |
|
452 | + do_action('give_form_pre_create', $args); |
|
453 | 453 | |
454 | - $id = wp_insert_post( $args, true ); |
|
454 | + $id = wp_insert_post($args, true); |
|
455 | 455 | |
456 | - $donation_form = WP_Post::get_instance( $id ); |
|
456 | + $donation_form = WP_Post::get_instance($id); |
|
457 | 457 | |
458 | 458 | /** |
459 | 459 | * Fired after a donation form is created |
@@ -461,9 +461,9 @@ discard block |
||
461 | 461 | * @param int $id The post ID of the created item. |
462 | 462 | * @param array $args The post object arguments used for creation. |
463 | 463 | */ |
464 | - do_action( 'give_form_post_create', $id, $args ); |
|
464 | + do_action('give_form_post_create', $id, $args); |
|
465 | 465 | |
466 | - return $this->setup_donation_form( $donation_form ); |
|
466 | + return $this->setup_donation_form($donation_form); |
|
467 | 467 | |
468 | 468 | } |
469 | 469 | |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | * @return string Donation form name. |
489 | 489 | */ |
490 | 490 | public function get_name() { |
491 | - return get_the_title( $this->ID ); |
|
491 | + return get_the_title($this->ID); |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | /** |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | */ |
502 | 502 | public function get_price() { |
503 | 503 | |
504 | - if ( ! isset( $this->price ) ) { |
|
504 | + if ( ! isset($this->price)) { |
|
505 | 505 | |
506 | 506 | $this->price = give_maybe_sanitize_amount( |
507 | 507 | give_get_meta( |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | ) |
512 | 512 | ); |
513 | 513 | |
514 | - if ( ! $this->price ) { |
|
514 | + if ( ! $this->price) { |
|
515 | 515 | $this->price = 0; |
516 | 516 | } |
517 | 517 | |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | * @param string $price The donation form price. |
526 | 526 | * @param string|int $id The form ID. |
527 | 527 | */ |
528 | - return apply_filters( 'give_get_set_price', $this->price, $this->ID ); |
|
528 | + return apply_filters('give_get_set_price', $this->price, $this->ID); |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | /** |
@@ -538,22 +538,22 @@ discard block |
||
538 | 538 | */ |
539 | 539 | public function get_minimum_price() { |
540 | 540 | |
541 | - if ( ! isset( $this->minimum_price ) ) { |
|
541 | + if ( ! isset($this->minimum_price)) { |
|
542 | 542 | |
543 | - $this->minimum_price = give_get_meta( $this->ID, '_give_custom_amount_range_minimum', true ); |
|
543 | + $this->minimum_price = give_get_meta($this->ID, '_give_custom_amount_range_minimum', true); |
|
544 | 544 | |
545 | 545 | // Give backward < 2.1 |
546 | - if ( empty( $this->minimum_price ) ) { |
|
547 | - $this->minimum_price = give_get_meta( $this->ID, '_give_custom_amount_minimum', true ); |
|
546 | + if (empty($this->minimum_price)) { |
|
547 | + $this->minimum_price = give_get_meta($this->ID, '_give_custom_amount_minimum', true); |
|
548 | 548 | } |
549 | 549 | |
550 | - if ( ! $this->is_custom_price_mode() ) { |
|
551 | - $this->minimum_price = give_get_lowest_price_option( $this->ID ); |
|
550 | + if ( ! $this->is_custom_price_mode()) { |
|
551 | + $this->minimum_price = give_get_lowest_price_option($this->ID); |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | } |
555 | 555 | |
556 | - return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID ); |
|
556 | + return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID); |
|
557 | 557 | } |
558 | 558 | |
559 | 559 | /** |
@@ -566,15 +566,15 @@ discard block |
||
566 | 566 | */ |
567 | 567 | public function get_maximum_price() { |
568 | 568 | |
569 | - if ( ! isset( $this->maximum_price ) ) { |
|
570 | - $this->maximum_price = give_get_meta( $this->ID, '_give_custom_amount_range_maximum', true, 999999.99 ); |
|
569 | + if ( ! isset($this->maximum_price)) { |
|
570 | + $this->maximum_price = give_get_meta($this->ID, '_give_custom_amount_range_maximum', true, 999999.99); |
|
571 | 571 | |
572 | - if ( ! $this->is_custom_price_mode() ) { |
|
573 | - $this->maximum_price = give_get_highest_price_option( $this->ID ); |
|
572 | + if ( ! $this->is_custom_price_mode()) { |
|
573 | + $this->maximum_price = give_get_highest_price_option($this->ID); |
|
574 | 574 | } |
575 | 575 | } |
576 | 576 | |
577 | - return apply_filters( 'give_get_set_maximum_price', $this->maximum_price, $this->ID ); |
|
577 | + return apply_filters('give_get_set_maximum_price', $this->maximum_price, $this->ID); |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | /** |
@@ -587,9 +587,9 @@ discard block |
||
587 | 587 | */ |
588 | 588 | public function get_prices() { |
589 | 589 | |
590 | - if ( ! isset( $this->prices ) ) { |
|
590 | + if ( ! isset($this->prices)) { |
|
591 | 591 | |
592 | - $this->prices = give_get_meta( $this->ID, '_give_donation_levels', true ); |
|
592 | + $this->prices = give_get_meta($this->ID, '_give_donation_levels', true); |
|
593 | 593 | |
594 | 594 | } |
595 | 595 | |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | * @param array $prices The array of mulit-level prices. |
602 | 602 | * @param int|string $ID The ID of the form. |
603 | 603 | */ |
604 | - return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID ); |
|
604 | + return apply_filters('give_get_donation_levels', $this->prices, $this->ID); |
|
605 | 605 | |
606 | 606 | } |
607 | 607 | |
@@ -615,18 +615,18 @@ discard block |
||
615 | 615 | * |
616 | 616 | * @return array|null |
617 | 617 | */ |
618 | - public function get_level_info( $price_id ) { |
|
618 | + public function get_level_info($price_id) { |
|
619 | 619 | $level_info = array(); |
620 | 620 | |
621 | 621 | // Bailout. |
622 | - if ( 'multi' !== $this->get_type() ) { |
|
622 | + if ('multi' !== $this->get_type()) { |
|
623 | 623 | return null; |
624 | - } elseif ( ! ( $levels = $this->get_prices() ) ) { |
|
624 | + } elseif ( ! ($levels = $this->get_prices())) { |
|
625 | 625 | return $level_info; |
626 | 626 | } |
627 | 627 | |
628 | - foreach ( $levels as $level ) { |
|
629 | - if ( $price_id === $level['_give_id']['level_id'] ) { |
|
628 | + foreach ($levels as $level) { |
|
629 | + if ($price_id === $level['_give_id']['level_id']) { |
|
630 | 630 | $level_info = $level; |
631 | 631 | break; |
632 | 632 | } |
@@ -646,25 +646,25 @@ discard block |
||
646 | 646 | */ |
647 | 647 | public function get_goal() { |
648 | 648 | |
649 | - if ( ! isset( $this->goal ) ) { |
|
649 | + if ( ! isset($this->goal)) { |
|
650 | 650 | |
651 | - $goal_format = give_get_form_goal_format( $this->ID ); |
|
651 | + $goal_format = give_get_form_goal_format($this->ID); |
|
652 | 652 | |
653 | - if ( 'donation' === $goal_format ) { |
|
654 | - $this->goal = give_get_meta( $this->ID, '_give_number_of_donation_goal', true ); |
|
655 | - } elseif ( 'donors' === $goal_format ) { |
|
656 | - $this->goal = give_get_meta( $this->ID, '_give_number_of_donor_goal', true ); |
|
653 | + if ('donation' === $goal_format) { |
|
654 | + $this->goal = give_get_meta($this->ID, '_give_number_of_donation_goal', true); |
|
655 | + } elseif ('donors' === $goal_format) { |
|
656 | + $this->goal = give_get_meta($this->ID, '_give_number_of_donor_goal', true); |
|
657 | 657 | } else { |
658 | - $this->goal = give_get_meta( $this->ID, '_give_set_goal', true ); |
|
658 | + $this->goal = give_get_meta($this->ID, '_give_set_goal', true); |
|
659 | 659 | } |
660 | 660 | |
661 | - if ( ! $this->goal ) { |
|
661 | + if ( ! $this->goal) { |
|
662 | 662 | $this->goal = 0; |
663 | 663 | } |
664 | 664 | |
665 | 665 | } |
666 | 666 | |
667 | - return apply_filters( 'give_get_set_goal', $this->goal, $this->ID ); |
|
667 | + return apply_filters('give_get_set_goal', $this->goal, $this->ID); |
|
668 | 668 | |
669 | 669 | } |
670 | 670 | |
@@ -678,10 +678,10 @@ discard block |
||
678 | 678 | */ |
679 | 679 | public function is_single_price_mode() { |
680 | 680 | |
681 | - $option = give_get_meta( $this->ID, '_give_price_option', true ); |
|
681 | + $option = give_get_meta($this->ID, '_give_price_option', true); |
|
682 | 682 | $ret = 0; |
683 | 683 | |
684 | - if ( empty( $option ) || $option === 'set' ) { |
|
684 | + if (empty($option) || $option === 'set') { |
|
685 | 685 | $ret = 1; |
686 | 686 | } |
687 | 687 | |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | * @param bool $ret Is donation form in single price mode? |
694 | 694 | * @param int|string $ID The ID of the donation form. |
695 | 695 | */ |
696 | - return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID ); |
|
696 | + return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID); |
|
697 | 697 | |
698 | 698 | } |
699 | 699 | |
@@ -707,10 +707,10 @@ discard block |
||
707 | 707 | */ |
708 | 708 | public function is_custom_price_mode() { |
709 | 709 | |
710 | - $option = give_get_meta( $this->ID, '_give_custom_amount', true ); |
|
710 | + $option = give_get_meta($this->ID, '_give_custom_amount', true); |
|
711 | 711 | $ret = 0; |
712 | 712 | |
713 | - if ( give_is_setting_enabled( $option ) ) { |
|
713 | + if (give_is_setting_enabled($option)) { |
|
714 | 714 | $ret = 1; |
715 | 715 | } |
716 | 716 | |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | * @param bool $ret Is donation form in custom price mode? |
723 | 723 | * @param int|string $ID The ID of the donation form. |
724 | 724 | */ |
725 | - return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID ); |
|
725 | + return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID); |
|
726 | 726 | |
727 | 727 | } |
728 | 728 | |
@@ -736,20 +736,20 @@ discard block |
||
736 | 736 | * |
737 | 737 | * @return bool |
738 | 738 | */ |
739 | - public function is_custom_price( $amount ) { |
|
739 | + public function is_custom_price($amount) { |
|
740 | 740 | $result = false; |
741 | - $amount = give_maybe_sanitize_amount( $amount ); |
|
741 | + $amount = give_maybe_sanitize_amount($amount); |
|
742 | 742 | |
743 | - if ( $this->is_custom_price_mode() ) { |
|
743 | + if ($this->is_custom_price_mode()) { |
|
744 | 744 | |
745 | - if ( 'set' === $this->get_type() ) { |
|
746 | - if ( $amount !== $this->get_price() ) { |
|
745 | + if ('set' === $this->get_type()) { |
|
746 | + if ($amount !== $this->get_price()) { |
|
747 | 747 | $result = true; |
748 | 748 | } |
749 | 749 | |
750 | - } elseif ( 'multi' === $this->get_type() ) { |
|
751 | - $level_amounts = array_map( 'give_maybe_sanitize_amount', wp_list_pluck( $this->get_prices(), '_give_amount' ) ); |
|
752 | - $result = ! in_array( $amount, $level_amounts ); |
|
750 | + } elseif ('multi' === $this->get_type()) { |
|
751 | + $level_amounts = array_map('give_maybe_sanitize_amount', wp_list_pluck($this->get_prices(), '_give_amount')); |
|
752 | + $result = ! in_array($amount, $level_amounts); |
|
753 | 753 | } |
754 | 754 | } |
755 | 755 | |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | * |
763 | 763 | * @since 1.8.18 |
764 | 764 | */ |
765 | - return (bool) apply_filters( 'give_is_custom_price', $result, $amount, $this->ID ); |
|
765 | + return (bool) apply_filters('give_is_custom_price', $result, $amount, $this->ID); |
|
766 | 766 | } |
767 | 767 | |
768 | 768 | /** |
@@ -777,10 +777,10 @@ discard block |
||
777 | 777 | */ |
778 | 778 | public function has_variable_prices() { |
779 | 779 | |
780 | - $option = give_get_meta( $this->ID, '_give_price_option', true ); |
|
780 | + $option = give_get_meta($this->ID, '_give_price_option', true); |
|
781 | 781 | $ret = 0; |
782 | 782 | |
783 | - if ( $option === 'multi' ) { |
|
783 | + if ($option === 'multi') { |
|
784 | 784 | $ret = 1; |
785 | 785 | } |
786 | 786 | |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | * @param bool $ret Does donation form have variable prices? |
791 | 791 | * @param int|string $ID The ID of the donation form. |
792 | 792 | */ |
793 | - return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID ); |
|
793 | + return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID); |
|
794 | 794 | |
795 | 795 | } |
796 | 796 | |
@@ -804,17 +804,17 @@ discard block |
||
804 | 804 | */ |
805 | 805 | public function get_type() { |
806 | 806 | |
807 | - if ( ! isset( $this->type ) ) { |
|
807 | + if ( ! isset($this->type)) { |
|
808 | 808 | |
809 | - $this->type = give_get_meta( $this->ID, '_give_price_option', true ); |
|
809 | + $this->type = give_get_meta($this->ID, '_give_price_option', true); |
|
810 | 810 | |
811 | - if ( empty( $this->type ) ) { |
|
811 | + if (empty($this->type)) { |
|
812 | 812 | $this->type = 'set'; |
813 | 813 | } |
814 | 814 | |
815 | 815 | } |
816 | 816 | |
817 | - return apply_filters( 'give_get_form_type', $this->type, $this->ID ); |
|
817 | + return apply_filters('give_get_form_type', $this->type, $this->ID); |
|
818 | 818 | |
819 | 819 | } |
820 | 820 | |
@@ -830,23 +830,23 @@ discard block |
||
830 | 830 | * |
831 | 831 | * @return string |
832 | 832 | */ |
833 | - public function get_form_classes( $args ) { |
|
833 | + public function get_form_classes($args) { |
|
834 | 834 | |
835 | - $float_labels_option = give_is_float_labels_enabled( $args ) |
|
835 | + $float_labels_option = give_is_float_labels_enabled($args) |
|
836 | 836 | ? 'float-labels-enabled' |
837 | 837 | : ''; |
838 | 838 | |
839 | - $form_classes_array = apply_filters( 'give_form_classes', array( |
|
839 | + $form_classes_array = apply_filters('give_form_classes', array( |
|
840 | 840 | 'give-form', |
841 | - 'give-form-' . $this->ID, |
|
842 | - 'give-form-type-' . $this->get_type(), |
|
841 | + 'give-form-'.$this->ID, |
|
842 | + 'give-form-type-'.$this->get_type(), |
|
843 | 843 | $float_labels_option, |
844 | - ), $this->ID, $args ); |
|
844 | + ), $this->ID, $args); |
|
845 | 845 | |
846 | 846 | // Remove empty class names. |
847 | - $form_classes_array = array_filter( $form_classes_array ); |
|
847 | + $form_classes_array = array_filter($form_classes_array); |
|
848 | 848 | |
849 | - return implode( ' ', $form_classes_array ); |
|
849 | + return implode(' ', $form_classes_array); |
|
850 | 850 | |
851 | 851 | } |
852 | 852 | |
@@ -861,22 +861,22 @@ discard block |
||
861 | 861 | * |
862 | 862 | * @return string |
863 | 863 | */ |
864 | - public function get_form_wrap_classes( $args ) { |
|
864 | + public function get_form_wrap_classes($args) { |
|
865 | 865 | $custom_class = array( |
866 | 866 | 'give-form-wrap', |
867 | 867 | ); |
868 | 868 | |
869 | - if ( $this->is_close_donation_form() ) { |
|
869 | + if ($this->is_close_donation_form()) { |
|
870 | 870 | $custom_class[] = 'give-form-closed'; |
871 | 871 | } else { |
872 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
872 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
873 | 873 | ? $args['display_style'] |
874 | - : give_get_meta( $this->ID, '_give_payment_display', true ); |
|
874 | + : give_get_meta($this->ID, '_give_payment_display', true); |
|
875 | 875 | |
876 | 876 | $custom_class[] = "give-display-{$display_option}"; |
877 | 877 | |
878 | 878 | // If admin want to show only button for form then user inbuilt modal functionality. |
879 | - if ( 'button' === $display_option ) { |
|
879 | + if ('button' === $display_option) { |
|
880 | 880 | $custom_class[] = 'give-display-button-only'; |
881 | 881 | } |
882 | 882 | } |
@@ -887,10 +887,10 @@ discard block |
||
887 | 887 | * |
888 | 888 | * @since 1.0 |
889 | 889 | */ |
890 | - $form_wrap_classes_array = (array) apply_filters( 'give_form_wrap_classes', $custom_class, $this->ID, $args ); |
|
890 | + $form_wrap_classes_array = (array) apply_filters('give_form_wrap_classes', $custom_class, $this->ID, $args); |
|
891 | 891 | |
892 | 892 | |
893 | - return implode( ' ', $form_wrap_classes_array ); |
|
893 | + return implode(' ', $form_wrap_classes_array); |
|
894 | 894 | |
895 | 895 | } |
896 | 896 | |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | public function is_set_type_donation_form() { |
906 | 906 | $form_type = $this->get_type(); |
907 | 907 | |
908 | - return ( 'set' === $form_type ? true : false ); |
|
908 | + return ('set' === $form_type ? true : false); |
|
909 | 909 | } |
910 | 910 | |
911 | 911 | /** |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | public function is_multi_type_donation_form() { |
920 | 920 | $form_type = $this->get_type(); |
921 | 921 | |
922 | - return ( 'multi' === $form_type ? true : false ); |
|
922 | + return ('multi' === $form_type ? true : false); |
|
923 | 923 | |
924 | 924 | } |
925 | 925 | |
@@ -933,15 +933,15 @@ discard block |
||
933 | 933 | */ |
934 | 934 | public function get_sales() { |
935 | 935 | |
936 | - if ( ! isset( $this->sales ) ) { |
|
936 | + if ( ! isset($this->sales)) { |
|
937 | 937 | |
938 | - if ( '' == give_get_meta( $this->ID, '_give_form_sales', true ) ) { |
|
939 | - add_post_meta( $this->ID, '_give_form_sales', 0 ); |
|
938 | + if ('' == give_get_meta($this->ID, '_give_form_sales', true)) { |
|
939 | + add_post_meta($this->ID, '_give_form_sales', 0); |
|
940 | 940 | } // End if |
941 | 941 | |
942 | - $this->sales = give_get_meta( $this->ID, '_give_form_sales', true ); |
|
942 | + $this->sales = give_get_meta($this->ID, '_give_form_sales', true); |
|
943 | 943 | |
944 | - if ( $this->sales < 0 ) { |
|
944 | + if ($this->sales < 0) { |
|
945 | 945 | // Never let sales be less than zero. |
946 | 946 | $this->sales = 0; |
947 | 947 | } |
@@ -962,13 +962,13 @@ discard block |
||
962 | 962 | * |
963 | 963 | * @return int|false New number of total sales. |
964 | 964 | */ |
965 | - public function increase_sales( $quantity = 1 ) { |
|
965 | + public function increase_sales($quantity = 1) { |
|
966 | 966 | |
967 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
968 | - $quantity = absint( $quantity ); |
|
967 | + $sales = give_get_form_sales_stats($this->ID); |
|
968 | + $quantity = absint($quantity); |
|
969 | 969 | $total_sales = $sales + $quantity; |
970 | 970 | |
971 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
971 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
972 | 972 | |
973 | 973 | $this->sales = $total_sales; |
974 | 974 | |
@@ -989,17 +989,17 @@ discard block |
||
989 | 989 | * |
990 | 990 | * @return int|false New number of total sales. |
991 | 991 | */ |
992 | - public function decrease_sales( $quantity = 1 ) { |
|
992 | + public function decrease_sales($quantity = 1) { |
|
993 | 993 | |
994 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
994 | + $sales = give_get_form_sales_stats($this->ID); |
|
995 | 995 | |
996 | 996 | // Only decrease if not already zero |
997 | - if ( $sales > 0 ) { |
|
997 | + if ($sales > 0) { |
|
998 | 998 | |
999 | - $quantity = absint( $quantity ); |
|
999 | + $quantity = absint($quantity); |
|
1000 | 1000 | $total_sales = $sales - $quantity; |
1001 | 1001 | |
1002 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
1002 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
1003 | 1003 | |
1004 | 1004 | $this->sales = $sales; |
1005 | 1005 | |
@@ -1023,15 +1023,15 @@ discard block |
||
1023 | 1023 | */ |
1024 | 1024 | public function get_earnings() { |
1025 | 1025 | |
1026 | - if ( ! isset( $this->earnings ) ) { |
|
1026 | + if ( ! isset($this->earnings)) { |
|
1027 | 1027 | |
1028 | - if ( '' == give_get_meta( $this->ID, '_give_form_earnings', true ) ) { |
|
1029 | - add_post_meta( $this->ID, '_give_form_earnings', 0 ); |
|
1028 | + if ('' == give_get_meta($this->ID, '_give_form_earnings', true)) { |
|
1029 | + add_post_meta($this->ID, '_give_form_earnings', 0); |
|
1030 | 1030 | } |
1031 | 1031 | |
1032 | - $this->earnings = give_get_meta( $this->ID, '_give_form_earnings', true ); |
|
1032 | + $this->earnings = give_get_meta($this->ID, '_give_form_earnings', true); |
|
1033 | 1033 | |
1034 | - if ( $this->earnings < 0 ) { |
|
1034 | + if ($this->earnings < 0) { |
|
1035 | 1035 | // Never let earnings be less than zero |
1036 | 1036 | $this->earnings = 0; |
1037 | 1037 | } |
@@ -1055,9 +1055,9 @@ discard block |
||
1055 | 1055 | * |
1056 | 1056 | * @return float|false |
1057 | 1057 | */ |
1058 | - public function increase_earnings( $amount = 0, $payment_id = 0 ) { |
|
1058 | + public function increase_earnings($amount = 0, $payment_id = 0) { |
|
1059 | 1059 | |
1060 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
1060 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
1061 | 1061 | |
1062 | 1062 | /** |
1063 | 1063 | * Modify the earning amount when increasing. |
@@ -1068,11 +1068,11 @@ discard block |
||
1068 | 1068 | * @param int $form_id Donation form ID. |
1069 | 1069 | * @param int $payment_id Donation ID. |
1070 | 1070 | */ |
1071 | - $amount = apply_filters( 'give_increase_form_earnings_amount', $amount, $this->ID, $payment_id ); |
|
1071 | + $amount = apply_filters('give_increase_form_earnings_amount', $amount, $this->ID, $payment_id); |
|
1072 | 1072 | |
1073 | 1073 | $new_amount = $earnings + (float) $amount; |
1074 | 1074 | |
1075 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
1075 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
1076 | 1076 | |
1077 | 1077 | $this->earnings = $new_amount; |
1078 | 1078 | |
@@ -1095,11 +1095,11 @@ discard block |
||
1095 | 1095 | * |
1096 | 1096 | * @return float|false |
1097 | 1097 | */ |
1098 | - public function decrease_earnings( $amount, $payment_id = 0 ) { |
|
1098 | + public function decrease_earnings($amount, $payment_id = 0) { |
|
1099 | 1099 | |
1100 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
1100 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
1101 | 1101 | |
1102 | - if ( $earnings > 0 ) { |
|
1102 | + if ($earnings > 0) { |
|
1103 | 1103 | |
1104 | 1104 | /** |
1105 | 1105 | * Modify the earning value when decreasing it. |
@@ -1110,12 +1110,12 @@ discard block |
||
1110 | 1110 | * @param int $form_id Donation Form ID. |
1111 | 1111 | * @param int $payment_id Donation ID. |
1112 | 1112 | */ |
1113 | - $amount = apply_filters( 'give_decrease_form_earnings_amount', $amount, $this->ID, $payment_id ); |
|
1113 | + $amount = apply_filters('give_decrease_form_earnings_amount', $amount, $this->ID, $payment_id); |
|
1114 | 1114 | |
1115 | 1115 | // Only decrease if greater than zero |
1116 | 1116 | $new_amount = $earnings - (float) $amount; |
1117 | 1117 | |
1118 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
1118 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
1119 | 1119 | $this->earnings = $new_amount; |
1120 | 1120 | |
1121 | 1121 | return $this->earnings; |
@@ -1141,10 +1141,10 @@ discard block |
||
1141 | 1141 | * @return bool |
1142 | 1142 | */ |
1143 | 1143 | public function is_close_donation_form() { |
1144 | - $is_closed = ( 'closed' === give_get_meta( $this->ID, '_give_form_status', true, 'open' ) ); |
|
1144 | + $is_closed = ('closed' === give_get_meta($this->ID, '_give_form_status', true, 'open')); |
|
1145 | 1145 | |
1146 | 1146 | // If manual upgrade not completed, proceed with backward compatible code. |
1147 | - if ( ! give_has_upgrade_completed( 'v210_verify_form_status_upgrades' ) ) { |
|
1147 | + if ( ! give_has_upgrade_completed('v210_verify_form_status_upgrades')) { |
|
1148 | 1148 | |
1149 | 1149 | // Check for backward compatibility. |
1150 | 1150 | $is_closed = $this->bc_210_is_close_donation_form(); |
@@ -1174,17 +1174,17 @@ discard block |
||
1174 | 1174 | * |
1175 | 1175 | * @return bool The result of the update query. |
1176 | 1176 | */ |
1177 | - private function update_meta( $meta_key = '', $meta_value = '' ) { |
|
1177 | + private function update_meta($meta_key = '', $meta_value = '') { |
|
1178 | 1178 | |
1179 | 1179 | /* @var WPDB $wpdb */ |
1180 | 1180 | global $wpdb; |
1181 | 1181 | |
1182 | 1182 | // Bailout. |
1183 | - if ( empty( $meta_key ) ) { |
|
1183 | + if (empty($meta_key)) { |
|
1184 | 1184 | return false; |
1185 | 1185 | } |
1186 | 1186 | |
1187 | - if ( give_update_meta( $this->ID, $meta_key, $meta_value ) ) { |
|
1187 | + if (give_update_meta($this->ID, $meta_key, $meta_value)) { |
|
1188 | 1188 | return true; |
1189 | 1189 | } |
1190 | 1190 | |
@@ -1201,33 +1201,33 @@ discard block |
||
1201 | 1201 | private function bc_210_is_close_donation_form() { |
1202 | 1202 | |
1203 | 1203 | $close_form = false; |
1204 | - $is_goal_enabled = give_is_setting_enabled( give_get_meta( $this->ID, '_give_goal_option', true, 'disabled' ) ); |
|
1204 | + $is_goal_enabled = give_is_setting_enabled(give_get_meta($this->ID, '_give_goal_option', true, 'disabled')); |
|
1205 | 1205 | |
1206 | 1206 | // Proceed, if the form goal is enabled. |
1207 | - if ( $is_goal_enabled ) { |
|
1207 | + if ($is_goal_enabled) { |
|
1208 | 1208 | |
1209 | - $close_form_when_goal_achieved = give_is_setting_enabled( give_get_meta( $this->ID, '_give_close_form_when_goal_achieved', true, 'disabled' ) ); |
|
1209 | + $close_form_when_goal_achieved = give_is_setting_enabled(give_get_meta($this->ID, '_give_close_form_when_goal_achieved', true, 'disabled')); |
|
1210 | 1210 | |
1211 | 1211 | // Proceed, if close form when goal achieved option is enabled. |
1212 | - if ( $close_form_when_goal_achieved ) { |
|
1212 | + if ($close_form_when_goal_achieved) { |
|
1213 | 1213 | |
1214 | - $form = new Give_Donate_Form( $this->ID ); |
|
1215 | - $goal_format = give_get_form_goal_format( $this->ID ); |
|
1214 | + $form = new Give_Donate_Form($this->ID); |
|
1215 | + $goal_format = give_get_form_goal_format($this->ID); |
|
1216 | 1216 | |
1217 | 1217 | // Verify whether the form is closed or not after processing data based on goal format. |
1218 | - switch ( $goal_format ) { |
|
1218 | + switch ($goal_format) { |
|
1219 | 1219 | case 'donation': |
1220 | 1220 | $closed = $form->get_goal() <= $form->get_sales(); |
1221 | 1221 | break; |
1222 | 1222 | case 'donors': |
1223 | - $closed = $form->get_goal() <= give_get_form_donor_count( $this->ID ); |
|
1223 | + $closed = $form->get_goal() <= give_get_form_donor_count($this->ID); |
|
1224 | 1224 | break; |
1225 | 1225 | default : |
1226 | 1226 | $closed = $form->get_goal() <= $form->get_earnings(); |
1227 | 1227 | break; |
1228 | 1228 | } |
1229 | 1229 | |
1230 | - if ( $closed ) { |
|
1230 | + if ($closed) { |
|
1231 | 1231 | $close_form = true; |
1232 | 1232 | } |
1233 | 1233 |