@@ -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 | /** |
50 | 50 | * Main Give Class |
@@ -195,11 +195,11 @@ discard block |
||
195 | 195 | * @return Give |
196 | 196 | */ |
197 | 197 | public static function instance() { |
198 | - if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Give ) ) { |
|
198 | + if ( ! isset(self::$instance) && ! (self::$instance instanceof Give)) { |
|
199 | 199 | self::$instance = new Give; |
200 | 200 | self::$instance->setup_constants(); |
201 | 201 | |
202 | - add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); |
|
202 | + add_action('plugins_loaded', array(self::$instance, 'load_textdomain')); |
|
203 | 203 | |
204 | 204 | self::$instance->includes(); |
205 | 205 | self::$instance->roles = new Give_Roles(); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @since 1.8.7 |
223 | 223 | */ |
224 | - do_action( 'give_init', self::$instance ); |
|
224 | + do_action('give_init', self::$instance); |
|
225 | 225 | |
226 | 226 | return self::$instance; |
227 | 227 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function __clone() { |
241 | 241 | // Cloning instances of the class is forbidden |
242 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
242 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | /** |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | */ |
253 | 253 | public function __wakeup() { |
254 | 254 | // Unserializing instances of the class is forbidden. |
255 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
255 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0'); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
@@ -266,33 +266,33 @@ discard block |
||
266 | 266 | private function setup_constants() { |
267 | 267 | |
268 | 268 | // Plugin version |
269 | - if ( ! defined( 'GIVE_VERSION' ) ) { |
|
270 | - define( 'GIVE_VERSION', '1.8.7' ); |
|
269 | + if ( ! defined('GIVE_VERSION')) { |
|
270 | + define('GIVE_VERSION', '1.8.7'); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | // Plugin Folder Path |
274 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) { |
|
275 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
274 | + if ( ! defined('GIVE_PLUGIN_DIR')) { |
|
275 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__)); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | // Plugin Folder URL |
279 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) { |
|
280 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
279 | + if ( ! defined('GIVE_PLUGIN_URL')) { |
|
280 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__)); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | // Plugin Basename aka: "give/give.php" |
284 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) { |
|
285 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
284 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) { |
|
285 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__)); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | // Plugin Root File |
289 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) { |
|
290 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
289 | + if ( ! defined('GIVE_PLUGIN_FILE')) { |
|
290 | + define('GIVE_PLUGIN_FILE', __FILE__); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | // Make sure CAL_GREGORIAN is defined |
294 | - if ( ! defined( 'CAL_GREGORIAN' ) ) { |
|
295 | - define( 'CAL_GREGORIAN', 1 ); |
|
294 | + if ( ! defined('CAL_GREGORIAN')) { |
|
295 | + define('CAL_GREGORIAN', 1); |
|
296 | 296 | } |
297 | 297 | } |
298 | 298 | |
@@ -307,123 +307,123 @@ discard block |
||
307 | 307 | private function includes() { |
308 | 308 | global $give_options; |
309 | 309 | |
310 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php'; |
|
311 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
310 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php'; |
|
311 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
312 | 312 | $give_options = give_get_settings(); |
313 | 313 | |
314 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php'; |
|
315 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cache.php'; |
|
316 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
317 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
318 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
319 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
320 | - require_once GIVE_PLUGIN_DIR . 'includes/filters.php'; |
|
321 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
322 | - |
|
323 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
324 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
325 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
326 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
327 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php'; |
|
328 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customer-meta.php'; |
|
329 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php'; |
|
330 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
331 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
332 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
333 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
334 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
335 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
336 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
337 | - |
|
338 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
339 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
340 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
341 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
342 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
343 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
344 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
345 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
346 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
347 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
348 | - require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php'; |
|
349 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
350 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
351 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
352 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php'; |
|
353 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php'; |
|
354 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php'; |
|
355 | - |
|
356 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
357 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
358 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
359 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
360 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
361 | - |
|
362 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
363 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
364 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
365 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
366 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
367 | - |
|
368 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
369 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
370 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
371 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
372 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
373 | - |
|
374 | - if( defined( 'WP_CLI' ) && WP_CLI ) { |
|
375 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
314 | + require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php'; |
|
315 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cache.php'; |
|
316 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
317 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
318 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
319 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
320 | + require_once GIVE_PLUGIN_DIR.'includes/filters.php'; |
|
321 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
322 | + |
|
323 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
324 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
325 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
326 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
327 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php'; |
|
328 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customer-meta.php'; |
|
329 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php'; |
|
330 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
331 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
332 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
333 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
334 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
335 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
336 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
337 | + |
|
338 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
339 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
340 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
341 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
342 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
343 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
344 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
345 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
346 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
347 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
348 | + require_once GIVE_PLUGIN_DIR.'includes/process-donation.php'; |
|
349 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
350 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
351 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
352 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php'; |
|
353 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php'; |
|
354 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php'; |
|
355 | + |
|
356 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
357 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
358 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
359 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
360 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
361 | + |
|
362 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
363 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
364 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
365 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
366 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
367 | + |
|
368 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
369 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
370 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
371 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
372 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
373 | + |
|
374 | + if (defined('WP_CLI') && WP_CLI) { |
|
375 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
376 | 376 | } |
377 | 377 | |
378 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) { |
|
379 | - |
|
380 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
381 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
382 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
383 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
384 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
385 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
386 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
387 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php'; |
|
388 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
389 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
390 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
391 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
392 | - |
|
393 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
394 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
395 | - |
|
396 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
397 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
398 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
399 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
400 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php'; |
|
401 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
402 | - |
|
403 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php'; |
|
404 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
405 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php'; |
|
406 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php'; |
|
407 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php'; |
|
408 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
409 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
410 | - |
|
411 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
412 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
413 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
414 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
415 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
416 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
417 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
418 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
419 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
420 | - |
|
421 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
422 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php'; |
|
378 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) { |
|
379 | + |
|
380 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
381 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
382 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
383 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
384 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
385 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
386 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
387 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php'; |
|
388 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
389 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
390 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
391 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
392 | + |
|
393 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
394 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
395 | + |
|
396 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
397 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
398 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
399 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
400 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php'; |
|
401 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
402 | + |
|
403 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php'; |
|
404 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
405 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php'; |
|
406 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php'; |
|
407 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php'; |
|
408 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
409 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
410 | + |
|
411 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
412 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
413 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
414 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
415 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
416 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
417 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
418 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
419 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
420 | + |
|
421 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
422 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
423 | 423 | |
424 | 424 | } |
425 | 425 | |
426 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
426 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
427 | 427 | |
428 | 428 | } |
429 | 429 | |
@@ -437,26 +437,26 @@ discard block |
||
437 | 437 | */ |
438 | 438 | public function load_textdomain() { |
439 | 439 | // Set filter for Give's languages directory |
440 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
441 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
440 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
441 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir); |
|
442 | 442 | |
443 | 443 | // Traditional WordPress plugin locale filter |
444 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
445 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
444 | + $locale = apply_filters('plugin_locale', get_locale(), 'give'); |
|
445 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale); |
|
446 | 446 | |
447 | 447 | // Setup paths to current locale file |
448 | - $mofile_local = $give_lang_dir . $mofile; |
|
449 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
448 | + $mofile_local = $give_lang_dir.$mofile; |
|
449 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
450 | 450 | |
451 | - if ( file_exists( $mofile_global ) ) { |
|
451 | + if (file_exists($mofile_global)) { |
|
452 | 452 | // Look in global /wp-content/languages/give folder |
453 | - load_textdomain( 'give', $mofile_global ); |
|
454 | - } elseif ( file_exists( $mofile_local ) ) { |
|
453 | + load_textdomain('give', $mofile_global); |
|
454 | + } elseif (file_exists($mofile_local)) { |
|
455 | 455 | // Look in local location from filter `give_languages_directory` |
456 | - load_textdomain( 'give', $mofile_local ); |
|
456 | + load_textdomain('give', $mofile_local); |
|
457 | 457 | } else { |
458 | 458 | // Load the default language files packaged up w/ Give |
459 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
459 | + load_plugin_textdomain('give', false, $give_lang_dir); |
|
460 | 460 | } |
461 | 461 | } |
462 | 462 |
@@ -10,61 +10,61 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
13 | +if ( ! defined('WP_UNINSTALL_PLUGIN')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load Give file. |
18 | -include_once( 'give.php' ); |
|
18 | +include_once('give.php'); |
|
19 | 19 | |
20 | 20 | global $wpdb, $wp_roles; |
21 | 21 | |
22 | 22 | |
23 | -if ( give_is_setting_enabled( give_get_option( 'uninstall_on_delete' ) ) ) { |
|
23 | +if (give_is_setting_enabled(give_get_option('uninstall_on_delete'))) { |
|
24 | 24 | |
25 | 25 | // Delete All the Custom Post Types. |
26 | - $give_taxonomies = array( 'form_category', 'form_tag', 'give_log_type' ); |
|
27 | - $give_post_types = array( 'give_forms', 'give_payment', 'give_log' ); |
|
28 | - foreach ( $give_post_types as $post_type ) { |
|
26 | + $give_taxonomies = array('form_category', 'form_tag', 'give_log_type'); |
|
27 | + $give_post_types = array('give_forms', 'give_payment', 'give_log'); |
|
28 | + foreach ($give_post_types as $post_type) { |
|
29 | 29 | |
30 | - $give_taxonomies = array_merge( $give_taxonomies, get_object_taxonomies( $post_type ) ); |
|
31 | - $items = get_posts( array( |
|
30 | + $give_taxonomies = array_merge($give_taxonomies, get_object_taxonomies($post_type)); |
|
31 | + $items = get_posts(array( |
|
32 | 32 | 'post_type' => $post_type, |
33 | 33 | 'post_status' => 'any', |
34 | - 'numberposts' => - 1, |
|
34 | + 'numberposts' => -1, |
|
35 | 35 | 'fields' => 'ids', |
36 | - ) ); |
|
36 | + )); |
|
37 | 37 | |
38 | - if ( $items ) { |
|
39 | - foreach ( $items as $item ) { |
|
40 | - wp_delete_post( $item, true ); |
|
38 | + if ($items) { |
|
39 | + foreach ($items as $item) { |
|
40 | + wp_delete_post($item, true); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | 45 | // Delete All the Terms & Taxonomies. |
46 | - foreach ( array_unique( array_filter( $give_taxonomies ) ) as $taxonomy ) { |
|
46 | + foreach (array_unique(array_filter($give_taxonomies)) as $taxonomy) { |
|
47 | 47 | |
48 | - $terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy ) ); |
|
48 | + $terms = $wpdb->get_results($wpdb->prepare("SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy)); |
|
49 | 49 | |
50 | 50 | // Delete Terms. |
51 | - if ( $terms ) { |
|
52 | - foreach ( $terms as $term ) { |
|
53 | - $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) ); |
|
54 | - $wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) ); |
|
51 | + if ($terms) { |
|
52 | + foreach ($terms as $term) { |
|
53 | + $wpdb->delete($wpdb->term_taxonomy, array('term_taxonomy_id' => $term->term_taxonomy_id)); |
|
54 | + $wpdb->delete($wpdb->terms, array('term_id' => $term->term_id)); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | 58 | // Delete Taxonomies. |
59 | - $wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) ); |
|
59 | + $wpdb->delete($wpdb->term_taxonomy, array('taxonomy' => $taxonomy), array('%s')); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | // Delete the Plugin Pages. |
63 | - $give_created_pages = array( 'success_page', 'failure_page', 'history_page' ); |
|
64 | - foreach ( $give_created_pages as $p ) { |
|
65 | - $page = give_get_option( $p, false ); |
|
66 | - if ( $page ) { |
|
67 | - wp_delete_post( $page, true ); |
|
63 | + $give_created_pages = array('success_page', 'failure_page', 'history_page'); |
|
64 | + foreach ($give_created_pages as $p) { |
|
65 | + $page = give_get_option($p, false); |
|
66 | + if ($page) { |
|
67 | + wp_delete_post($page, true); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
@@ -72,20 +72,20 @@ discard block |
||
72 | 72 | Give()->roles->remove_caps(); |
73 | 73 | |
74 | 74 | // Delete the Roles. |
75 | - $give_roles = array( 'give_manager', 'give_accountant', 'give_worker' ); |
|
76 | - foreach ( $give_roles as $role ) { |
|
77 | - remove_role( $role ); |
|
75 | + $give_roles = array('give_manager', 'give_accountant', 'give_worker'); |
|
76 | + foreach ($give_roles as $role) { |
|
77 | + remove_role($role); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | // Remove all database tables. |
81 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_donors' ); |
|
82 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customers' ); |
|
83 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . 'give_customermeta' ); |
|
81 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_donors'); |
|
82 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customers'); |
|
83 | + $wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'give_customermeta'); |
|
84 | 84 | |
85 | 85 | // Cleanup Cron Events. |
86 | - wp_clear_scheduled_hook( 'give_daily_scheduled_events' ); |
|
87 | - wp_clear_scheduled_hook( 'give_daily_cron' ); |
|
88 | - wp_clear_scheduled_hook( 'give_weekly_cron' ); |
|
86 | + wp_clear_scheduled_hook('give_daily_scheduled_events'); |
|
87 | + wp_clear_scheduled_hook('give_daily_cron'); |
|
88 | + wp_clear_scheduled_hook('give_weekly_cron'); |
|
89 | 89 | |
90 | 90 | // Get all options. |
91 | 91 | $give_option_names = $wpdb->get_col( |
@@ -95,16 +95,16 @@ discard block |
||
95 | 95 | ) |
96 | 96 | ); |
97 | 97 | |
98 | - if ( ! empty( $give_option_names ) ) { |
|
98 | + if ( ! empty($give_option_names)) { |
|
99 | 99 | // Convert option name to transient or option name. |
100 | 100 | $new_give_option_names = array(); |
101 | 101 | |
102 | 102 | // Delete all the Plugin Options. |
103 | - foreach ( $give_option_names as $option ) { |
|
104 | - if ( false !== strpos( $option, 'give_cache' ) ) { |
|
105 | - Give_Cache::delete( $option ); |
|
103 | + foreach ($give_option_names as $option) { |
|
104 | + if (false !== strpos($option, 'give_cache')) { |
|
105 | + Give_Cache::delete($option); |
|
106 | 106 | } else { |
107 | - delete_option( $option ); |
|
107 | + delete_option($option); |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | */ |
13 | 13 | |
14 | 14 | // Exit if accessed directly. |
15 | -if ( ! defined( 'ABSPATH' ) ) { |
|
15 | +if ( ! defined('ABSPATH')) { |
|
16 | 16 | exit; |
17 | 17 | } |
18 | 18 | |
@@ -26,26 +26,26 @@ discard block |
||
26 | 26 | function give_test_ajax_works() { |
27 | 27 | |
28 | 28 | // Check if the Airplane Mode plugin is installed |
29 | - if ( class_exists( 'Airplane_Mode_Core' ) ) { |
|
29 | + if (class_exists('Airplane_Mode_Core')) { |
|
30 | 30 | |
31 | 31 | $airplane = Airplane_Mode_Core::getInstance(); |
32 | 32 | |
33 | - if ( method_exists( $airplane, 'enabled' ) ) { |
|
33 | + if (method_exists($airplane, 'enabled')) { |
|
34 | 34 | |
35 | - if ( $airplane->enabled() ) { |
|
35 | + if ($airplane->enabled()) { |
|
36 | 36 | return true; |
37 | 37 | } |
38 | 38 | } else { |
39 | 39 | |
40 | - if ( $airplane->check_status() == 'on' ) { |
|
40 | + if ($airplane->check_status() == 'on') { |
|
41 | 41 | return true; |
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | |
46 | - add_filter( 'block_local_requests', '__return_false' ); |
|
46 | + add_filter('block_local_requests', '__return_false'); |
|
47 | 47 | |
48 | - if ( Give_Cache::get( '_give_ajax_works', true ) ) { |
|
48 | + if (Give_Cache::get('_give_ajax_works', true)) { |
|
49 | 49 | return true; |
50 | 50 | } |
51 | 51 | |
@@ -57,35 +57,35 @@ discard block |
||
57 | 57 | ), |
58 | 58 | ); |
59 | 59 | |
60 | - $ajax = wp_remote_post( give_get_ajax_url(), $params ); |
|
60 | + $ajax = wp_remote_post(give_get_ajax_url(), $params); |
|
61 | 61 | |
62 | 62 | $works = true; |
63 | 63 | |
64 | - if ( is_wp_error( $ajax ) ) { |
|
64 | + if (is_wp_error($ajax)) { |
|
65 | 65 | |
66 | 66 | $works = false; |
67 | 67 | |
68 | 68 | } else { |
69 | 69 | |
70 | - if ( empty( $ajax['response'] ) ) { |
|
70 | + if (empty($ajax['response'])) { |
|
71 | 71 | $works = false; |
72 | 72 | } |
73 | 73 | |
74 | - if ( empty( $ajax['response']['code'] ) || 200 !== (int) $ajax['response']['code'] ) { |
|
74 | + if (empty($ajax['response']['code']) || 200 !== (int) $ajax['response']['code']) { |
|
75 | 75 | $works = false; |
76 | 76 | } |
77 | 77 | |
78 | - if ( empty( $ajax['response']['message'] ) || 'OK' !== $ajax['response']['message'] ) { |
|
78 | + if (empty($ajax['response']['message']) || 'OK' !== $ajax['response']['message']) { |
|
79 | 79 | $works = false; |
80 | 80 | } |
81 | 81 | |
82 | - if ( ! isset( $ajax['body'] ) || 0 !== (int) $ajax['body'] ) { |
|
82 | + if ( ! isset($ajax['body']) || 0 !== (int) $ajax['body']) { |
|
83 | 83 | $works = false; |
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | - if ( $works ) { |
|
88 | - Give_Cache::set( '_give_ajax_works', '1', DAY_IN_SECONDS, true ); |
|
87 | + if ($works) { |
|
88 | + Give_Cache::set('_give_ajax_works', '1', DAY_IN_SECONDS, true); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | return $works; |
@@ -100,16 +100,16 @@ discard block |
||
100 | 100 | * @return string |
101 | 101 | */ |
102 | 102 | function give_get_ajax_url() { |
103 | - $scheme = defined( 'FORCE_SSL_ADMIN' ) && FORCE_SSL_ADMIN ? 'https' : 'admin'; |
|
103 | + $scheme = defined('FORCE_SSL_ADMIN') && FORCE_SSL_ADMIN ? 'https' : 'admin'; |
|
104 | 104 | |
105 | 105 | $current_url = give_get_current_page_url(); |
106 | - $ajax_url = admin_url( 'admin-ajax.php', $scheme ); |
|
106 | + $ajax_url = admin_url('admin-ajax.php', $scheme); |
|
107 | 107 | |
108 | - if ( preg_match( '/^https/', $current_url ) && ! preg_match( '/^https/', $ajax_url ) ) { |
|
109 | - $ajax_url = preg_replace( '/^http/', 'https', $ajax_url ); |
|
108 | + if (preg_match('/^https/', $current_url) && ! preg_match('/^https/', $ajax_url)) { |
|
109 | + $ajax_url = preg_replace('/^http/', 'https', $ajax_url); |
|
110 | 110 | } |
111 | 111 | |
112 | - return apply_filters( 'give_ajax_url', $ajax_url ); |
|
112 | + return apply_filters('give_ajax_url', $ajax_url); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | /** |
@@ -125,12 +125,12 @@ discard block |
||
125 | 125 | * |
126 | 126 | * @since 1.7 |
127 | 127 | */ |
128 | - do_action( 'give_donation_form_login_fields' ); |
|
128 | + do_action('give_donation_form_login_fields'); |
|
129 | 129 | |
130 | 130 | give_die(); |
131 | 131 | } |
132 | 132 | |
133 | -add_action( 'wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields' ); |
|
133 | +add_action('wp_ajax_nopriv_give_checkout_login', 'give_load_checkout_login_fields'); |
|
134 | 134 | |
135 | 135 | /** |
136 | 136 | * Load Checkout Fields |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @return void |
141 | 141 | */ |
142 | 142 | function give_load_checkout_fields() { |
143 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : ''; |
|
143 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : ''; |
|
144 | 144 | |
145 | 145 | ob_start(); |
146 | 146 | |
@@ -149,18 +149,18 @@ discard block |
||
149 | 149 | * |
150 | 150 | * @since 1.7 |
151 | 151 | */ |
152 | - do_action( 'give_donation_form_register_login_fields', $form_id ); |
|
152 | + do_action('give_donation_form_register_login_fields', $form_id); |
|
153 | 153 | |
154 | 154 | $fields = ob_get_clean(); |
155 | 155 | |
156 | - wp_send_json( array( |
|
157 | - 'fields' => wp_json_encode( $fields ), |
|
158 | - 'submit' => wp_json_encode( give_checkout_button_purchase( $form_id ) ), |
|
159 | - ) ); |
|
156 | + wp_send_json(array( |
|
157 | + 'fields' => wp_json_encode($fields), |
|
158 | + 'submit' => wp_json_encode(give_checkout_button_purchase($form_id)), |
|
159 | + )); |
|
160 | 160 | } |
161 | 161 | |
162 | -add_action( 'wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields' ); |
|
163 | -add_action( 'wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields' ); |
|
162 | +add_action('wp_ajax_nopriv_give_cancel_login', 'give_load_checkout_fields'); |
|
163 | +add_action('wp_ajax_nopriv_give_checkout_register', 'give_load_checkout_fields'); |
|
164 | 164 | |
165 | 165 | /** |
166 | 166 | * Get Form Title via AJAX (used only in WordPress Admin) |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | * @return void |
171 | 171 | */ |
172 | 172 | function give_ajax_get_form_title() { |
173 | - if ( isset( $_POST['form_id'] ) ) { |
|
174 | - $title = get_the_title( $_POST['form_id'] ); |
|
175 | - if ( $title ) { |
|
173 | + if (isset($_POST['form_id'])) { |
|
174 | + $title = get_the_title($_POST['form_id']); |
|
175 | + if ($title) { |
|
176 | 176 | echo $title; |
177 | 177 | } else { |
178 | 178 | echo 'fail'; |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | give_die(); |
182 | 182 | } |
183 | 183 | |
184 | -add_action( 'wp_ajax_give_get_form_title', 'give_ajax_get_form_title' ); |
|
185 | -add_action( 'wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title' ); |
|
184 | +add_action('wp_ajax_give_get_form_title', 'give_ajax_get_form_title'); |
|
185 | +add_action('wp_ajax_nopriv_give_get_form_title', 'give_ajax_get_form_title'); |
|
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Retrieve a states drop down |
@@ -193,23 +193,23 @@ discard block |
||
193 | 193 | */ |
194 | 194 | function give_ajax_get_states_field() { |
195 | 195 | |
196 | - if ( empty( $_POST['country'] ) ) { |
|
196 | + if (empty($_POST['country'])) { |
|
197 | 197 | $_POST['country'] = give_get_country(); |
198 | 198 | } |
199 | - $states = give_get_states( $_POST['country'] ); |
|
199 | + $states = give_get_states($_POST['country']); |
|
200 | 200 | |
201 | - if ( ! empty( $states ) ) { |
|
201 | + if ( ! empty($states)) { |
|
202 | 202 | |
203 | 203 | $args = array( |
204 | 204 | 'name' => $_POST['field_name'], |
205 | 205 | 'id' => $_POST['field_name'], |
206 | - 'class' => $_POST['field_name'] . ' give-select', |
|
207 | - 'options' => give_get_states( $_POST['country'] ), |
|
206 | + 'class' => $_POST['field_name'].' give-select', |
|
207 | + 'options' => give_get_states($_POST['country']), |
|
208 | 208 | 'show_option_all' => false, |
209 | 209 | 'show_option_none' => false, |
210 | 210 | ); |
211 | 211 | |
212 | - $response = Give()->html->select( $args ); |
|
212 | + $response = Give()->html->select($args); |
|
213 | 213 | |
214 | 214 | } else { |
215 | 215 | |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | give_die(); |
222 | 222 | } |
223 | 223 | |
224 | -add_action( 'wp_ajax_give_get_states', 'give_ajax_get_states_field' ); |
|
225 | -add_action( 'wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field' ); |
|
224 | +add_action('wp_ajax_give_get_states', 'give_ajax_get_states_field'); |
|
225 | +add_action('wp_ajax_nopriv_give_get_states', 'give_ajax_get_states_field'); |
|
226 | 226 | |
227 | 227 | /** |
228 | 228 | * Retrieve a states drop down |
@@ -234,17 +234,17 @@ discard block |
||
234 | 234 | function give_ajax_form_search() { |
235 | 235 | global $wpdb; |
236 | 236 | |
237 | - $search = esc_sql( sanitize_text_field( $_GET['s'] ) ); |
|
237 | + $search = esc_sql(sanitize_text_field($_GET['s'])); |
|
238 | 238 | $results = array(); |
239 | - if ( current_user_can( 'edit_give_forms' ) ) { |
|
240 | - $items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50" ); |
|
239 | + if (current_user_can('edit_give_forms')) { |
|
240 | + $items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_title` LIKE '%$search%' LIMIT 50"); |
|
241 | 241 | } else { |
242 | - $items = $wpdb->get_results( "SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50" ); |
|
242 | + $items = $wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts WHERE `post_type` = 'give_forms' AND `post_status` = 'publish' AND `post_title` LIKE '%$search%' LIMIT 50"); |
|
243 | 243 | } |
244 | 244 | |
245 | - if ( $items ) { |
|
245 | + if ($items) { |
|
246 | 246 | |
247 | - foreach ( $items as $item ) { |
|
247 | + foreach ($items as $item) { |
|
248 | 248 | |
249 | 249 | $results[] = array( |
250 | 250 | 'id' => $item->ID, |
@@ -255,18 +255,18 @@ discard block |
||
255 | 255 | |
256 | 256 | $items[] = array( |
257 | 257 | 'id' => 0, |
258 | - 'name' => esc_html__( 'No forms found.', 'give' ), |
|
258 | + 'name' => esc_html__('No forms found.', 'give'), |
|
259 | 259 | ); |
260 | 260 | |
261 | 261 | } |
262 | 262 | |
263 | - echo json_encode( $results ); |
|
263 | + echo json_encode($results); |
|
264 | 264 | |
265 | 265 | give_die(); |
266 | 266 | } |
267 | 267 | |
268 | -add_action( 'wp_ajax_give_form_search', 'give_ajax_form_search' ); |
|
269 | -add_action( 'wp_ajax_nopriv_give_form_search', 'give_ajax_form_search' ); |
|
268 | +add_action('wp_ajax_give_form_search', 'give_ajax_form_search'); |
|
269 | +add_action('wp_ajax_nopriv_give_form_search', 'give_ajax_form_search'); |
|
270 | 270 | |
271 | 271 | /** |
272 | 272 | * Search the donors database via Ajax |
@@ -278,38 +278,38 @@ discard block |
||
278 | 278 | function give_ajax_donor_search() { |
279 | 279 | global $wpdb; |
280 | 280 | |
281 | - $search = esc_sql( sanitize_text_field( $_GET['s'] ) ); |
|
281 | + $search = esc_sql(sanitize_text_field($_GET['s'])); |
|
282 | 282 | $results = array(); |
283 | - if ( ! current_user_can( 'view_give_reports' ) ) { |
|
283 | + if ( ! current_user_can('view_give_reports')) { |
|
284 | 284 | $donors = array(); |
285 | 285 | } else { |
286 | - $donors = $wpdb->get_results( "SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50" ); |
|
286 | + $donors = $wpdb->get_results("SELECT id,name,email FROM {$wpdb->prefix}give_donors WHERE `name` LIKE '%$search%' OR `email` LIKE '%$search%' LIMIT 50"); |
|
287 | 287 | } |
288 | 288 | |
289 | - if ( $donors ) { |
|
289 | + if ($donors) { |
|
290 | 290 | |
291 | - foreach ( $donors as $donor ) { |
|
291 | + foreach ($donors as $donor) { |
|
292 | 292 | |
293 | 293 | $results[] = array( |
294 | 294 | 'id' => $donor->id, |
295 | - 'name' => $donor->name . '(' . $donor->email . ')', |
|
295 | + 'name' => $donor->name.'('.$donor->email.')', |
|
296 | 296 | ); |
297 | 297 | } |
298 | 298 | } else { |
299 | 299 | |
300 | 300 | $donors[] = array( |
301 | 301 | 'id' => 0, |
302 | - 'name' => esc_html__( 'No donors found.', 'give' ), |
|
302 | + 'name' => esc_html__('No donors found.', 'give'), |
|
303 | 303 | ); |
304 | 304 | |
305 | 305 | } |
306 | 306 | |
307 | - echo json_encode( $results ); |
|
307 | + echo json_encode($results); |
|
308 | 308 | |
309 | 309 | give_die(); |
310 | 310 | } |
311 | 311 | |
312 | -add_action( 'wp_ajax_give_donor_search', 'give_ajax_donor_search' ); |
|
312 | +add_action('wp_ajax_give_donor_search', 'give_ajax_donor_search'); |
|
313 | 313 | |
314 | 314 | |
315 | 315 | /** |
@@ -321,42 +321,42 @@ discard block |
||
321 | 321 | */ |
322 | 322 | function give_ajax_search_users() { |
323 | 323 | |
324 | - if ( current_user_can( 'manage_give_settings' ) ) { |
|
324 | + if (current_user_can('manage_give_settings')) { |
|
325 | 325 | |
326 | - $search_query = trim( $_POST['user_name'] ); |
|
327 | - $exclude = trim( $_POST['exclude'] ); |
|
326 | + $search_query = trim($_POST['user_name']); |
|
327 | + $exclude = trim($_POST['exclude']); |
|
328 | 328 | |
329 | 329 | $get_users_args = array( |
330 | 330 | 'number' => 9999, |
331 | - 'search' => $search_query . '*', |
|
331 | + 'search' => $search_query.'*', |
|
332 | 332 | ); |
333 | 333 | |
334 | - if ( ! empty( $exclude ) ) { |
|
335 | - $exclude_array = explode( ',', $exclude ); |
|
334 | + if ( ! empty($exclude)) { |
|
335 | + $exclude_array = explode(',', $exclude); |
|
336 | 336 | $get_users_args['exclude'] = $exclude_array; |
337 | 337 | } |
338 | 338 | |
339 | - $get_users_args = apply_filters( 'give_search_users_args', $get_users_args ); |
|
339 | + $get_users_args = apply_filters('give_search_users_args', $get_users_args); |
|
340 | 340 | |
341 | - $found_users = apply_filters( 'give_ajax_found_users', get_users( $get_users_args ), $search_query ); |
|
341 | + $found_users = apply_filters('give_ajax_found_users', get_users($get_users_args), $search_query); |
|
342 | 342 | |
343 | 343 | $user_list = '<ul>'; |
344 | - if ( $found_users ) { |
|
345 | - foreach ( $found_users as $user ) { |
|
346 | - $user_list .= '<li><a href="#" data-userid="' . esc_attr( $user->ID ) . '" data-login="' . esc_attr( $user->user_login ) . '">' . esc_html( $user->user_login ) . '</a></li>'; |
|
344 | + if ($found_users) { |
|
345 | + foreach ($found_users as $user) { |
|
346 | + $user_list .= '<li><a href="#" data-userid="'.esc_attr($user->ID).'" data-login="'.esc_attr($user->user_login).'">'.esc_html($user->user_login).'</a></li>'; |
|
347 | 347 | } |
348 | 348 | } else { |
349 | - $user_list .= '<li>' . esc_html__( 'No users found.', 'give' ) . '</li>'; |
|
349 | + $user_list .= '<li>'.esc_html__('No users found.', 'give').'</li>'; |
|
350 | 350 | } |
351 | 351 | $user_list .= '</ul>'; |
352 | 352 | |
353 | - echo json_encode( array( 'results' => $user_list ) ); |
|
353 | + echo json_encode(array('results' => $user_list)); |
|
354 | 354 | |
355 | 355 | } |
356 | 356 | die(); |
357 | 357 | } |
358 | 358 | |
359 | -add_action( 'wp_ajax_give_search_users', 'give_ajax_search_users' ); |
|
359 | +add_action('wp_ajax_give_search_users', 'give_ajax_search_users'); |
|
360 | 360 | |
361 | 361 | |
362 | 362 | /** |
@@ -368,32 +368,32 @@ discard block |
||
368 | 368 | */ |
369 | 369 | function give_check_for_form_price_variations() { |
370 | 370 | |
371 | - if ( ! current_user_can( 'edit_give_forms', get_current_user_id() ) ) { |
|
372 | - die( '-1' ); |
|
371 | + if ( ! current_user_can('edit_give_forms', get_current_user_id())) { |
|
372 | + die('-1'); |
|
373 | 373 | } |
374 | 374 | |
375 | - $form_id = intval( $_POST['form_id'] ); |
|
376 | - $form = get_post( $form_id ); |
|
375 | + $form_id = intval($_POST['form_id']); |
|
376 | + $form = get_post($form_id); |
|
377 | 377 | |
378 | - if ( 'give_forms' != $form->post_type ) { |
|
379 | - die( '-2' ); |
|
378 | + if ('give_forms' != $form->post_type) { |
|
379 | + die('-2'); |
|
380 | 380 | } |
381 | 381 | |
382 | - if ( give_has_variable_prices( $form_id ) ) { |
|
383 | - $variable_prices = give_get_variable_prices( $form_id ); |
|
382 | + if (give_has_variable_prices($form_id)) { |
|
383 | + $variable_prices = give_get_variable_prices($form_id); |
|
384 | 384 | |
385 | - if ( $variable_prices ) { |
|
385 | + if ($variable_prices) { |
|
386 | 386 | $ajax_response = '<select class="give_price_options_select give-select give-select" name="give_price_option">'; |
387 | 387 | |
388 | - if ( isset( $_POST['all_prices'] ) ) { |
|
389 | - $ajax_response .= '<option value="all">' . esc_html__( 'All Levels', 'give' ) . '</option>'; |
|
388 | + if (isset($_POST['all_prices'])) { |
|
389 | + $ajax_response .= '<option value="all">'.esc_html__('All Levels', 'give').'</option>'; |
|
390 | 390 | } |
391 | 391 | |
392 | - foreach ( $variable_prices as $key => $price ) { |
|
392 | + foreach ($variable_prices as $key => $price) { |
|
393 | 393 | |
394 | - $level_text = ! empty( $price['_give_text'] ) ? esc_html( $price['_give_text'] ) : give_currency_filter( give_format_amount( $price['_give_amount'] ) ); |
|
394 | + $level_text = ! empty($price['_give_text']) ? esc_html($price['_give_text']) : give_currency_filter(give_format_amount($price['_give_amount'])); |
|
395 | 395 | |
396 | - $ajax_response .= '<option value="' . esc_attr( $price['_give_id']['level_id'] ) . '">' . $level_text . '</option>'; |
|
396 | + $ajax_response .= '<option value="'.esc_attr($price['_give_id']['level_id']).'">'.$level_text.'</option>'; |
|
397 | 397 | } |
398 | 398 | $ajax_response .= '</select>'; |
399 | 399 | echo $ajax_response; |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | give_die(); |
404 | 404 | } |
405 | 405 | |
406 | -add_action( 'wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations' ); |
|
406 | +add_action('wp_ajax_give_check_for_form_price_variations', 'give_check_for_form_price_variations'); |
|
407 | 407 | |
408 | 408 | |
409 | 409 | /** |
@@ -414,25 +414,25 @@ discard block |
||
414 | 414 | * @return void |
415 | 415 | */ |
416 | 416 | function give_check_for_form_price_variations_html() { |
417 | - if ( ! current_user_can( 'edit_give_payments', get_current_user_id() ) ) { |
|
417 | + if ( ! current_user_can('edit_give_payments', get_current_user_id())) { |
|
418 | 418 | wp_die(); |
419 | 419 | } |
420 | 420 | |
421 | - $form_id = ! empty( $_POST['form_id'] ) ? intval( $_POST['form_id'] ) : 0; |
|
422 | - $payment_id = ! empty( $_POST['payment_id'] ) ? intval( $_POST['payment_id'] ) : 0; |
|
423 | - $form = get_post( $form_id ); |
|
421 | + $form_id = ! empty($_POST['form_id']) ? intval($_POST['form_id']) : 0; |
|
422 | + $payment_id = ! empty($_POST['payment_id']) ? intval($_POST['payment_id']) : 0; |
|
423 | + $form = get_post($form_id); |
|
424 | 424 | |
425 | - if ( 'give_forms' != $form->post_type ) { |
|
425 | + if ('give_forms' != $form->post_type) { |
|
426 | 426 | wp_die(); |
427 | 427 | } |
428 | 428 | |
429 | - if ( ! give_has_variable_prices( $form_id ) || ! $form_id ) { |
|
430 | - esc_html_e( 'n/a', 'give' ); |
|
429 | + if ( ! give_has_variable_prices($form_id) || ! $form_id) { |
|
430 | + esc_html_e('n/a', 'give'); |
|
431 | 431 | } else { |
432 | 432 | $prices_atts = ''; |
433 | - if( $variable_prices = give_get_variable_prices( $form_id ) ) { |
|
434 | - foreach ( $variable_prices as $variable_price ) { |
|
435 | - $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount( $variable_price['_give_amount'] ); |
|
433 | + if ($variable_prices = give_get_variable_prices($form_id)) { |
|
434 | + foreach ($variable_prices as $variable_price) { |
|
435 | + $prices_atts[$variable_price['_give_id']['level_id']] = give_format_amount($variable_price['_give_amount']); |
|
436 | 436 | } |
437 | 437 | } |
438 | 438 | |
@@ -443,12 +443,12 @@ discard block |
||
443 | 443 | 'chosen' => true, |
444 | 444 | 'show_option_all' => '', |
445 | 445 | 'show_option_none' => '', |
446 | - 'select_atts' => 'data-prices=' . esc_attr( json_encode( $prices_atts ) ), |
|
446 | + 'select_atts' => 'data-prices='.esc_attr(json_encode($prices_atts)), |
|
447 | 447 | ); |
448 | 448 | |
449 | - if( $payment_id ) { |
|
449 | + if ($payment_id) { |
|
450 | 450 | // Payment object. |
451 | - $payment = new Give_Payment( $payment_id ); |
|
451 | + $payment = new Give_Payment($payment_id); |
|
452 | 452 | |
453 | 453 | // Payment meta. |
454 | 454 | $payment_meta = $payment->get_meta(); |
@@ -456,10 +456,10 @@ discard block |
||
456 | 456 | } |
457 | 457 | |
458 | 458 | // Render variable prices select tag html. |
459 | - give_get_form_variable_price_dropdown( $variable_price_dropdown_option, true ); |
|
459 | + give_get_form_variable_price_dropdown($variable_price_dropdown_option, true); |
|
460 | 460 | } |
461 | 461 | |
462 | 462 | give_die(); |
463 | 463 | } |
464 | 464 | |
465 | -add_action( 'wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html' ); |
|
465 | +add_action('wp_ajax_give_check_for_form_price_variations_html', 'give_check_for_form_price_variations_html'); |
@@ -18,17 +18,17 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return array |
20 | 20 | */ |
21 | -function give_offline_register_gateway( $gateways ) { |
|
21 | +function give_offline_register_gateway($gateways) { |
|
22 | 22 | // Format: ID => Name |
23 | 23 | $gateways['offline'] = array( |
24 | - 'admin_label' => esc_attr__( 'Offline Donation', 'give' ), |
|
25 | - 'checkout_label' => esc_attr__( 'Offline Donation', 'give' ) |
|
24 | + 'admin_label' => esc_attr__('Offline Donation', 'give'), |
|
25 | + 'checkout_label' => esc_attr__('Offline Donation', 'give') |
|
26 | 26 | ); |
27 | 27 | |
28 | 28 | return $gateways; |
29 | 29 | } |
30 | 30 | |
31 | -add_filter( 'give_payment_gateways', 'give_offline_register_gateway', 1 ); |
|
31 | +add_filter('give_payment_gateways', 'give_offline_register_gateway', 1); |
|
32 | 32 | |
33 | 33 | |
34 | 34 | /** |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return void |
42 | 42 | */ |
43 | -function give_offline_payment_cc_form( $form_id ) { |
|
43 | +function give_offline_payment_cc_form($form_id) { |
|
44 | 44 | // Get offline payment instruction. |
45 | - $offline_instructions = give_get_offline_payment_instruction( $form_id, true ); |
|
45 | + $offline_instructions = give_get_offline_payment_instruction($form_id, true); |
|
46 | 46 | |
47 | 47 | ob_start(); |
48 | 48 | |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @param int $form_id Give form id. |
55 | 55 | */ |
56 | - do_action( 'give_before_offline_info_fields', $form_id ); |
|
56 | + do_action('give_before_offline_info_fields', $form_id); |
|
57 | 57 | ?> |
58 | 58 | <fieldset id="give_offline_payment_info"> |
59 | - <?php echo stripslashes( $offline_instructions ); ?> |
|
59 | + <?php echo stripslashes($offline_instructions); ?> |
|
60 | 60 | </fieldset> |
61 | 61 | <?php |
62 | 62 | /** |
@@ -66,35 +66,35 @@ discard block |
||
66 | 66 | * |
67 | 67 | * @param int $form_id Give form id. |
68 | 68 | */ |
69 | - do_action( 'give_after_offline_info_fields', $form_id ); |
|
69 | + do_action('give_after_offline_info_fields', $form_id); |
|
70 | 70 | |
71 | 71 | echo ob_get_clean(); |
72 | 72 | } |
73 | 73 | |
74 | -add_action( 'give_offline_cc_form', 'give_offline_payment_cc_form' ); |
|
74 | +add_action('give_offline_cc_form', 'give_offline_payment_cc_form'); |
|
75 | 75 | |
76 | 76 | /** |
77 | 77 | * Give Offline Billing Field |
78 | 78 | * |
79 | 79 | * @param $form_id |
80 | 80 | */ |
81 | -function give_offline_billing_fields( $form_id ) { |
|
81 | +function give_offline_billing_fields($form_id) { |
|
82 | 82 | //Enable Default CC fields (billing info) |
83 | - $post_offline_cc_fields = get_post_meta( $form_id, '_give_offline_donation_enable_billing_fields_single', true ); |
|
84 | - $post_offline_customize_option = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
83 | + $post_offline_cc_fields = get_post_meta($form_id, '_give_offline_donation_enable_billing_fields_single', true); |
|
84 | + $post_offline_customize_option = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
85 | 85 | |
86 | - $global_offline_cc_fields = give_get_option( 'give_offline_donation_enable_billing_fields' ); |
|
86 | + $global_offline_cc_fields = give_get_option('give_offline_donation_enable_billing_fields'); |
|
87 | 87 | |
88 | 88 | //Output CC Address fields if global option is on and user hasn't elected to customize this form's offline donation options |
89 | 89 | if ( |
90 | - ( give_is_setting_enabled( $post_offline_customize_option, 'global' ) && give_is_setting_enabled( $global_offline_cc_fields ) ) |
|
91 | - || ( give_is_setting_enabled( $post_offline_customize_option, 'enabled' ) && give_is_setting_enabled( $post_offline_cc_fields ) ) |
|
90 | + (give_is_setting_enabled($post_offline_customize_option, 'global') && give_is_setting_enabled($global_offline_cc_fields)) |
|
91 | + || (give_is_setting_enabled($post_offline_customize_option, 'enabled') && give_is_setting_enabled($post_offline_cc_fields)) |
|
92 | 92 | ) { |
93 | - give_default_cc_address_fields( $form_id ); |
|
93 | + give_default_cc_address_fields($form_id); |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | -add_action( 'give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1 ); |
|
97 | +add_action('give_before_offline_info_fields', 'give_offline_billing_fields', 10, 1); |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Process the payment |
@@ -105,16 +105,16 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return void |
107 | 107 | */ |
108 | -function give_offline_process_payment( $purchase_data ) { |
|
108 | +function give_offline_process_payment($purchase_data) { |
|
109 | 109 | |
110 | - $purchase_summary = give_get_purchase_summary( $purchase_data ); |
|
110 | + $purchase_summary = give_get_purchase_summary($purchase_data); |
|
111 | 111 | |
112 | 112 | // setup the payment details |
113 | 113 | $payment_data = array( |
114 | 114 | 'price' => $purchase_data['price'], |
115 | 115 | 'give_form_title' => $purchase_data['post_data']['give-form-title'], |
116 | - 'give_form_id' => intval( $purchase_data['post_data']['give-form-id'] ), |
|
117 | - 'give_price_id' => isset( $purchase_data['post_data']['give-price-id'] ) ? $purchase_data['post_data']['give-price-id'] : '', |
|
116 | + 'give_form_id' => intval($purchase_data['post_data']['give-form-id']), |
|
117 | + 'give_price_id' => isset($purchase_data['post_data']['give-price-id']) ? $purchase_data['post_data']['give-price-id'] : '', |
|
118 | 118 | 'date' => $purchase_data['date'], |
119 | 119 | 'user_email' => $purchase_data['user_email'], |
120 | 120 | 'purchase_key' => $purchase_data['purchase_key'], |
@@ -126,20 +126,20 @@ discard block |
||
126 | 126 | |
127 | 127 | |
128 | 128 | // record the pending payment |
129 | - $payment = give_insert_payment( $payment_data ); |
|
129 | + $payment = give_insert_payment($payment_data); |
|
130 | 130 | |
131 | - if ( $payment ) { |
|
132 | - give_offline_send_admin_notice( $payment ); |
|
133 | - give_offline_send_donor_instructions( $payment ); |
|
131 | + if ($payment) { |
|
132 | + give_offline_send_admin_notice($payment); |
|
133 | + give_offline_send_donor_instructions($payment); |
|
134 | 134 | give_send_to_success_page(); |
135 | 135 | } else { |
136 | 136 | // if errors are present, send the user back to the donation form so they can be corrected |
137 | - give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
137 | + give_send_back_to_checkout('?payment-mode='.$purchase_data['post_data']['give-gateway']); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | } |
141 | 141 | |
142 | -add_action( 'give_gateway_offline', 'give_offline_process_payment' ); |
|
142 | +add_action('give_gateway_offline', 'give_offline_process_payment'); |
|
143 | 143 | |
144 | 144 | |
145 | 145 | /** |
@@ -152,59 +152,59 @@ discard block |
||
152 | 152 | * @since 1.0 |
153 | 153 | * @return void |
154 | 154 | */ |
155 | -function give_offline_send_donor_instructions( $payment_id = 0 ) { |
|
155 | +function give_offline_send_donor_instructions($payment_id = 0) { |
|
156 | 156 | |
157 | - $payment_data = give_get_payment_meta( $payment_id ); |
|
158 | - $post_offline_customization_option = get_post_meta( $payment_data['form_id'], '_give_customize_offline_donations', true ); |
|
157 | + $payment_data = give_get_payment_meta($payment_id); |
|
158 | + $post_offline_customization_option = get_post_meta($payment_data['form_id'], '_give_customize_offline_donations', true); |
|
159 | 159 | |
160 | 160 | //Customize email content depending on whether the single form has been customized |
161 | - $email_content = give_get_option( 'global_offline_donation_email' ); |
|
161 | + $email_content = give_get_option('global_offline_donation_email'); |
|
162 | 162 | |
163 | - if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) { |
|
164 | - $email_content = get_post_meta( $payment_data['form_id'], '_give_offline_donation_email', true ); |
|
163 | + if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) { |
|
164 | + $email_content = get_post_meta($payment_data['form_id'], '_give_offline_donation_email', true); |
|
165 | 165 | } |
166 | 166 | |
167 | - $from_name = give_get_option( 'from_name', wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ) ); |
|
167 | + $from_name = give_get_option('from_name', wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES)); |
|
168 | 168 | |
169 | 169 | /** |
170 | 170 | * Filters the from name. |
171 | 171 | * |
172 | 172 | * @since 1.7 |
173 | 173 | */ |
174 | - $from_name = apply_filters( 'give_donation_from_name', $from_name, $payment_id, $payment_data ); |
|
174 | + $from_name = apply_filters('give_donation_from_name', $from_name, $payment_id, $payment_data); |
|
175 | 175 | |
176 | - $from_email = give_get_option( 'from_email', get_bloginfo( 'admin_email' ) ); |
|
176 | + $from_email = give_get_option('from_email', get_bloginfo('admin_email')); |
|
177 | 177 | |
178 | 178 | /** |
179 | 179 | * Filters the from email. |
180 | 180 | * |
181 | 181 | * @since 1.7 |
182 | 182 | */ |
183 | - $from_email = apply_filters( 'give_donation_from_address', $from_email, $payment_id, $payment_data ); |
|
183 | + $from_email = apply_filters('give_donation_from_address', $from_email, $payment_id, $payment_data); |
|
184 | 184 | |
185 | - $to_email = give_get_payment_user_email( $payment_id ); |
|
185 | + $to_email = give_get_payment_user_email($payment_id); |
|
186 | 186 | |
187 | - $subject = give_get_option( 'offline_donation_subject', __( 'Offline Donation Instructions', 'give' ) ); |
|
188 | - if ( give_is_setting_enabled( $post_offline_customization_option, 'enabled' ) ) { |
|
189 | - $subject = get_post_meta( $payment_data['form_id'], '_give_offline_donation_subject', true ); |
|
187 | + $subject = give_get_option('offline_donation_subject', __('Offline Donation Instructions', 'give')); |
|
188 | + if (give_is_setting_enabled($post_offline_customization_option, 'enabled')) { |
|
189 | + $subject = get_post_meta($payment_data['form_id'], '_give_offline_donation_subject', true); |
|
190 | 190 | } |
191 | 191 | |
192 | - $subject = apply_filters( 'give_offline_donation_subject', wp_strip_all_tags( $subject ), $payment_id ); |
|
193 | - $subject = give_do_email_tags( $subject, $payment_id ); |
|
192 | + $subject = apply_filters('give_offline_donation_subject', wp_strip_all_tags($subject), $payment_id); |
|
193 | + $subject = give_do_email_tags($subject, $payment_id); |
|
194 | 194 | |
195 | - $attachments = apply_filters( 'give_offline_donation_attachments', array(), $payment_id, $payment_data ); |
|
196 | - $message = give_do_email_tags( $email_content, $payment_id ); |
|
195 | + $attachments = apply_filters('give_offline_donation_attachments', array(), $payment_id, $payment_data); |
|
196 | + $message = give_do_email_tags($email_content, $payment_id); |
|
197 | 197 | |
198 | 198 | $emails = Give()->emails; |
199 | 199 | |
200 | - $emails->__set( 'from_name', $from_name ); |
|
201 | - $emails->__set( 'from_email', $from_email ); |
|
202 | - $emails->__set( 'heading', __( 'Offline Donation Instructions', 'give' ) ); |
|
200 | + $emails->__set('from_name', $from_name); |
|
201 | + $emails->__set('from_email', $from_email); |
|
202 | + $emails->__set('heading', __('Offline Donation Instructions', 'give')); |
|
203 | 203 | |
204 | - $headers = apply_filters( 'give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data ); |
|
205 | - $emails->__set( 'headers', $headers ); |
|
204 | + $headers = apply_filters('give_receipt_headers', $emails->get_headers(), $payment_id, $payment_data); |
|
205 | + $emails->__set('headers', $headers); |
|
206 | 206 | |
207 | - $emails->send( $to_email, $subject, $message, $attachments ); |
|
207 | + $emails->send($to_email, $subject, $message, $attachments); |
|
208 | 208 | |
209 | 209 | } |
210 | 210 | |
@@ -221,54 +221,54 @@ discard block |
||
221 | 221 | * @return void |
222 | 222 | * |
223 | 223 | */ |
224 | -function give_offline_send_admin_notice( $payment_id = 0 ) { |
|
224 | +function give_offline_send_admin_notice($payment_id = 0) { |
|
225 | 225 | |
226 | 226 | /* Send an email notification to the admin */ |
227 | 227 | $admin_email = give_get_admin_notice_emails(); |
228 | - $user_info = give_get_payment_meta_user_info( $payment_id ); |
|
228 | + $user_info = give_get_payment_meta_user_info($payment_id); |
|
229 | 229 | |
230 | - if ( isset( $user_info['id'] ) && $user_info['id'] > 0 ) { |
|
231 | - $user_data = get_userdata( $user_info['id'] ); |
|
230 | + if (isset($user_info['id']) && $user_info['id'] > 0) { |
|
231 | + $user_data = get_userdata($user_info['id']); |
|
232 | 232 | $name = $user_data->display_name; |
233 | - } elseif ( isset( $user_info['first_name'] ) && isset( $user_info['last_name'] ) ) { |
|
234 | - $name = $user_info['first_name'] . ' ' . $user_info['last_name']; |
|
233 | + } elseif (isset($user_info['first_name']) && isset($user_info['last_name'])) { |
|
234 | + $name = $user_info['first_name'].' '.$user_info['last_name']; |
|
235 | 235 | } else { |
236 | 236 | $name = $user_info['email']; |
237 | 237 | } |
238 | 238 | |
239 | - $amount = give_currency_filter( give_format_amount( give_get_payment_amount( $payment_id ) ) ); |
|
239 | + $amount = give_currency_filter(give_format_amount(give_get_payment_amount($payment_id))); |
|
240 | 240 | |
241 | - $admin_subject = apply_filters( 'give_offline_admin_donation_notification_subject', __( 'New Pending Donation', 'give' ), $payment_id ); |
|
241 | + $admin_subject = apply_filters('give_offline_admin_donation_notification_subject', __('New Pending Donation', 'give'), $payment_id); |
|
242 | 242 | |
243 | - $admin_message = __( 'Dear Admin,', 'give' ) . "\n\n"; |
|
244 | - $admin_message .= sprintf(__( 'A new offline donation has been made on your website for %s.', 'give' ), $amount) . "\n\n"; |
|
245 | - $admin_message .= __( 'The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give' ) . "\n\n"; |
|
243 | + $admin_message = __('Dear Admin,', 'give')."\n\n"; |
|
244 | + $admin_message .= sprintf(__('A new offline donation has been made on your website for %s.', 'give'), $amount)."\n\n"; |
|
245 | + $admin_message .= __('The donation is in a pending status and is awaiting payment. Donation instructions have been emailed to the donor. Once you receive payment, be sure to mark the donation as complete using the link below.', 'give')."\n\n"; |
|
246 | 246 | |
247 | 247 | |
248 | - $admin_message .= '<strong>' . __( 'Donor:', 'give' ) . '</strong> {fullname}' . "\n"; |
|
249 | - $admin_message .= '<strong>' . __( 'Amount:', 'give' ) . '</strong> {amount}' . "\n\n"; |
|
248 | + $admin_message .= '<strong>'.__('Donor:', 'give').'</strong> {fullname}'."\n"; |
|
249 | + $admin_message .= '<strong>'.__('Amount:', 'give').'</strong> {amount}'."\n\n"; |
|
250 | 250 | |
251 | 251 | $admin_message .= sprintf( |
252 | 252 | '<a href="%1$s">%2$s</a>', |
253 | - admin_url( 'edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id=' . $payment_id ), |
|
254 | - __( 'View Donation Details »', 'give' ) |
|
255 | - ) . "\n\n"; |
|
253 | + admin_url('edit.php?post_type=give_forms&page=give-payment-history&view=view-order-details&id='.$payment_id), |
|
254 | + __('View Donation Details »', 'give') |
|
255 | + )."\n\n"; |
|
256 | 256 | |
257 | - $admin_message = apply_filters( 'give_offline_admin_donation_notification', $admin_message, $payment_id ); |
|
258 | - $admin_message = give_do_email_tags( $admin_message, $payment_id ); |
|
257 | + $admin_message = apply_filters('give_offline_admin_donation_notification', $admin_message, $payment_id); |
|
258 | + $admin_message = give_do_email_tags($admin_message, $payment_id); |
|
259 | 259 | |
260 | - $attachments = apply_filters( 'give_offline_admin_donation_notification_attachments', array(), $payment_id ); |
|
261 | - $admin_headers = apply_filters( 'give_offline_admin_donation_notification_headers', array(), $payment_id ); |
|
260 | + $attachments = apply_filters('give_offline_admin_donation_notification_attachments', array(), $payment_id); |
|
261 | + $admin_headers = apply_filters('give_offline_admin_donation_notification_headers', array(), $payment_id); |
|
262 | 262 | |
263 | 263 | //Send Email |
264 | 264 | $emails = Give()->emails; |
265 | - $emails->__set( 'heading', __( 'New Offline Donation', 'give' ) ); |
|
265 | + $emails->__set('heading', __('New Offline Donation', 'give')); |
|
266 | 266 | |
267 | - if ( ! empty( $admin_headers ) ) { |
|
268 | - $emails->__set( 'headers', $admin_headers ); |
|
267 | + if ( ! empty($admin_headers)) { |
|
268 | + $emails->__set('headers', $admin_headers); |
|
269 | 269 | } |
270 | 270 | |
271 | - $emails->send( $admin_email, $admin_subject, $admin_message, $attachments ); |
|
271 | + $emails->send($admin_email, $admin_subject, $admin_message, $attachments); |
|
272 | 272 | |
273 | 273 | } |
274 | 274 | |
@@ -280,20 +280,20 @@ discard block |
||
280 | 280 | * |
281 | 281 | * @return array |
282 | 282 | */ |
283 | -function give_offline_add_settings( $settings ) { |
|
283 | +function give_offline_add_settings($settings) { |
|
284 | 284 | |
285 | 285 | // Bailout: Do not show offline gateways setting in to metabox if its disabled globally. |
286 | - if ( in_array( 'offline', give_get_option( 'gateways' ) ) ) { |
|
286 | + if (in_array('offline', give_get_option('gateways'))) { |
|
287 | 287 | return $settings; |
288 | 288 | } |
289 | 289 | |
290 | 290 | //Vars |
291 | 291 | $prefix = '_give_'; |
292 | 292 | |
293 | - $is_gateway_active = give_is_gateway_active( 'offline' ); |
|
293 | + $is_gateway_active = give_is_gateway_active('offline'); |
|
294 | 294 | |
295 | 295 | //this gateway isn't active |
296 | - if ( ! $is_gateway_active ) { |
|
296 | + if ( ! $is_gateway_active) { |
|
297 | 297 | //return settings and bounce |
298 | 298 | return $settings; |
299 | 299 | } |
@@ -302,34 +302,34 @@ discard block |
||
302 | 302 | $check_settings = array( |
303 | 303 | |
304 | 304 | array( |
305 | - 'name' => __( 'Offline Donations', 'give' ), |
|
306 | - 'desc' => __( 'Do you want to customize the donation instructions for this form?', 'give' ), |
|
307 | - 'id' => $prefix . 'customize_offline_donations', |
|
305 | + 'name' => __('Offline Donations', 'give'), |
|
306 | + 'desc' => __('Do you want to customize the donation instructions for this form?', 'give'), |
|
307 | + 'id' => $prefix.'customize_offline_donations', |
|
308 | 308 | 'type' => 'radio_inline', |
309 | 309 | 'default' => 'global', |
310 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
311 | - 'global' => __( 'Global Option', 'give' ), |
|
312 | - 'enabled' => __( 'Customize', 'give' ), |
|
313 | - 'disabled' => __( 'Disable', 'give' ), |
|
310 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
311 | + 'global' => __('Global Option', 'give'), |
|
312 | + 'enabled' => __('Customize', 'give'), |
|
313 | + 'disabled' => __('Disable', 'give'), |
|
314 | 314 | ) |
315 | 315 | ), |
316 | 316 | ), |
317 | 317 | array( |
318 | - 'name' => __( 'Billing Fields', 'give' ), |
|
319 | - 'desc' => __( 'This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give' ), |
|
320 | - 'id' => $prefix . 'offline_donation_enable_billing_fields_single', |
|
318 | + 'name' => __('Billing Fields', 'give'), |
|
319 | + 'desc' => __('This option will enable the billing details section for this form\'s offline donation payment gateway. The fieldset will appear above the offline donation instructions.', 'give'), |
|
320 | + 'id' => $prefix.'offline_donation_enable_billing_fields_single', |
|
321 | 321 | 'row_classes' => 'give-subfield', |
322 | 322 | 'type' => 'radio_inline', |
323 | 323 | 'default' => 'disabled', |
324 | 324 | 'options' => array( |
325 | - 'enabled' => __( 'Enabled', 'give' ), |
|
326 | - 'disabled' => __( 'Disabled', 'give' ), |
|
325 | + 'enabled' => __('Enabled', 'give'), |
|
326 | + 'disabled' => __('Disabled', 'give'), |
|
327 | 327 | ), |
328 | 328 | ), |
329 | 329 | array( |
330 | - 'id' => $prefix . 'offline_checkout_notes', |
|
331 | - 'name' => __( 'Donation Instructions', 'give' ), |
|
332 | - 'desc' => __( 'Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ), |
|
330 | + 'id' => $prefix.'offline_checkout_notes', |
|
331 | + 'name' => __('Donation Instructions', 'give'), |
|
332 | + 'desc' => __('Enter the instructions you want to display to the donor during the donation process. Most likely this would include important information like mailing address and who to make the check out to.', 'give'), |
|
333 | 333 | 'default' => give_get_default_offline_donation_content(), |
334 | 334 | 'type' => 'wysiwyg', |
335 | 335 | 'row_classes' => 'give-subfield', |
@@ -338,17 +338,17 @@ discard block |
||
338 | 338 | ) |
339 | 339 | ), |
340 | 340 | array( |
341 | - 'id' => $prefix . 'offline_donation_subject', |
|
342 | - 'name' => __( 'Email Subject', 'give' ), |
|
343 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
344 | - 'default' => __( '{form_title} - Offline Donation Instructions', 'give' ), |
|
341 | + 'id' => $prefix.'offline_donation_subject', |
|
342 | + 'name' => __('Email Subject', 'give'), |
|
343 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
344 | + 'default' => __('{form_title} - Offline Donation Instructions', 'give'), |
|
345 | 345 | 'row_classes' => 'give-subfield', |
346 | 346 | 'type' => 'text' |
347 | 347 | ), |
348 | 348 | array( |
349 | - 'id' => $prefix . 'offline_donation_email', |
|
350 | - 'name' => __( 'Email Instructions', 'give' ), |
|
351 | - 'desc' => __( 'Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give' ) . ' ' . __( 'Available template tags:', 'give' ) . give_get_emails_tags_list(), |
|
349 | + 'id' => $prefix.'offline_donation_email', |
|
350 | + 'name' => __('Email Instructions', 'give'), |
|
351 | + 'desc' => __('Enter the instructions you want emailed to the donor after they have submitted the donation form. Most likely this would include important information like mailing address and who to make the check out to.', 'give').' '.__('Available template tags:', 'give').give_get_emails_tags_list(), |
|
352 | 352 | 'default' => give_get_default_offline_donation_email_content(), |
353 | 353 | 'type' => 'wysiwyg', |
354 | 354 | 'row_classes' => 'give-subfield', |
@@ -360,14 +360,14 @@ discard block |
||
360 | 360 | 'name' => 'offline_docs', |
361 | 361 | 'type' => 'docs_link', |
362 | 362 | 'url' => 'http://docs.givewp.com/settings-gateway-offline-donations', |
363 | - 'title' => __( 'Offline Donations', 'give' ), |
|
363 | + 'title' => __('Offline Donations', 'give'), |
|
364 | 364 | ), |
365 | 365 | ); |
366 | 366 | |
367 | - return array_merge( $settings, $check_settings ); |
|
367 | + return array_merge($settings, $check_settings); |
|
368 | 368 | } |
369 | 369 | |
370 | -add_filter( 'give_forms_offline_donations_metabox_fields', 'give_offline_add_settings' ); |
|
370 | +add_filter('give_forms_offline_donations_metabox_fields', 'give_offline_add_settings'); |
|
371 | 371 | |
372 | 372 | |
373 | 373 | /** |
@@ -379,32 +379,32 @@ discard block |
||
379 | 379 | */ |
380 | 380 | function give_get_default_offline_donation_content() { |
381 | 381 | |
382 | - $sitename = get_bloginfo( 'sitename' ); |
|
382 | + $sitename = get_bloginfo('sitename'); |
|
383 | 383 | |
384 | - $default_text = '<p>' . __( 'In order to make an offline donation we ask that you please follow these instructions', 'give' ) . ': </p>'; |
|
384 | + $default_text = '<p>'.__('In order to make an offline donation we ask that you please follow these instructions', 'give').': </p>'; |
|
385 | 385 | $default_text .= '<ol>'; |
386 | 386 | $default_text .= '<li>'; |
387 | 387 | $default_text .= sprintf( |
388 | 388 | /* translators: %s: site name */ |
389 | - __( 'Make a check payable to "%s"', 'give' ), |
|
389 | + __('Make a check payable to "%s"', 'give'), |
|
390 | 390 | $sitename |
391 | 391 | ); |
392 | 392 | $default_text .= '</li>'; |
393 | 393 | $default_text .= '<li>'; |
394 | 394 | $default_text .= sprintf( |
395 | 395 | /* translators: %s: site name */ |
396 | - __( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
396 | + __('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
397 | 397 | $sitename |
398 | 398 | ); |
399 | 399 | $default_text .= '</li>'; |
400 | - $default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>'; |
|
400 | + $default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>'; |
|
401 | 401 | $default_text .= '</ol>'; |
402 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
402 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
403 | 403 | $default_text .= ' <em>123 G Street </em><br>'; |
404 | 404 | $default_text .= ' <em>San Diego, CA 92101 </em><br>'; |
405 | - $default_text .= '<p>' . __( 'All contributions will be gratefully acknowledged and are tax deductible.', 'give' ) . '</p>'; |
|
405 | + $default_text .= '<p>'.__('All contributions will be gratefully acknowledged and are tax deductible.', 'give').'</p>'; |
|
406 | 406 | |
407 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
407 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
408 | 408 | |
409 | 409 | } |
410 | 410 | |
@@ -417,34 +417,34 @@ discard block |
||
417 | 417 | */ |
418 | 418 | function give_get_default_offline_donation_email_content() { |
419 | 419 | |
420 | - $sitename = get_bloginfo( 'sitename' ); |
|
421 | - $default_text = '<p>' . __( 'Dear {name},', 'give' ) . '</p>'; |
|
422 | - $default_text .= '<p>' . __( 'Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give' ) . '</p>'; |
|
420 | + $sitename = get_bloginfo('sitename'); |
|
421 | + $default_text = '<p>'.__('Dear {name},', 'give').'</p>'; |
|
422 | + $default_text .= '<p>'.__('Thank you for your offline donation request! Your generosity is greatly appreciated. In order to make an offline donation we ask that you please follow these instructions:', 'give').'</p>'; |
|
423 | 423 | $default_text .= '<ol>'; |
424 | 424 | $default_text .= '<li>'; |
425 | 425 | $default_text .= sprintf( |
426 | 426 | /* translators: %s: site name */ |
427 | - __( 'Make a check payable to "%s"', 'give' ), |
|
427 | + __('Make a check payable to "%s"', 'give'), |
|
428 | 428 | $sitename |
429 | 429 | ); |
430 | 430 | $default_text .= '</li>'; |
431 | 431 | $default_text .= '<li>'; |
432 | 432 | $default_text .= sprintf( |
433 | 433 | /* translators: %s: site name */ |
434 | - __( 'On the memo line of the check, please indicate that the donation is for "%s"', 'give' ), |
|
434 | + __('On the memo line of the check, please indicate that the donation is for "%s"', 'give'), |
|
435 | 435 | $sitename |
436 | 436 | ); |
437 | 437 | $default_text .= '</li>'; |
438 | - $default_text .= '<li>' . __( 'Please mail your check to:', 'give' ) . '</li>'; |
|
438 | + $default_text .= '<li>'.__('Please mail your check to:', 'give').'</li>'; |
|
439 | 439 | $default_text .= '</ol>'; |
440 | - $default_text .= ' <em>' . $sitename . '</em><br>'; |
|
440 | + $default_text .= ' <em>'.$sitename.'</em><br>'; |
|
441 | 441 | $default_text .= ' <em>123 G Street </em><br>'; |
442 | 442 | $default_text .= ' <em>San Diego, CA 92101 </em><br>'; |
443 | - $default_text .= '<p>' . __( 'Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give' ) . '</p>'; |
|
444 | - $default_text .= '<p>' . __( 'Sincerely,', 'give' ) . '</p>'; |
|
445 | - $default_text .= '<p>' . $sitename . '</p>'; |
|
443 | + $default_text .= '<p>'.__('Once your donation has been received we will mark it as complete and you will receive an email receipt for your records. Please contact us with any questions you may have!', 'give').'</p>'; |
|
444 | + $default_text .= '<p>'.__('Sincerely,', 'give').'</p>'; |
|
445 | + $default_text .= '<p>'.$sitename.'</p>'; |
|
446 | 446 | |
447 | - return apply_filters( 'give_default_offline_donation_content', $default_text ); |
|
447 | + return apply_filters('give_default_offline_donation_content', $default_text); |
|
448 | 448 | |
449 | 449 | } |
450 | 450 | |
@@ -458,17 +458,17 @@ discard block |
||
458 | 458 | * |
459 | 459 | * @return string |
460 | 460 | */ |
461 | -function give_offline_donation_receipt_status_notice( $notice, $id ) { |
|
462 | - $payment = new Give_Payment( $id ); |
|
461 | +function give_offline_donation_receipt_status_notice($notice, $id) { |
|
462 | + $payment = new Give_Payment($id); |
|
463 | 463 | |
464 | - if ( 'offline' !== $payment->gateway || $payment->is_completed() ) { |
|
464 | + if ('offline' !== $payment->gateway || $payment->is_completed()) { |
|
465 | 465 | return $notice; |
466 | 466 | } |
467 | 467 | |
468 | - return give_output_error( __( 'Payment Pending: Please follow the instructions below to complete your donation.', 'give' ), false, 'warning' ); |
|
468 | + return give_output_error(__('Payment Pending: Please follow the instructions below to complete your donation.', 'give'), false, 'warning'); |
|
469 | 469 | } |
470 | 470 | |
471 | -add_filter( 'give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2 ); |
|
471 | +add_filter('give_receipt_status_notice', 'give_offline_donation_receipt_status_notice', 10, 2); |
|
472 | 472 | |
473 | 473 | /** |
474 | 474 | * Add offline payment instruction on payment receipt. |
@@ -479,26 +479,26 @@ discard block |
||
479 | 479 | * |
480 | 480 | * @return mixed |
481 | 481 | */ |
482 | -function give_offline_payment_receipt_after( $payment ) { |
|
482 | +function give_offline_payment_receipt_after($payment) { |
|
483 | 483 | // Get payment object. |
484 | - $payment = new Give_Payment( $payment->ID ); |
|
484 | + $payment = new Give_Payment($payment->ID); |
|
485 | 485 | |
486 | 486 | // Bailout. |
487 | - if ( 'offline' !== $payment->gateway ) { |
|
487 | + if ('offline' !== $payment->gateway) { |
|
488 | 488 | return false; |
489 | 489 | } |
490 | 490 | |
491 | 491 | ?> |
492 | 492 | <tr> |
493 | - <td scope="row"><strong><?php esc_html_e( 'Offline Payment Instruction:', 'give' ); ?></strong></td> |
|
493 | + <td scope="row"><strong><?php esc_html_e('Offline Payment Instruction:', 'give'); ?></strong></td> |
|
494 | 494 | <td> |
495 | - <?php echo give_get_offline_payment_instruction( $payment->form_id, true ); ?> |
|
495 | + <?php echo give_get_offline_payment_instruction($payment->form_id, true); ?> |
|
496 | 496 | </td> |
497 | 497 | </tr> |
498 | 498 | <?php |
499 | 499 | } |
500 | 500 | |
501 | -add_filter( 'give_payment_receipt_after', 'give_offline_payment_receipt_after' ); |
|
501 | +add_filter('give_payment_receipt_after', 'give_offline_payment_receipt_after'); |
|
502 | 502 | |
503 | 503 | /** |
504 | 504 | * Get offline payment instructions. |
@@ -510,27 +510,27 @@ discard block |
||
510 | 510 | * |
511 | 511 | * @return string |
512 | 512 | */ |
513 | -function give_get_offline_payment_instruction( $form_id, $wpautop = false ) { |
|
513 | +function give_get_offline_payment_instruction($form_id, $wpautop = false) { |
|
514 | 514 | // Bailout. |
515 | - if ( ! $form_id ) { |
|
515 | + if ( ! $form_id) { |
|
516 | 516 | return ''; |
517 | 517 | } |
518 | 518 | |
519 | - $post_offline_customization_option = get_post_meta( $form_id, '_give_customize_offline_donations', true ); |
|
520 | - $post_offline_instructions = get_post_meta( $form_id, '_give_offline_checkout_notes', true ); |
|
521 | - $global_offline_instruction = give_get_option( 'global_offline_donation_content' ); |
|
519 | + $post_offline_customization_option = get_post_meta($form_id, '_give_customize_offline_donations', true); |
|
520 | + $post_offline_instructions = get_post_meta($form_id, '_give_offline_checkout_notes', true); |
|
521 | + $global_offline_instruction = give_get_option('global_offline_donation_content'); |
|
522 | 522 | $offline_instructions = $global_offline_instruction; |
523 | 523 | |
524 | - if ( give_is_setting_enabled( $post_offline_customization_option ) ) { |
|
524 | + if (give_is_setting_enabled($post_offline_customization_option)) { |
|
525 | 525 | $offline_instructions = $post_offline_instructions; |
526 | 526 | } |
527 | 527 | |
528 | - $settings_url = admin_url( 'post.php?post=' . $form_id . '&action=edit&message=1' ); |
|
528 | + $settings_url = admin_url('post.php?post='.$form_id.'&action=edit&message=1'); |
|
529 | 529 | |
530 | 530 | /* translators: %s: form settings url */ |
531 | - $offline_instructions = ! empty( $offline_instructions ) ? $offline_instructions : sprintf( __( 'Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give' ), $settings_url ); |
|
531 | + $offline_instructions = ! empty($offline_instructions) ? $offline_instructions : sprintf(__('Please enter offline donation instructions in <a href="%s">this form\'s settings</a>.', 'give'), $settings_url); |
|
532 | 532 | |
533 | - return ( $wpautop ? wpautop( $offline_instructions ) : $offline_instructions ); |
|
533 | + return ($wpautop ? wpautop($offline_instructions) : $offline_instructions); |
|
534 | 534 | } |
535 | 535 | |
536 | 536 | |
@@ -544,24 +544,24 @@ discard block |
||
544 | 544 | * |
545 | 545 | * @return array |
546 | 546 | */ |
547 | -function give_filter_offline_gateway( $gateway_list, $form_id ) { |
|
547 | +function give_filter_offline_gateway($gateway_list, $form_id) { |
|
548 | 548 | if ( |
549 | 549 | // Show offline payment gateway if enable for new donation form. |
550 | - ( false === strpos( $_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms' ) ) |
|
550 | + (false === strpos($_SERVER['REQUEST_URI'], '/wp-admin/post-new.php?post_type=give_forms')) |
|
551 | 551 | && $form_id |
552 | - && ! give_is_setting_enabled( get_post_meta( $form_id, '_give_customize_offline_donations', true ), array( |
|
552 | + && ! give_is_setting_enabled(get_post_meta($form_id, '_give_customize_offline_donations', true), array( |
|
553 | 553 | 'enabled', |
554 | 554 | 'global', |
555 | - ) ) |
|
555 | + )) |
|
556 | 556 | ) { |
557 | - unset( $gateway_list['offline'] ); |
|
557 | + unset($gateway_list['offline']); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | // Output. |
561 | 561 | return $gateway_list; |
562 | 562 | } |
563 | 563 | |
564 | -add_filter( 'give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2 ); |
|
564 | +add_filter('give_enabled_payment_gateways', 'give_filter_offline_gateway', 10, 2); |
|
565 | 565 | |
566 | 566 | /** |
567 | 567 | * Set default gateway to global default payment gateway |
@@ -575,10 +575,10 @@ discard block |
||
575 | 575 | * |
576 | 576 | * @return void |
577 | 577 | */ |
578 | -function _give_customize_offline_donations_on_save_callback( $meta_key, $meta_value, $postid ) { |
|
579 | - if ( ! give_is_setting_enabled( $meta_value ) && ( 'offline' === get_post_meta( $postid, '_give_default_gateway', true ) ) ) { |
|
580 | - update_post_meta( $postid, '_give_default_gateway', 'global' ); |
|
578 | +function _give_customize_offline_donations_on_save_callback($meta_key, $meta_value, $postid) { |
|
579 | + if ( ! give_is_setting_enabled($meta_value) && ('offline' === get_post_meta($postid, '_give_default_gateway', true))) { |
|
580 | + update_post_meta($postid, '_give_default_gateway', 'global'); |
|
581 | 581 | } |
582 | 582 | } |
583 | 583 | |
584 | -add_filter( 'give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3 ); |
|
584 | +add_filter('give_save__give_customize_offline_donations', '_give_customize_offline_donations_on_save_callback', 10, 3); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __setup_hooks() { |
45 | 45 | // Create the log post type |
46 | - add_action( 'init', array( $this, 'register_post_type' ), 1 ); |
|
46 | + add_action('init', array($this, 'register_post_type'), 1); |
|
47 | 47 | |
48 | 48 | // Create types taxonomy and default types |
49 | - add_action( 'init', array( $this, 'register_taxonomy' ), 1 ); |
|
49 | + add_action('init', array($this, 'register_taxonomy'), 1); |
|
50 | 50 | |
51 | - add_action( 'save_post_give_payment', array( $this, 'background_process_delete_cache' ) ); |
|
52 | - add_action( 'save_post_give_forms', array( $this, 'background_process_delete_cache' ) ); |
|
53 | - add_action( 'save_post_give_log', array( $this, 'background_process_delete_cache' ) ); |
|
54 | - add_action( 'give_delete_log_cache', array( $this, 'delete_cache' ) ); |
|
51 | + add_action('save_post_give_payment', array($this, 'background_process_delete_cache')); |
|
52 | + add_action('save_post_give_forms', array($this, 'background_process_delete_cache')); |
|
53 | + add_action('save_post_give_log', array($this, 'background_process_delete_cache')); |
|
54 | + add_action('give_delete_log_cache', array($this, 'delete_cache')); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | /* Logs post type */ |
69 | 69 | $log_args = array( |
70 | 70 | 'labels' => array( |
71 | - 'name' => esc_html__( 'Logs', 'give' ), |
|
71 | + 'name' => esc_html__('Logs', 'give'), |
|
72 | 72 | ), |
73 | 73 | 'public' => false, |
74 | 74 | 'exclude_from_search' => true, |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | 'query_var' => false, |
78 | 78 | 'rewrite' => false, |
79 | 79 | 'capability_type' => 'post', |
80 | - 'supports' => array( 'title', 'editor' ), |
|
80 | + 'supports' => array('title', 'editor'), |
|
81 | 81 | 'can_export' => true, |
82 | 82 | ); |
83 | 83 | |
84 | - register_post_type( 'give_log', $log_args ); |
|
84 | + register_post_type('give_log', $log_args); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | * @return void |
96 | 96 | */ |
97 | 97 | public function register_taxonomy() { |
98 | - register_taxonomy( 'give_log_type', 'give_log', array( |
|
98 | + register_taxonomy('give_log_type', 'give_log', array( |
|
99 | 99 | 'public' => false, |
100 | - ) ); |
|
100 | + )); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | 'api_request', |
118 | 118 | ); |
119 | 119 | |
120 | - return apply_filters( 'give_log_types', $terms ); |
|
120 | + return apply_filters('give_log_types', $terms); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * |
133 | 133 | * @return bool Whether log type is valid. |
134 | 134 | */ |
135 | - public function valid_type( $type ) { |
|
136 | - return in_array( $type, $this->log_types() ); |
|
135 | + public function valid_type($type) { |
|
136 | + return in_array($type, $this->log_types()); |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | /** |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @return int Log ID. |
154 | 154 | */ |
155 | - public function add( $title = '', $message = '', $parent = 0, $type = null ) { |
|
155 | + public function add($title = '', $message = '', $parent = 0, $type = null) { |
|
156 | 156 | $log_data = array( |
157 | 157 | 'post_title' => $title, |
158 | 158 | 'post_content' => $message, |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | 'log_type' => $type, |
161 | 161 | ); |
162 | 162 | |
163 | - return $this->insert_log( $log_data ); |
|
163 | + return $this->insert_log($log_data); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -177,12 +177,12 @@ discard block |
||
177 | 177 | * |
178 | 178 | * @return array An array of the connected logs. |
179 | 179 | */ |
180 | - public function get_logs( $object_id = 0, $type = null, $paged = null ) { |
|
181 | - return $this->get_connected_logs( array( |
|
180 | + public function get_logs($object_id = 0, $type = null, $paged = null) { |
|
181 | + return $this->get_connected_logs(array( |
|
182 | 182 | 'post_parent' => $object_id, |
183 | 183 | 'paged' => $paged, |
184 | 184 | 'log_type' => $type, |
185 | - ) ); |
|
185 | + )); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @return int The ID of the newly created log item. |
198 | 198 | */ |
199 | - public function insert_log( $log_data = array(), $log_meta = array() ) { |
|
199 | + public function insert_log($log_data = array(), $log_meta = array()) { |
|
200 | 200 | $defaults = array( |
201 | 201 | 'post_type' => 'give_log', |
202 | 202 | 'post_status' => 'publish', |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | 'log_type' => false, |
206 | 206 | ); |
207 | 207 | |
208 | - $args = wp_parse_args( $log_data, $defaults ); |
|
208 | + $args = wp_parse_args($log_data, $defaults); |
|
209 | 209 | |
210 | 210 | /** |
211 | 211 | * Fires before inserting log entry. |
@@ -215,20 +215,20 @@ discard block |
||
215 | 215 | * @param array $log_data Log entry data. |
216 | 216 | * @param array $log_meta Log entry meta. |
217 | 217 | */ |
218 | - do_action( 'give_pre_insert_log', $log_data, $log_meta ); |
|
218 | + do_action('give_pre_insert_log', $log_data, $log_meta); |
|
219 | 219 | |
220 | 220 | // Store the log entry |
221 | - $log_id = wp_insert_post( $args ); |
|
221 | + $log_id = wp_insert_post($args); |
|
222 | 222 | |
223 | 223 | // Set the log type, if any |
224 | - if ( $log_data['log_type'] && $this->valid_type( $log_data['log_type'] ) ) { |
|
225 | - wp_set_object_terms( $log_id, $log_data['log_type'], 'give_log_type', false ); |
|
224 | + if ($log_data['log_type'] && $this->valid_type($log_data['log_type'])) { |
|
225 | + wp_set_object_terms($log_id, $log_data['log_type'], 'give_log_type', false); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | // Set log meta, if any |
229 | - if ( $log_id && ! empty( $log_meta ) ) { |
|
230 | - foreach ( (array) $log_meta as $key => $meta ) { |
|
231 | - update_post_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta ); |
|
229 | + if ($log_id && ! empty($log_meta)) { |
|
230 | + foreach ((array) $log_meta as $key => $meta) { |
|
231 | + update_post_meta($log_id, '_give_log_'.sanitize_key($key), $meta); |
|
232 | 232 | } |
233 | 233 | } |
234 | 234 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * @param array $log_data Log entry data. |
242 | 242 | * @param array $log_meta Log entry meta. |
243 | 243 | */ |
244 | - do_action( 'give_post_insert_log', $log_id, $log_data, $log_meta ); |
|
244 | + do_action('give_post_insert_log', $log_id, $log_data, $log_meta); |
|
245 | 245 | |
246 | 246 | return $log_id; |
247 | 247 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | * |
258 | 258 | * @return bool|null True if successful, false otherwise. |
259 | 259 | */ |
260 | - public function update_log( $log_data = array(), $log_meta = array() ) { |
|
260 | + public function update_log($log_data = array(), $log_meta = array()) { |
|
261 | 261 | |
262 | 262 | /** |
263 | 263 | * Fires before updating log entry. |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @param array $log_data Log entry data. |
268 | 268 | * @param array $log_meta Log entry meta. |
269 | 269 | */ |
270 | - do_action( 'give_pre_update_log', $log_data, $log_meta ); |
|
270 | + do_action('give_pre_update_log', $log_data, $log_meta); |
|
271 | 271 | |
272 | 272 | $defaults = array( |
273 | 273 | 'post_type' => 'give_log', |
@@ -275,15 +275,15 @@ discard block |
||
275 | 275 | 'post_parent' => 0, |
276 | 276 | ); |
277 | 277 | |
278 | - $args = wp_parse_args( $log_data, $defaults ); |
|
278 | + $args = wp_parse_args($log_data, $defaults); |
|
279 | 279 | |
280 | 280 | // Store the log entry |
281 | - $log_id = wp_update_post( $args ); |
|
281 | + $log_id = wp_update_post($args); |
|
282 | 282 | |
283 | - if ( $log_id && ! empty( $log_meta ) ) { |
|
284 | - foreach ( (array) $log_meta as $key => $meta ) { |
|
285 | - if ( ! empty( $meta ) ) { |
|
286 | - update_post_meta( $log_id, '_give_log_' . sanitize_key( $key ), $meta ); |
|
283 | + if ($log_id && ! empty($log_meta)) { |
|
284 | + foreach ((array) $log_meta as $key => $meta) { |
|
285 | + if ( ! empty($meta)) { |
|
286 | + update_post_meta($log_id, '_give_log_'.sanitize_key($key), $meta); |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | } |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | * @param array $log_data Log entry data. |
298 | 298 | * @param array $log_meta Log entry meta. |
299 | 299 | */ |
300 | - do_action( 'give_post_update_log', $log_id, $log_data, $log_meta ); |
|
300 | + do_action('give_post_update_log', $log_id, $log_data, $log_meta); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | /** |
@@ -312,19 +312,19 @@ discard block |
||
312 | 312 | * |
313 | 313 | * @return array|false Array if logs were found, false otherwise. |
314 | 314 | */ |
315 | - public function get_connected_logs( $args = array() ) { |
|
315 | + public function get_connected_logs($args = array()) { |
|
316 | 316 | |
317 | 317 | $defaults = array( |
318 | 318 | 'post_type' => 'give_log', |
319 | 319 | 'posts_per_page' => 20, |
320 | 320 | 'post_status' => 'publish', |
321 | - 'paged' => get_query_var( 'paged' ), |
|
321 | + 'paged' => get_query_var('paged'), |
|
322 | 322 | 'log_type' => false, |
323 | 323 | ); |
324 | 324 | |
325 | - $query_args = wp_parse_args( $args, $defaults ); |
|
325 | + $query_args = wp_parse_args($args, $defaults); |
|
326 | 326 | |
327 | - if ( $query_args['log_type'] && $this->valid_type( $query_args['log_type'] ) ) { |
|
327 | + if ($query_args['log_type'] && $this->valid_type($query_args['log_type'])) { |
|
328 | 328 | $query_args['tax_query'] = array( |
329 | 329 | array( |
330 | 330 | 'taxonomy' => 'give_log_type', |
@@ -334,9 +334,9 @@ discard block |
||
334 | 334 | ); |
335 | 335 | } |
336 | 336 | |
337 | - $logs = get_posts( $query_args ); |
|
337 | + $logs = get_posts($query_args); |
|
338 | 338 | |
339 | - if ( $logs ) { |
|
339 | + if ($logs) { |
|
340 | 340 | return $logs; |
341 | 341 | } |
342 | 342 | |
@@ -359,20 +359,20 @@ discard block |
||
359 | 359 | * |
360 | 360 | * @return int Log count. |
361 | 361 | */ |
362 | - public function get_log_count( $object_id = 0, $type = null, $meta_query = null, $date_query = null ) { |
|
362 | + public function get_log_count($object_id = 0, $type = null, $meta_query = null, $date_query = null) { |
|
363 | 363 | |
364 | 364 | $query_args = array( |
365 | 365 | 'post_type' => 'give_log', |
366 | - 'posts_per_page' => - 1, |
|
366 | + 'posts_per_page' => -1, |
|
367 | 367 | 'post_status' => 'publish', |
368 | 368 | 'fields' => 'ids', |
369 | 369 | ); |
370 | 370 | |
371 | - if ( $object_id ) { |
|
371 | + if ($object_id) { |
|
372 | 372 | $query_args['post_parent'] = $object_id; |
373 | 373 | } |
374 | 374 | |
375 | - if ( ! empty( $type ) && $this->valid_type( $type ) ) { |
|
375 | + if ( ! empty($type) && $this->valid_type($type)) { |
|
376 | 376 | $query_args['tax_query'] = array( |
377 | 377 | array( |
378 | 378 | 'taxonomy' => 'give_log_type', |
@@ -382,24 +382,24 @@ discard block |
||
382 | 382 | ); |
383 | 383 | } |
384 | 384 | |
385 | - if ( ! empty( $meta_query ) ) { |
|
385 | + if ( ! empty($meta_query)) { |
|
386 | 386 | $query_args['meta_query'] = $meta_query; |
387 | 387 | } |
388 | 388 | |
389 | - if ( ! empty( $date_query ) ) { |
|
389 | + if ( ! empty($date_query)) { |
|
390 | 390 | $query_args['date_query'] = $date_query; |
391 | 391 | } |
392 | 392 | |
393 | 393 | // Get cache key for current query. |
394 | - $cache_key = Give_Cache::get_key( 'get_log_count', $query_args ); |
|
394 | + $cache_key = Give_Cache::get_key('get_log_count', $query_args); |
|
395 | 395 | |
396 | 396 | // check if cache already exist or not. |
397 | - if ( ! ( $logs_count = Give_Cache::get( $cache_key ) ) ) { |
|
398 | - $logs = new WP_Query( $query_args ); |
|
397 | + if ( ! ($logs_count = Give_Cache::get($cache_key))) { |
|
398 | + $logs = new WP_Query($query_args); |
|
399 | 399 | $logs_count = (int) $logs->post_count; |
400 | 400 | |
401 | 401 | // Cache results. |
402 | - Give_Cache::set( $cache_key, $logs_count ); |
|
402 | + Give_Cache::set($cache_key, $logs_count); |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | return $logs_count; |
@@ -419,16 +419,16 @@ discard block |
||
419 | 419 | * |
420 | 420 | * @return void |
421 | 421 | */ |
422 | - public function delete_logs( $object_id = 0, $type = null, $meta_query = null ) { |
|
422 | + public function delete_logs($object_id = 0, $type = null, $meta_query = null) { |
|
423 | 423 | $query_args = array( |
424 | 424 | 'post_parent' => $object_id, |
425 | 425 | 'post_type' => 'give_log', |
426 | - 'posts_per_page' => - 1, |
|
426 | + 'posts_per_page' => -1, |
|
427 | 427 | 'post_status' => 'publish', |
428 | 428 | 'fields' => 'ids', |
429 | 429 | ); |
430 | 430 | |
431 | - if ( ! empty( $type ) && $this->valid_type( $type ) ) { |
|
431 | + if ( ! empty($type) && $this->valid_type($type)) { |
|
432 | 432 | $query_args['tax_query'] = array( |
433 | 433 | array( |
434 | 434 | 'taxonomy' => 'give_log_type', |
@@ -438,15 +438,15 @@ discard block |
||
438 | 438 | ); |
439 | 439 | } |
440 | 440 | |
441 | - if ( ! empty( $meta_query ) ) { |
|
441 | + if ( ! empty($meta_query)) { |
|
442 | 442 | $query_args['meta_query'] = $meta_query; |
443 | 443 | } |
444 | 444 | |
445 | - $logs = get_posts( $query_args ); |
|
445 | + $logs = get_posts($query_args); |
|
446 | 446 | |
447 | - if ( $logs ) { |
|
448 | - foreach ( $logs as $log ) { |
|
449 | - wp_delete_post( $log, true ); |
|
447 | + if ($logs) { |
|
448 | + foreach ($logs as $log) { |
|
449 | + wp_delete_post($log, true); |
|
450 | 450 | } |
451 | 451 | } |
452 | 452 | } |
@@ -459,9 +459,9 @@ discard block |
||
459 | 459 | * |
460 | 460 | * @param int $post_id |
461 | 461 | */ |
462 | - public function background_process_delete_cache( $post_id ) { |
|
462 | + public function background_process_delete_cache($post_id) { |
|
463 | 463 | // Delete log cache immediately |
464 | - wp_schedule_single_event( time() - 5, 'give_delete_log_cache' ); |
|
464 | + wp_schedule_single_event(time() - 5, 'give_delete_log_cache'); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | /** |
@@ -489,11 +489,11 @@ discard block |
||
489 | 489 | ); |
490 | 490 | |
491 | 491 | // Bailout. |
492 | - if ( empty( $cache_option_names ) ) { |
|
492 | + if (empty($cache_option_names)) { |
|
493 | 493 | return false; |
494 | 494 | } |
495 | 495 | |
496 | - Give_Cache::delete( $cache_option_names ); |
|
496 | + Give_Cache::delete($cache_option_names); |
|
497 | 497 | } |
498 | 498 | } |
499 | 499 | |
@@ -515,10 +515,10 @@ discard block |
||
515 | 515 | * |
516 | 516 | * @return int ID of the new log entry. |
517 | 517 | */ |
518 | -function give_record_log( $title = '', $message = '', $parent = 0, $type = null ) { |
|
518 | +function give_record_log($title = '', $message = '', $parent = 0, $type = null) { |
|
519 | 519 | /* @var Give_Logging $give_logs */ |
520 | 520 | global $give_logs; |
521 | - $log = $give_logs->add( $title, $message, $parent, $type ); |
|
521 | + $log = $give_logs->add($title, $message, $parent, $type); |
|
522 | 522 | |
523 | 523 | return $log; |
524 | 524 | } |
@@ -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,9 +23,9 @@ discard block |
||
23 | 23 | */ |
24 | 24 | function give_is_test_mode() { |
25 | 25 | |
26 | - $ret = give_is_setting_enabled( give_get_option( 'test_mode' ) ); |
|
26 | + $ret = give_is_setting_enabled(give_get_option('test_mode')); |
|
27 | 27 | |
28 | - return (bool) apply_filters( 'give_is_test_mode', $ret ); |
|
28 | + return (bool) apply_filters('give_is_test_mode', $ret); |
|
29 | 29 | |
30 | 30 | } |
31 | 31 | |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | */ |
38 | 38 | function give_get_currency() { |
39 | 39 | |
40 | - $currency = give_get_option( 'currency', 'USD' ); |
|
40 | + $currency = give_get_option('currency', 'USD'); |
|
41 | 41 | |
42 | - return apply_filters( 'give_currency', $currency ); |
|
42 | + return apply_filters('give_currency', $currency); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | */ |
52 | 52 | function give_get_currency_position() { |
53 | 53 | |
54 | - $currency_pos = give_get_option( 'currency_position', 'before' ); |
|
54 | + $currency_pos = give_get_option('currency_position', 'before'); |
|
55 | 55 | |
56 | - return apply_filters( 'give_currency_position', $currency_pos ); |
|
56 | + return apply_filters('give_currency_position', $currency_pos); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | |
@@ -66,39 +66,39 @@ discard block |
||
66 | 66 | |
67 | 67 | function give_get_currencies() { |
68 | 68 | $currencies = array( |
69 | - 'USD' => esc_html__( 'US Dollars ($)', 'give' ), |
|
70 | - 'EUR' => esc_html__( 'Euros (€)', 'give' ), |
|
71 | - 'GBP' => esc_html__( 'Pounds Sterling (£)', 'give' ), |
|
72 | - 'AUD' => esc_html__( 'Australian Dollars ($)', 'give' ), |
|
73 | - 'BRL' => esc_html__( 'Brazilian Real (R$)', 'give' ), |
|
74 | - 'CAD' => esc_html__( 'Canadian Dollars ($)', 'give' ), |
|
75 | - 'CZK' => esc_html__( 'Czech Koruna (Kč)', 'give' ), |
|
76 | - 'DKK' => esc_html__( 'Danish Krone (kr)', 'give' ), |
|
77 | - 'HKD' => esc_html__( 'Hong Kong Dollar ($)', 'give' ), |
|
78 | - 'HUF' => esc_html__( 'Hungarian Forint (Ft)', 'give' ), |
|
79 | - 'ILS' => esc_html__( 'Israeli Shekel (₪)', 'give' ), |
|
80 | - 'JPY' => esc_html__( 'Japanese Yen (¥)', 'give' ), |
|
81 | - 'MYR' => esc_html__( 'Malaysian Ringgits (RM)', 'give' ), |
|
82 | - 'MXN' => esc_html__( 'Mexican Peso ($)', 'give' ), |
|
83 | - 'MAD' => esc_html__( 'Moroccan Dirham (.د.م)', 'give' ), |
|
84 | - 'NZD' => esc_html__( 'New Zealand Dollar ($)', 'give' ), |
|
85 | - 'NOK' => esc_html__( 'Norwegian Krone (Kr.)', 'give' ), |
|
86 | - 'PHP' => esc_html__( 'Philippine Pesos (₱)', 'give' ), |
|
87 | - 'PLN' => esc_html__( 'Polish Zloty (zł)', 'give' ), |
|
88 | - 'SGD' => esc_html__( 'Singapore Dollar ($)', 'give' ), |
|
89 | - 'KRW' => esc_html__( 'South Korean Won (₩)', 'give' ), |
|
90 | - 'ZAR' => esc_html__( 'South African Rand (R)', 'give' ), |
|
91 | - 'SEK' => esc_html__( 'Swedish Krona (kr)', 'give' ), |
|
92 | - 'CHF' => esc_html__( 'Swiss Franc (CHF)', 'give' ), |
|
93 | - 'TWD' => esc_html__( 'Taiwan New Dollars (NT$)', 'give' ), |
|
94 | - 'THB' => esc_html__( 'Thai Baht (฿)', 'give' ), |
|
95 | - 'INR' => esc_html__( 'Indian Rupee (₹)', 'give' ), |
|
96 | - 'TRY' => esc_html__( 'Turkish Lira (₺)', 'give' ), |
|
97 | - 'RIAL' => esc_html__( 'Iranian Rial (﷼)', 'give' ), |
|
98 | - 'RUB' => esc_html__( 'Russian Rubles (руб)', 'give' ) |
|
69 | + 'USD' => esc_html__('US Dollars ($)', 'give'), |
|
70 | + 'EUR' => esc_html__('Euros (€)', 'give'), |
|
71 | + 'GBP' => esc_html__('Pounds Sterling (£)', 'give'), |
|
72 | + 'AUD' => esc_html__('Australian Dollars ($)', 'give'), |
|
73 | + 'BRL' => esc_html__('Brazilian Real (R$)', 'give'), |
|
74 | + 'CAD' => esc_html__('Canadian Dollars ($)', 'give'), |
|
75 | + 'CZK' => esc_html__('Czech Koruna (Kč)', 'give'), |
|
76 | + 'DKK' => esc_html__('Danish Krone (kr)', 'give'), |
|
77 | + 'HKD' => esc_html__('Hong Kong Dollar ($)', 'give'), |
|
78 | + 'HUF' => esc_html__('Hungarian Forint (Ft)', 'give'), |
|
79 | + 'ILS' => esc_html__('Israeli Shekel (₪)', 'give'), |
|
80 | + 'JPY' => esc_html__('Japanese Yen (¥)', 'give'), |
|
81 | + 'MYR' => esc_html__('Malaysian Ringgits (RM)', 'give'), |
|
82 | + 'MXN' => esc_html__('Mexican Peso ($)', 'give'), |
|
83 | + 'MAD' => esc_html__('Moroccan Dirham (.د.م)', 'give'), |
|
84 | + 'NZD' => esc_html__('New Zealand Dollar ($)', 'give'), |
|
85 | + 'NOK' => esc_html__('Norwegian Krone (Kr.)', 'give'), |
|
86 | + 'PHP' => esc_html__('Philippine Pesos (₱)', 'give'), |
|
87 | + 'PLN' => esc_html__('Polish Zloty (zł)', 'give'), |
|
88 | + 'SGD' => esc_html__('Singapore Dollar ($)', 'give'), |
|
89 | + 'KRW' => esc_html__('South Korean Won (₩)', 'give'), |
|
90 | + 'ZAR' => esc_html__('South African Rand (R)', 'give'), |
|
91 | + 'SEK' => esc_html__('Swedish Krona (kr)', 'give'), |
|
92 | + 'CHF' => esc_html__('Swiss Franc (CHF)', 'give'), |
|
93 | + 'TWD' => esc_html__('Taiwan New Dollars (NT$)', 'give'), |
|
94 | + 'THB' => esc_html__('Thai Baht (฿)', 'give'), |
|
95 | + 'INR' => esc_html__('Indian Rupee (₹)', 'give'), |
|
96 | + 'TRY' => esc_html__('Turkish Lira (₺)', 'give'), |
|
97 | + 'RIAL' => esc_html__('Iranian Rial (﷼)', 'give'), |
|
98 | + 'RUB' => esc_html__('Russian Rubles (руб)', 'give') |
|
99 | 99 | ); |
100 | 100 | |
101 | - return apply_filters( 'give_currencies', $currencies ); |
|
101 | + return apply_filters('give_currencies', $currencies); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | * |
115 | 115 | * @return string The symbol to use for the currency |
116 | 116 | */ |
117 | -function give_currency_symbol( $currency = '' ) { |
|
117 | +function give_currency_symbol($currency = '') { |
|
118 | 118 | |
119 | - if ( empty( $currency ) ) { |
|
119 | + if (empty($currency)) { |
|
120 | 120 | $currency = give_get_currency(); |
121 | 121 | } |
122 | - switch ( $currency ) : |
|
122 | + switch ($currency) : |
|
123 | 123 | case 'GBP' : |
124 | 124 | $symbol = '£'; |
125 | 125 | break; |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | endswitch; |
199 | 199 | |
200 | 200 | |
201 | - return apply_filters( 'give_currency_symbol', $symbol, $currency ); |
|
201 | + return apply_filters('give_currency_symbol', $symbol, $currency); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -212,21 +212,21 @@ discard block |
||
212 | 212 | |
213 | 213 | global $wp; |
214 | 214 | |
215 | - if ( get_option( 'permalink_structure' ) ) { |
|
216 | - $base = trailingslashit( home_url( $wp->request ) ); |
|
215 | + if (get_option('permalink_structure')) { |
|
216 | + $base = trailingslashit(home_url($wp->request)); |
|
217 | 217 | } else { |
218 | - $base = add_query_arg( $wp->query_string, '', trailingslashit( home_url( $wp->request ) ) ); |
|
219 | - $base = remove_query_arg( array( 'post_type', 'name' ), $base ); |
|
218 | + $base = add_query_arg($wp->query_string, '', trailingslashit(home_url($wp->request))); |
|
219 | + $base = remove_query_arg(array('post_type', 'name'), $base); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | $scheme = is_ssl() ? 'https' : 'http'; |
223 | - $current_uri = set_url_scheme( $base, $scheme ); |
|
223 | + $current_uri = set_url_scheme($base, $scheme); |
|
224 | 224 | |
225 | - if ( is_front_page() ) { |
|
226 | - $current_uri = home_url( '/' ); |
|
225 | + if (is_front_page()) { |
|
226 | + $current_uri = home_url('/'); |
|
227 | 227 | } |
228 | 228 | |
229 | - return apply_filters( 'give_get_current_page_url', $current_uri ); |
|
229 | + return apply_filters('give_get_current_page_url', $current_uri); |
|
230 | 230 | |
231 | 231 | } |
232 | 232 | |
@@ -248,15 +248,15 @@ discard block |
||
248 | 248 | */ |
249 | 249 | $gateways = give_get_enabled_payment_gateways(); |
250 | 250 | |
251 | - if ( count( $gateways ) == 1 && ! isset( $gateways['paypal'] ) && ! isset( $gateways['manual'] ) ) { |
|
251 | + if (count($gateways) == 1 && ! isset($gateways['paypal']) && ! isset($gateways['manual'])) { |
|
252 | 252 | $ret = true; |
253 | - } else if ( count( $gateways ) == 1 ) { |
|
253 | + } else if (count($gateways) == 1) { |
|
254 | 254 | $ret = false; |
255 | - } else if ( count( $gateways ) == 2 && isset( $gateways['paypal'] ) && isset( $gateways['manual'] ) ) { |
|
255 | + } else if (count($gateways) == 2 && isset($gateways['paypal']) && isset($gateways['manual'])) { |
|
256 | 256 | $ret = false; |
257 | 257 | } |
258 | 258 | |
259 | - return (bool) apply_filters( 'give_verify_credit_cards', $ret ); |
|
259 | + return (bool) apply_filters('give_verify_credit_cards', $ret); |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | /** |
@@ -268,26 +268,26 @@ discard block |
||
268 | 268 | function give_get_timezone_id() { |
269 | 269 | |
270 | 270 | // if site timezone string exists, return it |
271 | - if ( $timezone = get_option( 'timezone_string' ) ) { |
|
271 | + if ($timezone = get_option('timezone_string')) { |
|
272 | 272 | return $timezone; |
273 | 273 | } |
274 | 274 | |
275 | 275 | // get UTC offset, if it isn't set return UTC |
276 | - if ( ! ( $utc_offset = 3600 * get_option( 'gmt_offset', 0 ) ) ) { |
|
276 | + if ( ! ($utc_offset = 3600 * get_option('gmt_offset', 0))) { |
|
277 | 277 | return 'UTC'; |
278 | 278 | } |
279 | 279 | |
280 | 280 | // attempt to guess the timezone string from the UTC offset |
281 | - $timezone = timezone_name_from_abbr( '', $utc_offset ); |
|
281 | + $timezone = timezone_name_from_abbr('', $utc_offset); |
|
282 | 282 | |
283 | 283 | // last try, guess timezone string manually |
284 | - if ( $timezone === false ) { |
|
284 | + if ($timezone === false) { |
|
285 | 285 | |
286 | - $is_dst = date( 'I' ); |
|
286 | + $is_dst = date('I'); |
|
287 | 287 | |
288 | - foreach ( timezone_abbreviations_list() as $abbr ) { |
|
289 | - foreach ( $abbr as $city ) { |
|
290 | - if ( $city['dst'] == $is_dst && $city['offset'] == $utc_offset ) { |
|
288 | + foreach (timezone_abbreviations_list() as $abbr) { |
|
289 | + foreach ($abbr as $city) { |
|
290 | + if ($city['dst'] == $is_dst && $city['offset'] == $utc_offset) { |
|
291 | 291 | return $city['timezone_id']; |
292 | 292 | } |
293 | 293 | } |
@@ -311,17 +311,17 @@ discard block |
||
311 | 311 | |
312 | 312 | $ip = '127.0.0.1'; |
313 | 313 | |
314 | - if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { |
|
314 | + if ( ! empty($_SERVER['HTTP_CLIENT_IP'])) { |
|
315 | 315 | //check ip from share internet |
316 | 316 | $ip = $_SERVER['HTTP_CLIENT_IP']; |
317 | - } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { |
|
317 | + } elseif ( ! empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
318 | 318 | //to check ip is pass from proxy |
319 | 319 | $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
320 | - } elseif ( ! empty( $_SERVER['REMOTE_ADDR'] ) ) { |
|
320 | + } elseif ( ! empty($_SERVER['REMOTE_ADDR'])) { |
|
321 | 321 | $ip = $_SERVER['REMOTE_ADDR']; |
322 | 322 | } |
323 | 323 | |
324 | - return apply_filters( 'give_get_ip', $ip ); |
|
324 | + return apply_filters('give_get_ip', $ip); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | |
@@ -336,9 +336,9 @@ discard block |
||
336 | 336 | * |
337 | 337 | * @uses Give()->session->set() |
338 | 338 | */ |
339 | -function give_set_purchase_session( $purchase_data = array() ) { |
|
340 | - Give()->session->set( 'give_purchase', $purchase_data ); |
|
341 | - Give()->session->set( 'give_email', $purchase_data['user_email'] ); |
|
339 | +function give_set_purchase_session($purchase_data = array()) { |
|
340 | + Give()->session->set('give_purchase', $purchase_data); |
|
341 | + Give()->session->set('give_email', $purchase_data['user_email']); |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | /** |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | * @return mixed array | false |
353 | 353 | */ |
354 | 354 | function give_get_purchase_session() { |
355 | - return Give()->session->get( 'give_purchase' ); |
|
355 | + return Give()->session->get('give_purchase'); |
|
356 | 356 | } |
357 | 357 | |
358 | 358 | /** |
@@ -367,14 +367,14 @@ discard block |
||
367 | 367 | * |
368 | 368 | * @return string |
369 | 369 | */ |
370 | -function give_get_purchase_summary( $purchase_data, $email = true ) { |
|
370 | +function give_get_purchase_summary($purchase_data, $email = true) { |
|
371 | 371 | $summary = ''; |
372 | 372 | |
373 | - if ( $email ) { |
|
374 | - $summary .= $purchase_data['user_email'] . ' - '; |
|
373 | + if ($email) { |
|
374 | + $summary .= $purchase_data['user_email'].' - '; |
|
375 | 375 | } |
376 | 376 | |
377 | - $summary .= get_the_title( $purchase_data['post_data']['give-form-id'] ); |
|
377 | + $summary .= get_the_title($purchase_data['post_data']['give-form-id']); |
|
378 | 378 | |
379 | 379 | return $summary; |
380 | 380 | } |
@@ -391,31 +391,31 @@ discard block |
||
391 | 391 | function give_get_host() { |
392 | 392 | $host = false; |
393 | 393 | |
394 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
394 | + if (defined('WPE_APIKEY')) { |
|
395 | 395 | $host = 'WP Engine'; |
396 | - } elseif ( defined( 'PAGELYBIN' ) ) { |
|
396 | + } elseif (defined('PAGELYBIN')) { |
|
397 | 397 | $host = 'Pagely'; |
398 | - } elseif ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
398 | + } elseif (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
399 | 399 | $host = 'ICDSoft'; |
400 | - } elseif ( DB_HOST == 'mysqlv5' ) { |
|
400 | + } elseif (DB_HOST == 'mysqlv5') { |
|
401 | 401 | $host = 'NetworkSolutions'; |
402 | - } elseif ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
402 | + } elseif (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
403 | 403 | $host = 'iPage'; |
404 | - } elseif ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
404 | + } elseif (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
405 | 405 | $host = 'IPower'; |
406 | - } elseif ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
406 | + } elseif (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
407 | 407 | $host = 'MediaTemple Grid'; |
408 | - } elseif ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
408 | + } elseif (strpos(DB_HOST, '.pair.com') !== false) { |
|
409 | 409 | $host = 'pair Networks'; |
410 | - } elseif ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
410 | + } elseif (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
411 | 411 | $host = 'Rackspace Cloud'; |
412 | - } elseif ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
412 | + } elseif (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
413 | 413 | $host = 'SysFix.eu Power Hosting'; |
414 | - } elseif ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
414 | + } elseif (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
415 | 415 | $host = 'Flywheel'; |
416 | 416 | } else { |
417 | 417 | // Adding a general fallback for data gathering |
418 | - $host = 'DBH: ' . DB_HOST . ', SRV: ' . $_SERVER['SERVER_NAME']; |
|
418 | + $host = 'DBH: '.DB_HOST.', SRV: '.$_SERVER['SERVER_NAME']; |
|
419 | 419 | } |
420 | 420 | |
421 | 421 | return $host; |
@@ -431,67 +431,67 @@ discard block |
||
431 | 431 | * |
432 | 432 | * @return bool true if host matches, false if not |
433 | 433 | */ |
434 | -function give_is_host( $host = false ) { |
|
434 | +function give_is_host($host = false) { |
|
435 | 435 | |
436 | 436 | $return = false; |
437 | 437 | |
438 | - if ( $host ) { |
|
439 | - $host = str_replace( ' ', '', strtolower( $host ) ); |
|
438 | + if ($host) { |
|
439 | + $host = str_replace(' ', '', strtolower($host)); |
|
440 | 440 | |
441 | - switch ( $host ) { |
|
441 | + switch ($host) { |
|
442 | 442 | case 'wpengine': |
443 | - if ( defined( 'WPE_APIKEY' ) ) { |
|
443 | + if (defined('WPE_APIKEY')) { |
|
444 | 444 | $return = true; |
445 | 445 | } |
446 | 446 | break; |
447 | 447 | case 'pagely': |
448 | - if ( defined( 'PAGELYBIN' ) ) { |
|
448 | + if (defined('PAGELYBIN')) { |
|
449 | 449 | $return = true; |
450 | 450 | } |
451 | 451 | break; |
452 | 452 | case 'icdsoft': |
453 | - if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { |
|
453 | + if (DB_HOST == 'localhost:/tmp/mysql5.sock') { |
|
454 | 454 | $return = true; |
455 | 455 | } |
456 | 456 | break; |
457 | 457 | case 'networksolutions': |
458 | - if ( DB_HOST == 'mysqlv5' ) { |
|
458 | + if (DB_HOST == 'mysqlv5') { |
|
459 | 459 | $return = true; |
460 | 460 | } |
461 | 461 | break; |
462 | 462 | case 'ipage': |
463 | - if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { |
|
463 | + if (strpos(DB_HOST, 'ipagemysql.com') !== false) { |
|
464 | 464 | $return = true; |
465 | 465 | } |
466 | 466 | break; |
467 | 467 | case 'ipower': |
468 | - if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { |
|
468 | + if (strpos(DB_HOST, 'ipowermysql.com') !== false) { |
|
469 | 469 | $return = true; |
470 | 470 | } |
471 | 471 | break; |
472 | 472 | case 'mediatemplegrid': |
473 | - if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { |
|
473 | + if (strpos(DB_HOST, '.gridserver.com') !== false) { |
|
474 | 474 | $return = true; |
475 | 475 | } |
476 | 476 | break; |
477 | 477 | case 'pairnetworks': |
478 | - if ( strpos( DB_HOST, '.pair.com' ) !== false ) { |
|
478 | + if (strpos(DB_HOST, '.pair.com') !== false) { |
|
479 | 479 | $return = true; |
480 | 480 | } |
481 | 481 | break; |
482 | 482 | case 'rackspacecloud': |
483 | - if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { |
|
483 | + if (strpos(DB_HOST, '.stabletransit.com') !== false) { |
|
484 | 484 | $return = true; |
485 | 485 | } |
486 | 486 | break; |
487 | 487 | case 'sysfix.eu': |
488 | 488 | case 'sysfix.eupowerhosting': |
489 | - if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { |
|
489 | + if (strpos(DB_HOST, '.sysfix.eu') !== false) { |
|
490 | 490 | $return = true; |
491 | 491 | } |
492 | 492 | break; |
493 | 493 | case 'flywheel': |
494 | - if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { |
|
494 | + if (strpos($_SERVER['SERVER_NAME'], 'Flywheel') !== false) { |
|
495 | 495 | $return = true; |
496 | 496 | } |
497 | 497 | break; |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | * @param string $replacement Optional. The function that should have been called. |
525 | 525 | * @param array $backtrace Optional. Contains stack backtrace of deprecated function. |
526 | 526 | */ |
527 | -function _give_deprecated_function( $function, $version, $replacement = null, $backtrace = null ) { |
|
527 | +function _give_deprecated_function($function, $version, $replacement = null, $backtrace = null) { |
|
528 | 528 | |
529 | 529 | /** |
530 | 530 | * Fires while give deprecated function call occurs. |
@@ -537,19 +537,19 @@ discard block |
||
537 | 537 | * @param string $replacement Optional. The function that should have been called. |
538 | 538 | * @param string $version The plugin version that deprecated the function. |
539 | 539 | */ |
540 | - do_action( 'give_deprecated_function_run', $function, $replacement, $version ); |
|
540 | + do_action('give_deprecated_function_run', $function, $replacement, $version); |
|
541 | 541 | |
542 | - $show_errors = current_user_can( 'manage_options' ); |
|
542 | + $show_errors = current_user_can('manage_options'); |
|
543 | 543 | |
544 | 544 | // Allow plugin to filter the output error trigger |
545 | - if ( WP_DEBUG && apply_filters( 'give_deprecated_function_trigger_error', $show_errors ) ) { |
|
546 | - if ( ! is_null( $replacement ) ) { |
|
547 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give' ), $function, $version, $replacement ) ); |
|
548 | - trigger_error( print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
545 | + if (WP_DEBUG && apply_filters('give_deprecated_function_trigger_error', $show_errors)) { |
|
546 | + if ( ! is_null($replacement)) { |
|
547 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s! Use %3$s instead.', 'give'), $function, $version, $replacement)); |
|
548 | + trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
549 | 549 | // Alternatively we could dump this to a file. |
550 | 550 | } else { |
551 | - trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give' ), $function, $version ) ); |
|
552 | - trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
551 | + trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since Give version %2$s with no alternative available.', 'give'), $function, $version)); |
|
552 | + trigger_error(print_r($backtrace, 1)); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine. |
|
553 | 553 | // Alternatively we could dump this to a file. |
554 | 554 | } |
555 | 555 | } |
@@ -563,8 +563,8 @@ discard block |
||
563 | 563 | * @return string $post_id |
564 | 564 | */ |
565 | 565 | function give_get_admin_post_id() { |
566 | - $post_id = isset( $_GET['post'] ) ? $_GET['post'] : null; |
|
567 | - if ( ! $post_id && isset( $_POST['post_id'] ) ) { |
|
566 | + $post_id = isset($_GET['post']) ? $_GET['post'] : null; |
|
567 | + if ( ! $post_id && isset($_POST['post_id'])) { |
|
568 | 568 | $post_id = $_POST['post_id']; |
569 | 569 | } |
570 | 570 | |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | * @return string Arg separator output |
579 | 579 | */ |
580 | 580 | function give_get_php_arg_separator_output() { |
581 | - return ini_get( 'arg_separator.output' ); |
|
581 | + return ini_get('arg_separator.output'); |
|
582 | 582 | } |
583 | 583 | |
584 | 584 | |
@@ -593,10 +593,10 @@ discard block |
||
593 | 593 | * |
594 | 594 | * @return string Short month name |
595 | 595 | */ |
596 | -function give_month_num_to_name( $n ) { |
|
597 | - $timestamp = mktime( 0, 0, 0, $n, 1, 2005 ); |
|
596 | +function give_month_num_to_name($n) { |
|
597 | + $timestamp = mktime(0, 0, 0, $n, 1, 2005); |
|
598 | 598 | |
599 | - return date_i18n( "M", $timestamp ); |
|
599 | + return date_i18n("M", $timestamp); |
|
600 | 600 | } |
601 | 601 | |
602 | 602 | |
@@ -609,10 +609,10 @@ discard block |
||
609 | 609 | * |
610 | 610 | * @return bool Whether or not function is disabled. |
611 | 611 | */ |
612 | -function give_is_func_disabled( $function ) { |
|
613 | - $disabled = explode( ',', ini_get( 'disable_functions' ) ); |
|
612 | +function give_is_func_disabled($function) { |
|
613 | + $disabled = explode(',', ini_get('disable_functions')); |
|
614 | 614 | |
615 | - return in_array( $function, $disabled ); |
|
615 | + return in_array($function, $disabled); |
|
616 | 616 | } |
617 | 617 | |
618 | 618 | |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | */ |
624 | 624 | function give_get_newsletter() { ?> |
625 | 625 | |
626 | - <p class="newsletter-intro"><?php esc_html_e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p> |
|
626 | + <p class="newsletter-intro"><?php esc_html_e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p> |
|
627 | 627 | |
628 | 628 | <div class="give-newsletter-form-wrap"> |
629 | 629 | |
@@ -631,33 +631,33 @@ discard block |
||
631 | 631 | method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" |
632 | 632 | target="_blank" novalidate> |
633 | 633 | <div class="give-newsletter-confirmation"> |
634 | - <p><?php esc_html_e( 'Thanks for Subscribing!', 'give' ); ?> :)</p> |
|
634 | + <p><?php esc_html_e('Thanks for Subscribing!', 'give'); ?> :)</p> |
|
635 | 635 | </div> |
636 | 636 | |
637 | 637 | <table class="form-table give-newsletter-form"> |
638 | 638 | <tr valign="middle"> |
639 | 639 | <td> |
640 | 640 | <label for="mce-EMAIL" |
641 | - class="screen-reader-text"><?php esc_html_e( 'Email Address (required)', 'give' ); ?></label> |
|
641 | + class="screen-reader-text"><?php esc_html_e('Email Address (required)', 'give'); ?></label> |
|
642 | 642 | <input type="email" name="EMAIL" id="mce-EMAIL" |
643 | - placeholder="<?php esc_attr_e( 'Email Address (required)', 'give' ); ?>" |
|
643 | + placeholder="<?php esc_attr_e('Email Address (required)', 'give'); ?>" |
|
644 | 644 | class="required email" value=""> |
645 | 645 | </td> |
646 | 646 | <td> |
647 | 647 | <label for="mce-FNAME" |
648 | - class="screen-reader-text"><?php esc_html_e( 'First Name', 'give' ); ?></label> |
|
648 | + class="screen-reader-text"><?php esc_html_e('First Name', 'give'); ?></label> |
|
649 | 649 | <input type="text" name="FNAME" id="mce-FNAME" |
650 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" class="" value=""> |
|
650 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" class="" value=""> |
|
651 | 651 | </td> |
652 | 652 | <td> |
653 | 653 | <label for="mce-LNAME" |
654 | - class="screen-reader-text"><?php esc_html_e( 'Last Name', 'give' ); ?></label> |
|
654 | + class="screen-reader-text"><?php esc_html_e('Last Name', 'give'); ?></label> |
|
655 | 655 | <input type="text" name="LNAME" id="mce-LNAME" |
656 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" class="" value=""> |
|
656 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" class="" value=""> |
|
657 | 657 | </td> |
658 | 658 | <td> |
659 | 659 | <input type="submit" name="subscribe" id="mc-embedded-subscribe" class="button" |
660 | - value="<?php esc_attr_e( 'Subscribe', 'give' ); ?>"> |
|
660 | + value="<?php esc_attr_e('Subscribe', 'give'); ?>"> |
|
661 | 661 | </td> |
662 | 662 | </tr> |
663 | 663 | </table> |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | <a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php |
721 | 721 | printf( |
722 | 722 | /* translators: %s: Give twitter user @givewp */ |
723 | - esc_html_e( 'Follow %s', 'give' ), |
|
723 | + esc_html_e('Follow %s', 'give'), |
|
724 | 724 | '@givewp' |
725 | 725 | ); |
726 | 726 | ?></a> |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | * |
750 | 750 | * @return string |
751 | 751 | */ |
752 | -function give_svg_icons( $icon ) { |
|
752 | +function give_svg_icons($icon) { |
|
753 | 753 | |
754 | 754 | // Store your SVGs in an associative array |
755 | 755 | $svgs = array( |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | ); |
762 | 762 | |
763 | 763 | // Return the chosen icon's SVG string |
764 | - return $svgs[ $icon ]; |
|
764 | + return $svgs[$icon]; |
|
765 | 765 | } |
766 | 766 | |
767 | 767 | /** |
@@ -773,15 +773,15 @@ discard block |
||
773 | 773 | * |
774 | 774 | * @return mixed |
775 | 775 | */ |
776 | -function modify_nav_menu_meta_box_object( $post_type ) { |
|
777 | - if ( isset( $post_type->name ) && $post_type->name == 'give_forms' ) { |
|
778 | - $post_type->labels->name = esc_html__( 'Donation Forms', 'give' ); |
|
776 | +function modify_nav_menu_meta_box_object($post_type) { |
|
777 | + if (isset($post_type->name) && $post_type->name == 'give_forms') { |
|
778 | + $post_type->labels->name = esc_html__('Donation Forms', 'give'); |
|
779 | 779 | } |
780 | 780 | |
781 | 781 | return $post_type; |
782 | 782 | } |
783 | 783 | |
784 | -add_filter( 'nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object' ); |
|
784 | +add_filter('nav_menu_meta_box_object', 'modify_nav_menu_meta_box_object'); |
|
785 | 785 | |
786 | 786 | |
787 | 787 | /** |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | * @license https://opensource.org/licenses/MIT MIT |
796 | 796 | */ |
797 | 797 | |
798 | -if ( ! function_exists( 'array_column' ) ) { |
|
798 | +if ( ! function_exists('array_column')) { |
|
799 | 799 | /** |
800 | 800 | * Returns the values from a single column of the input array, identified by |
801 | 801 | * the $columnKey. |
@@ -814,53 +814,53 @@ discard block |
||
814 | 814 | * |
815 | 815 | * @return array |
816 | 816 | */ |
817 | - function array_column( $input = null, $columnKey = null, $indexKey = null ) { |
|
817 | + function array_column($input = null, $columnKey = null, $indexKey = null) { |
|
818 | 818 | // Using func_get_args() in order to check for proper number of |
819 | 819 | // parameters and trigger errors exactly as the built-in array_column() |
820 | 820 | // does in PHP 5.5. |
821 | 821 | $argc = func_num_args(); |
822 | 822 | $params = func_get_args(); |
823 | 823 | |
824 | - if ( $argc < 2 ) { |
|
825 | - trigger_error( sprintf( esc_html__( 'array_column() expects at least 2 parameters, %s given.', 'give' ), $argc ), E_USER_WARNING ); |
|
824 | + if ($argc < 2) { |
|
825 | + trigger_error(sprintf(esc_html__('array_column() expects at least 2 parameters, %s given.', 'give'), $argc), E_USER_WARNING); |
|
826 | 826 | |
827 | 827 | return null; |
828 | 828 | } |
829 | 829 | |
830 | - if ( ! is_array( $params[0] ) ) { |
|
831 | - trigger_error( sprintf( esc_html__( 'array_column() expects parameter 1 to be array, %s given.', 'give' ), gettype( $params[0] ) ), E_USER_WARNING ); |
|
830 | + if ( ! is_array($params[0])) { |
|
831 | + trigger_error(sprintf(esc_html__('array_column() expects parameter 1 to be array, %s given.', 'give'), gettype($params[0])), E_USER_WARNING); |
|
832 | 832 | |
833 | 833 | return null; |
834 | 834 | } |
835 | 835 | |
836 | - if ( ! is_int( $params[1] ) |
|
837 | - && ! is_float( $params[1] ) |
|
838 | - && ! is_string( $params[1] ) |
|
836 | + if ( ! is_int($params[1]) |
|
837 | + && ! is_float($params[1]) |
|
838 | + && ! is_string($params[1]) |
|
839 | 839 | && $params[1] !== null |
840 | - && ! ( is_object( $params[1] ) && method_exists( $params[1], '__toString' ) ) |
|
840 | + && ! (is_object($params[1]) && method_exists($params[1], '__toString')) |
|
841 | 841 | ) { |
842 | - trigger_error( esc_html__( 'array_column(): The column key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
|
842 | + trigger_error(esc_html__('array_column(): The column key should be either a string or an integer.', 'give'), E_USER_WARNING); |
|
843 | 843 | |
844 | 844 | return false; |
845 | 845 | } |
846 | 846 | |
847 | - if ( isset( $params[2] ) |
|
848 | - && ! is_int( $params[2] ) |
|
849 | - && ! is_float( $params[2] ) |
|
850 | - && ! is_string( $params[2] ) |
|
851 | - && ! ( is_object( $params[2] ) && method_exists( $params[2], '__toString' ) ) |
|
847 | + if (isset($params[2]) |
|
848 | + && ! is_int($params[2]) |
|
849 | + && ! is_float($params[2]) |
|
850 | + && ! is_string($params[2]) |
|
851 | + && ! (is_object($params[2]) && method_exists($params[2], '__toString')) |
|
852 | 852 | ) { |
853 | - trigger_error( esc_html__( 'array_column(): The index key should be either a string or an integer.', 'give' ), E_USER_WARNING ); |
|
853 | + trigger_error(esc_html__('array_column(): The index key should be either a string or an integer.', 'give'), E_USER_WARNING); |
|
854 | 854 | |
855 | 855 | return false; |
856 | 856 | } |
857 | 857 | |
858 | 858 | $paramsInput = $params[0]; |
859 | - $paramsColumnKey = ( $params[1] !== null ) ? (string) $params[1] : null; |
|
859 | + $paramsColumnKey = ($params[1] !== null) ? (string) $params[1] : null; |
|
860 | 860 | |
861 | 861 | $paramsIndexKey = null; |
862 | - if ( isset( $params[2] ) ) { |
|
863 | - if ( is_float( $params[2] ) || is_int( $params[2] ) ) { |
|
862 | + if (isset($params[2])) { |
|
863 | + if (is_float($params[2]) || is_int($params[2])) { |
|
864 | 864 | $paramsIndexKey = (int) $params[2]; |
865 | 865 | } else { |
866 | 866 | $paramsIndexKey = (string) $params[2]; |
@@ -869,26 +869,26 @@ discard block |
||
869 | 869 | |
870 | 870 | $resultArray = array(); |
871 | 871 | |
872 | - foreach ( $paramsInput as $row ) { |
|
872 | + foreach ($paramsInput as $row) { |
|
873 | 873 | $key = $value = null; |
874 | 874 | $keySet = $valueSet = false; |
875 | 875 | |
876 | - if ( $paramsIndexKey !== null && array_key_exists( $paramsIndexKey, $row ) ) { |
|
876 | + if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) { |
|
877 | 877 | $keySet = true; |
878 | - $key = (string) $row[ $paramsIndexKey ]; |
|
878 | + $key = (string) $row[$paramsIndexKey]; |
|
879 | 879 | } |
880 | 880 | |
881 | - if ( $paramsColumnKey === null ) { |
|
881 | + if ($paramsColumnKey === null) { |
|
882 | 882 | $valueSet = true; |
883 | 883 | $value = $row; |
884 | - } elseif ( is_array( $row ) && array_key_exists( $paramsColumnKey, $row ) ) { |
|
884 | + } elseif (is_array($row) && array_key_exists($paramsColumnKey, $row)) { |
|
885 | 885 | $valueSet = true; |
886 | - $value = $row[ $paramsColumnKey ]; |
|
886 | + $value = $row[$paramsColumnKey]; |
|
887 | 887 | } |
888 | 888 | |
889 | - if ( $valueSet ) { |
|
890 | - if ( $keySet ) { |
|
891 | - $resultArray[ $key ] = $value; |
|
889 | + if ($valueSet) { |
|
890 | + if ($keySet) { |
|
891 | + $resultArray[$key] = $value; |
|
892 | 892 | } else { |
893 | 893 | $resultArray[] = $value; |
894 | 894 | } |
@@ -910,40 +910,40 @@ discard block |
||
910 | 910 | * |
911 | 911 | * @return bool Whether the receipt is visible or not. |
912 | 912 | */ |
913 | -function give_can_view_receipt( $payment_key = '' ) { |
|
913 | +function give_can_view_receipt($payment_key = '') { |
|
914 | 914 | |
915 | 915 | $return = false; |
916 | 916 | |
917 | - if ( empty( $payment_key ) ) { |
|
917 | + if (empty($payment_key)) { |
|
918 | 918 | return $return; |
919 | 919 | } |
920 | 920 | |
921 | 921 | global $give_receipt_args; |
922 | 922 | |
923 | - $give_receipt_args['id'] = give_get_purchase_id_by_key( $payment_key ); |
|
923 | + $give_receipt_args['id'] = give_get_purchase_id_by_key($payment_key); |
|
924 | 924 | |
925 | - $user_id = (int) give_get_payment_user_id( $give_receipt_args['id'] ); |
|
925 | + $user_id = (int) give_get_payment_user_id($give_receipt_args['id']); |
|
926 | 926 | |
927 | - $payment_meta = give_get_payment_meta( $give_receipt_args['id'] ); |
|
927 | + $payment_meta = give_get_payment_meta($give_receipt_args['id']); |
|
928 | 928 | |
929 | - if ( is_user_logged_in() ) { |
|
930 | - if ( $user_id === (int) get_current_user_id() ) { |
|
929 | + if (is_user_logged_in()) { |
|
930 | + if ($user_id === (int) get_current_user_id()) { |
|
931 | 931 | $return = true; |
932 | - } elseif ( wp_get_current_user()->user_email === give_get_payment_user_email( $give_receipt_args['id'] ) ) { |
|
932 | + } elseif (wp_get_current_user()->user_email === give_get_payment_user_email($give_receipt_args['id'])) { |
|
933 | 933 | $return = true; |
934 | - } elseif ( current_user_can( 'view_give_sensitive_data' ) ) { |
|
934 | + } elseif (current_user_can('view_give_sensitive_data')) { |
|
935 | 935 | $return = true; |
936 | 936 | } |
937 | 937 | } |
938 | 938 | |
939 | 939 | $session = give_get_purchase_session(); |
940 | - if ( ! empty( $session ) && ! is_user_logged_in() ) { |
|
941 | - if ( $session['purchase_key'] === $payment_meta['key'] ) { |
|
940 | + if ( ! empty($session) && ! is_user_logged_in()) { |
|
941 | + if ($session['purchase_key'] === $payment_meta['key']) { |
|
942 | 942 | $return = true; |
943 | 943 | } |
944 | 944 | } |
945 | 945 | |
946 | - return (bool) apply_filters( 'give_can_view_receipt', $return, $payment_key ); |
|
946 | + return (bool) apply_filters('give_can_view_receipt', $return, $payment_key); |
|
947 | 947 | |
948 | 948 | } |
949 | 949 | |
@@ -952,7 +952,7 @@ discard block |
||
952 | 952 | * |
953 | 953 | * Fallback in case the calendar extension is not loaded in PHP; Only supports Gregorian calendar |
954 | 954 | */ |
955 | -if ( ! function_exists( 'cal_days_in_month' ) ) { |
|
955 | +if ( ! function_exists('cal_days_in_month')) { |
|
956 | 956 | /** |
957 | 957 | * cal_days_in_month |
958 | 958 | * |
@@ -962,8 +962,8 @@ discard block |
||
962 | 962 | * |
963 | 963 | * @return bool|string |
964 | 964 | */ |
965 | - function cal_days_in_month( $calendar, $month, $year ) { |
|
966 | - return date( 't', mktime( 0, 0, 0, $month, 1, $year ) ); |
|
965 | + function cal_days_in_month($calendar, $month, $year) { |
|
966 | + return date('t', mktime(0, 0, 0, $month, 1, $year)); |
|
967 | 967 | } |
968 | 968 | } |
969 | 969 | |
@@ -982,42 +982,42 @@ discard block |
||
982 | 982 | */ |
983 | 983 | function give_get_plugins() { |
984 | 984 | $plugins = get_plugins(); |
985 | - $active_plugin_paths = (array) get_option( 'active_plugins', array() ); |
|
985 | + $active_plugin_paths = (array) get_option('active_plugins', array()); |
|
986 | 986 | |
987 | - if ( is_multisite() ) { |
|
988 | - $network_activated_plugin_paths = array_keys( get_site_option( 'active_sitewide_plugins', array() ) ); |
|
989 | - $active_plugin_paths = array_merge( $active_plugin_paths, $network_activated_plugin_paths ); |
|
987 | + if (is_multisite()) { |
|
988 | + $network_activated_plugin_paths = array_keys(get_site_option('active_sitewide_plugins', array())); |
|
989 | + $active_plugin_paths = array_merge($active_plugin_paths, $network_activated_plugin_paths); |
|
990 | 990 | } |
991 | 991 | |
992 | - foreach ( $plugins as $plugin_path => $plugin_data ) { |
|
992 | + foreach ($plugins as $plugin_path => $plugin_data) { |
|
993 | 993 | // Is plugin active? |
994 | - if ( in_array( $plugin_path, $active_plugin_paths ) ) { |
|
995 | - $plugins[ $plugin_path ]['Status'] = 'active'; |
|
994 | + if (in_array($plugin_path, $active_plugin_paths)) { |
|
995 | + $plugins[$plugin_path]['Status'] = 'active'; |
|
996 | 996 | } else { |
997 | - $plugins[ $plugin_path ]['Status'] = 'inactive'; |
|
997 | + $plugins[$plugin_path]['Status'] = 'inactive'; |
|
998 | 998 | } |
999 | 999 | |
1000 | - $dirname = strtolower( dirname( $plugin_path ) ); |
|
1000 | + $dirname = strtolower(dirname($plugin_path)); |
|
1001 | 1001 | |
1002 | 1002 | // Is plugin a Give add-on by WordImpress? |
1003 | - if ( strstr( $dirname, 'give-' ) && strstr( $plugin_data['AuthorURI'], 'wordimpress.com' ) ) { |
|
1003 | + if (strstr($dirname, 'give-') && strstr($plugin_data['AuthorURI'], 'wordimpress.com')) { |
|
1004 | 1004 | // Plugin is a Give-addon. |
1005 | - $plugins[ $plugin_path ]['Type'] = 'add-on'; |
|
1005 | + $plugins[$plugin_path]['Type'] = 'add-on'; |
|
1006 | 1006 | |
1007 | 1007 | // Get license info from database. |
1008 | - $plugin_name = str_replace( 'Give - ', '', $plugin_data['Name'] ); |
|
1009 | - $db_option = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $plugin_name ) ) ) . '_license_active'; |
|
1010 | - $license_active = get_option( $db_option ); |
|
1008 | + $plugin_name = str_replace('Give - ', '', $plugin_data['Name']); |
|
1009 | + $db_option = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($plugin_name))).'_license_active'; |
|
1010 | + $license_active = get_option($db_option); |
|
1011 | 1011 | |
1012 | 1012 | // Does a valid license exist? |
1013 | - if ( ! empty( $license_active ) && 'valid' === $license_active->license ) { |
|
1014 | - $plugins[ $plugin_path ]['License'] = true; |
|
1013 | + if ( ! empty($license_active) && 'valid' === $license_active->license) { |
|
1014 | + $plugins[$plugin_path]['License'] = true; |
|
1015 | 1015 | } else { |
1016 | - $plugins[ $plugin_path ]['License'] = false; |
|
1016 | + $plugins[$plugin_path]['License'] = false; |
|
1017 | 1017 | } |
1018 | 1018 | } else { |
1019 | 1019 | // Plugin is not a Give add-on. |
1020 | - $plugins[ $plugin_path ]['Type'] = 'other'; |
|
1020 | + $plugins[$plugin_path]['Type'] = 'other'; |
|
1021 | 1021 | } |
1022 | 1022 | } |
1023 | 1023 | |
@@ -1034,16 +1034,16 @@ discard block |
||
1034 | 1034 | * |
1035 | 1035 | * @return bool |
1036 | 1036 | */ |
1037 | -function give_is_terms_enabled( $form_id ) { |
|
1038 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
1037 | +function give_is_terms_enabled($form_id) { |
|
1038 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
1039 | 1039 | |
1040 | 1040 | if ( |
1041 | - give_is_setting_enabled( $form_option, 'global' ) |
|
1042 | - && give_is_setting_enabled( give_get_option( 'terms' ) ) |
|
1041 | + give_is_setting_enabled($form_option, 'global') |
|
1042 | + && give_is_setting_enabled(give_get_option('terms')) |
|
1043 | 1043 | ) { |
1044 | 1044 | return true; |
1045 | 1045 | |
1046 | - } elseif ( give_is_setting_enabled( $form_option ) ) { |
|
1046 | + } elseif (give_is_setting_enabled($form_option)) { |
|
1047 | 1047 | return true; |
1048 | 1048 | |
1049 | 1049 | } else { |
@@ -1066,9 +1066,9 @@ discard block |
||
1066 | 1066 | * |
1067 | 1067 | * @return WP_Error|bool |
1068 | 1068 | */ |
1069 | -function give_delete_donation_stats( $date_range = '', $args = array() ) { |
|
1069 | +function give_delete_donation_stats($date_range = '', $args = array()) { |
|
1070 | 1070 | // Delete all cache. |
1071 | - $status = Give_Cache::delete( Give_Cache::get_options_like( 'give_stats' ) ); |
|
1071 | + $status = Give_Cache::delete(Give_Cache::get_options_like('give_stats')); |
|
1072 | 1072 | |
1073 | 1073 | /** |
1074 | 1074 | * Fire the action when donation stats delete. |
@@ -1078,7 +1078,7 @@ discard block |
||
1078 | 1078 | * @param string|array $date_range |
1079 | 1079 | * @param array $args |
1080 | 1080 | */ |
1081 | - do_action( 'give_delete_donation_stats', $status, $date_range, $args ); |
|
1081 | + do_action('give_delete_donation_stats', $status, $date_range, $args); |
|
1082 | 1082 | |
1083 | 1083 | return $status; |
1084 | 1084 | } |
1085 | 1085 | \ No newline at end of file |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | -if ( ! class_exists( 'Give_License' ) ) : |
|
17 | +if ( ! class_exists('Give_License')) : |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Give_License Class |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @var string |
105 | 105 | */ |
106 | - private $api_url = 'https://givewp.com/edd-sl-api/'; |
|
106 | + private $api_url = 'https://givewp.com/edd-sl-api/'; |
|
107 | 107 | |
108 | 108 | /** |
109 | 109 | * Account URL |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * |
114 | 114 | * @var null|string |
115 | 115 | */ |
116 | - private $account_url = 'https://givewp.com/my-account/'; |
|
116 | + private $account_url = 'https://givewp.com/my-account/'; |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Ccheckout URL |
@@ -142,19 +142,19 @@ discard block |
||
142 | 142 | * @param string $_checkout_url |
143 | 143 | * @param string $_account_url |
144 | 144 | */ |
145 | - public function __construct( $_file, $_item_name, $_version, $_author, $_optname = null, $_api_url = null, $_checkout_url = null, $_account_url = null ) { |
|
145 | + public function __construct($_file, $_item_name, $_version, $_author, $_optname = null, $_api_url = null, $_checkout_url = null, $_account_url = null) { |
|
146 | 146 | $give_options = give_get_settings(); |
147 | 147 | |
148 | 148 | $this->file = $_file; |
149 | 149 | $this->item_name = $_item_name; |
150 | - $this->item_shortname = 'give_' . preg_replace( '/[^a-zA-Z0-9_\s]/', '', str_replace( ' ', '_', strtolower( $this->item_name ) ) ); |
|
150 | + $this->item_shortname = 'give_'.preg_replace('/[^a-zA-Z0-9_\s]/', '', str_replace(' ', '_', strtolower($this->item_name))); |
|
151 | 151 | $this->version = $_version; |
152 | - $this->license = isset( $give_options[ $this->item_shortname . '_license_key' ] ) ? trim( $give_options[ $this->item_shortname . '_license_key' ] ) : ''; |
|
153 | - $this->license_data = get_option( $this->item_shortname . '_license_active' ); |
|
152 | + $this->license = isset($give_options[$this->item_shortname.'_license_key']) ? trim($give_options[$this->item_shortname.'_license_key']) : ''; |
|
153 | + $this->license_data = get_option($this->item_shortname.'_license_active'); |
|
154 | 154 | $this->author = $_author; |
155 | - $this->api_url = is_null( $_api_url ) ? $this->api_url : $_api_url; |
|
156 | - $this->checkout_url = is_null( $_checkout_url ) ? $this->checkout_url : $_checkout_url; |
|
157 | - $this->account_url = is_null( $_account_url ) ? $this->account_url : $_account_url; |
|
155 | + $this->api_url = is_null($_api_url) ? $this->api_url : $_api_url; |
|
156 | + $this->checkout_url = is_null($_checkout_url) ? $this->checkout_url : $_checkout_url; |
|
157 | + $this->account_url = is_null($_account_url) ? $this->account_url : $_account_url; |
|
158 | 158 | |
159 | 159 | // Setup hooks |
160 | 160 | $this->includes(); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * @return void |
174 | 174 | */ |
175 | 175 | private function includes() { |
176 | - if ( ! class_exists( 'EDD_SL_Plugin_Updater' ) ) { |
|
176 | + if ( ! class_exists('EDD_SL_Plugin_Updater')) { |
|
177 | 177 | require_once 'admin/EDD_SL_Plugin_Updater.php'; |
178 | 178 | } |
179 | 179 | } |
@@ -191,26 +191,26 @@ discard block |
||
191 | 191 | private function hooks() { |
192 | 192 | |
193 | 193 | // Register settings |
194 | - add_filter( 'give_settings_licenses', array( $this, 'settings' ), 1 ); |
|
194 | + add_filter('give_settings_licenses', array($this, 'settings'), 1); |
|
195 | 195 | |
196 | 196 | // Activate license key on settings save |
197 | - add_action( 'admin_init', array( $this, 'activate_license' ) ); |
|
197 | + add_action('admin_init', array($this, 'activate_license')); |
|
198 | 198 | |
199 | 199 | // Deactivate license key |
200 | - add_action( 'admin_init', array( $this, 'deactivate_license' ) ); |
|
200 | + add_action('admin_init', array($this, 'deactivate_license')); |
|
201 | 201 | |
202 | 202 | // Updater |
203 | - add_action( 'admin_init', array( $this, 'auto_updater' ), 0 ); |
|
203 | + add_action('admin_init', array($this, 'auto_updater'), 0); |
|
204 | 204 | |
205 | - add_action( 'admin_notices', array( $this, 'notices' ) ); |
|
205 | + add_action('admin_notices', array($this, 'notices')); |
|
206 | 206 | |
207 | 207 | // Check license weekly. |
208 | - add_action( 'give_weekly_scheduled_events', array( $this, 'weekly_license_check' ) ); |
|
209 | - add_action( 'give_validate_license_when_site_migrated', array( $this, 'weekly_license_check' ) ); |
|
208 | + add_action('give_weekly_scheduled_events', array($this, 'weekly_license_check')); |
|
209 | + add_action('give_validate_license_when_site_migrated', array($this, 'weekly_license_check')); |
|
210 | 210 | |
211 | 211 | // Check subscription weekly. |
212 | - add_action( 'give_weekly_scheduled_events', array( $this, 'weekly_subscription_check' ) ); |
|
213 | - add_action( 'give_validate_license_when_site_migrated', array( $this, 'weekly_subscription_check' ) ); |
|
212 | + add_action('give_weekly_scheduled_events', array($this, 'weekly_subscription_check')); |
|
213 | + add_action('give_validate_license_when_site_migrated', array($this, 'weekly_subscription_check')); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | */ |
224 | 224 | public function auto_updater() { |
225 | 225 | |
226 | - if ( ! $this->is_valid_license() ) { |
|
226 | + if ( ! $this->is_valid_license()) { |
|
227 | 227 | return false; |
228 | 228 | } |
229 | 229 | |
@@ -252,16 +252,16 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @return array License settings. |
254 | 254 | */ |
255 | - public function settings( $settings ) { |
|
255 | + public function settings($settings) { |
|
256 | 256 | |
257 | 257 | $give_license_settings = array( |
258 | 258 | array( |
259 | 259 | 'name' => $this->item_name, |
260 | - 'id' => $this->item_shortname . '_license_key', |
|
260 | + 'id' => $this->item_shortname.'_license_key', |
|
261 | 261 | 'desc' => '', |
262 | 262 | 'type' => 'license_key', |
263 | 263 | 'options' => array( |
264 | - 'license' => get_option( $this->item_shortname . '_license_active' ), |
|
264 | + 'license' => get_option($this->item_shortname.'_license_active'), |
|
265 | 265 | 'shortname' => $this->item_shortname, |
266 | 266 | 'item_name' => $this->item_name, |
267 | 267 | 'api_url' => $this->api_url, |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | ) |
273 | 273 | ); |
274 | 274 | |
275 | - return array_merge( $settings, $give_license_settings ); |
|
275 | + return array_merge($settings, $give_license_settings); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
@@ -287,18 +287,18 @@ discard block |
||
287 | 287 | * |
288 | 288 | * @return array License settings content. |
289 | 289 | */ |
290 | - public function license_settings_content( $settings ) { |
|
290 | + public function license_settings_content($settings) { |
|
291 | 291 | |
292 | 292 | $give_license_settings = array( |
293 | 293 | array( |
294 | - 'name' => esc_html__( 'Add-on Licenses', 'give' ), |
|
294 | + 'name' => esc_html__('Add-on Licenses', 'give'), |
|
295 | 295 | 'desc' => '<hr>', |
296 | 296 | 'type' => 'give_title', |
297 | 297 | 'id' => 'give_title' |
298 | 298 | ), |
299 | 299 | ); |
300 | 300 | |
301 | - return array_merge( $settings, $give_license_settings ); |
|
301 | + return array_merge($settings, $give_license_settings); |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | /** |
@@ -313,37 +313,37 @@ discard block |
||
313 | 313 | */ |
314 | 314 | public function activate_license() { |
315 | 315 | // Bailout: Check if license key set of not. |
316 | - if ( ! isset( $_POST[ $this->item_shortname . '_license_key' ] ) ) { |
|
316 | + if ( ! isset($_POST[$this->item_shortname.'_license_key'])) { |
|
317 | 317 | return; |
318 | 318 | } |
319 | 319 | |
320 | 320 | // Security check. |
321 | - if ( ! wp_verify_nonce( $_REQUEST[ $this->item_shortname . '_license_key-nonce' ], $this->item_shortname . '_license_key-nonce' ) ) { |
|
321 | + if ( ! wp_verify_nonce($_REQUEST[$this->item_shortname.'_license_key-nonce'], $this->item_shortname.'_license_key-nonce')) { |
|
322 | 322 | |
323 | - wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
323 | + wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
324 | 324 | |
325 | 325 | } |
326 | 326 | |
327 | 327 | // Check if user have correct permissions. |
328 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
328 | + if ( ! current_user_can('manage_give_settings')) { |
|
329 | 329 | return; |
330 | 330 | } |
331 | 331 | |
332 | 332 | // Allow third party addon developers to handle license activation. |
333 | - if( $this->__is_third_party_addon() ){ |
|
334 | - do_action( 'give_activate_license', $this ); |
|
333 | + if ($this->__is_third_party_addon()) { |
|
334 | + do_action('give_activate_license', $this); |
|
335 | 335 | return; |
336 | 336 | } |
337 | 337 | |
338 | 338 | // Delete previous license setting if a empty license key submitted. |
339 | - if ( empty( $_POST[ $this->item_shortname . '_license_key' ] ) ) { |
|
340 | - delete_option( $this->item_shortname . '_license_active' ); |
|
339 | + if (empty($_POST[$this->item_shortname.'_license_key'])) { |
|
340 | + delete_option($this->item_shortname.'_license_active'); |
|
341 | 341 | return; |
342 | 342 | } |
343 | 343 | |
344 | 344 | // Do not simultaneously activate any addon if user want to deactivate any addon. |
345 | - foreach ( $_POST as $key => $value ) { |
|
346 | - if ( false !== strpos( $key, 'license_key_deactivate' ) ) { |
|
345 | + foreach ($_POST as $key => $value) { |
|
346 | + if (false !== strpos($key, 'license_key_deactivate')) { |
|
347 | 347 | // Don't activate a key when deactivating a different key |
348 | 348 | return; |
349 | 349 | } |
@@ -351,15 +351,15 @@ discard block |
||
351 | 351 | |
352 | 352 | |
353 | 353 | // Check if plugin previously installed. |
354 | - if ( $this->is_valid_license() ) { |
|
354 | + if ($this->is_valid_license()) { |
|
355 | 355 | return; |
356 | 356 | } |
357 | 357 | |
358 | 358 | // Get license key. |
359 | - $license = sanitize_text_field( $_POST[ $this->item_shortname . '_license_key' ] ); |
|
359 | + $license = sanitize_text_field($_POST[$this->item_shortname.'_license_key']); |
|
360 | 360 | |
361 | 361 | // Bailout. |
362 | - if( empty( $license ) ) { |
|
362 | + if (empty($license)) { |
|
363 | 363 | return; |
364 | 364 | } |
365 | 365 | |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | $api_params = array( |
371 | 371 | 'edd_action' => 'activate_license', //never change from "edd_" to "give_"! |
372 | 372 | 'license' => $license, |
373 | - 'item_name' => urlencode( $this->item_name ), |
|
373 | + 'item_name' => urlencode($this->item_name), |
|
374 | 374 | 'url' => home_url() |
375 | 375 | ); |
376 | 376 | |
@@ -385,16 +385,16 @@ discard block |
||
385 | 385 | ); |
386 | 386 | |
387 | 387 | // Make sure there are no errors |
388 | - if ( is_wp_error( $response ) ) { |
|
388 | + if (is_wp_error($response)) { |
|
389 | 389 | return; |
390 | 390 | } |
391 | 391 | |
392 | 392 | // Tell WordPress to look for updates |
393 | - set_site_transient( 'update_plugins', null ); |
|
393 | + set_site_transient('update_plugins', null); |
|
394 | 394 | |
395 | 395 | // Decode license data |
396 | - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
397 | - update_option( $this->item_shortname . '_license_active', $license_data ); |
|
396 | + $license_data = json_decode(wp_remote_retrieve_body($response)); |
|
397 | + update_option($this->item_shortname.'_license_active', $license_data); |
|
398 | 398 | |
399 | 399 | // Check subscription for license key and store this to db (if any). |
400 | 400 | $this->__single_subscription_check(); |
@@ -412,34 +412,34 @@ discard block |
||
412 | 412 | */ |
413 | 413 | public function deactivate_license() { |
414 | 414 | |
415 | - if ( ! isset( $_POST[ $this->item_shortname . '_license_key' ] ) ) { |
|
415 | + if ( ! isset($_POST[$this->item_shortname.'_license_key'])) { |
|
416 | 416 | return; |
417 | 417 | } |
418 | 418 | |
419 | - if ( ! wp_verify_nonce( $_REQUEST[ $this->item_shortname . '_license_key-nonce' ], $this->item_shortname . '_license_key-nonce' ) ) { |
|
419 | + if ( ! wp_verify_nonce($_REQUEST[$this->item_shortname.'_license_key-nonce'], $this->item_shortname.'_license_key-nonce')) { |
|
420 | 420 | |
421 | - wp_die( esc_html__( 'Nonce verification failed.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
421 | + wp_die(esc_html__('Nonce verification failed.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
422 | 422 | |
423 | 423 | } |
424 | 424 | |
425 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
425 | + if ( ! current_user_can('manage_give_settings')) { |
|
426 | 426 | return; |
427 | 427 | } |
428 | 428 | |
429 | 429 | // Allow third party addon developers to handle license deactivation. |
430 | - if( $this->__is_third_party_addon() ){ |
|
431 | - do_action( 'give_deactivate_license', $this ); |
|
430 | + if ($this->__is_third_party_addon()) { |
|
431 | + do_action('give_deactivate_license', $this); |
|
432 | 432 | return; |
433 | 433 | } |
434 | 434 | |
435 | 435 | // Run on deactivate button press |
436 | - if ( isset( $_POST[ $this->item_shortname . '_license_key_deactivate' ] ) ) { |
|
436 | + if (isset($_POST[$this->item_shortname.'_license_key_deactivate'])) { |
|
437 | 437 | |
438 | 438 | // Data to send to the API |
439 | 439 | $api_params = array( |
440 | 440 | 'edd_action' => 'deactivate_license', //never change from "edd_" to "give_"! |
441 | 441 | 'license' => $this->license, |
442 | - 'item_name' => urlencode( $this->item_name ), |
|
442 | + 'item_name' => urlencode($this->item_name), |
|
443 | 443 | 'url' => home_url() |
444 | 444 | ); |
445 | 445 | |
@@ -454,15 +454,15 @@ discard block |
||
454 | 454 | ); |
455 | 455 | |
456 | 456 | // Make sure there are no errors |
457 | - if ( is_wp_error( $response ) ) { |
|
457 | + if (is_wp_error($response)) { |
|
458 | 458 | return; |
459 | 459 | } |
460 | 460 | |
461 | 461 | // Decode the license data |
462 | - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
462 | + $license_data = json_decode(wp_remote_retrieve_body($response)); |
|
463 | 463 | |
464 | 464 | // Remove license data. |
465 | - delete_option( $this->item_shortname . '_license_active' ); |
|
465 | + delete_option($this->item_shortname.'_license_active'); |
|
466 | 466 | |
467 | 467 | // Remove license key from subscriptions if exist. |
468 | 468 | $this->__remove_license_key_from_subscriptions(); |
@@ -479,18 +479,18 @@ discard block |
||
479 | 479 | */ |
480 | 480 | public function weekly_license_check() { |
481 | 481 | |
482 | - if( ! empty( $_POST['give_settings'] ) ) { |
|
482 | + if ( ! empty($_POST['give_settings'])) { |
|
483 | 483 | // Don't fire when saving settings |
484 | 484 | return false; |
485 | 485 | } |
486 | 486 | |
487 | - if( empty( $this->license ) ) { |
|
487 | + if (empty($this->license)) { |
|
488 | 488 | return false; |
489 | 489 | } |
490 | 490 | |
491 | 491 | // Allow third party addon developers to handle their license check. |
492 | - if( $this->__is_third_party_addon() ){ |
|
493 | - do_action( 'give_weekly_license_check', $this ); |
|
492 | + if ($this->__is_third_party_addon()) { |
|
493 | + do_action('give_weekly_license_check', $this); |
|
494 | 494 | return false; |
495 | 495 | } |
496 | 496 | |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | $api_params = array( |
499 | 499 | 'edd_action'=> 'check_license', |
500 | 500 | 'license' => $this->license, |
501 | - 'item_name' => urlencode( $this->item_name ), |
|
501 | + 'item_name' => urlencode($this->item_name), |
|
502 | 502 | 'url' => home_url() |
503 | 503 | ); |
504 | 504 | |
@@ -513,12 +513,12 @@ discard block |
||
513 | 513 | ); |
514 | 514 | |
515 | 515 | // Make sure the response came back okay. |
516 | - if ( is_wp_error( $response ) ) { |
|
516 | + if (is_wp_error($response)) { |
|
517 | 517 | return false; |
518 | 518 | } |
519 | 519 | |
520 | - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
521 | - update_option( $this->item_shortname . '_license_active', $license_data ); |
|
520 | + $license_data = json_decode(wp_remote_retrieve_body($response)); |
|
521 | + update_option($this->item_shortname.'_license_active', $license_data); |
|
522 | 522 | } |
523 | 523 | |
524 | 524 | /** |
@@ -531,24 +531,24 @@ discard block |
||
531 | 531 | */ |
532 | 532 | public function weekly_subscription_check() { |
533 | 533 | |
534 | - if( ! empty( $_POST['give_settings'] ) ) { |
|
534 | + if ( ! empty($_POST['give_settings'])) { |
|
535 | 535 | // Don't fire when saving settings |
536 | 536 | return false; |
537 | 537 | } |
538 | 538 | |
539 | 539 | // Remove old subscription data. |
540 | - if( absint( get_option( '_give_subscriptions_edit_last', true ) ) < current_time( 'timestamp' , 1 ) ){ |
|
541 | - delete_option( 'give_subscriptions' ); |
|
542 | - update_option( '_give_subscriptions_edit_last', strtotime( '+ 1 day', current_time( 'timestamp' , 1 ) ) ); |
|
540 | + if (absint(get_option('_give_subscriptions_edit_last', true)) < current_time('timestamp', 1)) { |
|
541 | + delete_option('give_subscriptions'); |
|
542 | + update_option('_give_subscriptions_edit_last', strtotime('+ 1 day', current_time('timestamp', 1))); |
|
543 | 543 | } |
544 | 544 | |
545 | - if( empty( $this->license ) ) { |
|
545 | + if (empty($this->license)) { |
|
546 | 546 | return false; |
547 | 547 | } |
548 | 548 | |
549 | 549 | // Allow third party addon developers to handle there subscription check. |
550 | - if( $this->__is_third_party_addon() ){ |
|
551 | - do_action( 'give_weekly_subscription_check', $this ); |
|
550 | + if ($this->__is_third_party_addon()) { |
|
551 | + do_action('give_weekly_subscription_check', $this); |
|
552 | 552 | return false; |
553 | 553 | } |
554 | 554 | |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | // This is custom feature to check subscriptions. |
563 | 563 | 'edd_action'=> 'check_subscription', |
564 | 564 | 'license' => $this->license, |
565 | - 'item_name' => urlencode( $this->item_name ), |
|
565 | + 'item_name' => urlencode($this->item_name), |
|
566 | 566 | 'url' => home_url() |
567 | 567 | ); |
568 | 568 | |
@@ -577,27 +577,27 @@ discard block |
||
577 | 577 | ); |
578 | 578 | |
579 | 579 | // Make sure the response came back okay. |
580 | - if ( is_wp_error( $response ) ) { |
|
580 | + if (is_wp_error($response)) { |
|
581 | 581 | return false; |
582 | 582 | } |
583 | 583 | |
584 | - $subscription_data = json_decode( wp_remote_retrieve_body( $response ), true ); |
|
584 | + $subscription_data = json_decode(wp_remote_retrieve_body($response), true); |
|
585 | 585 | |
586 | - if( ! empty( $subscription_data['success'] ) && absint( $subscription_data['success'] ) ) { |
|
587 | - $subscriptions = get_option( 'give_subscriptions', array() ); |
|
586 | + if ( ! empty($subscription_data['success']) && absint($subscription_data['success'])) { |
|
587 | + $subscriptions = get_option('give_subscriptions', array()); |
|
588 | 588 | |
589 | 589 | // Update subscription data only if subscription does not exist already. |
590 | - if( ! array_key_exists( $subscription_data['id'], $subscriptions ) ) { |
|
591 | - $subscriptions[ $subscription_data['id'] ] = $subscription_data; |
|
592 | - $subscriptions[ $subscription_data['id'] ]['licenses'] = array(); |
|
590 | + if ( ! array_key_exists($subscription_data['id'], $subscriptions)) { |
|
591 | + $subscriptions[$subscription_data['id']] = $subscription_data; |
|
592 | + $subscriptions[$subscription_data['id']]['licenses'] = array(); |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | // Store licenses for subscription. |
596 | - if( ! in_array( $this->license, $subscriptions[ $subscription_data['id'] ]['licenses'] ) ) { |
|
597 | - $subscriptions[ $subscription_data['id'] ]['licenses'][] = $this->license; |
|
596 | + if ( ! in_array($this->license, $subscriptions[$subscription_data['id']]['licenses'])) { |
|
597 | + $subscriptions[$subscription_data['id']]['licenses'][] = $this->license; |
|
598 | 598 | } |
599 | 599 | |
600 | - update_option( 'give_subscriptions', $subscriptions ); |
|
600 | + update_option('give_subscriptions', $subscriptions); |
|
601 | 601 | } |
602 | 602 | } |
603 | 603 | |
@@ -611,11 +611,11 @@ discard block |
||
611 | 611 | */ |
612 | 612 | private function __single_subscription_check() { |
613 | 613 | // Do not fire if license key is not set. |
614 | - if ( ! isset( $_POST[ $this->item_shortname . '_license_key' ] ) ) { |
|
614 | + if ( ! isset($_POST[$this->item_shortname.'_license_key'])) { |
|
615 | 615 | return false; |
616 | 616 | } |
617 | 617 | |
618 | - if( empty( $this->license ) ) { |
|
618 | + if (empty($this->license)) { |
|
619 | 619 | return false; |
620 | 620 | } |
621 | 621 | |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | // This is custom feature to check subscriptions. |
627 | 627 | 'edd_action'=> 'check_subscription', |
628 | 628 | 'license' => $this->license, |
629 | - 'item_name' => urlencode( $this->item_name ), |
|
629 | + 'item_name' => urlencode($this->item_name), |
|
630 | 630 | 'url' => home_url() |
631 | 631 | ); |
632 | 632 | |
@@ -641,27 +641,27 @@ discard block |
||
641 | 641 | ); |
642 | 642 | |
643 | 643 | // Make sure the response came back okay. |
644 | - if ( is_wp_error( $response ) ) { |
|
644 | + if (is_wp_error($response)) { |
|
645 | 645 | return false; |
646 | 646 | } |
647 | 647 | |
648 | - $subscription_data = json_decode( wp_remote_retrieve_body( $response ), true ); |
|
648 | + $subscription_data = json_decode(wp_remote_retrieve_body($response), true); |
|
649 | 649 | |
650 | - if( ! empty( $subscription_data['success'] ) && absint( $subscription_data['success'] ) ) { |
|
651 | - $subscriptions = get_option( 'give_subscriptions', array() ); |
|
650 | + if ( ! empty($subscription_data['success']) && absint($subscription_data['success'])) { |
|
651 | + $subscriptions = get_option('give_subscriptions', array()); |
|
652 | 652 | |
653 | 653 | // Update subscription data only if subscription does not exist already. |
654 | - if( ! array_key_exists( $subscription_data['id'], $subscriptions ) ) { |
|
655 | - $subscriptions[ $subscription_data['id'] ] = $subscription_data; |
|
656 | - $subscriptions[ $subscription_data['id'] ]['licenses'] = array(); |
|
654 | + if ( ! array_key_exists($subscription_data['id'], $subscriptions)) { |
|
655 | + $subscriptions[$subscription_data['id']] = $subscription_data; |
|
656 | + $subscriptions[$subscription_data['id']]['licenses'] = array(); |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | // Store licenses for subscription. |
660 | - if( ! in_array( $this->license, $subscriptions[ $subscription_data['id'] ]['licenses'] ) ) { |
|
661 | - $subscriptions[ $subscription_data['id'] ]['licenses'][] = $this->license; |
|
660 | + if ( ! in_array($this->license, $subscriptions[$subscription_data['id']]['licenses'])) { |
|
661 | + $subscriptions[$subscription_data['id']]['licenses'][] = $this->license; |
|
662 | 662 | } |
663 | 663 | |
664 | - update_option( 'give_subscriptions', $subscriptions ); |
|
664 | + update_option('give_subscriptions', $subscriptions); |
|
665 | 665 | } |
666 | 666 | } |
667 | 667 | |
@@ -674,12 +674,12 @@ discard block |
||
674 | 674 | * @return void |
675 | 675 | */ |
676 | 676 | public function notices() { |
677 | - if( ! current_user_can( 'manage_give_settings' ) ) { |
|
677 | + if ( ! current_user_can('manage_give_settings')) { |
|
678 | 678 | return; |
679 | 679 | } |
680 | 680 | |
681 | 681 | // Do not show licenses notices on license tab. |
682 | - if( 'licenses' === give_get_current_setting_tab() ) { |
|
682 | + if ('licenses' === give_get_current_setting_tab()) { |
|
683 | 683 | return; |
684 | 684 | } |
685 | 685 | |
@@ -688,93 +688,93 @@ discard block |
||
688 | 688 | static $addon_license_key_in_subscriptions; |
689 | 689 | |
690 | 690 | // Set default value. |
691 | - $addon_license_key_in_subscriptions = ! empty( $addon_license_key_in_subscriptions ) ? $addon_license_key_in_subscriptions : array(); |
|
691 | + $addon_license_key_in_subscriptions = ! empty($addon_license_key_in_subscriptions) ? $addon_license_key_in_subscriptions : array(); |
|
692 | 692 | $messages = array(); |
693 | 693 | |
694 | - if( |
|
695 | - empty( $this->license ) |
|
696 | - && ! $this->__is_notice_dismissed( 'general' ) |
|
697 | - && empty( $showed_invalid_message ) |
|
694 | + if ( |
|
695 | + empty($this->license) |
|
696 | + && ! $this->__is_notice_dismissed('general') |
|
697 | + && empty($showed_invalid_message) |
|
698 | 698 | ) { |
699 | 699 | $messages['general'] = sprintf( |
700 | - __( 'You have invalid or expired license keys for Give Addon. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give' ), |
|
701 | - admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=licenses' ) |
|
700 | + __('You have invalid or expired license keys for Give Addon. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give'), |
|
701 | + admin_url('edit.php?post_type=give_forms&page=give-settings&tab=licenses') |
|
702 | 702 | ); |
703 | 703 | $showed_invalid_message = true; |
704 | 704 | |
705 | 705 | } |
706 | 706 | |
707 | 707 | // Get subscriptions. |
708 | - $subscriptions = get_option( 'give_subscriptions' ); |
|
708 | + $subscriptions = get_option('give_subscriptions'); |
|
709 | 709 | |
710 | 710 | // Show subscription messages. |
711 | - if( ! empty( $subscriptions ) && ! $showed_subscriptions_message ) { |
|
711 | + if ( ! empty($subscriptions) && ! $showed_subscriptions_message) { |
|
712 | 712 | |
713 | - foreach ( $subscriptions as $subscription ) { |
|
713 | + foreach ($subscriptions as $subscription) { |
|
714 | 714 | // Subscription expires timestamp. |
715 | - $subscription_expires = strtotime( $subscription['expires'] ); |
|
715 | + $subscription_expires = strtotime($subscription['expires']); |
|
716 | 716 | |
717 | 717 | // Start showing subscriptions message before one week of renewal date. |
718 | - if( strtotime( '- 7 days', $subscription_expires ) > current_time( 'timestamp', 1 ) ) { |
|
718 | + if (strtotime('- 7 days', $subscription_expires) > current_time('timestamp', 1)) { |
|
719 | 719 | continue; |
720 | 720 | } |
721 | 721 | |
722 | 722 | // Check if subscription message already exist in messages. |
723 | - if( array_key_exists( $subscription['id'], $messages ) ) { |
|
723 | + if (array_key_exists($subscription['id'], $messages)) { |
|
724 | 724 | continue; |
725 | 725 | } |
726 | 726 | |
727 | - if( ( ! $this->__is_notice_dismissed( $subscription['id'] ) && 'active' !== $subscription['status'] ) ) { |
|
727 | + if (( ! $this->__is_notice_dismissed($subscription['id']) && 'active' !== $subscription['status'])) { |
|
728 | 728 | |
729 | - if( strtotime( $subscription['expires'] ) < current_time( 'timestamp', 1 ) ) {// Check if license already expired. |
|
729 | + if (strtotime($subscription['expires']) < current_time('timestamp', 1)) {// Check if license already expired. |
|
730 | 730 | $messages[$subscription['id']] = sprintf( |
731 | - __( 'You Give addon license expired for payment <a href="%s" target="_blank">#%d</a>. <a href="%s" target="_blank">Click to renew an existing license</a> or <a href="%s">Click here if already renewed</a>.', 'give' ), |
|
732 | - urldecode( $subscription['invoice_url'] ), |
|
731 | + __('You Give addon license expired for payment <a href="%s" target="_blank">#%d</a>. <a href="%s" target="_blank">Click to renew an existing license</a> or <a href="%s">Click here if already renewed</a>.', 'give'), |
|
732 | + urldecode($subscription['invoice_url']), |
|
733 | 733 | $subscription['payment_id'], |
734 | 734 | "{$this->checkout_url}?edd_license_key={$subscription['license_key']}&utm_campaign=admin&utm_source=licenses&utm_medium=expired", |
735 | - esc_url( add_query_arg( '_give_hide_license_notices_permanently', $subscription['id'], $_SERVER['REQUEST_URI'] ) ) |
|
735 | + esc_url(add_query_arg('_give_hide_license_notices_permanently', $subscription['id'], $_SERVER['REQUEST_URI'])) |
|
736 | 736 | ); |
737 | - }else{ |
|
737 | + } else { |
|
738 | 738 | $messages[$subscription['id']] = sprintf( |
739 | - __( 'You Give addon license will expire in %s for payment <a href="%s" target="_blank">#%d</a>. <a href="%s" target="_blank">Click to renew an existing license</a> or <a href="%s">Click here if already renewed</a>.', 'give' ), |
|
740 | - human_time_diff( current_time( 'timestamp', 1 ), strtotime( $subscription['expires'] ) ), |
|
741 | - urldecode( $subscription['invoice_url'] ), |
|
739 | + __('You Give addon license will expire in %s for payment <a href="%s" target="_blank">#%d</a>. <a href="%s" target="_blank">Click to renew an existing license</a> or <a href="%s">Click here if already renewed</a>.', 'give'), |
|
740 | + human_time_diff(current_time('timestamp', 1), strtotime($subscription['expires'])), |
|
741 | + urldecode($subscription['invoice_url']), |
|
742 | 742 | $subscription['payment_id'], |
743 | 743 | "{$this->checkout_url}?edd_license_key={$subscription['license_key']}&utm_campaign=admin&utm_source=licenses&utm_medium=expired", |
744 | - esc_url( add_query_arg( '_give_hide_license_notices_permanently', $subscription['id'], $_SERVER['REQUEST_URI'] ) ) |
|
744 | + esc_url(add_query_arg('_give_hide_license_notices_permanently', $subscription['id'], $_SERVER['REQUEST_URI'])) |
|
745 | 745 | ); |
746 | 746 | } |
747 | 747 | } |
748 | 748 | |
749 | 749 | // Stop validation for these license keys. |
750 | - $addon_license_key_in_subscriptions = array_merge( $addon_license_key_in_subscriptions, $subscription['licenses'] ); |
|
750 | + $addon_license_key_in_subscriptions = array_merge($addon_license_key_in_subscriptions, $subscription['licenses']); |
|
751 | 751 | } |
752 | 752 | $showed_subscriptions_message = true; |
753 | 753 | } |
754 | 754 | |
755 | 755 | // Show non subscription addon messages. |
756 | - if( |
|
757 | - ! in_array( $this->license, $addon_license_key_in_subscriptions ) |
|
758 | - && ! $this->__is_notice_dismissed( 'general' ) |
|
756 | + if ( |
|
757 | + ! in_array($this->license, $addon_license_key_in_subscriptions) |
|
758 | + && ! $this->__is_notice_dismissed('general') |
|
759 | 759 | && ! $this->is_valid_license() |
760 | - && empty( $showed_invalid_message ) |
|
760 | + && empty($showed_invalid_message) |
|
761 | 761 | ) { |
762 | 762 | |
763 | 763 | $messages['general'] = sprintf( |
764 | - __( 'You have invalid or expired license keys for Give Addon. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give' ), |
|
765 | - admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=licenses' ) |
|
764 | + __('You have invalid or expired license keys for Give Addon. Please go to the <a href="%s">licenses page</a> to correct this issue.', 'give'), |
|
765 | + admin_url('edit.php?post_type=give_forms&page=give-settings&tab=licenses') |
|
766 | 766 | ); |
767 | 767 | $showed_invalid_message = true; |
768 | 768 | |
769 | 769 | } |
770 | 770 | |
771 | 771 | // Print messages. |
772 | - if( ! empty( $messages ) ) { |
|
773 | - foreach( $messages as $notice_id => $message ) { |
|
772 | + if ( ! empty($messages)) { |
|
773 | + foreach ($messages as $notice_id => $message) { |
|
774 | 774 | |
775 | 775 | echo sprintf( |
776 | 776 | '<div class="notice notice-error is-dismissible give-license-notice" data-dismiss-notice-shortly="%1$s"><p>%2$s</p></div>', |
777 | - esc_url( add_query_arg( '_give_hide_license_notices_shortly', $notice_id, $_SERVER['REQUEST_URI'] ) ), |
|
777 | + esc_url(add_query_arg('_give_hide_license_notices_shortly', $notice_id, $_SERVER['REQUEST_URI'])), |
|
778 | 778 | $message |
779 | 779 | ); |
780 | 780 | } |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | * @return bool |
791 | 791 | */ |
792 | 792 | public function is_valid_license() { |
793 | - if( apply_filters( 'give_is_valid_license' , ( is_object( $this->license_data ) && ! empty( $this->license_data ) && property_exists( $this->license_data, 'license' )&& 'valid' === $this->license_data->license ) ) ) { |
|
793 | + if (apply_filters('give_is_valid_license', (is_object($this->license_data) && ! empty($this->license_data) && property_exists($this->license_data, 'license') && 'valid' === $this->license_data->license))) { |
|
794 | 794 | return true; |
795 | 795 | } |
796 | 796 | |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | * @return bool |
807 | 807 | */ |
808 | 808 | private function __is_third_party_addon() { |
809 | - return ( false === strpos( $this->api_url, 'givewp.com/' ) ); |
|
809 | + return (false === strpos($this->api_url, 'givewp.com/')); |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | /** |
@@ -820,26 +820,26 @@ discard block |
||
820 | 820 | * |
821 | 821 | * @return void|bool |
822 | 822 | */ |
823 | - private function __remove_license_key_from_subscriptions(){ |
|
824 | - $subscriptions = get_option( 'give_subscriptions', array() ); |
|
823 | + private function __remove_license_key_from_subscriptions() { |
|
824 | + $subscriptions = get_option('give_subscriptions', array()); |
|
825 | 825 | |
826 | 826 | // Bailout. |
827 | - if( empty( $this->license ) ) { |
|
827 | + if (empty($this->license)) { |
|
828 | 828 | return false; |
829 | 829 | } |
830 | 830 | |
831 | - if( ! empty( $subscriptions ) ) { |
|
832 | - foreach ( $subscriptions as $subscription_id => $subscription ) { |
|
833 | - $license_index = array_search( $this->license, $subscription['licenses'] ); |
|
834 | - if( false !== $license_index ) { |
|
831 | + if ( ! empty($subscriptions)) { |
|
832 | + foreach ($subscriptions as $subscription_id => $subscription) { |
|
833 | + $license_index = array_search($this->license, $subscription['licenses']); |
|
834 | + if (false !== $license_index) { |
|
835 | 835 | // Remove license key. |
836 | - unset( $subscriptions[ $subscription_id ]['licenses'][$license_index] ); |
|
836 | + unset($subscriptions[$subscription_id]['licenses'][$license_index]); |
|
837 | 837 | |
838 | 838 | // Rearrange license keys. |
839 | - $subscriptions[ $subscription_id ]['licenses'] = array_values( $subscriptions[ $subscription_id ]['licenses'] ); |
|
839 | + $subscriptions[$subscription_id]['licenses'] = array_values($subscriptions[$subscription_id]['licenses']); |
|
840 | 840 | |
841 | 841 | // Update subscription information. |
842 | - update_option( 'give_subscriptions', $subscriptions ); |
|
842 | + update_option('give_subscriptions', $subscriptions); |
|
843 | 843 | break; |
844 | 844 | } |
845 | 845 | } |
@@ -854,7 +854,7 @@ discard block |
||
854 | 854 | * |
855 | 855 | * @return void |
856 | 856 | */ |
857 | - private function __remove_license_notices_show_blocker(){ |
|
857 | + private function __remove_license_notices_show_blocker() { |
|
858 | 858 | global $wpdb; |
859 | 859 | |
860 | 860 | // Delete permanent notice blocker. |
@@ -892,21 +892,21 @@ discard block |
||
892 | 892 | * |
893 | 893 | * @return bool |
894 | 894 | */ |
895 | - private function __is_notice_dismissed( $notice_id ){ |
|
895 | + private function __is_notice_dismissed($notice_id) { |
|
896 | 896 | $current_user = wp_get_current_user(); |
897 | 897 | $is_notice_dismissed = false; |
898 | 898 | |
899 | 899 | // Ge is notice dismissed permanently. |
900 | - $already_dismiss_notices = ( $already_dismiss_notices = get_user_meta( $current_user->ID, '_give_hide_license_notices_permanently', true ) ) |
|
900 | + $already_dismiss_notices = ($already_dismiss_notices = get_user_meta($current_user->ID, '_give_hide_license_notices_permanently', true)) |
|
901 | 901 | ? $already_dismiss_notices |
902 | 902 | : array(); |
903 | 903 | |
904 | 904 | |
905 | - if( |
|
906 | - in_array( $notice_id, $already_dismiss_notices ) |
|
907 | - || Give_Cache::get( "_give_hide_license_notices_shortly_{$current_user->ID}_{$notice_id}", true ) |
|
905 | + if ( |
|
906 | + in_array($notice_id, $already_dismiss_notices) |
|
907 | + || Give_Cache::get("_give_hide_license_notices_shortly_{$current_user->ID}_{$notice_id}", true) |
|
908 | 908 | ) { |
909 | - $is_notice_dismissed = true; |
|
909 | + $is_notice_dismissed = true; |
|
910 | 910 | } |
911 | 911 | |
912 | 912 | return $is_notice_dismissed; |
@@ -10,13 +10,13 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | global $status, $page; |
54 | 54 | |
55 | 55 | // Set parent defaults |
56 | - parent::__construct( array( |
|
57 | - 'singular' => esc_html__( 'API Key', 'give' ), // Singular name of the listed records |
|
58 | - 'plural' => esc_html__( 'API Keys', 'give' ), // Plural name of the listed records |
|
59 | - 'ajax' => false,// Does this table support ajax? |
|
60 | - ) ); |
|
56 | + parent::__construct(array( |
|
57 | + 'singular' => esc_html__('API Key', 'give'), // Singular name of the listed records |
|
58 | + 'plural' => esc_html__('API Keys', 'give'), // Plural name of the listed records |
|
59 | + 'ajax' => false, // Does this table support ajax? |
|
60 | + )); |
|
61 | 61 | |
62 | 62 | $this->query(); |
63 | 63 | } |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return string Column Name |
75 | 75 | */ |
76 | - public function column_default( $item, $column_name ) { |
|
77 | - return $item[ $column_name ]; |
|
76 | + public function column_default($item, $column_name) { |
|
77 | + return $item[$column_name]; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @return string Column Name |
89 | 89 | */ |
90 | - public function column_key( $item ) { |
|
91 | - return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['key'] ) . '"/>'; |
|
90 | + public function column_key($item) { |
|
91 | + return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['key']).'"/>'; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return string Column Name |
103 | 103 | */ |
104 | - public function column_token( $item ) { |
|
105 | - return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['token'] ) . '"/>'; |
|
104 | + public function column_token($item) { |
|
105 | + return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['token']).'"/>'; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @return string Column Name |
117 | 117 | */ |
118 | - public function column_secret( $item ) { |
|
119 | - return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['secret'] ) . '"/>'; |
|
118 | + public function column_secret($item) { |
|
119 | + return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['secret']).'"/>'; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -126,46 +126,46 @@ discard block |
||
126 | 126 | * @since 1.1 |
127 | 127 | * @return string |
128 | 128 | */ |
129 | - public function column_user( $item ) { |
|
129 | + public function column_user($item) { |
|
130 | 130 | |
131 | 131 | $actions = array(); |
132 | 132 | |
133 | - if ( apply_filters( 'give_api_log_requests', true ) ) { |
|
133 | + if (apply_filters('give_api_log_requests', true)) { |
|
134 | 134 | $actions['view'] = sprintf( |
135 | 135 | '<a href="%s">%s</a>', |
136 | - esc_url( add_query_arg( array( |
|
136 | + esc_url(add_query_arg(array( |
|
137 | 137 | 'section' => 'api_requests', |
138 | 138 | 'post_type' => 'give_forms', |
139 | 139 | 'page' => 'give-tools', |
140 | 140 | 'tab' => 'logs', |
141 | 141 | 's' => $item['email'], |
142 | - ), 'edit.php' ) ), |
|
143 | - esc_html__( 'View API Log', 'give' ) |
|
142 | + ), 'edit.php')), |
|
143 | + esc_html__('View API Log', 'give') |
|
144 | 144 | ); |
145 | 145 | } |
146 | 146 | |
147 | 147 | $actions['reissue'] = sprintf( |
148 | 148 | '<a href="%s" class="give-regenerate-api-key">%s</a>', |
149 | - esc_url( wp_nonce_url( add_query_arg( array( |
|
149 | + esc_url(wp_nonce_url(add_query_arg(array( |
|
150 | 150 | 'user_id' => $item['id'], |
151 | 151 | 'give_action' => 'process_api_key', |
152 | 152 | 'give_api_process' => 'regenerate', |
153 | - ) ), 'give-api-nonce' ) ), |
|
154 | - esc_html__( 'Reissue', 'give' ) |
|
153 | + )), 'give-api-nonce')), |
|
154 | + esc_html__('Reissue', 'give') |
|
155 | 155 | ); |
156 | - $actions['revoke'] = sprintf( |
|
156 | + $actions['revoke'] = sprintf( |
|
157 | 157 | '<a href="%s" class="give-revoke-api-key give-delete">%s</a>', |
158 | - esc_url( wp_nonce_url( add_query_arg( array( |
|
158 | + esc_url(wp_nonce_url(add_query_arg(array( |
|
159 | 159 | 'user_id' => $item['id'], |
160 | 160 | 'give_action' => 'process_api_key', |
161 | 161 | 'give_api_process' => 'revoke', |
162 | - ) ), 'give-api-nonce' ) ), |
|
163 | - esc_html__( 'Revoke', 'give' ) |
|
162 | + )), 'give-api-nonce')), |
|
163 | + esc_html__('Revoke', 'give') |
|
164 | 164 | ); |
165 | 165 | |
166 | - $actions = apply_filters( 'give_api_row_actions', array_filter( $actions ) ); |
|
166 | + $actions = apply_filters('give_api_row_actions', array_filter($actions)); |
|
167 | 167 | |
168 | - return sprintf( '%1$s %2$s', $item['user'], $this->row_actions( $actions ) ); |
|
168 | + return sprintf('%1$s %2$s', $item['user'], $this->row_actions($actions)); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function get_columns() { |
191 | 191 | $columns = array( |
192 | - 'user' => esc_html__( 'Username', 'give' ), |
|
193 | - 'key' => esc_html__( 'Public Key', 'give' ), |
|
194 | - 'token' => esc_html__( 'Token', 'give' ), |
|
195 | - 'secret' => esc_html__( 'Secret Key', 'give' ), |
|
192 | + 'user' => esc_html__('Username', 'give'), |
|
193 | + 'key' => esc_html__('Public Key', 'give'), |
|
194 | + 'token' => esc_html__('Token', 'give'), |
|
195 | + 'secret' => esc_html__('Secret Key', 'give'), |
|
196 | 196 | ); |
197 | 197 | |
198 | 198 | return $columns; |
@@ -206,20 +206,20 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @param string $which |
208 | 208 | */ |
209 | - protected function display_tablenav( $which ) { |
|
210 | - if ( 'top' === $which ) { |
|
211 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
209 | + protected function display_tablenav($which) { |
|
210 | + if ('top' === $which) { |
|
211 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
212 | 212 | } |
213 | 213 | ?> |
214 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
214 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
215 | 215 | |
216 | 216 | <div class="alignleft actions bulkactions"> |
217 | - <?php $this->bulk_actions( $which ); ?> |
|
217 | + <?php $this->bulk_actions($which); ?> |
|
218 | 218 | </div> |
219 | 219 | |
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"/> |
@@ -237,19 +237,19 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @return void |
239 | 239 | */ |
240 | - function bulk_actions( $which = '' ) { |
|
240 | + function bulk_actions($which = '') { |
|
241 | 241 | // These aren't really bulk actions but this outputs the markup in the right place |
242 | 242 | static $give_api_is_bottom; |
243 | 243 | |
244 | - if ( $give_api_is_bottom ) { |
|
244 | + if ($give_api_is_bottom) { |
|
245 | 245 | return; |
246 | 246 | } |
247 | 247 | ?> |
248 | 248 | <input type="hidden" name="give_action" value="process_api_key"/> |
249 | 249 | <input type="hidden" name="give_api_process" value="generate"/> |
250 | - <?php wp_nonce_field( 'give-api-nonce' ); ?> |
|
250 | + <?php wp_nonce_field('give-api-nonce'); ?> |
|
251 | 251 | <?php echo Give()->html->ajax_user_search(); ?> |
252 | - <?php submit_button( esc_html__( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false ); ?> |
|
252 | + <?php submit_button(esc_html__('Generate New API Keys', 'give'), 'secondary', 'submit', false); ?> |
|
253 | 253 | <?php |
254 | 254 | $give_api_is_bottom = true; |
255 | 255 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * @return int Current page number |
263 | 263 | */ |
264 | 264 | public function get_paged() { |
265 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
265 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
@@ -273,21 +273,21 @@ discard block |
||
273 | 273 | * @return array |
274 | 274 | */ |
275 | 275 | public function query() { |
276 | - $users = get_users( array( |
|
276 | + $users = get_users(array( |
|
277 | 277 | 'meta_value' => 'give_user_secret_key', |
278 | 278 | 'number' => $this->per_page, |
279 | - 'offset' => $this->per_page * ( $this->get_paged() - 1 ), |
|
280 | - ) ); |
|
281 | - $keys = array(); |
|
282 | - |
|
283 | - foreach ( $users as $user ) { |
|
284 | - $keys[ $user->ID ]['id'] = $user->ID; |
|
285 | - $keys[ $user->ID ]['email'] = $user->user_email; |
|
286 | - $keys[ $user->ID ]['user'] = '<a href="' . add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) . '"><strong>' . $user->user_login . '</strong></a>'; |
|
287 | - |
|
288 | - $keys[ $user->ID ]['key'] = Give()->api->get_user_public_key( $user->ID ); |
|
289 | - $keys[ $user->ID ]['secret'] = Give()->api->get_user_secret_key( $user->ID ); |
|
290 | - $keys[ $user->ID ]['token'] = Give()->api->get_token( $user->ID ); |
|
279 | + 'offset' => $this->per_page * ($this->get_paged() - 1), |
|
280 | + )); |
|
281 | + $keys = array(); |
|
282 | + |
|
283 | + foreach ($users as $user) { |
|
284 | + $keys[$user->ID]['id'] = $user->ID; |
|
285 | + $keys[$user->ID]['email'] = $user->user_email; |
|
286 | + $keys[$user->ID]['user'] = '<a href="'.add_query_arg('user_id', $user->ID, 'user-edit.php').'"><strong>'.$user->user_login.'</strong></a>'; |
|
287 | + |
|
288 | + $keys[$user->ID]['key'] = Give()->api->get_user_public_key($user->ID); |
|
289 | + $keys[$user->ID]['secret'] = Give()->api->get_user_secret_key($user->ID); |
|
290 | + $keys[$user->ID]['token'] = Give()->api->get_token($user->ID); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | return $keys; |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | public function total_items() { |
305 | 305 | global $wpdb; |
306 | 306 | |
307 | - if ( ! ( $total_items = Give_Cache::get( 'give_total_api_keys', true ) ) ) { |
|
307 | + if ( ! ($total_items = Give_Cache::get('give_total_api_keys', true))) { |
|
308 | 308 | $total_items = $wpdb->get_var( |
309 | 309 | $wpdb->prepare( |
310 | 310 | "SELECT count(user_id) |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | ) |
314 | 314 | ); |
315 | 315 | |
316 | - Give_Cache::set( 'give_total_api_keys', $total_items, HOUR_IN_SECONDS, true ); |
|
316 | + Give_Cache::set('give_total_api_keys', $total_items, HOUR_IN_SECONDS, true); |
|
317 | 317 | } |
318 | 318 | |
319 | 319 | return $total_items; |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | $hidden = array(); // No hidden columns |
333 | 333 | $sortable = array(); // Not sortable... for now |
334 | 334 | |
335 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
335 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
336 | 336 | |
337 | 337 | $data = $this->query(); |
338 | 338 | |
@@ -340,10 +340,10 @@ discard block |
||
340 | 340 | |
341 | 341 | $this->items = $data; |
342 | 342 | |
343 | - $this->set_pagination_args( array( |
|
343 | + $this->set_pagination_args(array( |
|
344 | 344 | 'total_items' => $total_items, |
345 | 345 | 'per_page' => $this->per_page, |
346 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
346 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
347 | 347 | ) |
348 | 348 | ); |
349 | 349 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -26,11 +26,11 @@ discard block |
||
26 | 26 | ob_start(); ?> |
27 | 27 | <div class="wrap" id="give-add-ons"> |
28 | 28 | <h1><?php echo get_admin_page_title(); ?> |
29 | - — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e( 'View All Add-ons', 'give' ); ?> |
|
29 | + — <a href="https://givewp.com/addons/" class="button-primary give-view-addons-all" target="_blank"><?php esc_html_e('View All Add-ons', 'give'); ?> |
|
30 | 30 | <span class="dashicons dashicons-external"></span></a> |
31 | 31 | </h1> |
32 | 32 | |
33 | - <p><?php esc_html_e( 'The following Add-ons extend the functionality of Give.', 'give' ); ?></p> |
|
33 | + <p><?php esc_html_e('The following Add-ons extend the functionality of Give.', 'give'); ?></p> |
|
34 | 34 | <?php echo give_add_ons_get_feed(); ?> |
35 | 35 | </div> |
36 | 36 | <?php |
@@ -48,20 +48,20 @@ discard block |
||
48 | 48 | function give_add_ons_get_feed() { |
49 | 49 | |
50 | 50 | $addons_debug = false; //set to true to debug |
51 | - $cache = Give_Cache::get( 'give_add_ons_feed', true ); |
|
51 | + $cache = Give_Cache::get('give_add_ons_feed', true); |
|
52 | 52 | |
53 | - if ( $cache === false || $addons_debug === true && WP_DEBUG === true ) { |
|
54 | - $feed = wp_remote_get( 'https://givewp.com/downloads/feed/', array( 'sslverify' => false ) ); |
|
53 | + if ($cache === false || $addons_debug === true && WP_DEBUG === true) { |
|
54 | + $feed = wp_remote_get('https://givewp.com/downloads/feed/', array('sslverify' => false)); |
|
55 | 55 | |
56 | - if ( ! is_wp_error( $feed ) ) { |
|
57 | - if ( isset( $feed['body'] ) && strlen( $feed['body'] ) > 0 ) { |
|
58 | - $cache = wp_remote_retrieve_body( $feed ); |
|
59 | - Give_Cache::set( 'give_add_ons_feed', $cache, HOUR_IN_SECONDS, true ); |
|
56 | + if ( ! is_wp_error($feed)) { |
|
57 | + if (isset($feed['body']) && strlen($feed['body']) > 0) { |
|
58 | + $cache = wp_remote_retrieve_body($feed); |
|
59 | + Give_Cache::set('give_add_ons_feed', $cache, HOUR_IN_SECONDS, true); |
|
60 | 60 | } |
61 | 61 | } else { |
62 | 62 | $cache = sprintf( |
63 | 63 | '<div class="error"><p>%s</p></div>', |
64 | - esc_html__( 'There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give' ) |
|
64 | + esc_html__('There was an error retrieving the Give Add-ons list from the server. Please try again later.', 'give') |
|
65 | 65 | ); |
66 | 66 | } |
67 | 67 | } |