@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Donation_Receipt extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = __( 'Donation Receipt', 'give' ); |
|
22 | - $this->shortcode['label'] = __( 'Donation Receipt', 'give' ); |
|
21 | + $this->shortcode['title'] = __('Donation Receipt', 'give'); |
|
22 | + $this->shortcode['label'] = __('Donation Receipt', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_receipt' ); |
|
24 | + parent::__construct('give_receipt'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -34,60 +34,60 @@ discard block |
||
34 | 34 | return array( |
35 | 35 | array( |
36 | 36 | 'type' => 'container', |
37 | - 'html' => sprintf( '<p class="strong">%s</p>', __( 'Optional settings', 'give' ) ), |
|
37 | + 'html' => sprintf('<p class="strong">%s</p>', __('Optional settings', 'give')), |
|
38 | 38 | ), |
39 | 39 | array( |
40 | 40 | 'type' => 'listbox', |
41 | 41 | 'name' => 'price', |
42 | - 'label' => __( 'Show Donation Amount:', 'give' ), |
|
42 | + 'label' => __('Show Donation Amount:', 'give'), |
|
43 | 43 | 'options' => array( |
44 | - 'true' => __( 'Show', 'give' ), |
|
45 | - 'false' => __( 'Hide', 'give' ), |
|
44 | + 'true' => __('Show', 'give'), |
|
45 | + 'false' => __('Hide', 'give'), |
|
46 | 46 | ), |
47 | 47 | ), |
48 | 48 | array( |
49 | 49 | 'type' => 'listbox', |
50 | 50 | 'name' => 'donor', |
51 | - 'label' => __( 'Show Donor Name:', 'give' ), |
|
51 | + 'label' => __('Show Donor Name:', 'give'), |
|
52 | 52 | 'options' => array( |
53 | - 'true' => __( 'Show', 'give' ), |
|
54 | - 'false' => __( 'Hide', 'give' ), |
|
53 | + 'true' => __('Show', 'give'), |
|
54 | + 'false' => __('Hide', 'give'), |
|
55 | 55 | ), |
56 | 56 | ), |
57 | 57 | array( |
58 | 58 | 'type' => 'listbox', |
59 | 59 | 'name' => 'date', |
60 | - 'label' => __( 'Show Date:', 'give' ), |
|
60 | + 'label' => __('Show Date:', 'give'), |
|
61 | 61 | 'options' => array( |
62 | - 'true' => __( 'Show', 'give' ), |
|
63 | - 'false' => __( 'Hide', 'give' ), |
|
62 | + 'true' => __('Show', 'give'), |
|
63 | + 'false' => __('Hide', 'give'), |
|
64 | 64 | ), |
65 | 65 | ), |
66 | 66 | array( |
67 | 67 | 'type' => 'listbox', |
68 | 68 | 'name' => 'payment_key', |
69 | - 'label' => __( 'Show Payment Key:', 'give' ), |
|
69 | + 'label' => __('Show Payment Key:', 'give'), |
|
70 | 70 | 'options' => array( |
71 | - 'true' => __( 'Show', 'give' ), |
|
72 | - 'false' => __( 'Hide', 'give' ), |
|
71 | + 'true' => __('Show', 'give'), |
|
72 | + 'false' => __('Hide', 'give'), |
|
73 | 73 | ), |
74 | 74 | ), |
75 | 75 | array( |
76 | 76 | 'type' => 'listbox', |
77 | 77 | 'name' => 'payment_method', |
78 | - 'label' => __( 'Show Payment Method:', 'give' ), |
|
78 | + 'label' => __('Show Payment Method:', 'give'), |
|
79 | 79 | 'options' => array( |
80 | - 'true' => __( 'Show', 'give' ), |
|
81 | - 'false' => __( 'Hide', 'give' ), |
|
80 | + 'true' => __('Show', 'give'), |
|
81 | + 'false' => __('Hide', 'give'), |
|
82 | 82 | ), |
83 | 83 | ), |
84 | 84 | array( |
85 | 85 | 'type' => 'listbox', |
86 | 86 | 'name' => 'payment_id', |
87 | - 'label' => __( 'Show Payment ID:', 'give' ), |
|
87 | + 'label' => __('Show Payment ID:', 'give'), |
|
88 | 88 | 'options' => array( |
89 | - 'true' => __( 'Show', 'give' ), |
|
90 | - 'false' => __( 'Hide', 'give' ), |
|
89 | + 'true' => __('Show', 'give'), |
|
90 | + 'false' => __('Hide', 'give'), |
|
91 | 91 | ), |
92 | 92 | ), |
93 | 93 | ); |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | */ |
41 | 41 | |
42 | 42 | // Exit if accessed directly |
43 | -if ( ! defined( 'ABSPATH' ) ) { |
|
43 | +if ( ! defined('ABSPATH')) { |
|
44 | 44 | exit; |
45 | 45 | } |
46 | 46 | |
47 | -if ( ! class_exists( 'Give' ) ) : |
|
47 | +if ( ! class_exists('Give')) : |
|
48 | 48 | /** |
49 | 49 | * Main Give Class |
50 | 50 | * |
@@ -159,11 +159,11 @@ discard block |
||
159 | 159 | * @return Give |
160 | 160 | */ |
161 | 161 | public static function instance() { |
162 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) { |
|
162 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) { |
|
163 | 163 | self::$instance = new Give; |
164 | 164 | self::$instance->setup_constants(); |
165 | 165 | |
166 | - add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); |
|
166 | + add_action('plugins_loaded', array(self::$instance, 'load_textdomain')); |
|
167 | 167 | |
168 | 168 | self::$instance->includes(); |
169 | 169 | self::$instance->roles = new Give_Roles(); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | */ |
196 | 196 | public function __clone() { |
197 | 197 | // Cloning instances of the class is forbidden |
198 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
198 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
199 | 199 | } |
200 | 200 | |
201 | 201 | /** |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public function __wakeup() { |
209 | 209 | // Unserializing instances of the class is forbidden |
210 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
210 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | /** |
@@ -220,33 +220,33 @@ discard block |
||
220 | 220 | private function setup_constants() { |
221 | 221 | |
222 | 222 | // Plugin version |
223 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
224 | - define( 'GIVE_VERSION', '1.5.2' ); |
|
223 | + if ( ! defined('GIVE_VERSION')) { |
|
224 | + define('GIVE_VERSION', '1.5.2'); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | // Plugin Folder Path |
228 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
229 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
228 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
229 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | // Plugin Folder URL |
233 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
234 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
233 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
234 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__)); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | // Plugin Basename aka: "give/give.php" |
238 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
239 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
238 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
239 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | // Plugin Root File |
243 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
244 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
243 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
244 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | // Make sure CAL_GREGORIAN is defined |
248 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
249 | - define( 'CAL_GREGORIAN', 1 ); |
|
248 | + if ( ! defined('CAL_GREGORIAN')) { |
|
249 | + define('CAL_GREGORIAN', 1); |
|
250 | 250 | } |
251 | 251 | } |
252 | 252 | |
@@ -260,109 +260,109 @@ discard block |
||
260 | 260 | private function includes() { |
261 | 261 | global $give_options; |
262 | 262 | |
263 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
263 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
264 | 264 | $give_options = give_get_settings(); |
265 | 265 | |
266 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
267 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
268 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
269 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
270 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
271 | - |
|
272 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
273 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
274 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
275 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
276 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php'; |
|
277 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php'; |
|
278 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
279 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
280 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
281 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
282 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
283 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
284 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
285 | - |
|
286 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
287 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
288 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
289 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
290 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
291 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
292 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
293 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
294 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
295 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
296 | - require_once GIVE_PLUGIN_DIR . 'includes/process-purchase.php'; |
|
297 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
298 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
299 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
300 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated-functions.php'; |
|
301 | - |
|
302 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
303 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
304 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
305 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
306 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
307 | - |
|
308 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
309 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
310 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
311 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
312 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
313 | - |
|
314 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
315 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
316 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
317 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
318 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
319 | - |
|
320 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
321 | - |
|
322 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
323 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
324 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
325 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
326 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
327 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
328 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
329 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
330 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
331 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
332 | - |
|
333 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
334 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
335 | - |
|
336 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
337 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
338 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
339 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
340 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
341 | - |
|
342 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php'; |
|
343 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
344 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php'; |
|
345 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php'; |
|
346 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php'; |
|
347 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
348 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
349 | - |
|
350 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
351 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
352 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
353 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
354 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
355 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
356 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
357 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
358 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
359 | - |
|
360 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
361 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php'; |
|
266 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
267 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
268 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
269 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
270 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
271 | + |
|
272 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
273 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
274 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
275 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
276 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php'; |
|
277 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php'; |
|
278 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
279 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
280 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
281 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
282 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
283 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
284 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
285 | + |
|
286 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
287 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
288 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
289 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
290 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
291 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
292 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
293 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
294 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
295 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
296 | + require_once GIVE_PLUGIN_DIR.'includes/process-purchase.php'; |
|
297 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
298 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
299 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
300 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated-functions.php'; |
|
301 | + |
|
302 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
303 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
304 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
305 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
306 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
307 | + |
|
308 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
309 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
310 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
311 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
312 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
313 | + |
|
314 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
315 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
316 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
317 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
318 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
319 | + |
|
320 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
321 | + |
|
322 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
323 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
324 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
325 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
326 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
327 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
328 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
329 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
330 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
331 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
332 | + |
|
333 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
334 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
335 | + |
|
336 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
337 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
338 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
339 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
340 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
341 | + |
|
342 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php'; |
|
343 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
344 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php'; |
|
345 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php'; |
|
346 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php'; |
|
347 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
348 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
349 | + |
|
350 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
351 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
352 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
353 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
354 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
355 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
356 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
357 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
358 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
359 | + |
|
360 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
361 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
362 | 362 | |
363 | 363 | } |
364 | 364 | |
365 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
365 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
366 | 366 | |
367 | 367 | } |
368 | 368 | |
@@ -375,26 +375,26 @@ discard block |
||
375 | 375 | */ |
376 | 376 | public function load_textdomain() { |
377 | 377 | // Set filter for Give's languages directory |
378 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
379 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
378 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
379 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
380 | 380 | |
381 | 381 | // Traditional WordPress plugin locale filter |
382 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
383 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
382 | + $locale = apply_filters('plugin_locale', get_locale(), 'give'); |
|
383 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale); |
|
384 | 384 | |
385 | 385 | // Setup paths to current locale file |
386 | - $mofile_local = $give_lang_dir . $mofile; |
|
387 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
386 | + $mofile_local = $give_lang_dir.$mofile; |
|
387 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
388 | 388 | |
389 | - if ( file_exists( $mofile_global ) ) { |
|
389 | + if (file_exists($mofile_global)) { |
|
390 | 390 | // Look in global /wp-content/languages/give folder |
391 | - load_textdomain( 'give', $mofile_global ); |
|
392 | - } elseif ( file_exists( $mofile_local ) ) { |
|
391 | + load_textdomain('give', $mofile_global); |
|
392 | + } elseif (file_exists($mofile_local)) { |
|
393 | 393 | // Look in local location from filter `give_languages_directory` |
394 | - load_textdomain( 'give', $mofile_local ); |
|
394 | + load_textdomain('give', $mofile_local); |
|
395 | 395 | } else { |
396 | 396 | // Load the default language files packaged up w/ Give |
397 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
397 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
398 | 398 | } |
399 | 399 | } |
400 | 400 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -23,14 +23,14 @@ discard block |
||
23 | 23 | |
24 | 24 | global $typenow; |
25 | 25 | |
26 | - if ( $typenow != 'give_forms' ) { |
|
26 | + if ($typenow != 'give_forms') { |
|
27 | 27 | return true; |
28 | 28 | } |
29 | 29 | |
30 | 30 | return false; |
31 | 31 | } |
32 | 32 | |
33 | -add_filter( 'give_shortcode_button_condition', 'give_shortcode_button_condition' ); |
|
33 | +add_filter('give_shortcode_button_condition', 'give_shortcode_button_condition'); |
|
34 | 34 | |
35 | 35 | |
36 | 36 | /** |
@@ -40,11 +40,11 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return int|false |
42 | 42 | */ |
43 | -function get_form_id_from_args( $args ) { |
|
43 | +function get_form_id_from_args($args) { |
|
44 | 44 | |
45 | - if ( isset( $args['form_id'] ) && $args['form_id'] != 0 ) { |
|
45 | + if (isset($args['form_id']) && $args['form_id'] != 0) { |
|
46 | 46 | |
47 | - return intval( $args['form_id'] ); |
|
47 | + return intval($args['form_id']); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return false; |
@@ -59,23 +59,23 @@ discard block |
||
59 | 59 | * |
60 | 60 | * @return bool |
61 | 61 | */ |
62 | -function give_is_float_labels_enabled( $args ) { |
|
62 | +function give_is_float_labels_enabled($args) { |
|
63 | 63 | |
64 | 64 | $float_labels = ''; |
65 | 65 | |
66 | - if ( ! empty( $args['float_labels'] ) ) { |
|
66 | + if ( ! empty($args['float_labels'])) { |
|
67 | 67 | $float_labels = $args['float_labels']; |
68 | 68 | } |
69 | 69 | |
70 | - if ( empty( $float_labels ) ) { |
|
71 | - $float_labels = get_post_meta( $args['form_id'], '_give_form_floating_labels', true ); |
|
70 | + if (empty($float_labels)) { |
|
71 | + $float_labels = get_post_meta($args['form_id'], '_give_form_floating_labels', true); |
|
72 | 72 | } |
73 | 73 | |
74 | - if ( empty( $float_labels ) ) { |
|
75 | - $float_labels = give_get_option( 'enable_floatlabels' ) ? 'enabled' : 'disabled'; |
|
74 | + if (empty($float_labels)) { |
|
75 | + $float_labels = give_get_option('enable_floatlabels') ? 'enabled' : 'disabled'; |
|
76 | 76 | } |
77 | 77 | |
78 | - return ( $float_labels == 'enabled' ) ? true : false; |
|
78 | + return ($float_labels == 'enabled') ? true : false; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | $can_checkout = true; |
92 | 92 | |
93 | - return (bool) apply_filters( 'give_can_checkout', $can_checkout ); |
|
93 | + return (bool) apply_filters('give_can_checkout', $can_checkout); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | function give_get_success_page_uri() { |
104 | 104 | global $give_options; |
105 | 105 | |
106 | - $success_page = isset( $give_options['success_page'] ) ? get_permalink( absint( $give_options['success_page'] ) ) : get_bloginfo( 'url' ); |
|
106 | + $success_page = isset($give_options['success_page']) ? get_permalink(absint($give_options['success_page'])) : get_bloginfo('url'); |
|
107 | 107 | |
108 | - return apply_filters( 'give_get_success_page_uri', $success_page ); |
|
108 | + return apply_filters('give_get_success_page_uri', $success_page); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | */ |
117 | 117 | function give_is_success_page() { |
118 | 118 | global $give_options; |
119 | - $is_success_page = isset( $give_options['success_page'] ) ? is_page( $give_options['success_page'] ) : false; |
|
119 | + $is_success_page = isset($give_options['success_page']) ? is_page($give_options['success_page']) : false; |
|
120 | 120 | |
121 | - return apply_filters( 'give_is_success_page', $is_success_page ); |
|
121 | + return apply_filters('give_is_success_page', $is_success_page); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
@@ -132,17 +132,17 @@ discard block |
||
132 | 132 | * @since 1.0 |
133 | 133 | * @return void |
134 | 134 | */ |
135 | -function give_send_to_success_page( $query_string = null ) { |
|
135 | +function give_send_to_success_page($query_string = null) { |
|
136 | 136 | |
137 | 137 | $redirect = give_get_success_page_uri(); |
138 | 138 | |
139 | - if ( $query_string ) { |
|
139 | + if ($query_string) { |
|
140 | 140 | $redirect .= $query_string; |
141 | 141 | } |
142 | 142 | |
143 | - $gateway = isset( $_REQUEST['give-gateway'] ) ? $_REQUEST['give-gateway'] : ''; |
|
143 | + $gateway = isset($_REQUEST['give-gateway']) ? $_REQUEST['give-gateway'] : ''; |
|
144 | 144 | |
145 | - wp_redirect( apply_filters( 'give_success_page_redirect', $redirect, $gateway, $query_string ) ); |
|
145 | + wp_redirect(apply_filters('give_success_page_redirect', $redirect, $gateway, $query_string)); |
|
146 | 146 | give_die(); |
147 | 147 | } |
148 | 148 | |
@@ -159,25 +159,25 @@ discard block |
||
159 | 159 | * @since 1.0 |
160 | 160 | * @return Void |
161 | 161 | */ |
162 | -function give_send_back_to_checkout( $args = array() ) { |
|
162 | +function give_send_back_to_checkout($args = array()) { |
|
163 | 163 | |
164 | - $redirect = ( isset( $_POST['give-current-url'] ) ) ? $_POST['give-current-url'] : ''; |
|
165 | - $form_id = isset( $_POST['give-form-id'] ) ? $_POST['give-form-id'] : 0; |
|
164 | + $redirect = (isset($_POST['give-current-url'])) ? $_POST['give-current-url'] : ''; |
|
165 | + $form_id = isset($_POST['give-form-id']) ? $_POST['give-form-id'] : 0; |
|
166 | 166 | |
167 | 167 | $defaults = array( |
168 | 168 | 'form-id' => (int) $form_id |
169 | 169 | ); |
170 | 170 | |
171 | 171 | // Check for backward compatibility |
172 | - if ( is_string( $args ) ) { |
|
173 | - $args = str_replace( '?', '', $args ); |
|
172 | + if (is_string($args)) { |
|
173 | + $args = str_replace('?', '', $args); |
|
174 | 174 | } |
175 | 175 | |
176 | - $args = wp_parse_args( $args, $defaults ); |
|
176 | + $args = wp_parse_args($args, $defaults); |
|
177 | 177 | |
178 | - $redirect = add_query_arg( $args, $redirect ) . '#give-form-' . $form_id . '-wrap'; |
|
178 | + $redirect = add_query_arg($args, $redirect).'#give-form-'.$form_id.'-wrap'; |
|
179 | 179 | |
180 | - wp_redirect( apply_filters( 'give_send_back_to_checkout', $redirect, $args ) ); |
|
180 | + wp_redirect(apply_filters('give_send_back_to_checkout', $redirect, $args)); |
|
181 | 181 | give_die(); |
182 | 182 | } |
183 | 183 | |
@@ -192,16 +192,16 @@ discard block |
||
192 | 192 | * @since 1.0 |
193 | 193 | * @return string |
194 | 194 | */ |
195 | -function give_get_success_page_url( $query_string = null ) { |
|
195 | +function give_get_success_page_url($query_string = null) { |
|
196 | 196 | |
197 | - $success_page = give_get_option( 'success_page', 0 ); |
|
198 | - $success_page = get_permalink( $success_page ); |
|
197 | + $success_page = give_get_option('success_page', 0); |
|
198 | + $success_page = get_permalink($success_page); |
|
199 | 199 | |
200 | - if ( $query_string ) { |
|
200 | + if ($query_string) { |
|
201 | 201 | $success_page .= $query_string; |
202 | 202 | } |
203 | 203 | |
204 | - return apply_filters( 'give_success_page_url', $success_page ); |
|
204 | + return apply_filters('give_success_page_url', $success_page); |
|
205 | 205 | |
206 | 206 | } |
207 | 207 | |
@@ -215,15 +215,15 @@ discard block |
||
215 | 215 | * |
216 | 216 | * @return mixed|void Full URL to the Transaction Failed page, if present, home page if it doesn't exist |
217 | 217 | */ |
218 | -function give_get_failed_transaction_uri( $extras = false ) { |
|
218 | +function give_get_failed_transaction_uri($extras = false) { |
|
219 | 219 | global $give_options; |
220 | 220 | |
221 | - $uri = ! empty( $give_options['failure_page'] ) ? trailingslashit( get_permalink( $give_options['failure_page'] ) ) : home_url(); |
|
222 | - if ( $extras ) { |
|
221 | + $uri = ! empty($give_options['failure_page']) ? trailingslashit(get_permalink($give_options['failure_page'])) : home_url(); |
|
222 | + if ($extras) { |
|
223 | 223 | $uri .= $extras; |
224 | 224 | } |
225 | 225 | |
226 | - return apply_filters( 'give_get_failed_transaction_uri', $uri ); |
|
226 | + return apply_filters('give_get_failed_transaction_uri', $uri); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | /** |
@@ -234,9 +234,9 @@ discard block |
||
234 | 234 | */ |
235 | 235 | function give_is_failed_transaction_page() { |
236 | 236 | global $give_options; |
237 | - $ret = isset( $give_options['failure_page'] ) ? is_page( $give_options['failure_page'] ) : false; |
|
237 | + $ret = isset($give_options['failure_page']) ? is_page($give_options['failure_page']) : false; |
|
238 | 238 | |
239 | - return apply_filters( 'give_is_failure_page', $ret ); |
|
239 | + return apply_filters('give_is_failure_page', $ret); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -248,18 +248,18 @@ discard block |
||
248 | 248 | */ |
249 | 249 | function give_listen_for_failed_payments() { |
250 | 250 | |
251 | - $failed_page = give_get_option( 'failure_page', 0 ); |
|
251 | + $failed_page = give_get_option('failure_page', 0); |
|
252 | 252 | |
253 | - if ( ! empty( $failed_page ) && is_page( $failed_page ) && ! empty( $_GET['payment-id'] ) ) { |
|
253 | + if ( ! empty($failed_page) && is_page($failed_page) && ! empty($_GET['payment-id'])) { |
|
254 | 254 | |
255 | - $payment_id = absint( $_GET['payment-id'] ); |
|
256 | - give_update_payment_status( $payment_id, 'failed' ); |
|
255 | + $payment_id = absint($_GET['payment-id']); |
|
256 | + give_update_payment_status($payment_id, 'failed'); |
|
257 | 257 | |
258 | 258 | } |
259 | 259 | |
260 | 260 | } |
261 | 261 | |
262 | -add_action( 'template_redirect', 'give_listen_for_failed_payments' ); |
|
262 | +add_action('template_redirect', 'give_listen_for_failed_payments'); |
|
263 | 263 | |
264 | 264 | |
265 | 265 | /** |
@@ -272,11 +272,11 @@ discard block |
||
272 | 272 | * @since 1.0 |
273 | 273 | * @return bool |
274 | 274 | */ |
275 | -function give_field_is_required( $field = '', $form_id ) { |
|
275 | +function give_field_is_required($field = '', $form_id) { |
|
276 | 276 | |
277 | - $required_fields = give_purchase_form_required_fields( $form_id ); |
|
277 | + $required_fields = give_purchase_form_required_fields($form_id); |
|
278 | 278 | |
279 | - return array_key_exists( $field, $required_fields ); |
|
279 | + return array_key_exists($field, $required_fields); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | /** |
@@ -294,14 +294,14 @@ discard block |
||
294 | 294 | * |
295 | 295 | * @return void |
296 | 296 | */ |
297 | -function give_record_sale_in_log( $give_form_id = 0, $payment_id, $price_id = false, $sale_date = null ) { |
|
297 | +function give_record_sale_in_log($give_form_id = 0, $payment_id, $price_id = false, $sale_date = null) { |
|
298 | 298 | global $give_logs; |
299 | 299 | |
300 | 300 | $log_data = array( |
301 | 301 | 'post_parent' => $give_form_id, |
302 | 302 | 'log_type' => 'sale', |
303 | - 'post_date' => isset( $sale_date ) ? $sale_date : null, |
|
304 | - 'post_date_gmt' => isset( $sale_date ) ? $sale_date : null |
|
303 | + 'post_date' => isset($sale_date) ? $sale_date : null, |
|
304 | + 'post_date_gmt' => isset($sale_date) ? $sale_date : null |
|
305 | 305 | ); |
306 | 306 | |
307 | 307 | $log_meta = array( |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | 'price_id' => (int) $price_id |
310 | 310 | ); |
311 | 311 | |
312 | - $give_logs->insert_log( $log_data, $log_meta ); |
|
312 | + $give_logs->insert_log($log_data, $log_meta); |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | |
@@ -323,11 +323,11 @@ discard block |
||
323 | 323 | * |
324 | 324 | * @return bool|int |
325 | 325 | */ |
326 | -function give_increase_purchase_count( $form_id = 0, $quantity = 1 ) { |
|
326 | +function give_increase_purchase_count($form_id = 0, $quantity = 1) { |
|
327 | 327 | $quantity = (int) $quantity; |
328 | - $form = new Give_Donate_Form( $form_id ); |
|
328 | + $form = new Give_Donate_Form($form_id); |
|
329 | 329 | |
330 | - return $form->increase_sales( $quantity ); |
|
330 | + return $form->increase_sales($quantity); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | /** |
@@ -340,11 +340,11 @@ discard block |
||
340 | 340 | * |
341 | 341 | * @return bool|int |
342 | 342 | */ |
343 | -function give_decrease_purchase_count( $form_id = 0, $quantity = 1 ) { |
|
343 | +function give_decrease_purchase_count($form_id = 0, $quantity = 1) { |
|
344 | 344 | $quantity = (int) $quantity; |
345 | - $form = new Give_Donate_Form( $form_id ); |
|
345 | + $form = new Give_Donate_Form($form_id); |
|
346 | 346 | |
347 | - return $form->decrease_sales( $quantity ); |
|
347 | + return $form->decrease_sales($quantity); |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | /** |
@@ -357,10 +357,10 @@ discard block |
||
357 | 357 | * |
358 | 358 | * @return bool|int |
359 | 359 | */ |
360 | -function give_increase_earnings( $give_form_id = 0, $amount ) { |
|
361 | - $form = new Give_Donate_Form( $give_form_id ); |
|
360 | +function give_increase_earnings($give_form_id = 0, $amount) { |
|
361 | + $form = new Give_Donate_Form($give_form_id); |
|
362 | 362 | |
363 | - return $form->increase_earnings( $amount ); |
|
363 | + return $form->increase_earnings($amount); |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | /** |
@@ -373,10 +373,10 @@ discard block |
||
373 | 373 | * |
374 | 374 | * @return bool|int |
375 | 375 | */ |
376 | -function give_decrease_earnings( $form_id = 0, $amount ) { |
|
377 | - $form = new Give_Donate_Form( $form_id ); |
|
376 | +function give_decrease_earnings($form_id = 0, $amount) { |
|
377 | + $form = new Give_Donate_Form($form_id); |
|
378 | 378 | |
379 | - return $form->decrease_earnings( $amount ); |
|
379 | + return $form->decrease_earnings($amount); |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | |
@@ -389,8 +389,8 @@ discard block |
||
389 | 389 | * |
390 | 390 | * @return int $earnings Earnings for a certain form |
391 | 391 | */ |
392 | -function give_get_form_earnings_stats( $form_id = 0 ) { |
|
393 | - $give_form = new Give_Donate_Form( $form_id ); |
|
392 | +function give_get_form_earnings_stats($form_id = 0) { |
|
393 | + $give_form = new Give_Donate_Form($form_id); |
|
394 | 394 | |
395 | 395 | return $give_form->earnings; |
396 | 396 | } |
@@ -405,8 +405,8 @@ discard block |
||
405 | 405 | * |
406 | 406 | * @return int $sales Amount of sales for a certain form |
407 | 407 | */ |
408 | -function give_get_form_sales_stats( $give_form_id = 0 ) { |
|
409 | - $give_form = new Give_Donate_Form( $give_form_id ); |
|
408 | +function give_get_form_sales_stats($give_form_id = 0) { |
|
409 | + $give_form = new Give_Donate_Form($give_form_id); |
|
410 | 410 | |
411 | 411 | return $give_form->sales; |
412 | 412 | } |
@@ -421,16 +421,16 @@ discard block |
||
421 | 421 | * |
422 | 422 | * @return float $sales Average monthly sales |
423 | 423 | */ |
424 | -function give_get_average_monthly_form_sales( $form_id = 0 ) { |
|
425 | - $sales = give_get_form_sales_stats( $form_id ); |
|
426 | - $release_date = get_post_field( 'post_date', $form_id ); |
|
424 | +function give_get_average_monthly_form_sales($form_id = 0) { |
|
425 | + $sales = give_get_form_sales_stats($form_id); |
|
426 | + $release_date = get_post_field('post_date', $form_id); |
|
427 | 427 | |
428 | - $diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) ); |
|
428 | + $diff = abs(current_time('timestamp') - strtotime($release_date)); |
|
429 | 429 | |
430 | - $months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication |
|
430 | + $months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication |
|
431 | 431 | |
432 | - if ( $months > 0 ) { |
|
433 | - $sales = ( $sales / $months ); |
|
432 | + if ($months > 0) { |
|
433 | + $sales = ($sales / $months); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | return $sales; |
@@ -446,16 +446,16 @@ discard block |
||
446 | 446 | * |
447 | 447 | * @return float $earnings Average monthly earnings |
448 | 448 | */ |
449 | -function give_get_average_monthly_form_earnings( $form_id = 0 ) { |
|
450 | - $earnings = give_get_form_earnings_stats( $form_id ); |
|
451 | - $release_date = get_post_field( 'post_date', $form_id ); |
|
449 | +function give_get_average_monthly_form_earnings($form_id = 0) { |
|
450 | + $earnings = give_get_form_earnings_stats($form_id); |
|
451 | + $release_date = get_post_field('post_date', $form_id); |
|
452 | 452 | |
453 | - $diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) ); |
|
453 | + $diff = abs(current_time('timestamp') - strtotime($release_date)); |
|
454 | 454 | |
455 | - $months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication |
|
455 | + $months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication |
|
456 | 456 | |
457 | - if ( $months > 0 ) { |
|
458 | - $earnings = ( $earnings / $months ); |
|
457 | + if ($months > 0) { |
|
458 | + $earnings = ($earnings / $months); |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | return $earnings < 0 ? 0 : $earnings; |
@@ -475,25 +475,25 @@ discard block |
||
475 | 475 | * |
476 | 476 | * @return string $price_name Name of the price option |
477 | 477 | */ |
478 | -function give_get_price_option_name( $form_id = 0, $price_id = 0, $payment_id = 0 ) { |
|
478 | +function give_get_price_option_name($form_id = 0, $price_id = 0, $payment_id = 0) { |
|
479 | 479 | |
480 | - $prices = give_get_variable_prices( $form_id ); |
|
480 | + $prices = give_get_variable_prices($form_id); |
|
481 | 481 | $price_name = ''; |
482 | 482 | |
483 | - foreach ( $prices as $price ) { |
|
483 | + foreach ($prices as $price) { |
|
484 | 484 | |
485 | - if ( intval( $price['_give_id']['level_id'] ) == intval( $price_id ) ) { |
|
485 | + if (intval($price['_give_id']['level_id']) == intval($price_id)) { |
|
486 | 486 | |
487 | - $price_text = isset( $price['_give_text'] ) ? $price['_give_text'] : ''; |
|
488 | - $price_fallback = give_currency_filter( give_format_amount( $price['_give_amount'] ) ); |
|
489 | - $price_name = ! empty( $price_text ) ? $price_text : $price_fallback; |
|
487 | + $price_text = isset($price['_give_text']) ? $price['_give_text'] : ''; |
|
488 | + $price_fallback = give_currency_filter(give_format_amount($price['_give_amount'])); |
|
489 | + $price_name = ! empty($price_text) ? $price_text : $price_fallback; |
|
490 | 490 | |
491 | 491 | } |
492 | 492 | |
493 | 493 | } |
494 | 494 | |
495 | 495 | |
496 | - return apply_filters( 'give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id ); |
|
496 | + return apply_filters('give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id); |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | |
@@ -506,14 +506,14 @@ discard block |
||
506 | 506 | * |
507 | 507 | * @return string $range A fully formatted price range |
508 | 508 | */ |
509 | -function give_price_range( $form_id = 0 ) { |
|
510 | - $low = give_get_lowest_price_option( $form_id ); |
|
511 | - $high = give_get_highest_price_option( $form_id ); |
|
512 | - $range = '<span class="give_price_range_low">' . give_currency_filter( give_format_amount( $low ) ) . '</span>'; |
|
509 | +function give_price_range($form_id = 0) { |
|
510 | + $low = give_get_lowest_price_option($form_id); |
|
511 | + $high = give_get_highest_price_option($form_id); |
|
512 | + $range = '<span class="give_price_range_low">'.give_currency_filter(give_format_amount($low)).'</span>'; |
|
513 | 513 | $range .= '<span class="give_price_range_sep"> – </span>'; |
514 | - $range .= '<span class="give_price_range_high">' . give_currency_filter( give_format_amount( $high ) ) . '</span>'; |
|
514 | + $range .= '<span class="give_price_range_high">'.give_currency_filter(give_format_amount($high)).'</span>'; |
|
515 | 515 | |
516 | - return apply_filters( 'give_price_range', $range, $form_id, $low, $high ); |
|
516 | + return apply_filters('give_price_range', $range, $form_id, $low, $high); |
|
517 | 517 | } |
518 | 518 | |
519 | 519 | |
@@ -528,36 +528,36 @@ discard block |
||
528 | 528 | * |
529 | 529 | * @return int ID of the lowest price |
530 | 530 | */ |
531 | -function give_get_lowest_price_id( $form_id = 0 ) { |
|
531 | +function give_get_lowest_price_id($form_id = 0) { |
|
532 | 532 | |
533 | - if ( empty( $form_id ) ) { |
|
533 | + if (empty($form_id)) { |
|
534 | 534 | $form_id = get_the_ID(); |
535 | 535 | } |
536 | 536 | |
537 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
538 | - return give_get_form_price( $form_id ); |
|
537 | + if ( ! give_has_variable_prices($form_id)) { |
|
538 | + return give_get_form_price($form_id); |
|
539 | 539 | } |
540 | 540 | |
541 | - $prices = give_get_variable_prices( $form_id ); |
|
541 | + $prices = give_get_variable_prices($form_id); |
|
542 | 542 | |
543 | 543 | $low = 0.00; |
544 | 544 | $min_id = 1; |
545 | 545 | |
546 | - if ( ! empty( $prices ) ) { |
|
546 | + if ( ! empty($prices)) { |
|
547 | 547 | |
548 | - foreach ( $prices as $key => $price ) { |
|
548 | + foreach ($prices as $key => $price) { |
|
549 | 549 | |
550 | - if ( empty( $price['_give_amount'] ) ) { |
|
550 | + if (empty($price['_give_amount'])) { |
|
551 | 551 | continue; |
552 | 552 | } |
553 | 553 | |
554 | - if ( ! isset( $min ) ) { |
|
554 | + if ( ! isset($min)) { |
|
555 | 555 | $min = $price['_give_amount']; |
556 | 556 | } else { |
557 | - $min = min( $min, $price['_give_amount'] ); |
|
557 | + $min = min($min, $price['_give_amount']); |
|
558 | 558 | } |
559 | 559 | |
560 | - if ( $price['_give_amount'] == $min ) { |
|
560 | + if ($price['_give_amount'] == $min) { |
|
561 | 561 | $min_id = $price['_give_id']['level_id']; |
562 | 562 | } |
563 | 563 | } |
@@ -575,43 +575,43 @@ discard block |
||
575 | 575 | * |
576 | 576 | * @return float Amount of the lowest price |
577 | 577 | */ |
578 | -function give_get_lowest_price_option( $form_id = 0 ) { |
|
579 | - if ( empty( $form_id ) ) { |
|
578 | +function give_get_lowest_price_option($form_id = 0) { |
|
579 | + if (empty($form_id)) { |
|
580 | 580 | $form_id = get_the_ID(); |
581 | 581 | } |
582 | 582 | |
583 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
584 | - return give_get_form_price( $form_id ); |
|
583 | + if ( ! give_has_variable_prices($form_id)) { |
|
584 | + return give_get_form_price($form_id); |
|
585 | 585 | } |
586 | 586 | |
587 | - $prices = give_get_variable_prices( $form_id ); |
|
587 | + $prices = give_get_variable_prices($form_id); |
|
588 | 588 | |
589 | 589 | $low = 0.00; |
590 | 590 | |
591 | - if ( ! empty( $prices ) ) { |
|
591 | + if ( ! empty($prices)) { |
|
592 | 592 | |
593 | - foreach ( $prices as $key => $price ) { |
|
593 | + foreach ($prices as $key => $price) { |
|
594 | 594 | |
595 | - if ( empty( $price['_give_amount'] ) ) { |
|
595 | + if (empty($price['_give_amount'])) { |
|
596 | 596 | continue; |
597 | 597 | } |
598 | 598 | |
599 | - if ( ! isset( $min ) ) { |
|
599 | + if ( ! isset($min)) { |
|
600 | 600 | $min = $price['_give_amount']; |
601 | 601 | } else { |
602 | - $min = min( $min, give_sanitize_amount( $price['_give_amount'] ) ); |
|
602 | + $min = min($min, give_sanitize_amount($price['_give_amount'])); |
|
603 | 603 | } |
604 | 604 | |
605 | - if ( $price['_give_amount'] == $min ) { |
|
605 | + if ($price['_give_amount'] == $min) { |
|
606 | 606 | $min_id = $key; |
607 | 607 | } |
608 | 608 | } |
609 | 609 | |
610 | - $low = $prices[ $min_id ]['_give_amount']; |
|
610 | + $low = $prices[$min_id]['_give_amount']; |
|
611 | 611 | |
612 | 612 | } |
613 | 613 | |
614 | - return give_sanitize_amount( $low ); |
|
614 | + return give_sanitize_amount($low); |
|
615 | 615 | } |
616 | 616 | |
617 | 617 | /** |
@@ -623,41 +623,41 @@ discard block |
||
623 | 623 | * |
624 | 624 | * @return float Amount of the highest price |
625 | 625 | */ |
626 | -function give_get_highest_price_option( $form_id = 0 ) { |
|
626 | +function give_get_highest_price_option($form_id = 0) { |
|
627 | 627 | |
628 | - if ( empty( $form_id ) ) { |
|
628 | + if (empty($form_id)) { |
|
629 | 629 | $form_id = get_the_ID(); |
630 | 630 | } |
631 | 631 | |
632 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
633 | - return give_get_form_price( $form_id ); |
|
632 | + if ( ! give_has_variable_prices($form_id)) { |
|
633 | + return give_get_form_price($form_id); |
|
634 | 634 | } |
635 | 635 | |
636 | - $prices = give_get_variable_prices( $form_id ); |
|
636 | + $prices = give_get_variable_prices($form_id); |
|
637 | 637 | |
638 | 638 | $high = 0.00; |
639 | 639 | |
640 | - if ( ! empty( $prices ) ) { |
|
640 | + if ( ! empty($prices)) { |
|
641 | 641 | |
642 | 642 | $max = 0; |
643 | 643 | |
644 | - foreach ( $prices as $key => $price ) { |
|
645 | - if ( empty( $price['_give_amount'] ) ) { |
|
644 | + foreach ($prices as $key => $price) { |
|
645 | + if (empty($price['_give_amount'])) { |
|
646 | 646 | continue; |
647 | 647 | } |
648 | - $give_amount = give_sanitize_amount( $price['_give_amount'] ); |
|
648 | + $give_amount = give_sanitize_amount($price['_give_amount']); |
|
649 | 649 | |
650 | - $max = max( $max, $give_amount ); |
|
650 | + $max = max($max, $give_amount); |
|
651 | 651 | |
652 | - if ( $give_amount == $max ) { |
|
652 | + if ($give_amount == $max) { |
|
653 | 653 | $max_id = $key; |
654 | 654 | } |
655 | 655 | } |
656 | 656 | |
657 | - $high = $prices[ $max_id ]['_give_amount']; |
|
657 | + $high = $prices[$max_id]['_give_amount']; |
|
658 | 658 | } |
659 | 659 | |
660 | - return give_sanitize_amount( $high ); |
|
660 | + return give_sanitize_amount($high); |
|
661 | 661 | } |
662 | 662 | |
663 | 663 | /** |
@@ -669,15 +669,15 @@ discard block |
||
669 | 669 | * |
670 | 670 | * @return mixed string|int Price of the form |
671 | 671 | */ |
672 | -function give_get_form_price( $form_id = 0 ) { |
|
672 | +function give_get_form_price($form_id = 0) { |
|
673 | 673 | |
674 | - if ( empty( $form_id ) ) { |
|
674 | + if (empty($form_id)) { |
|
675 | 675 | return false; |
676 | 676 | } |
677 | 677 | |
678 | - $form = new Give_Donate_Form( $form_id ); |
|
678 | + $form = new Give_Donate_Form($form_id); |
|
679 | 679 | |
680 | - return $form->__get( 'price' ); |
|
680 | + return $form->__get('price'); |
|
681 | 681 | } |
682 | 682 | |
683 | 683 | /** |
@@ -689,15 +689,15 @@ discard block |
||
689 | 689 | * |
690 | 690 | * @return mixed string|int Minimum price of the form |
691 | 691 | */ |
692 | -function give_get_form_minimum_price( $form_id = 0 ) { |
|
692 | +function give_get_form_minimum_price($form_id = 0) { |
|
693 | 693 | |
694 | - if ( empty( $form_id ) ) { |
|
694 | + if (empty($form_id)) { |
|
695 | 695 | return false; |
696 | 696 | } |
697 | 697 | |
698 | - $form = new Give_Donate_Form( $form_id ); |
|
698 | + $form = new Give_Donate_Form($form_id); |
|
699 | 699 | |
700 | - return $form->__get( 'minimum_price' ); |
|
700 | + return $form->__get('minimum_price'); |
|
701 | 701 | |
702 | 702 | } |
703 | 703 | |
@@ -712,52 +712,52 @@ discard block |
||
712 | 712 | * |
713 | 713 | * @return int $formatted_price |
714 | 714 | */ |
715 | -function give_price( $form_id = 0, $echo = true, $price_id = false ) { |
|
715 | +function give_price($form_id = 0, $echo = true, $price_id = false) { |
|
716 | 716 | |
717 | - if ( empty( $form_id ) ) { |
|
717 | + if (empty($form_id)) { |
|
718 | 718 | $form_id = get_the_ID(); |
719 | 719 | } |
720 | 720 | |
721 | - if ( give_has_variable_prices( $form_id ) ) { |
|
721 | + if (give_has_variable_prices($form_id)) { |
|
722 | 722 | |
723 | - $prices = give_get_variable_prices( $form_id ); |
|
723 | + $prices = give_get_variable_prices($form_id); |
|
724 | 724 | |
725 | - if ( false !== $price_id ) { |
|
725 | + if (false !== $price_id) { |
|
726 | 726 | |
727 | 727 | //loop through multi-prices to see which is default |
728 | - foreach ( $prices as $price ) { |
|
728 | + foreach ($prices as $price) { |
|
729 | 729 | //this is the default price |
730 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
730 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
731 | 731 | $price = (float) $price['_give_amount']; |
732 | 732 | }; |
733 | 733 | } |
734 | 734 | |
735 | 735 | } else { |
736 | 736 | |
737 | - $price = give_get_lowest_price_option( $form_id ); |
|
737 | + $price = give_get_lowest_price_option($form_id); |
|
738 | 738 | } |
739 | 739 | |
740 | - $price = give_sanitize_amount( $price ); |
|
740 | + $price = give_sanitize_amount($price); |
|
741 | 741 | |
742 | 742 | } else { |
743 | 743 | |
744 | - $price = give_get_form_price( $form_id ); |
|
744 | + $price = give_get_form_price($form_id); |
|
745 | 745 | |
746 | 746 | } |
747 | 747 | |
748 | - $price = apply_filters( 'give_form_price', give_sanitize_amount( $price ), $form_id ); |
|
749 | - $formatted_price = '<span class="give_price" id="give_price_' . $form_id . '">' . $price . '</span>'; |
|
750 | - $formatted_price = apply_filters( 'give_form_price_after_html', $formatted_price, $form_id, $price ); |
|
748 | + $price = apply_filters('give_form_price', give_sanitize_amount($price), $form_id); |
|
749 | + $formatted_price = '<span class="give_price" id="give_price_'.$form_id.'">'.$price.'</span>'; |
|
750 | + $formatted_price = apply_filters('give_form_price_after_html', $formatted_price, $form_id, $price); |
|
751 | 751 | |
752 | - if ( $echo ) { |
|
752 | + if ($echo) { |
|
753 | 753 | echo $formatted_price; |
754 | 754 | } else { |
755 | 755 | return $formatted_price; |
756 | 756 | } |
757 | 757 | } |
758 | 758 | |
759 | -add_filter( 'give_form_price', 'give_format_amount', 10 ); |
|
760 | -add_filter( 'give_form_price', 'give_currency_filter', 20 ); |
|
759 | +add_filter('give_form_price', 'give_format_amount', 10); |
|
760 | +add_filter('give_form_price', 'give_currency_filter', 20); |
|
761 | 761 | |
762 | 762 | |
763 | 763 | /** |
@@ -771,18 +771,18 @@ discard block |
||
771 | 771 | * |
772 | 772 | * @return float $amount Amount of the price option |
773 | 773 | */ |
774 | -function give_get_price_option_amount( $form_id = 0, $price_id = 0 ) { |
|
775 | - $prices = give_get_variable_prices( $form_id ); |
|
774 | +function give_get_price_option_amount($form_id = 0, $price_id = 0) { |
|
775 | + $prices = give_get_variable_prices($form_id); |
|
776 | 776 | |
777 | 777 | $amount = 0.00; |
778 | 778 | |
779 | - foreach ( $prices as $price ) { |
|
780 | - if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) { |
|
781 | - $amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00; |
|
779 | + foreach ($prices as $price) { |
|
780 | + if (isset($price['_give_id']['level_id']) && $price['_give_id']['level_id'] == $price_id) { |
|
781 | + $amount = isset($price['_give_amount']) ? $price['_give_amount'] : 0.00; |
|
782 | 782 | }; |
783 | 783 | } |
784 | 784 | |
785 | - return apply_filters( 'give_get_price_option_amount', give_sanitize_amount( $amount ), $form_id, $price_id ); |
|
785 | + return apply_filters('give_get_price_option_amount', give_sanitize_amount($amount), $form_id, $price_id); |
|
786 | 786 | } |
787 | 787 | |
788 | 788 | /** |
@@ -794,13 +794,13 @@ discard block |
||
794 | 794 | * |
795 | 795 | * @return mixed string|int Goal of the form |
796 | 796 | */ |
797 | -function give_get_form_goal( $form_id = 0 ) { |
|
797 | +function give_get_form_goal($form_id = 0) { |
|
798 | 798 | |
799 | - if ( empty( $form_id ) ) { |
|
799 | + if (empty($form_id)) { |
|
800 | 800 | return false; |
801 | 801 | } |
802 | 802 | |
803 | - $form = new Give_Donate_Form( $form_id ); |
|
803 | + $form = new Give_Donate_Form($form_id); |
|
804 | 804 | |
805 | 805 | return $form->goal; |
806 | 806 | |
@@ -816,27 +816,27 @@ discard block |
||
816 | 816 | * |
817 | 817 | * @return string $formatted_goal |
818 | 818 | */ |
819 | -function give_goal( $form_id = 0, $echo = true ) { |
|
819 | +function give_goal($form_id = 0, $echo = true) { |
|
820 | 820 | |
821 | - if ( empty( $form_id ) ) { |
|
821 | + if (empty($form_id)) { |
|
822 | 822 | $form_id = get_the_ID(); |
823 | 823 | } |
824 | 824 | |
825 | - $goal = give_get_form_goal( $form_id ); |
|
825 | + $goal = give_get_form_goal($form_id); |
|
826 | 826 | |
827 | - $goal = apply_filters( 'give_form_goal', give_sanitize_amount( $goal ), $form_id ); |
|
828 | - $formatted_goal = '<span class="give_price" id="give_price_' . $form_id . '">' . $goal . '</span>'; |
|
829 | - $formatted_goal = apply_filters( 'give_form_price_after_html', $formatted_goal, $form_id, $goal ); |
|
827 | + $goal = apply_filters('give_form_goal', give_sanitize_amount($goal), $form_id); |
|
828 | + $formatted_goal = '<span class="give_price" id="give_price_'.$form_id.'">'.$goal.'</span>'; |
|
829 | + $formatted_goal = apply_filters('give_form_price_after_html', $formatted_goal, $form_id, $goal); |
|
830 | 830 | |
831 | - if ( $echo ) { |
|
831 | + if ($echo) { |
|
832 | 832 | echo $formatted_goal; |
833 | 833 | } else { |
834 | 834 | return $formatted_goal; |
835 | 835 | } |
836 | 836 | } |
837 | 837 | |
838 | -add_filter( 'give_form_goal', 'give_format_amount', 10 ); |
|
839 | -add_filter( 'give_form_goal', 'give_currency_filter', 20 ); |
|
838 | +add_filter('give_form_goal', 'give_format_amount', 10); |
|
839 | +add_filter('give_form_goal', 'give_currency_filter', 20); |
|
840 | 840 | |
841 | 841 | |
842 | 842 | /** |
@@ -846,13 +846,13 @@ discard block |
||
846 | 846 | * @global $give_options |
847 | 847 | * @return bool $ret Whether or not the logged_in_only setting is set |
848 | 848 | */ |
849 | -function give_logged_in_only( $form_id ) { |
|
849 | +function give_logged_in_only($form_id) { |
|
850 | 850 | |
851 | - $form_option = get_post_meta( $form_id, '_give_logged_in_only', true ); |
|
851 | + $form_option = get_post_meta($form_id, '_give_logged_in_only', true); |
|
852 | 852 | |
853 | - $ret = ! empty( $form_option ) ? $form_option : false; |
|
853 | + $ret = ! empty($form_option) ? $form_option : false; |
|
854 | 854 | |
855 | - return (bool) apply_filters( 'give_logged_in_only', $ret, $form_id ); |
|
855 | + return (bool) apply_filters('give_logged_in_only', $ret, $form_id); |
|
856 | 856 | |
857 | 857 | } |
858 | 858 | |
@@ -864,10 +864,10 @@ discard block |
||
864 | 864 | * |
865 | 865 | * @param $form_id |
866 | 866 | */ |
867 | -function give_show_login_register_option( $form_id ) { |
|
867 | +function give_show_login_register_option($form_id) { |
|
868 | 868 | |
869 | - $show_register_form = get_post_meta( $form_id, '_give_show_register_form', true ); |
|
869 | + $show_register_form = get_post_meta($form_id, '_give_show_register_form', true); |
|
870 | 870 | |
871 | - return apply_filters( 'give_show_register_form', $show_register_form, $form_id ); |
|
871 | + return apply_filters('give_show_register_form', $show_register_form, $form_id); |
|
872 | 872 | |
873 | 873 | } |
874 | 874 | \ No newline at end of file |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * Used to redirect a user back to the purchase |
157 | 157 | * page if there are errors present. |
158 | 158 | * |
159 | - * @param array $args |
|
159 | + * @param string $args |
|
160 | 160 | * |
161 | 161 | * @access public |
162 | 162 | * @since 1.0 |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | * |
691 | 691 | * @param int $form_id ID number of the form to retrieve the minimum price for |
692 | 692 | * |
693 | - * @return mixed string|int Minimum price of the form |
|
693 | + * @return string string|int Minimum price of the form |
|
694 | 694 | */ |
695 | 695 | function give_get_form_minimum_price( $form_id = 0 ) { |
696 | 696 |
@@ -781,7 +781,7 @@ |
||
781 | 781 | foreach ( $prices as $price ) { |
782 | 782 | if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) { |
783 | 783 | $amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00; |
784 | - break; |
|
784 | + break; |
|
785 | 785 | }; |
786 | 786 | } |
787 | 787 |
@@ -33,20 +33,20 @@ discard block |
||
33 | 33 | $login_redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url()); |
34 | 34 | } |
35 | 35 | |
36 | - if ( empty( $logout_redirect ) ) { |
|
37 | - $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() ); |
|
38 | - } |
|
36 | + if ( empty( $logout_redirect ) ) { |
|
37 | + $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() ); |
|
38 | + } |
|
39 | 39 | |
40 | 40 | |
41 | - // Add user_logout action to logout url. |
|
42 | - $logout_redirect = add_query_arg( |
|
43 | - array( |
|
44 | - 'give_action' => 'user_logout', |
|
45 | - 'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ), |
|
46 | - 'give_logout_redirect' => urlencode( $logout_redirect ) |
|
47 | - ), |
|
48 | - home_url('/') |
|
49 | - ); |
|
41 | + // Add user_logout action to logout url. |
|
42 | + $logout_redirect = add_query_arg( |
|
43 | + array( |
|
44 | + 'give_action' => 'user_logout', |
|
45 | + 'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ), |
|
46 | + 'give_logout_redirect' => urlencode( $logout_redirect ) |
|
47 | + ), |
|
48 | + home_url('/') |
|
49 | + ); |
|
50 | 50 | |
51 | 51 | $give_login_redirect = $login_redirect; |
52 | 52 | $give_logout_redirect = $logout_redirect; |
@@ -136,23 +136,23 @@ discard block |
||
136 | 136 | * @return void |
137 | 137 | */ |
138 | 138 | function give_process_user_logout( $data ) { |
139 | - if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) { |
|
139 | + if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) { |
|
140 | 140 | |
141 | - // Prevent occurring of any custom action on wp_logout. |
|
142 | - remove_all_actions( 'wp_logout' ); |
|
141 | + // Prevent occurring of any custom action on wp_logout. |
|
142 | + remove_all_actions( 'wp_logout' ); |
|
143 | 143 | |
144 | - // Before logout give action. |
|
145 | - do_action( 'give_before_user_logout' ); |
|
144 | + // Before logout give action. |
|
145 | + do_action( 'give_before_user_logout' ); |
|
146 | 146 | |
147 | - // Logout user. |
|
148 | - wp_logout(); |
|
147 | + // Logout user. |
|
148 | + wp_logout(); |
|
149 | 149 | |
150 | - // After logout give action. |
|
151 | - do_action( 'give_after_user_logout' ); |
|
150 | + // After logout give action. |
|
151 | + do_action( 'give_after_user_logout' ); |
|
152 | 152 | |
153 | - wp_redirect( $data['give_logout_redirect'] ); |
|
154 | - give_die(); |
|
155 | - } |
|
153 | + wp_redirect( $data['give_logout_redirect'] ); |
|
154 | + give_die(); |
|
155 | + } |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | add_action( 'give_user_logout', 'give_process_user_logout' ); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -26,15 +26,15 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return string Login form |
28 | 28 | */ |
29 | -function give_login_form( $login_redirect = '', $logout_redirect = '' ) { |
|
30 | - global $give_login_redirect, $give_logout_redirect;; |
|
29 | +function give_login_form($login_redirect = '', $logout_redirect = '') { |
|
30 | + global $give_login_redirect, $give_logout_redirect; ; |
|
31 | 31 | |
32 | - if ( empty( $login_redirect ) ) { |
|
32 | + if (empty($login_redirect)) { |
|
33 | 33 | $login_redirect = add_query_arg('give-login-success', 'true', give_get_current_page_url()); |
34 | 34 | } |
35 | 35 | |
36 | - if ( empty( $logout_redirect ) ) { |
|
37 | - $logout_redirect = add_query_arg( 'give-logout-success', 'true', give_get_current_page_url() ); |
|
36 | + if (empty($logout_redirect)) { |
|
37 | + $logout_redirect = add_query_arg('give-logout-success', 'true', give_get_current_page_url()); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | $logout_redirect = add_query_arg( |
43 | 43 | array( |
44 | 44 | 'give_action' => 'user_logout', |
45 | - 'give_logout_nonce' => wp_create_nonce( 'give-logout-nonce' ), |
|
46 | - 'give_logout_redirect' => urlencode( $logout_redirect ) |
|
45 | + 'give_logout_nonce' => wp_create_nonce('give-logout-nonce'), |
|
46 | + 'give_logout_redirect' => urlencode($logout_redirect) |
|
47 | 47 | ), |
48 | 48 | home_url('/') |
49 | 49 | ); |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | |
54 | 54 | ob_start(); |
55 | 55 | |
56 | - give_get_template_part( 'shortcode', 'login' ); |
|
56 | + give_get_template_part('shortcode', 'login'); |
|
57 | 57 | |
58 | - return apply_filters( 'give_login_form', ob_get_clean() ); |
|
58 | + return apply_filters('give_login_form', ob_get_clean()); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -69,10 +69,10 @@ discard block |
||
69 | 69 | * |
70 | 70 | * @return string Register form |
71 | 71 | */ |
72 | -function give_register_form( $redirect = '' ) { |
|
72 | +function give_register_form($redirect = '') { |
|
73 | 73 | global $give_options, $give_register_redirect; |
74 | 74 | |
75 | - if ( empty( $redirect ) ) { |
|
75 | + if (empty($redirect)) { |
|
76 | 76 | $redirect = give_get_current_page_url(); |
77 | 77 | } |
78 | 78 | |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | |
81 | 81 | ob_start(); |
82 | 82 | |
83 | - if ( ! is_user_logged_in() ) { |
|
84 | - give_get_template_part( 'shortcode', 'register' ); |
|
83 | + if ( ! is_user_logged_in()) { |
|
84 | + give_get_template_part('shortcode', 'register'); |
|
85 | 85 | } |
86 | 86 | |
87 | - return apply_filters( 'give_register_form', ob_get_clean() ); |
|
87 | + return apply_filters('give_register_form', ob_get_clean()); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -96,34 +96,34 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @return void |
98 | 98 | */ |
99 | -function give_process_login_form( $data ) { |
|
100 | - if ( wp_verify_nonce( $data['give_login_nonce'], 'give-login-nonce' ) ) { |
|
101 | - $user_data = get_user_by( 'login', $data['give_user_login'] ); |
|
102 | - if ( ! $user_data ) { |
|
103 | - $user_data = get_user_by( 'email', $data['give_user_login'] ); |
|
99 | +function give_process_login_form($data) { |
|
100 | + if (wp_verify_nonce($data['give_login_nonce'], 'give-login-nonce')) { |
|
101 | + $user_data = get_user_by('login', $data['give_user_login']); |
|
102 | + if ( ! $user_data) { |
|
103 | + $user_data = get_user_by('email', $data['give_user_login']); |
|
104 | 104 | } |
105 | - if ( $user_data ) { |
|
105 | + if ($user_data) { |
|
106 | 106 | $user_ID = $user_data->ID; |
107 | 107 | $user_email = $user_data->user_email; |
108 | - if ( wp_check_password( $data['give_user_pass'], $user_data->user_pass, $user_data->ID ) ) { |
|
109 | - give_log_user_in( $user_data->ID, $data['give_user_login'], $data['give_user_pass'] ); |
|
108 | + if (wp_check_password($data['give_user_pass'], $user_data->user_pass, $user_data->ID)) { |
|
109 | + give_log_user_in($user_data->ID, $data['give_user_login'], $data['give_user_pass']); |
|
110 | 110 | } else { |
111 | - give_set_error( 'password_incorrect', __( 'The password you entered is incorrect.', 'give' ) ); |
|
111 | + give_set_error('password_incorrect', __('The password you entered is incorrect.', 'give')); |
|
112 | 112 | } |
113 | 113 | } else { |
114 | - give_set_error( 'username_incorrect', __( 'The username you entered does not exist.', 'give' ) ); |
|
114 | + give_set_error('username_incorrect', __('The username you entered does not exist.', 'give')); |
|
115 | 115 | } |
116 | 116 | // Check for errors and redirect if none present |
117 | 117 | $errors = give_get_errors(); |
118 | - if ( ! $errors ) { |
|
119 | - $redirect = apply_filters( 'give_login_redirect', $data['give_login_redirect'], $user_ID ); |
|
120 | - wp_redirect( $redirect ); |
|
118 | + if ( ! $errors) { |
|
119 | + $redirect = apply_filters('give_login_redirect', $data['give_login_redirect'], $user_ID); |
|
120 | + wp_redirect($redirect); |
|
121 | 121 | give_die(); |
122 | 122 | } |
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | -add_action( 'give_user_login', 'give_process_login_form' ); |
|
126 | +add_action('give_user_login', 'give_process_login_form'); |
|
127 | 127 | |
128 | 128 | |
129 | 129 | /** |
@@ -135,27 +135,27 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return void |
137 | 137 | */ |
138 | -function give_process_user_logout( $data ) { |
|
139 | - if ( wp_verify_nonce( $data['give_logout_nonce'], 'give-logout-nonce' ) && is_user_logged_in() ) { |
|
138 | +function give_process_user_logout($data) { |
|
139 | + if (wp_verify_nonce($data['give_logout_nonce'], 'give-logout-nonce') && is_user_logged_in()) { |
|
140 | 140 | |
141 | 141 | // Prevent occurring of any custom action on wp_logout. |
142 | - remove_all_actions( 'wp_logout' ); |
|
142 | + remove_all_actions('wp_logout'); |
|
143 | 143 | |
144 | 144 | // Before logout give action. |
145 | - do_action( 'give_before_user_logout' ); |
|
145 | + do_action('give_before_user_logout'); |
|
146 | 146 | |
147 | 147 | // Logout user. |
148 | 148 | wp_logout(); |
149 | 149 | |
150 | 150 | // After logout give action. |
151 | - do_action( 'give_after_user_logout' ); |
|
151 | + do_action('give_after_user_logout'); |
|
152 | 152 | |
153 | - wp_redirect( $data['give_logout_redirect'] ); |
|
153 | + wp_redirect($data['give_logout_redirect']); |
|
154 | 154 | give_die(); |
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
158 | -add_action( 'give_user_logout', 'give_process_user_logout' ); |
|
158 | +add_action('give_user_logout', 'give_process_user_logout'); |
|
159 | 159 | |
160 | 160 | /** |
161 | 161 | * Log User In |
@@ -168,15 +168,15 @@ discard block |
||
168 | 168 | * |
169 | 169 | * @return void |
170 | 170 | */ |
171 | -function give_log_user_in( $user_id, $user_login, $user_pass ) { |
|
172 | - if ( $user_id < 1 ) { |
|
171 | +function give_log_user_in($user_id, $user_login, $user_pass) { |
|
172 | + if ($user_id < 1) { |
|
173 | 173 | return; |
174 | 174 | } |
175 | 175 | |
176 | - wp_set_auth_cookie( $user_id ); |
|
177 | - wp_set_current_user( $user_id, $user_login ); |
|
178 | - do_action( 'wp_login', $user_login, get_userdata( $user_id ) ); |
|
179 | - do_action( 'give_log_user_in', $user_id, $user_login, $user_pass ); |
|
176 | + wp_set_auth_cookie($user_id); |
|
177 | + wp_set_current_user($user_id, $user_login); |
|
178 | + do_action('wp_login', $user_login, get_userdata($user_id)); |
|
179 | + do_action('give_log_user_in', $user_id, $user_login, $user_pass); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
@@ -189,70 +189,70 @@ discard block |
||
189 | 189 | * |
190 | 190 | * @return void |
191 | 191 | */ |
192 | -function give_process_register_form( $data ) { |
|
192 | +function give_process_register_form($data) { |
|
193 | 193 | |
194 | - if ( is_user_logged_in() ) { |
|
194 | + if (is_user_logged_in()) { |
|
195 | 195 | return; |
196 | 196 | } |
197 | 197 | |
198 | - if ( empty( $_POST['give_register_submit'] ) ) { |
|
198 | + if (empty($_POST['give_register_submit'])) { |
|
199 | 199 | return; |
200 | 200 | } |
201 | 201 | |
202 | - do_action( 'give_pre_process_register_form' ); |
|
202 | + do_action('give_pre_process_register_form'); |
|
203 | 203 | |
204 | - if ( empty( $data['give_user_login'] ) ) { |
|
205 | - give_set_error( 'empty_username', __( 'Invalid username.', 'give' ) ); |
|
204 | + if (empty($data['give_user_login'])) { |
|
205 | + give_set_error('empty_username', __('Invalid username.', 'give')); |
|
206 | 206 | } |
207 | 207 | |
208 | - if ( username_exists( $data['give_user_login'] ) ) { |
|
209 | - give_set_error( 'username_unavailable', __( 'Username already taken.', 'give' ) ); |
|
208 | + if (username_exists($data['give_user_login'])) { |
|
209 | + give_set_error('username_unavailable', __('Username already taken.', 'give')); |
|
210 | 210 | } |
211 | 211 | |
212 | - if ( ! validate_username( $data['give_user_login'] ) ) { |
|
213 | - give_set_error( 'username_invalid', __( 'Invalid username.', 'give' ) ); |
|
212 | + if ( ! validate_username($data['give_user_login'])) { |
|
213 | + give_set_error('username_invalid', __('Invalid username.', 'give')); |
|
214 | 214 | } |
215 | 215 | |
216 | - if ( email_exists( $data['give_user_email'] ) ) { |
|
217 | - give_set_error( 'email_unavailable', __( 'Email address already taken.', 'give' ) ); |
|
216 | + if (email_exists($data['give_user_email'])) { |
|
217 | + give_set_error('email_unavailable', __('Email address already taken.', 'give')); |
|
218 | 218 | } |
219 | 219 | |
220 | - if ( empty( $data['give_user_email'] ) || ! is_email( $data['give_user_email'] ) ) { |
|
221 | - give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) ); |
|
220 | + if (empty($data['give_user_email']) || ! is_email($data['give_user_email'])) { |
|
221 | + give_set_error('email_invalid', __('Invalid email.', 'give')); |
|
222 | 222 | } |
223 | 223 | |
224 | - if ( ! empty( $data['give_payment_email'] ) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email( $data['give_payment_email'] ) ) { |
|
225 | - give_set_error( 'payment_email_invalid', __( 'Invalid payment email.', 'give' ) ); |
|
224 | + if ( ! empty($data['give_payment_email']) && $data['give_payment_email'] != $data['give_user_email'] && ! is_email($data['give_payment_email'])) { |
|
225 | + give_set_error('payment_email_invalid', __('Invalid payment email.', 'give')); |
|
226 | 226 | } |
227 | 227 | |
228 | - if ( empty( $_POST['give_user_pass'] ) ) { |
|
229 | - give_set_error( 'empty_password', __( 'Please enter a password.', 'give' ) ); |
|
228 | + if (empty($_POST['give_user_pass'])) { |
|
229 | + give_set_error('empty_password', __('Please enter a password.', 'give')); |
|
230 | 230 | } |
231 | 231 | |
232 | - if ( ( ! empty( $_POST['give_user_pass'] ) && empty( $_POST['give_user_pass2'] ) ) || ( $_POST['give_user_pass'] !== $_POST['give_user_pass2'] ) ) { |
|
233 | - give_set_error( 'password_mismatch', __( 'Passwords don\'t match.', 'give' ) ); |
|
232 | + if (( ! empty($_POST['give_user_pass']) && empty($_POST['give_user_pass2'])) || ($_POST['give_user_pass'] !== $_POST['give_user_pass2'])) { |
|
233 | + give_set_error('password_mismatch', __('Passwords don\'t match.', 'give')); |
|
234 | 234 | } |
235 | 235 | |
236 | - do_action( 'give_process_register_form' ); |
|
236 | + do_action('give_process_register_form'); |
|
237 | 237 | |
238 | 238 | // Check for errors and redirect if none present |
239 | 239 | $errors = give_get_errors(); |
240 | 240 | |
241 | - if ( empty( $errors ) ) { |
|
241 | + if (empty($errors)) { |
|
242 | 242 | |
243 | - $redirect = apply_filters( 'give_register_redirect', $data['give_redirect'] ); |
|
243 | + $redirect = apply_filters('give_register_redirect', $data['give_redirect']); |
|
244 | 244 | |
245 | - give_register_and_login_new_user( array( |
|
245 | + give_register_and_login_new_user(array( |
|
246 | 246 | 'user_login' => $data['give_user_login'], |
247 | 247 | 'user_pass' => $data['give_user_pass'], |
248 | 248 | 'user_email' => $data['give_user_email'], |
249 | - 'user_registered' => date( 'Y-m-d H:i:s' ), |
|
250 | - 'role' => get_option( 'default_role' ) |
|
251 | - ) ); |
|
249 | + 'user_registered' => date('Y-m-d H:i:s'), |
|
250 | + 'role' => get_option('default_role') |
|
251 | + )); |
|
252 | 252 | |
253 | - wp_redirect( $redirect ); |
|
253 | + wp_redirect($redirect); |
|
254 | 254 | give_die(); |
255 | 255 | } |
256 | 256 | } |
257 | 257 | |
258 | -add_action( 'give_user_register', 'give_process_register_form' ); |
|
259 | 258 | \ No newline at end of file |
259 | +add_action('give_user_register', 'give_process_register_form'); |
|
260 | 260 | \ No newline at end of file |
@@ -42,16 +42,16 @@ |
||
42 | 42 | 'minWidth' => 320, |
43 | 43 | 'tooltip' => __( 'Enter an URL here to redirect to after login.', 'give' ), |
44 | 44 | ), |
45 | - array( |
|
46 | - 'type' => 'container', |
|
47 | - 'html' => sprintf( '<p class="no-margin">%s</p>', __( 'Logout Redirect URL (optional):', 'give' ) ), |
|
48 | - ), |
|
49 | - array( |
|
50 | - 'type' => 'textbox', |
|
51 | - 'name' => 'logout-redirect', |
|
52 | - 'minWidth' => 320, |
|
53 | - 'tooltip' => __( 'Enter an URL here to redirect to after logout.', 'give' ), |
|
54 | - ), |
|
45 | + array( |
|
46 | + 'type' => 'container', |
|
47 | + 'html' => sprintf( '<p class="no-margin">%s</p>', __( 'Logout Redirect URL (optional):', 'give' ) ), |
|
48 | + ), |
|
49 | + array( |
|
50 | + 'type' => 'textbox', |
|
51 | + 'name' => 'logout-redirect', |
|
52 | + 'minWidth' => 320, |
|
53 | + 'tooltip' => __( 'Enter an URL here to redirect to after logout.', 'give' ), |
|
54 | + ), |
|
55 | 55 | ); |
56 | 56 | } |
57 | 57 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @since 1.3.0 |
10 | 10 | */ |
11 | 11 | |
12 | -defined( 'ABSPATH' ) or exit; |
|
12 | +defined('ABSPATH') or exit; |
|
13 | 13 | |
14 | 14 | class Give_Shortcode_Login extends Give_Shortcode_Generator { |
15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function __construct() { |
20 | 20 | |
21 | - $this->shortcode['title'] = __( 'Login', 'give' ); |
|
22 | - $this->shortcode['label'] = __( 'Login', 'give' ); |
|
21 | + $this->shortcode['title'] = __('Login', 'give'); |
|
22 | + $this->shortcode['label'] = __('Login', 'give'); |
|
23 | 23 | |
24 | - parent::__construct( 'give_login' ); |
|
24 | + parent::__construct('give_login'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -34,23 +34,23 @@ discard block |
||
34 | 34 | return array( |
35 | 35 | array( |
36 | 36 | 'type' => 'container', |
37 | - 'html' => sprintf( '<p class="no-margin">%s</p>', __( 'Login Redirect URL (optional):', 'give' ) ), |
|
37 | + 'html' => sprintf('<p class="no-margin">%s</p>', __('Login Redirect URL (optional):', 'give')), |
|
38 | 38 | ), |
39 | 39 | array( |
40 | 40 | 'type' => 'textbox', |
41 | 41 | 'name' => 'login-redirect', |
42 | 42 | 'minWidth' => 320, |
43 | - 'tooltip' => __( 'Enter an URL here to redirect to after login.', 'give' ), |
|
43 | + 'tooltip' => __('Enter an URL here to redirect to after login.', 'give'), |
|
44 | 44 | ), |
45 | 45 | array( |
46 | 46 | 'type' => 'container', |
47 | - 'html' => sprintf( '<p class="no-margin">%s</p>', __( 'Logout Redirect URL (optional):', 'give' ) ), |
|
47 | + 'html' => sprintf('<p class="no-margin">%s</p>', __('Logout Redirect URL (optional):', 'give')), |
|
48 | 48 | ), |
49 | 49 | array( |
50 | 50 | 'type' => 'textbox', |
51 | 51 | 'name' => 'logout-redirect', |
52 | 52 | 'minWidth' => 320, |
53 | - 'tooltip' => __( 'Enter an URL here to redirect to after logout.', 'give' ), |
|
53 | + 'tooltip' => __('Enter an URL here to redirect to after logout.', 'give'), |
|
54 | 54 | ), |
55 | 55 | ); |
56 | 56 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | //validate display_style and float_labels value |
93 | 93 | if ( ( $key == 'display_style' && ! in_array( $value, array( 'onpage', 'reveal', 'modal' ) ) ) |
94 | - || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) ) |
|
94 | + || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) ) |
|
95 | 95 | ) { |
96 | 96 | |
97 | 97 | $atts[ $key ] = ''; |
@@ -169,15 +169,15 @@ discard block |
||
169 | 169 | */ |
170 | 170 | function give_login_form_shortcode( $atts, $content = null ) { |
171 | 171 | $atts = shortcode_atts( array( |
172 | - // Add backward compatibility for redirect attribute. |
|
173 | - 'redirect' => '', |
|
172 | + // Add backward compatibility for redirect attribute. |
|
173 | + 'redirect' => '', |
|
174 | 174 | |
175 | 175 | 'login-redirect' => '', |
176 | 176 | 'logout-redirect' => '', |
177 | 177 | ), $atts, 'give_login' ); |
178 | 178 | |
179 | - // Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute. |
|
180 | - $atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect' ] ) ? $atts['redirect'] : '' ); |
|
179 | + // Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute. |
|
180 | + $atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect' ] ) ? $atts['redirect'] : '' ); |
|
181 | 181 | |
182 | 182 | return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] ); |
183 | 183 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -25,28 +25,28 @@ discard block |
||
25 | 25 | */ |
26 | 26 | function give_donation_history() { |
27 | 27 | |
28 | - $email_access = give_get_option( 'email_access' ); |
|
28 | + $email_access = give_get_option('email_access'); |
|
29 | 29 | |
30 | 30 | //Is user logged in? Does a session exist? Does an email-access token exist? |
31 | - if ( is_user_logged_in() || Give()->session->get_session_expiration() !== false || ( $email_access == 'on' && Give()->email_access->token_exists ) ) { |
|
31 | + if (is_user_logged_in() || Give()->session->get_session_expiration() !== false || ($email_access == 'on' && Give()->email_access->token_exists)) { |
|
32 | 32 | ob_start(); |
33 | - give_get_template_part( 'history', 'donations' ); |
|
33 | + give_get_template_part('history', 'donations'); |
|
34 | 34 | |
35 | 35 | return ob_get_clean(); |
36 | 36 | } //Is Email-based access enabled? |
37 | - elseif ( $email_access == 'on' ) { |
|
37 | + elseif ($email_access == 'on') { |
|
38 | 38 | |
39 | 39 | ob_start(); |
40 | - give_get_template_part( 'email', 'login-form' ); |
|
40 | + give_get_template_part('email', 'login-form'); |
|
41 | 41 | |
42 | 42 | return ob_get_clean(); |
43 | 43 | } else { |
44 | - $message = __( 'You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give' ); |
|
45 | - echo apply_filters( 'give_donation_history_nonuser_message', give_output_error( $message, false ), $message ); |
|
44 | + $message = __('You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give'); |
|
45 | + echo apply_filters('give_donation_history_nonuser_message', give_output_error($message, false), $message); |
|
46 | 46 | } |
47 | 47 | } |
48 | 48 | |
49 | -add_shortcode( 'donation_history', 'give_donation_history' ); |
|
49 | +add_shortcode('donation_history', 'give_donation_history'); |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Donation Form Shortcode |
@@ -60,53 +60,53 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return string |
62 | 62 | */ |
63 | -function give_form_shortcode( $atts, $content = null ) { |
|
64 | - $atts = shortcode_atts( array( |
|
63 | +function give_form_shortcode($atts, $content = null) { |
|
64 | + $atts = shortcode_atts(array( |
|
65 | 65 | 'id' => '', |
66 | 66 | 'show_title' => true, |
67 | 67 | 'show_goal' => true, |
68 | 68 | 'show_content' => '', |
69 | 69 | 'float_labels' => '', |
70 | 70 | 'display_style' => '', |
71 | - ), $atts, 'give_form' ); |
|
71 | + ), $atts, 'give_form'); |
|
72 | 72 | |
73 | - foreach ( $atts as $key => $value ) { |
|
73 | + foreach ($atts as $key => $value) { |
|
74 | 74 | //convert shortcode_atts values to booleans |
75 | - if ( $key == 'show_title' ) { |
|
76 | - $atts[ $key ] = filter_var( $atts[ $key ], FILTER_VALIDATE_BOOLEAN ); |
|
77 | - } elseif ( $key == 'show_goal' ) { |
|
78 | - $atts[ $key ] = filter_var( $atts[ $key ], FILTER_VALIDATE_BOOLEAN ); |
|
75 | + if ($key == 'show_title') { |
|
76 | + $atts[$key] = filter_var($atts[$key], FILTER_VALIDATE_BOOLEAN); |
|
77 | + } elseif ($key == 'show_goal') { |
|
78 | + $atts[$key] = filter_var($atts[$key], FILTER_VALIDATE_BOOLEAN); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | //validate show_content value |
82 | - if ( $key == 'show_content' ) { |
|
83 | - if ( ! in_array( $value, array( 'none', 'above', 'below' ) ) ) { |
|
84 | - $atts[ $key ] = ''; |
|
85 | - } else if ( $value == 'above' ) { |
|
86 | - $atts[ $key ] = 'give_pre_form'; |
|
87 | - } else if ( $value == 'below' ) { |
|
88 | - $atts[ $key ] = 'give_post_form'; |
|
82 | + if ($key == 'show_content') { |
|
83 | + if ( ! in_array($value, array('none', 'above', 'below'))) { |
|
84 | + $atts[$key] = ''; |
|
85 | + } else if ($value == 'above') { |
|
86 | + $atts[$key] = 'give_pre_form'; |
|
87 | + } else if ($value == 'below') { |
|
88 | + $atts[$key] = 'give_post_form'; |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | 92 | //validate display_style and float_labels value |
93 | - if ( ( $key == 'display_style' && ! in_array( $value, array( 'onpage', 'reveal', 'modal' ) ) ) |
|
94 | - || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) ) |
|
93 | + if (($key == 'display_style' && ! in_array($value, array('onpage', 'reveal', 'modal'))) |
|
94 | + || ($key == 'float_labels' && ! in_array($value, array('enabled', 'disabled'))) |
|
95 | 95 | ) { |
96 | 96 | |
97 | - $atts[ $key ] = ''; |
|
97 | + $atts[$key] = ''; |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
101 | 101 | //get the Give Form |
102 | 102 | ob_start(); |
103 | - give_get_donation_form( $atts ); |
|
103 | + give_get_donation_form($atts); |
|
104 | 104 | $final_output = ob_get_clean(); |
105 | 105 | |
106 | - return apply_filters( 'give_donate_form', $final_output, $atts ); |
|
106 | + return apply_filters('give_donate_form', $final_output, $atts); |
|
107 | 107 | } |
108 | 108 | |
109 | -add_shortcode( 'give_form', 'give_form_shortcode' ); |
|
109 | +add_shortcode('give_form', 'give_form_shortcode'); |
|
110 | 110 | |
111 | 111 | /** |
112 | 112 | * Donation Form Goal Shortcode |
@@ -120,37 +120,37 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @return string |
122 | 122 | */ |
123 | -function give_goal_shortcode( $atts, $content = null ) { |
|
124 | - $atts = shortcode_atts( array( |
|
123 | +function give_goal_shortcode($atts, $content = null) { |
|
124 | + $atts = shortcode_atts(array( |
|
125 | 125 | 'id' => '', |
126 | 126 | 'show_text' => true, |
127 | 127 | 'show_bar' => true, |
128 | - ), $atts, 'give_goal' ); |
|
128 | + ), $atts, 'give_goal'); |
|
129 | 129 | |
130 | 130 | |
131 | 131 | //get the Give Form |
132 | 132 | ob_start(); |
133 | 133 | |
134 | 134 | //Sanity check 1: ensure there is an ID Provided |
135 | - if ( empty( $atts['id'] ) ) { |
|
136 | - give_output_error( __( 'Error: No Donation form ID for the shortcode provided.', 'give' ), true ); |
|
135 | + if (empty($atts['id'])) { |
|
136 | + give_output_error(__('Error: No Donation form ID for the shortcode provided.', 'give'), true); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | //Sanity check 2: Check that this form even has Goals enabled |
140 | - $goal_option = get_post_meta( $atts['id'], '_give_goal_option', true ); |
|
141 | - if ( empty( $goal_option ) || $goal_option !== 'yes' ) { |
|
142 | - give_output_error( __( 'Error: This form does not have Goals enabled.', 'give' ), true ); |
|
140 | + $goal_option = get_post_meta($atts['id'], '_give_goal_option', true); |
|
141 | + if (empty($goal_option) || $goal_option !== 'yes') { |
|
142 | + give_output_error(__('Error: This form does not have Goals enabled.', 'give'), true); |
|
143 | 143 | } else { |
144 | 144 | //Passed all sanity checks: output Goal |
145 | - give_show_goal_progress( $atts['id'], $atts ); |
|
145 | + give_show_goal_progress($atts['id'], $atts); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | $final_output = ob_get_clean(); |
149 | 149 | |
150 | - return apply_filters( 'give_goal_shortcode_output', $final_output, $atts ); |
|
150 | + return apply_filters('give_goal_shortcode_output', $final_output, $atts); |
|
151 | 151 | } |
152 | 152 | |
153 | -add_shortcode( 'give_goal', 'give_goal_shortcode' ); |
|
153 | +add_shortcode('give_goal', 'give_goal_shortcode'); |
|
154 | 154 | |
155 | 155 | |
156 | 156 | /** |
@@ -167,22 +167,22 @@ discard block |
||
167 | 167 | * @uses give_login_form() |
168 | 168 | * @return string |
169 | 169 | */ |
170 | -function give_login_form_shortcode( $atts, $content = null ) { |
|
171 | - $atts = shortcode_atts( array( |
|
170 | +function give_login_form_shortcode($atts, $content = null) { |
|
171 | + $atts = shortcode_atts(array( |
|
172 | 172 | // Add backward compatibility for redirect attribute. |
173 | 173 | 'redirect' => '', |
174 | 174 | |
175 | 175 | 'login-redirect' => '', |
176 | 176 | 'logout-redirect' => '', |
177 | - ), $atts, 'give_login' ); |
|
177 | + ), $atts, 'give_login'); |
|
178 | 178 | |
179 | 179 | // Check login-redirect attribute first, if it empty or not found then check for redirect attribute and add value of this to login-redirect attribute. |
180 | - $atts['login-redirect'] = ! empty( $atts['login-redirect'] ) ? $atts['login-redirect'] : ( ! empty( $atts['redirect' ] ) ? $atts['redirect'] : '' ); |
|
180 | + $atts['login-redirect'] = ! empty($atts['login-redirect']) ? $atts['login-redirect'] : ( ! empty($atts['redirect']) ? $atts['redirect'] : ''); |
|
181 | 181 | |
182 | - return give_login_form( $atts['login-redirect'], $atts['logout-redirect'] ); |
|
182 | + return give_login_form($atts['login-redirect'], $atts['logout-redirect']); |
|
183 | 183 | } |
184 | 184 | |
185 | -add_shortcode( 'give_login', 'give_login_form_shortcode' ); |
|
185 | +add_shortcode('give_login', 'give_login_form_shortcode'); |
|
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Register Shortcode |
@@ -197,15 +197,15 @@ discard block |
||
197 | 197 | * @uses give_register_form() |
198 | 198 | * @return string |
199 | 199 | */ |
200 | -function give_register_form_shortcode( $atts, $content = null ) { |
|
201 | - $atts = shortcode_atts( array( |
|
200 | +function give_register_form_shortcode($atts, $content = null) { |
|
201 | + $atts = shortcode_atts(array( |
|
202 | 202 | 'redirect' => '', |
203 | - ), $atts, 'give_register' ); |
|
203 | + ), $atts, 'give_register'); |
|
204 | 204 | |
205 | - return give_register_form( $atts['redirect'] ); |
|
205 | + return give_register_form($atts['redirect']); |
|
206 | 206 | } |
207 | 207 | |
208 | -add_shortcode( 'give_register', 'give_register_form_shortcode' ); |
|
208 | +add_shortcode('give_register', 'give_register_form_shortcode'); |
|
209 | 209 | |
210 | 210 | |
211 | 211 | /** |
@@ -220,62 +220,62 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @return string |
222 | 222 | */ |
223 | -function give_receipt_shortcode( $atts, $content = null ) { |
|
223 | +function give_receipt_shortcode($atts, $content = null) { |
|
224 | 224 | |
225 | 225 | global $give_receipt_args, $payment; |
226 | 226 | |
227 | - $give_receipt_args = shortcode_atts( array( |
|
228 | - 'error' => esc_html__( 'Sorry, you are missing the payment key to view this donation receipt.', 'give' ), |
|
227 | + $give_receipt_args = shortcode_atts(array( |
|
228 | + 'error' => esc_html__('Sorry, you are missing the payment key to view this donation receipt.', 'give'), |
|
229 | 229 | 'price' => true, |
230 | 230 | 'donor' => true, |
231 | 231 | 'date' => true, |
232 | 232 | 'payment_key' => false, |
233 | 233 | 'payment_method' => true, |
234 | 234 | 'payment_id' => true |
235 | - ), $atts, 'give_receipt' ); |
|
235 | + ), $atts, 'give_receipt'); |
|
236 | 236 | |
237 | 237 | //set $session var |
238 | 238 | $session = give_get_purchase_session(); |
239 | 239 | |
240 | 240 | //set payment key var |
241 | - if ( isset( $_GET['payment_key'] ) ) { |
|
242 | - $payment_key = urldecode( $_GET['payment_key'] ); |
|
243 | - } elseif ( $session ) { |
|
241 | + if (isset($_GET['payment_key'])) { |
|
242 | + $payment_key = urldecode($_GET['payment_key']); |
|
243 | + } elseif ($session) { |
|
244 | 244 | $payment_key = $session['purchase_key']; |
245 | - } elseif ( $give_receipt_args['payment_key'] ) { |
|
245 | + } elseif ($give_receipt_args['payment_key']) { |
|
246 | 246 | $payment_key = $give_receipt_args['payment_key']; |
247 | 247 | } |
248 | 248 | |
249 | - $email_access = give_get_option( 'email_access' ); |
|
249 | + $email_access = give_get_option('email_access'); |
|
250 | 250 | |
251 | 251 | // No payment_key found & Email Access is Turned on: |
252 | - if ( ! isset( $payment_key ) && $email_access == 'on' && ! Give()->email_access->token_exists ) { |
|
252 | + if ( ! isset($payment_key) && $email_access == 'on' && ! Give()->email_access->token_exists) { |
|
253 | 253 | |
254 | 254 | ob_start(); |
255 | 255 | |
256 | - give_get_template_part( 'email-login-form' ); |
|
256 | + give_get_template_part('email-login-form'); |
|
257 | 257 | |
258 | 258 | return ob_get_clean(); |
259 | 259 | |
260 | - } elseif ( ! isset( $payment_key ) ) { |
|
260 | + } elseif ( ! isset($payment_key)) { |
|
261 | 261 | |
262 | - return give_output_error( $give_receipt_args['error'], false, 'error' ); |
|
262 | + return give_output_error($give_receipt_args['error'], false, 'error'); |
|
263 | 263 | |
264 | 264 | } |
265 | 265 | |
266 | - $payment_id = give_get_purchase_id_by_key( $payment_key ); |
|
267 | - $user_can_view = give_can_view_receipt( $payment_key ); |
|
266 | + $payment_id = give_get_purchase_id_by_key($payment_key); |
|
267 | + $user_can_view = give_can_view_receipt($payment_key); |
|
268 | 268 | |
269 | 269 | // Key was provided, but user is logged out. Offer them the ability to login and view the receipt |
270 | - if ( ! $user_can_view && $email_access == 'on' && ! Give()->email_access->token_exists ) { |
|
270 | + if ( ! $user_can_view && $email_access == 'on' && ! Give()->email_access->token_exists) { |
|
271 | 271 | |
272 | 272 | ob_start(); |
273 | 273 | |
274 | - give_get_template_part( 'email-login-form' ); |
|
274 | + give_get_template_part('email-login-form'); |
|
275 | 275 | |
276 | 276 | return ob_get_clean(); |
277 | 277 | |
278 | - } elseif ( ! $user_can_view ) { |
|
278 | + } elseif ( ! $user_can_view) { |
|
279 | 279 | |
280 | 280 | global $give_login_redirect; |
281 | 281 | |
@@ -283,9 +283,9 @@ discard block |
||
283 | 283 | |
284 | 284 | ob_start(); |
285 | 285 | |
286 | - give_output_error( apply_filters( 'give_must_be_logged_in_error_message', esc_html__( 'You must be logged in to view this donation payment receipt.', 'give' ) ) ); |
|
286 | + give_output_error(apply_filters('give_must_be_logged_in_error_message', esc_html__('You must be logged in to view this donation payment receipt.', 'give'))); |
|
287 | 287 | |
288 | - give_get_template_part( 'shortcode', 'login' ); |
|
288 | + give_get_template_part('shortcode', 'login'); |
|
289 | 289 | |
290 | 290 | $login_form = ob_get_clean(); |
291 | 291 | |
@@ -302,13 +302,13 @@ discard block |
||
302 | 302 | * Or if user is logged in and the user can view sensitive shop data |
303 | 303 | * |
304 | 304 | */ |
305 | - if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) { |
|
306 | - return give_output_error( $give_receipt_args['error'], false, 'error' ); |
|
305 | + if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) { |
|
306 | + return give_output_error($give_receipt_args['error'], false, 'error'); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | ob_start(); |
310 | 310 | |
311 | - give_get_template_part( 'shortcode', 'receipt' ); |
|
311 | + give_get_template_part('shortcode', 'receipt'); |
|
312 | 312 | |
313 | 313 | $display = ob_get_clean(); |
314 | 314 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | |
318 | 318 | } |
319 | 319 | |
320 | -add_shortcode( 'give_receipt', 'give_receipt_shortcode' ); |
|
320 | +add_shortcode('give_receipt', 'give_receipt_shortcode'); |
|
321 | 321 | |
322 | 322 | /** |
323 | 323 | * Profile Editor Shortcode |
@@ -337,18 +337,18 @@ discard block |
||
337 | 337 | * |
338 | 338 | * @return string Output generated from the profile editor |
339 | 339 | */ |
340 | -function give_profile_editor_shortcode( $atts, $content = null ) { |
|
340 | +function give_profile_editor_shortcode($atts, $content = null) { |
|
341 | 341 | |
342 | 342 | ob_start(); |
343 | 343 | |
344 | - give_get_template_part( 'shortcode', 'profile-editor' ); |
|
344 | + give_get_template_part('shortcode', 'profile-editor'); |
|
345 | 345 | |
346 | 346 | $display = ob_get_clean(); |
347 | 347 | |
348 | 348 | return $display; |
349 | 349 | } |
350 | 350 | |
351 | -add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' ); |
|
351 | +add_shortcode('give_profile_editor', 'give_profile_editor_shortcode'); |
|
352 | 352 | |
353 | 353 | /** |
354 | 354 | * Process Profile Updater Form |
@@ -361,30 +361,30 @@ discard block |
||
361 | 361 | * |
362 | 362 | * @return false |
363 | 363 | */ |
364 | -function give_process_profile_editor_updates( $data ) { |
|
364 | +function give_process_profile_editor_updates($data) { |
|
365 | 365 | // Profile field change request |
366 | - if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) { |
|
366 | + if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) { |
|
367 | 367 | return false; |
368 | 368 | } |
369 | 369 | |
370 | 370 | // Nonce security |
371 | - if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) { |
|
371 | + if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) { |
|
372 | 372 | return false; |
373 | 373 | } |
374 | 374 | |
375 | 375 | $user_id = get_current_user_id(); |
376 | - $old_user_data = get_userdata( $user_id ); |
|
377 | - |
|
378 | - $display_name = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name; |
|
379 | - $first_name = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name; |
|
380 | - $last_name = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name; |
|
381 | - $email = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email; |
|
382 | - $line1 = ( isset( $data['give_address_line1'] ) ? sanitize_text_field( $data['give_address_line1'] ) : '' ); |
|
383 | - $line2 = ( isset( $data['give_address_line2'] ) ? sanitize_text_field( $data['give_address_line2'] ) : '' ); |
|
384 | - $city = ( isset( $data['give_address_city'] ) ? sanitize_text_field( $data['give_address_city'] ) : '' ); |
|
385 | - $state = ( isset( $data['give_address_state'] ) ? sanitize_text_field( $data['give_address_state'] ) : '' ); |
|
386 | - $zip = ( isset( $data['give_address_zip'] ) ? sanitize_text_field( $data['give_address_zip'] ) : '' ); |
|
387 | - $country = ( isset( $data['give_address_country'] ) ? sanitize_text_field( $data['give_address_country'] ) : '' ); |
|
376 | + $old_user_data = get_userdata($user_id); |
|
377 | + |
|
378 | + $display_name = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name; |
|
379 | + $first_name = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name; |
|
380 | + $last_name = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name; |
|
381 | + $email = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email; |
|
382 | + $line1 = (isset($data['give_address_line1']) ? sanitize_text_field($data['give_address_line1']) : ''); |
|
383 | + $line2 = (isset($data['give_address_line2']) ? sanitize_text_field($data['give_address_line2']) : ''); |
|
384 | + $city = (isset($data['give_address_city']) ? sanitize_text_field($data['give_address_city']) : ''); |
|
385 | + $state = (isset($data['give_address_state']) ? sanitize_text_field($data['give_address_state']) : ''); |
|
386 | + $zip = (isset($data['give_address_zip']) ? sanitize_text_field($data['give_address_zip']) : ''); |
|
387 | + $country = (isset($data['give_address_country']) ? sanitize_text_field($data['give_address_country']) : ''); |
|
388 | 388 | |
389 | 389 | $userdata = array( |
390 | 390 | 'ID' => $user_id, |
@@ -404,45 +404,45 @@ discard block |
||
404 | 404 | 'country' => $country |
405 | 405 | ); |
406 | 406 | |
407 | - do_action( 'give_pre_update_user_profile', $user_id, $userdata ); |
|
407 | + do_action('give_pre_update_user_profile', $user_id, $userdata); |
|
408 | 408 | |
409 | 409 | // New password |
410 | - if ( ! empty( $data['give_new_user_pass1'] ) ) { |
|
411 | - if ( $data['give_new_user_pass1'] !== $data['give_new_user_pass2'] ) { |
|
412 | - give_set_error( 'password_mismatch', __( 'The passwords you entered do not match. Please try again.', 'give' ) ); |
|
410 | + if ( ! empty($data['give_new_user_pass1'])) { |
|
411 | + if ($data['give_new_user_pass1'] !== $data['give_new_user_pass2']) { |
|
412 | + give_set_error('password_mismatch', __('The passwords you entered do not match. Please try again.', 'give')); |
|
413 | 413 | } else { |
414 | 414 | $userdata['user_pass'] = $data['give_new_user_pass1']; |
415 | 415 | } |
416 | 416 | } |
417 | 417 | |
418 | 418 | // Make sure the new email doesn't belong to another user |
419 | - if ( $email != $old_user_data->user_email ) { |
|
420 | - if ( email_exists( $email ) ) { |
|
421 | - give_set_error( 'email_exists', __( 'The email you entered belongs to another user. Please use another.', 'give' ) ); |
|
419 | + if ($email != $old_user_data->user_email) { |
|
420 | + if (email_exists($email)) { |
|
421 | + give_set_error('email_exists', __('The email you entered belongs to another user. Please use another.', 'give')); |
|
422 | 422 | } |
423 | 423 | } |
424 | 424 | |
425 | 425 | // Check for errors |
426 | 426 | $errors = give_get_errors(); |
427 | 427 | |
428 | - if ( $errors ) { |
|
428 | + if ($errors) { |
|
429 | 429 | // Send back to the profile editor if there are errors |
430 | - wp_redirect( $data['give_redirect'] ); |
|
430 | + wp_redirect($data['give_redirect']); |
|
431 | 431 | give_die(); |
432 | 432 | } |
433 | 433 | |
434 | 434 | // Update the user |
435 | - $meta = update_user_meta( $user_id, '_give_user_address', $address ); |
|
436 | - $updated = wp_update_user( $userdata ); |
|
435 | + $meta = update_user_meta($user_id, '_give_user_address', $address); |
|
436 | + $updated = wp_update_user($userdata); |
|
437 | 437 | |
438 | - if ( $updated ) { |
|
439 | - do_action( 'give_user_profile_updated', $user_id, $userdata ); |
|
440 | - wp_redirect( add_query_arg( 'updated', 'true', $data['give_redirect'] ) ); |
|
438 | + if ($updated) { |
|
439 | + do_action('give_user_profile_updated', $user_id, $userdata); |
|
440 | + wp_redirect(add_query_arg('updated', 'true', $data['give_redirect'])); |
|
441 | 441 | give_die(); |
442 | 442 | } |
443 | 443 | |
444 | 444 | return false; |
445 | 445 | } |
446 | 446 | |
447 | -add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' ); |
|
447 | +add_action('give_edit_user_profile', 'give_process_profile_editor_updates'); |
|
448 | 448 |
@@ -9,13 +9,13 @@ 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 | |
16 | 16 | // Load WP_List_Table if not loaded |
17 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
18 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
17 | +if ( ! class_exists('WP_List_Table')) { |
|
18 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | global $status, $page; |
46 | 46 | |
47 | 47 | // Set parent defaults |
48 | - parent::__construct( array( |
|
49 | - 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | - 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
48 | + parent::__construct(array( |
|
49 | + 'singular' => give_get_forms_label_singular(), // Singular name of the listed records |
|
50 | + 'plural' => give_get_forms_label_plural(), // Plural name of the listed records |
|
51 | 51 | 'ajax' => false // Does this table support ajax? |
52 | - ) ); |
|
52 | + )); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | * |
64 | 64 | * @return string Column Name |
65 | 65 | */ |
66 | - public function column_default( $item, $column_name ) { |
|
67 | - switch ( $column_name ) { |
|
66 | + public function column_default($item, $column_name) { |
|
67 | + switch ($column_name) { |
|
68 | 68 | case 'ID' : |
69 | 69 | return $item['ID_label']; |
70 | 70 | case 'error' : |
71 | - return get_the_title( $item['ID'] ) ? get_the_title( $item['ID'] ) : __( 'Payment Error', 'give' ); |
|
71 | + return get_the_title($item['ID']) ? get_the_title($item['ID']) : __('Payment Error', 'give'); |
|
72 | 72 | default: |
73 | - return $item[ $column_name ]; |
|
73 | + return $item[$column_name]; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
@@ -84,29 +84,29 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @return void |
86 | 86 | */ |
87 | - public function column_message( $item ) { |
|
87 | + public function column_message($item) { |
|
88 | 88 | |
89 | 89 | ?> |
90 | - <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox" title="<?php _e( 'View Log Message', 'give' ); ?> "><?php _e( 'View Log Message', 'give' ); ?></a> |
|
90 | + <a href="#TB_inline?width=640&inlineId=log-message-<?php echo $item['ID']; ?>" class="thickbox" title="<?php _e('View Log Message', 'give'); ?> "><?php _e('View Log Message', 'give'); ?></a> |
|
91 | 91 | <div id="log-message-<?php echo $item['ID']; ?>" style="display:none;"> |
92 | 92 | <?php |
93 | 93 | |
94 | - $log_message = get_post_field( 'post_content', $item['ID'] ); |
|
94 | + $log_message = get_post_field('post_content', $item['ID']); |
|
95 | 95 | |
96 | - $serialized = strpos( $log_message, '{"' ); |
|
96 | + $serialized = strpos($log_message, '{"'); |
|
97 | 97 | |
98 | 98 | // Check to see if the log message contains serialized information |
99 | - if ( $serialized !== false ) { |
|
100 | - $length = strlen( $log_message ) - $serialized; |
|
101 | - $intro = substr( $log_message, 0, - $length ); |
|
102 | - $data = substr( $log_message, $serialized, strlen( $log_message ) - 1 ); |
|
99 | + if ($serialized !== false) { |
|
100 | + $length = strlen($log_message) - $serialized; |
|
101 | + $intro = substr($log_message, 0, - $length); |
|
102 | + $data = substr($log_message, $serialized, strlen($log_message) - 1); |
|
103 | 103 | |
104 | - echo wpautop( $intro ); |
|
105 | - echo wpautop( '<strong>' . __( 'Log data:', 'give' ) . '</strong>' ); |
|
106 | - echo '<div style="word-wrap: break-word;">' . wpautop( $data ) . '</div>'; |
|
104 | + echo wpautop($intro); |
|
105 | + echo wpautop('<strong>'.__('Log data:', 'give').'</strong>'); |
|
106 | + echo '<div style="word-wrap: break-word;">'.wpautop($data).'</div>'; |
|
107 | 107 | } else { |
108 | 108 | // No serialized data found |
109 | - echo wpautop( $log_message ); |
|
109 | + echo wpautop($log_message); |
|
110 | 110 | } |
111 | 111 | ?> |
112 | 112 | </div> |
@@ -122,12 +122,12 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function get_columns() { |
124 | 124 | $columns = array( |
125 | - 'ID' => __( 'Log ID', 'give' ), |
|
126 | - 'payment_id' => __( 'Payment ID', 'give' ), |
|
127 | - 'error' => __( 'Error', 'give' ), |
|
128 | - 'message' => __( 'Error Message', 'give' ), |
|
129 | - 'gateway' => __( 'Gateway', 'give' ), |
|
130 | - 'date' => __( 'Date', 'give' ) |
|
125 | + 'ID' => __('Log ID', 'give'), |
|
126 | + 'payment_id' => __('Payment ID', 'give'), |
|
127 | + 'error' => __('Error', 'give'), |
|
128 | + 'message' => __('Error Message', 'give'), |
|
129 | + 'gateway' => __('Gateway', 'give'), |
|
130 | + 'date' => __('Date', 'give') |
|
131 | 131 | ); |
132 | 132 | |
133 | 133 | return $columns; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @return int Current page number |
142 | 142 | */ |
143 | 143 | public function get_paged() { |
144 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
144 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @since 1.0 |
152 | 152 | * @return void |
153 | 153 | */ |
154 | - public function bulk_actions( $which = '' ) { |
|
154 | + public function bulk_actions($which = '') { |
|
155 | 155 | give_log_views(); |
156 | 156 | } |
157 | 157 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | global $give_logs; |
168 | 168 | |
169 | 169 | // Prevent the queries from getting cached. Without this there are occasional memory issues for some installs |
170 | - wp_suspend_cache_addition( true ); |
|
170 | + wp_suspend_cache_addition(true); |
|
171 | 171 | |
172 | 172 | $logs_data = array(); |
173 | 173 | $paged = $this->get_paged(); |
@@ -176,17 +176,17 @@ discard block |
||
176 | 176 | 'paged' => $paged |
177 | 177 | ); |
178 | 178 | |
179 | - $logs = $give_logs->get_connected_logs( $log_query ); |
|
179 | + $logs = $give_logs->get_connected_logs($log_query); |
|
180 | 180 | |
181 | - if ( $logs ) { |
|
182 | - foreach ( $logs as $log ) { |
|
181 | + if ($logs) { |
|
182 | + foreach ($logs as $log) { |
|
183 | 183 | |
184 | 184 | $logs_data[] = array( |
185 | 185 | 'ID' => $log->ID, |
186 | - 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>' . $log->ID . '</span>', |
|
186 | + 'ID_label' => '<span class=\'give-item-label give-item-label-gray\'>'.$log->ID.'</span>', |
|
187 | 187 | 'payment_id' => $log->post_parent, |
188 | 188 | 'error' => 'error', |
189 | - 'gateway' => give_get_payment_gateway( $log->post_parent ), |
|
189 | + 'gateway' => give_get_payment_gateway($log->post_parent), |
|
190 | 190 | 'date' => $log->post_date |
191 | 191 | ); |
192 | 192 | } |
@@ -207,19 +207,19 @@ discard block |
||
207 | 207 | * |
208 | 208 | * @param string $which |
209 | 209 | */ |
210 | - protected function display_tablenav( $which ) { |
|
211 | - if ( 'top' === $which ) { |
|
212 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
210 | + protected function display_tablenav($which) { |
|
211 | + if ('top' === $which) { |
|
212 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
213 | 213 | } |
214 | 214 | ?> |
215 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
215 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
216 | 216 | |
217 | 217 | <div class="alignleft actions bulkactions"> |
218 | - <?php $this->bulk_actions( $which ); ?> |
|
218 | + <?php $this->bulk_actions($which); ?> |
|
219 | 219 | </div> |
220 | 220 | <?php |
221 | - $this->extra_tablenav( $which ); |
|
222 | - $this->pagination( $which ); |
|
221 | + $this->extra_tablenav($which); |
|
222 | + $this->pagination($which); |
|
223 | 223 | ?> |
224 | 224 | |
225 | 225 | <br class="clear"/> |
@@ -246,15 +246,15 @@ discard block |
||
246 | 246 | $columns = $this->get_columns(); |
247 | 247 | $hidden = array(); // No hidden columns |
248 | 248 | $sortable = $this->get_sortable_columns(); |
249 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
249 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
250 | 250 | $current_page = $this->get_pagenum(); |
251 | 251 | $this->items = $this->get_logs(); |
252 | - $total_items = $give_logs->get_log_count( 0, 'gateway_error' ); |
|
252 | + $total_items = $give_logs->get_log_count(0, 'gateway_error'); |
|
253 | 253 | |
254 | - $this->set_pagination_args( array( |
|
254 | + $this->set_pagination_args(array( |
|
255 | 255 | 'total_items' => $total_items, |
256 | 256 | 'per_page' => $this->per_page, |
257 | - 'total_pages' => ceil( $total_items / $this->per_page ) |
|
257 | + 'total_pages' => ceil($total_items / $this->per_page) |
|
258 | 258 | ) |
259 | 259 | ); |
260 | 260 | } |
@@ -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,39 +26,39 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @return void |
28 | 28 | */ |
29 | -function give_email_donation_receipt( $payment_id, $admin_notice = true ) { |
|
29 | +function give_email_donation_receipt($payment_id, $admin_notice = true) { |
|
30 | 30 | |
31 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
31 | + $payment_data = give_get_payment_meta($payment_id); |
|
32 | 32 | |
33 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
34 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
33 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
34 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
35 | 35 | |
36 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
37 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
36 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
37 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
38 | 38 | |
39 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
39 | + $to_email = give_get_payment_user_email($payment_id); |
|
40 | 40 | |
41 | - $subject = give_get_option( 'donation_subject', __( 'Donation Receipt', 'give' ) ); |
|
42 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
43 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
41 | + $subject = give_get_option('donation_subject', __('Donation Receipt', 'give')); |
|
42 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
43 | + $subject = give_do_email_tags($subject, $payment_id); |
|
44 | 44 | |
45 | - $attachments = apply_filters( 'give_receipt_attachments', array(), $payment_id, $payment_data ); |
|
46 | - $message = give_do_email_tags( give_get_email_body_content( $payment_id, $payment_data ), $payment_id ); |
|
45 | + $attachments = apply_filters('give_receipt_attachments', array(), $payment_id, $payment_data); |
|
46 | + $message = give_do_email_tags(give_get_email_body_content($payment_id, $payment_data), $payment_id); |
|
47 | 47 | |
48 | 48 | $emails = Give()->emails; |
49 | 49 | |
50 | - $emails->__set( 'from_name', $from_name ); |
|
51 | - $emails->__set( 'from_email', $from_email ); |
|
52 | - $emails->__set( 'heading', __( 'Donation Receipt', 'give' ) ); |
|
50 | + $emails->__set('from_name', $from_name); |
|
51 | + $emails->__set('from_email', $from_email); |
|
52 | + $emails->__set('heading', __('Donation Receipt', 'give')); |
|
53 | 53 | |
54 | 54 | |
55 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
56 | - $emails->__set( 'headers', $headers ); |
|
55 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
56 | + $emails->__set('headers', $headers); |
|
57 | 57 | |
58 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
58 | + $emails->send($to_email, $subject, $message, $attachments); |
|
59 | 59 | |
60 | - if ( $admin_notice && ! give_admin_notices_disabled( $payment_id ) ) { |
|
61 | - do_action( 'give_admin_sale_notice', $payment_id, $payment_data ); |
|
60 | + if ($admin_notice && ! give_admin_notices_disabled($payment_id)) { |
|
61 | + do_action('give_admin_sale_notice', $payment_id, $payment_data); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
@@ -71,29 +71,29 @@ discard block |
||
71 | 71 | */ |
72 | 72 | function give_email_test_donation_receipt() { |
73 | 73 | |
74 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
75 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, 0, array() ); |
|
74 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
75 | + $from_name = apply_filters('give_purchase_from_name', $from_name, 0, array()); |
|
76 | 76 | |
77 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
78 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, 0, array() ); |
|
77 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
78 | + $from_email = apply_filters('give_purchase_from_address', $from_email, 0, array()); |
|
79 | 79 | |
80 | - $subject = give_get_option( 'donation_subject', __( 'Donation Receipt', 'give' ) ); |
|
81 | - $subject = apply_filters( 'give_donation_subject', wp_strip_all_tags( $subject ), 0 ); |
|
82 | - $subject = give_do_email_tags( $subject, 0 ); |
|
80 | + $subject = give_get_option('donation_subject', __('Donation Receipt', 'give')); |
|
81 | + $subject = apply_filters('give_donation_subject', wp_strip_all_tags($subject), 0); |
|
82 | + $subject = give_do_email_tags($subject, 0); |
|
83 | 83 | |
84 | - $attachments = apply_filters( 'give_receipt_attachments', array(), 0, array() ); |
|
84 | + $attachments = apply_filters('give_receipt_attachments', array(), 0, array()); |
|
85 | 85 | |
86 | - $message = give_email_preview_template_tags( give_get_email_body_content( 0, array() ) ); |
|
86 | + $message = give_email_preview_template_tags(give_get_email_body_content(0, array())); |
|
87 | 87 | |
88 | 88 | $emails = Give()->emails; |
89 | - $emails->__set( 'from_name', $from_name ); |
|
90 | - $emails->__set( 'from_email', $from_email ); |
|
91 | - $emails->__set( 'heading', __( 'Donation Receipt', 'give' ) ); |
|
89 | + $emails->__set('from_name', $from_name); |
|
90 | + $emails->__set('from_email', $from_email); |
|
91 | + $emails->__set('heading', __('Donation Receipt', 'give')); |
|
92 | 92 | |
93 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), 0, array() ); |
|
94 | - $emails->__set( 'headers', $headers ); |
|
93 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), 0, array()); |
|
94 | + $emails->__set('headers', $headers); |
|
95 | 95 | |
96 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
96 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
97 | 97 | |
98 | 98 | } |
99 | 99 | |
@@ -107,49 +107,49 @@ discard block |
||
107 | 107 | * |
108 | 108 | * @return void |
109 | 109 | */ |
110 | -function give_admin_email_notice( $payment_id = 0, $payment_data = array() ) { |
|
110 | +function give_admin_email_notice($payment_id = 0, $payment_data = array()) { |
|
111 | 111 | |
112 | - $payment_id = absint( $payment_id ); |
|
112 | + $payment_id = absint($payment_id); |
|
113 | 113 | |
114 | - if ( empty( $payment_id ) ) { |
|
114 | + if (empty($payment_id)) { |
|
115 | 115 | return; |
116 | 116 | } |
117 | 117 | |
118 | - if ( ! give_get_payment_by( 'id', $payment_id ) ) { |
|
118 | + if ( ! give_get_payment_by('id', $payment_id)) { |
|
119 | 119 | return; |
120 | 120 | } |
121 | 121 | |
122 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
123 | - $from_name = apply_filters( 'give_purchase_from_name', $from_name, $payment_id, $payment_data ); |
|
122 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
123 | + $from_name = apply_filters('give_purchase_from_name', $from_name, $payment_id, $payment_data); |
|
124 | 124 | |
125 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
126 | - $from_email = apply_filters( 'give_purchase_from_address', $from_email, $payment_id, $payment_data ); |
|
125 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
126 | + $from_email = apply_filters('give_purchase_from_address', $from_email, $payment_id, $payment_data); |
|
127 | 127 | |
128 | - $subject = give_get_option( 'donation_notification_subject', sprintf( __( 'New Donation - Payment #%s', 'give' ), $payment_id ) ); |
|
129 | - $subject = apply_filters( 'give_admin_donation_notification_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
130 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
128 | + $subject = give_get_option('donation_notification_subject', sprintf(__('New Donation - Payment #%s', 'give'), $payment_id)); |
|
129 | + $subject = apply_filters('give_admin_donation_notification_subject', wp_strip_all_tags($subject), $payment_id); |
|
130 | + $subject = give_do_email_tags($subject, $payment_id); |
|
131 | 131 | |
132 | - $headers = "From: " . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>\r\n"; |
|
133 | - $headers .= "Reply-To: " . $from_email . "\r\n"; |
|
132 | + $headers = "From: ".stripslashes_deep(html_entity_decode($from_name, ENT_COMPAT, 'UTF-8'))." <$from_email>\r\n"; |
|
133 | + $headers .= "Reply-To: ".$from_email."\r\n"; |
|
134 | 134 | //$headers .= "MIME-Version: 1.0\r\n"; |
135 | 135 | $headers .= "Content-Type: text/html; charset=utf-8\r\n"; |
136 | - $headers = apply_filters( 'give_admin_donation_notification_headers', $headers, $payment_id, $payment_data ); |
|
136 | + $headers = apply_filters('give_admin_donation_notification_headers', $headers, $payment_id, $payment_data); |
|
137 | 137 | |
138 | - $attachments = apply_filters( 'give_admin_donation_notification_attachments', array(), $payment_id, $payment_data ); |
|
138 | + $attachments = apply_filters('give_admin_donation_notification_attachments', array(), $payment_id, $payment_data); |
|
139 | 139 | |
140 | - $message = give_get_donation_notification_body_content( $payment_id, $payment_data ); |
|
140 | + $message = give_get_donation_notification_body_content($payment_id, $payment_data); |
|
141 | 141 | |
142 | 142 | $emails = Give()->emails; |
143 | - $emails->__set( 'from_name', $from_name ); |
|
144 | - $emails->__set( 'from_email', $from_email ); |
|
145 | - $emails->__set( 'headers', $headers ); |
|
146 | - $emails->__set( 'heading', __( 'New Donation!', 'give' ) ); |
|
143 | + $emails->__set('from_name', $from_name); |
|
144 | + $emails->__set('from_email', $from_email); |
|
145 | + $emails->__set('headers', $headers); |
|
146 | + $emails->__set('heading', __('New Donation!', 'give')); |
|
147 | 147 | |
148 | - $emails->send( give_get_admin_notice_emails(), $subject, $message, $attachments ); |
|
148 | + $emails->send(give_get_admin_notice_emails(), $subject, $message, $attachments); |
|
149 | 149 | |
150 | 150 | } |
151 | 151 | |
152 | -add_action( 'give_admin_sale_notice', 'give_admin_email_notice', 10, 2 ); |
|
152 | +add_action('give_admin_sale_notice', 'give_admin_email_notice', 10, 2); |
|
153 | 153 | |
154 | 154 | /** |
155 | 155 | * Retrieves the emails for which admin notifications are sent to (these can be |
@@ -162,10 +162,10 @@ discard block |
||
162 | 162 | function give_get_admin_notice_emails() { |
163 | 163 | global $give_options; |
164 | 164 | |
165 | - $emails = isset( $give_options['admin_notice_emails'] ) && strlen( trim( $give_options['admin_notice_emails'] ) ) > 0 ? $give_options['admin_notice_emails'] : get_bloginfo( 'admin_email' ); |
|
166 | - $emails = array_map( 'trim', explode( "\n", $emails ) ); |
|
165 | + $emails = isset($give_options['admin_notice_emails']) && strlen(trim($give_options['admin_notice_emails'])) > 0 ? $give_options['admin_notice_emails'] : get_bloginfo('admin_email'); |
|
166 | + $emails = array_map('trim', explode("\n", $emails)); |
|
167 | 167 | |
168 | - return apply_filters( 'give_admin_notice_emails', $emails ); |
|
168 | + return apply_filters('give_admin_notice_emails', $emails); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @return mixed |
179 | 179 | */ |
180 | -function give_admin_notices_disabled( $payment_id = 0 ) { |
|
180 | +function give_admin_notices_disabled($payment_id = 0) { |
|
181 | 181 | |
182 | - $retval = give_get_option( 'disable_admin_notices' ); |
|
182 | + $retval = give_get_option('disable_admin_notices'); |
|
183 | 183 | |
184 | - return apply_filters( 'give_admin_notices_disabled', $retval, $payment_id ); |
|
184 | + return apply_filters('give_admin_notices_disabled', $retval, $payment_id); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | /** |
@@ -194,17 +194,17 @@ discard block |
||
194 | 194 | */ |
195 | 195 | function give_get_default_donation_notification_email() { |
196 | 196 | |
197 | - $default_email_body = __( 'Hi there,', 'give' ) . "\n\n" . __( 'This email is to inform you that a new donation has been made on your website: ', 'give' ) . '<a href="' . get_bloginfo( 'url' ) . '" target="_blank">' . get_bloginfo( 'url' ) . '</a>' . ".\n\n"; |
|
198 | - $default_email_body .= '<strong>' . __( 'Donor: ', 'give' ) . '</strong> ' . ' {name}' . "\n"; |
|
199 | - $default_email_body .= '<strong>' . __( 'Donation: ', 'give' ) . '</strong> ' . ' {donation}' . "\n"; |
|
200 | - $default_email_body .= '<strong>' . __( 'Amount: ', 'give' ) . '</strong> ' . ' {price}' . "\n"; |
|
201 | - $default_email_body .= '<strong>' . __( 'Payment Method: ', 'give' ) . '</strong> ' . ' {payment_method}' . "\n\n"; |
|
202 | - $default_email_body .= __( 'Thank you,', 'give' ) . "\n\n" . '{sitename}'; |
|
197 | + $default_email_body = __('Hi there,', 'give')."\n\n".__('This email is to inform you that a new donation has been made on your website: ', 'give').'<a href="'.get_bloginfo('url').'" target="_blank">'.get_bloginfo('url').'</a>'.".\n\n"; |
|
198 | + $default_email_body .= '<strong>'.__('Donor: ', 'give').'</strong> '.' {name}'."\n"; |
|
199 | + $default_email_body .= '<strong>'.__('Donation: ', 'give').'</strong> '.' {donation}'."\n"; |
|
200 | + $default_email_body .= '<strong>'.__('Amount: ', 'give').'</strong> '.' {price}'."\n"; |
|
201 | + $default_email_body .= '<strong>'.__('Payment Method: ', 'give').'</strong> '.' {payment_method}'."\n\n"; |
|
202 | + $default_email_body .= __('Thank you,', 'give')."\n\n".'{sitename}'; |
|
203 | 203 | |
204 | - $custom_message = give_get_option( 'donation_notification' ); |
|
205 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
204 | + $custom_message = give_get_option('donation_notification'); |
|
205 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
206 | 206 | |
207 | - return apply_filters( 'give_default_donation_notification_email', $message ); |
|
207 | + return apply_filters('give_default_donation_notification_email', $message); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | |
@@ -218,26 +218,26 @@ discard block |
||
218 | 218 | */ |
219 | 219 | function give_get_default_donation_receipt_email() { |
220 | 220 | |
221 | - $default_email_body = __( 'Dear', 'give' ) . " {name},\n\n"; |
|
222 | - $default_email_body .= __( 'Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give' ) . "\n\n"; |
|
223 | - $default_email_body .= '<strong>' . __( 'Donor', 'give' ) . ':</strong> ' . '{fullname}' . "\n"; |
|
224 | - $default_email_body .= '<strong>' . __( 'Donation', 'give' ) . ':</strong> ' . '{donation}' . "\n"; |
|
225 | - $default_email_body .= '<strong>' . __( 'Donation Date', 'give' ) . ':</strong> ' . '{date}' . "\n"; |
|
226 | - $default_email_body .= '<strong>' . __( 'Amount', 'give' ) . ':</strong> ' . '{price}' . "\n"; |
|
227 | - $default_email_body .= '<strong>' . __( 'Payment Method', 'give' ) . ':</strong> ' . '{payment_method}' . "\n"; |
|
228 | - $default_email_body .= '<strong>' . __( 'Payment ID', 'give' ) . ':</strong> ' . '{payment_id}' . "\n"; |
|
229 | - $default_email_body .= '<strong>' . __( 'Receipt ID', 'give' ) . ':</strong> ' . '{receipt_id}' . "\n\n"; |
|
230 | - $default_email_body .= '{receipt_link}' . "\n\n"; |
|
221 | + $default_email_body = __('Dear', 'give')." {name},\n\n"; |
|
222 | + $default_email_body .= __('Thank you for your donation. Your generosity is appreciated! Here are the details of your donation:', 'give')."\n\n"; |
|
223 | + $default_email_body .= '<strong>'.__('Donor', 'give').':</strong> '.'{fullname}'."\n"; |
|
224 | + $default_email_body .= '<strong>'.__('Donation', 'give').':</strong> '.'{donation}'."\n"; |
|
225 | + $default_email_body .= '<strong>'.__('Donation Date', 'give').':</strong> '.'{date}'."\n"; |
|
226 | + $default_email_body .= '<strong>'.__('Amount', 'give').':</strong> '.'{price}'."\n"; |
|
227 | + $default_email_body .= '<strong>'.__('Payment Method', 'give').':</strong> '.'{payment_method}'."\n"; |
|
228 | + $default_email_body .= '<strong>'.__('Payment ID', 'give').':</strong> '.'{payment_id}'."\n"; |
|
229 | + $default_email_body .= '<strong>'.__('Receipt ID', 'give').':</strong> '.'{receipt_id}'."\n\n"; |
|
230 | + $default_email_body .= '{receipt_link}'."\n\n"; |
|
231 | 231 | |
232 | 232 | $default_email_body .= "\n\n"; |
233 | - $default_email_body .= __( 'Sincerely,', 'give' ); |
|
234 | - $default_email_body .= "\n" . '{sitename}' . "\n"; |
|
233 | + $default_email_body .= __('Sincerely,', 'give'); |
|
234 | + $default_email_body .= "\n".'{sitename}'."\n"; |
|
235 | 235 | |
236 | - $custom_message = give_get_option( 'donation_receipt' ); |
|
236 | + $custom_message = give_get_option('donation_receipt'); |
|
237 | 237 | |
238 | - $message = ! empty( $custom_message ) ? $custom_message : $default_email_body; |
|
238 | + $message = ! empty($custom_message) ? $custom_message : $default_email_body; |
|
239 | 239 | |
240 | - return apply_filters( 'give_default_donation_receipt_email', $message ); |
|
240 | + return apply_filters('give_default_donation_receipt_email', $message); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | /** |
@@ -249,19 +249,19 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @return array $email_names |
251 | 251 | */ |
252 | -function give_get_email_names( $user_info ) { |
|
252 | +function give_get_email_names($user_info) { |
|
253 | 253 | $email_names = array(); |
254 | - $user_info = maybe_unserialize( $user_info ); |
|
254 | + $user_info = maybe_unserialize($user_info); |
|
255 | 255 | |
256 | 256 | $email_names['fullname'] = ''; |
257 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 && isset( $user_info['first_name'] ) ) { |
|
258 | - $user_data = get_userdata( $user_info['id'] ); |
|
257 | + if (isset($user_info['id']) && $user_info['id'] > 0 && isset($user_info['first_name'])) { |
|
258 | + $user_data = get_userdata($user_info['id']); |
|
259 | 259 | $email_names['name'] = $user_info['first_name']; |
260 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
260 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
261 | 261 | $email_names['username'] = $user_data->user_login; |
262 | - } elseif ( isset( $user_info['first_name'] ) ) { |
|
262 | + } elseif (isset($user_info['first_name'])) { |
|
263 | 263 | $email_names['name'] = $user_info['first_name']; |
264 | - $email_names['fullname'] = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
264 | + $email_names['fullname'] = $user_info['first_name'].' '.$user_info['last_name']; |
|
265 | 265 | $email_names['username'] = $user_info['first_name']; |
266 | 266 | } else { |
267 | 267 | $email_names['name'] = $user_info['email']; |
@@ -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 | |
@@ -24,13 +24,13 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @return string |
26 | 26 | */ |
27 | -function give_admin_rate_us( $footer_text ) { |
|
27 | +function give_admin_rate_us($footer_text) { |
|
28 | 28 | global $typenow; |
29 | 29 | |
30 | - if ( $typenow == 'give_forms' ) { |
|
30 | + if ($typenow == 'give_forms') { |
|
31 | 31 | $rate_text = sprintf( |
32 | - __( 'If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give' ), |
|
33 | - '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="' . __( 'Thanks :)', 'give' ) . '">★★★★★</a>' |
|
32 | + __('If you like <strong>Give</strong> please leave us a %s rating. It takes a minute and helps a lot. Thanks in advance!', 'give'), |
|
33 | + '<a href="https://wordpress.org/support/view/plugin-reviews/give?filter=5#postform" target="_blank" class="give-rating-link" data-rated="'.__('Thanks :)', 'give').'">★★★★★</a>' |
|
34 | 34 | ); |
35 | 35 | |
36 | 36 | return $rate_text; |
@@ -39,4 +39,4 @@ discard block |
||
39 | 39 | } |
40 | 40 | } |
41 | 41 | |
42 | -add_filter( 'admin_footer_text', 'give_admin_rate_us' ); |
|
42 | +add_filter('admin_footer_text', 'give_admin_rate_us'); |