@@ -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(); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | */ |
| 233 | 233 | public function __clone() {
|
| 234 | 234 | // Cloning instances of the class is forbidden |
| 235 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
| 235 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
|
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | /** |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | public function __wakeup() {
|
| 247 | 247 | // Unserializing instances of the class is forbidden. |
| 248 | - _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'give' ), '1.0' ); |
|
| 248 | + _doing_it_wrong(__FUNCTION__, __('Cheatin’ huh?', 'give'), '1.0');
|
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /** |
@@ -259,33 +259,33 @@ discard block |
||
| 259 | 259 | private function setup_constants() {
|
| 260 | 260 | |
| 261 | 261 | // Plugin version |
| 262 | - if ( ! defined( 'GIVE_VERSION' ) ) {
|
|
| 263 | - define( 'GIVE_VERSION', '1.8.5' ); |
|
| 262 | + if ( ! defined('GIVE_VERSION')) {
|
|
| 263 | + define('GIVE_VERSION', '1.8.5');
|
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | // Plugin Folder Path |
| 267 | - if ( ! defined( 'GIVE_PLUGIN_DIR' ) ) {
|
|
| 268 | - define( 'GIVE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
|
| 267 | + if ( ! defined('GIVE_PLUGIN_DIR')) {
|
|
| 268 | + define('GIVE_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
|
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | // Plugin Folder URL |
| 272 | - if ( ! defined( 'GIVE_PLUGIN_URL' ) ) {
|
|
| 273 | - define( 'GIVE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
|
| 272 | + if ( ! defined('GIVE_PLUGIN_URL')) {
|
|
| 273 | + define('GIVE_PLUGIN_URL', plugin_dir_url(__FILE__));
|
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | // Plugin Basename aka: "give/give.php" |
| 277 | - if ( ! defined( 'GIVE_PLUGIN_BASENAME' ) ) {
|
|
| 278 | - define( 'GIVE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
|
| 277 | + if ( ! defined('GIVE_PLUGIN_BASENAME')) {
|
|
| 278 | + define('GIVE_PLUGIN_BASENAME', plugin_basename(__FILE__));
|
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | // Plugin Root File |
| 282 | - if ( ! defined( 'GIVE_PLUGIN_FILE' ) ) {
|
|
| 283 | - define( 'GIVE_PLUGIN_FILE', __FILE__ ); |
|
| 282 | + if ( ! defined('GIVE_PLUGIN_FILE')) {
|
|
| 283 | + define('GIVE_PLUGIN_FILE', __FILE__);
|
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | // Make sure CAL_GREGORIAN is defined |
| 287 | - if ( ! defined( 'CAL_GREGORIAN' ) ) {
|
|
| 288 | - define( 'CAL_GREGORIAN', 1 ); |
|
| 287 | + if ( ! defined('CAL_GREGORIAN')) {
|
|
| 288 | + define('CAL_GREGORIAN', 1);
|
|
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | |
@@ -300,122 +300,122 @@ discard block |
||
| 300 | 300 | private function includes() {
|
| 301 | 301 | global $give_options; |
| 302 | 302 | |
| 303 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-settings.php'; |
|
| 304 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-give-settings.php'; |
|
| 303 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-settings.php'; |
|
| 304 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-give-settings.php'; |
|
| 305 | 305 | $give_options = give_get_settings(); |
| 306 | 306 | |
| 307 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/give-metabox-functions.php'; |
|
| 308 | - require_once GIVE_PLUGIN_DIR . 'includes/post-types.php'; |
|
| 309 | - require_once GIVE_PLUGIN_DIR . 'includes/scripts.php'; |
|
| 310 | - require_once GIVE_PLUGIN_DIR . 'includes/ajax-functions.php'; |
|
| 311 | - require_once GIVE_PLUGIN_DIR . 'includes/actions.php'; |
|
| 312 | - require_once GIVE_PLUGIN_DIR . 'includes/filters.php'; |
|
| 313 | - require_once GIVE_PLUGIN_DIR . 'includes/api/class-give-api.php'; |
|
| 314 | - |
|
| 315 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-roles.php'; |
|
| 316 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-template-loader.php'; |
|
| 317 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-donate-form.php'; |
|
| 318 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db.php'; |
|
| 319 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customers.php'; |
|
| 320 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-db-customer-meta.php'; |
|
| 321 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-customer.php'; |
|
| 322 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-stats.php'; |
|
| 323 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-session.php'; |
|
| 324 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-html-elements.php'; |
|
| 325 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-logging.php'; |
|
| 326 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-license-handler.php'; |
|
| 327 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cron.php'; |
|
| 328 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-email-access.php'; |
|
| 329 | - |
|
| 330 | - require_once GIVE_PLUGIN_DIR . 'includes/country-functions.php'; |
|
| 331 | - require_once GIVE_PLUGIN_DIR . 'includes/template-functions.php'; |
|
| 332 | - require_once GIVE_PLUGIN_DIR . 'includes/misc-functions.php'; |
|
| 333 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/functions.php'; |
|
| 334 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/template.php'; |
|
| 335 | - require_once GIVE_PLUGIN_DIR . 'includes/forms/widget.php'; |
|
| 336 | - require_once GIVE_PLUGIN_DIR . 'includes/shortcodes.php'; |
|
| 337 | - require_once GIVE_PLUGIN_DIR . 'includes/formatting.php'; |
|
| 338 | - require_once GIVE_PLUGIN_DIR . 'includes/price-functions.php'; |
|
| 339 | - require_once GIVE_PLUGIN_DIR . 'includes/error-tracking.php'; |
|
| 340 | - require_once GIVE_PLUGIN_DIR . 'includes/process-donation.php'; |
|
| 341 | - require_once GIVE_PLUGIN_DIR . 'includes/login-register.php'; |
|
| 342 | - require_once GIVE_PLUGIN_DIR . 'includes/user-functions.php'; |
|
| 343 | - require_once GIVE_PLUGIN_DIR . 'includes/plugin-compatibility.php'; |
|
| 344 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-functions.php'; |
|
| 345 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-actions.php'; |
|
| 346 | - require_once GIVE_PLUGIN_DIR . 'includes/deprecated/deprecated-filters.php'; |
|
| 347 | - |
|
| 348 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/functions.php'; |
|
| 349 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/actions.php'; |
|
| 350 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payment-stats.php'; |
|
| 351 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-payments-query.php'; |
|
| 352 | - require_once GIVE_PLUGIN_DIR . 'includes/payments/class-give-payment.php'; |
|
| 353 | - |
|
| 354 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/functions.php'; |
|
| 355 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/actions.php'; |
|
| 356 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/paypal-standard.php'; |
|
| 357 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/offline-donations.php'; |
|
| 358 | - require_once GIVE_PLUGIN_DIR . 'includes/gateways/manual.php'; |
|
| 359 | - |
|
| 360 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-emails.php'; |
|
| 361 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/class-give-email-tags.php'; |
|
| 362 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/functions.php'; |
|
| 363 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/template.php'; |
|
| 364 | - require_once GIVE_PLUGIN_DIR . 'includes/emails/actions.php'; |
|
| 365 | - |
|
| 366 | - if( defined( 'WP_CLI' ) && WP_CLI ) {
|
|
| 367 | - require_once GIVE_PLUGIN_DIR . 'includes/class-give-cli-commands.php'; |
|
| 307 | + require_once GIVE_PLUGIN_DIR.'includes/admin/give-metabox-functions.php'; |
|
| 308 | + require_once GIVE_PLUGIN_DIR.'includes/post-types.php'; |
|
| 309 | + require_once GIVE_PLUGIN_DIR.'includes/scripts.php'; |
|
| 310 | + require_once GIVE_PLUGIN_DIR.'includes/ajax-functions.php'; |
|
| 311 | + require_once GIVE_PLUGIN_DIR.'includes/actions.php'; |
|
| 312 | + require_once GIVE_PLUGIN_DIR.'includes/filters.php'; |
|
| 313 | + require_once GIVE_PLUGIN_DIR.'includes/api/class-give-api.php'; |
|
| 314 | + |
|
| 315 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-roles.php'; |
|
| 316 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-template-loader.php'; |
|
| 317 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-donate-form.php'; |
|
| 318 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db.php'; |
|
| 319 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customers.php'; |
|
| 320 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-db-customer-meta.php'; |
|
| 321 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-customer.php'; |
|
| 322 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-stats.php'; |
|
| 323 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-session.php'; |
|
| 324 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-html-elements.php'; |
|
| 325 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-logging.php'; |
|
| 326 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-license-handler.php'; |
|
| 327 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cron.php'; |
|
| 328 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-email-access.php'; |
|
| 329 | + |
|
| 330 | + require_once GIVE_PLUGIN_DIR.'includes/country-functions.php'; |
|
| 331 | + require_once GIVE_PLUGIN_DIR.'includes/template-functions.php'; |
|
| 332 | + require_once GIVE_PLUGIN_DIR.'includes/misc-functions.php'; |
|
| 333 | + require_once GIVE_PLUGIN_DIR.'includes/forms/functions.php'; |
|
| 334 | + require_once GIVE_PLUGIN_DIR.'includes/forms/template.php'; |
|
| 335 | + require_once GIVE_PLUGIN_DIR.'includes/forms/widget.php'; |
|
| 336 | + require_once GIVE_PLUGIN_DIR.'includes/shortcodes.php'; |
|
| 337 | + require_once GIVE_PLUGIN_DIR.'includes/formatting.php'; |
|
| 338 | + require_once GIVE_PLUGIN_DIR.'includes/price-functions.php'; |
|
| 339 | + require_once GIVE_PLUGIN_DIR.'includes/error-tracking.php'; |
|
| 340 | + require_once GIVE_PLUGIN_DIR.'includes/process-donation.php'; |
|
| 341 | + require_once GIVE_PLUGIN_DIR.'includes/login-register.php'; |
|
| 342 | + require_once GIVE_PLUGIN_DIR.'includes/user-functions.php'; |
|
| 343 | + require_once GIVE_PLUGIN_DIR.'includes/plugin-compatibility.php'; |
|
| 344 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-functions.php'; |
|
| 345 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-actions.php'; |
|
| 346 | + require_once GIVE_PLUGIN_DIR.'includes/deprecated/deprecated-filters.php'; |
|
| 347 | + |
|
| 348 | + require_once GIVE_PLUGIN_DIR.'includes/payments/functions.php'; |
|
| 349 | + require_once GIVE_PLUGIN_DIR.'includes/payments/actions.php'; |
|
| 350 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payment-stats.php'; |
|
| 351 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-payments-query.php'; |
|
| 352 | + require_once GIVE_PLUGIN_DIR.'includes/payments/class-give-payment.php'; |
|
| 353 | + |
|
| 354 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/functions.php'; |
|
| 355 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/actions.php'; |
|
| 356 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/paypal-standard.php'; |
|
| 357 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/offline-donations.php'; |
|
| 358 | + require_once GIVE_PLUGIN_DIR.'includes/gateways/manual.php'; |
|
| 359 | + |
|
| 360 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-emails.php'; |
|
| 361 | + require_once GIVE_PLUGIN_DIR.'includes/emails/class-give-email-tags.php'; |
|
| 362 | + require_once GIVE_PLUGIN_DIR.'includes/emails/functions.php'; |
|
| 363 | + require_once GIVE_PLUGIN_DIR.'includes/emails/template.php'; |
|
| 364 | + require_once GIVE_PLUGIN_DIR.'includes/emails/actions.php'; |
|
| 365 | + |
|
| 366 | + if (defined('WP_CLI') && WP_CLI) {
|
|
| 367 | + require_once GIVE_PLUGIN_DIR.'includes/class-give-cli-commands.php'; |
|
| 368 | 368 | } |
| 369 | 369 | |
| 370 | - if ( is_admin() || ( defined( 'WP_CLI' ) && WP_CLI ) ) {
|
|
| 371 | - |
|
| 372 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-footer.php'; |
|
| 373 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/welcome.php'; |
|
| 374 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-pages.php'; |
|
| 375 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-admin-notices.php'; |
|
| 376 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-api-keys-table.php'; |
|
| 377 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/class-i18n-module.php'; |
|
| 378 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-actions.php'; |
|
| 379 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/admin-filters.php'; |
|
| 380 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/system-info.php'; |
|
| 381 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/add-ons.php'; |
|
| 382 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/plugins.php'; |
|
| 383 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/dashboard-widgets.php'; |
|
| 384 | - |
|
| 385 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/actions.php'; |
|
| 386 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/payments/payments-history.php'; |
|
| 387 | - |
|
| 388 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customers.php'; |
|
| 389 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-functions.php'; |
|
| 390 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/customers/customer-actions.php'; |
|
| 391 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/metabox.php'; |
|
| 392 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/class-metabox-form-data.php'; |
|
| 393 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/forms/dashboard-columns.php'; |
|
| 394 | - |
|
| 395 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/export/export-functions.php'; |
|
| 396 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/reports.php'; |
|
| 397 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools.php'; |
|
| 398 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/tools/tools-actions.php'; |
|
| 399 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/pdf-reports.php'; |
|
| 400 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/class-give-graph.php'; |
|
| 401 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/reporting/graphing.php'; |
|
| 402 | - |
|
| 403 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
| 404 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/class-shortcode-button.php'; |
|
| 405 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-form.php'; |
|
| 406 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
| 407 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-login.php'; |
|
| 408 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-register.php'; |
|
| 409 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
| 410 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
| 411 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
| 412 | - |
|
| 413 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrade-functions.php'; |
|
| 414 | - require_once GIVE_PLUGIN_DIR . 'includes/admin/upgrades/upgrades.php'; |
|
| 370 | + if (is_admin() || (defined('WP_CLI') && WP_CLI)) {
|
|
| 371 | + |
|
| 372 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-footer.php'; |
|
| 373 | + require_once GIVE_PLUGIN_DIR.'includes/admin/welcome.php'; |
|
| 374 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-pages.php'; |
|
| 375 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-admin-notices.php'; |
|
| 376 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-api-keys-table.php'; |
|
| 377 | + require_once GIVE_PLUGIN_DIR.'includes/admin/class-i18n-module.php'; |
|
| 378 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-actions.php'; |
|
| 379 | + require_once GIVE_PLUGIN_DIR.'includes/admin/admin-filters.php'; |
|
| 380 | + require_once GIVE_PLUGIN_DIR.'includes/admin/system-info.php'; |
|
| 381 | + require_once GIVE_PLUGIN_DIR.'includes/admin/add-ons.php'; |
|
| 382 | + require_once GIVE_PLUGIN_DIR.'includes/admin/plugins.php'; |
|
| 383 | + require_once GIVE_PLUGIN_DIR.'includes/admin/dashboard-widgets.php'; |
|
| 384 | + |
|
| 385 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/actions.php'; |
|
| 386 | + require_once GIVE_PLUGIN_DIR.'includes/admin/payments/payments-history.php'; |
|
| 387 | + |
|
| 388 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customers.php'; |
|
| 389 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-functions.php'; |
|
| 390 | + require_once GIVE_PLUGIN_DIR.'includes/admin/customers/customer-actions.php'; |
|
| 391 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/metabox.php'; |
|
| 392 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/class-metabox-form-data.php'; |
|
| 393 | + require_once GIVE_PLUGIN_DIR.'includes/admin/forms/dashboard-columns.php'; |
|
| 394 | + |
|
| 395 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/export/export-functions.php'; |
|
| 396 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/reports.php'; |
|
| 397 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools.php'; |
|
| 398 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/tools/tools-actions.php'; |
|
| 399 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/pdf-reports.php'; |
|
| 400 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/class-give-graph.php'; |
|
| 401 | + require_once GIVE_PLUGIN_DIR.'includes/admin/reporting/graphing.php'; |
|
| 402 | + |
|
| 403 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/abstract-shortcode-generator.php'; |
|
| 404 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/class-shortcode-button.php'; |
|
| 405 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-form.php'; |
|
| 406 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-goal.php'; |
|
| 407 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-login.php'; |
|
| 408 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-register.php'; |
|
| 409 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-profile-editor.php'; |
|
| 410 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-donation-history.php'; |
|
| 411 | + require_once GIVE_PLUGIN_DIR.'includes/admin/shortcodes/shortcode-give-receipt.php'; |
|
| 412 | + |
|
| 413 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrade-functions.php'; |
|
| 414 | + require_once GIVE_PLUGIN_DIR.'includes/admin/upgrades/upgrades.php'; |
|
| 415 | 415 | |
| 416 | 416 | } |
| 417 | 417 | |
| 418 | - require_once GIVE_PLUGIN_DIR . 'includes/install.php'; |
|
| 418 | + require_once GIVE_PLUGIN_DIR.'includes/install.php'; |
|
| 419 | 419 | |
| 420 | 420 | } |
| 421 | 421 | |
@@ -429,26 +429,26 @@ discard block |
||
| 429 | 429 | */ |
| 430 | 430 | public function load_textdomain() {
|
| 431 | 431 | // Set filter for Give's languages directory |
| 432 | - $give_lang_dir = dirname( plugin_basename( GIVE_PLUGIN_FILE ) ) . '/languages/'; |
|
| 433 | - $give_lang_dir = apply_filters( 'give_languages_directory', $give_lang_dir ); |
|
| 432 | + $give_lang_dir = dirname(plugin_basename(GIVE_PLUGIN_FILE)).'/languages/'; |
|
| 433 | + $give_lang_dir = apply_filters('give_languages_directory', $give_lang_dir);
|
|
| 434 | 434 | |
| 435 | 435 | // Traditional WordPress plugin locale filter |
| 436 | - $locale = apply_filters( 'plugin_locale', get_locale(), 'give' ); |
|
| 437 | - $mofile = sprintf( '%1$s-%2$s.mo', 'give', $locale ); |
|
| 436 | + $locale = apply_filters('plugin_locale', get_locale(), 'give');
|
|
| 437 | + $mofile = sprintf('%1$s-%2$s.mo', 'give', $locale);
|
|
| 438 | 438 | |
| 439 | 439 | // Setup paths to current locale file |
| 440 | - $mofile_local = $give_lang_dir . $mofile; |
|
| 441 | - $mofile_global = WP_LANG_DIR . '/give/' . $mofile; |
|
| 440 | + $mofile_local = $give_lang_dir.$mofile; |
|
| 441 | + $mofile_global = WP_LANG_DIR.'/give/'.$mofile; |
|
| 442 | 442 | |
| 443 | - if ( file_exists( $mofile_global ) ) {
|
|
| 443 | + if (file_exists($mofile_global)) {
|
|
| 444 | 444 | // Look in global /wp-content/languages/give folder |
| 445 | - load_textdomain( 'give', $mofile_global ); |
|
| 446 | - } elseif ( file_exists( $mofile_local ) ) {
|
|
| 445 | + load_textdomain('give', $mofile_global);
|
|
| 446 | + } elseif (file_exists($mofile_local)) {
|
|
| 447 | 447 | // Look in local location from filter `give_languages_directory` |
| 448 | - load_textdomain( 'give', $mofile_local ); |
|
| 448 | + load_textdomain('give', $mofile_local);
|
|
| 449 | 449 | } else {
|
| 450 | 450 | // Load the default language files packaged up w/ Give |
| 451 | - load_plugin_textdomain( 'give', false, $give_lang_dir ); |
|
| 451 | + load_plugin_textdomain('give', false, $give_lang_dir);
|
|
| 452 | 452 | } |
| 453 | 453 | } |
| 454 | 454 | |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * @since 1.0 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; |
| 14 | 14 | } |
| 15 | 15 | |
@@ -22,10 +22,10 @@ discard block |
||
| 22 | 22 | * |
| 23 | 23 | * @return bool |
| 24 | 24 | */ |
| 25 | -function give_paypal_standard_billing_fields( $form_id ) { |
|
| 25 | +function give_paypal_standard_billing_fields($form_id) { |
|
| 26 | 26 | |
| 27 | - if ( give_is_setting_enabled( give_get_option( 'paypal_standard_billing_details' ) ) ) { |
|
| 28 | - give_default_cc_address_fields( $form_id ); |
|
| 27 | + if (give_is_setting_enabled(give_get_option('paypal_standard_billing_details'))) { |
|
| 28 | + give_default_cc_address_fields($form_id); |
|
| 29 | 29 | |
| 30 | 30 | return true; |
| 31 | 31 | } |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | -add_action( 'give_paypal_cc_form', 'give_paypal_standard_billing_fields'); |
|
| 37 | +add_action('give_paypal_cc_form', 'give_paypal_standard_billing_fields'); |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * Process PayPal Payment. |
@@ -45,34 +45,34 @@ discard block |
||
| 45 | 45 | * |
| 46 | 46 | * @return void |
| 47 | 47 | */ |
| 48 | -function give_process_paypal_payment( $payment_data ) { |
|
| 48 | +function give_process_paypal_payment($payment_data) { |
|
| 49 | 49 | |
| 50 | 50 | // Validate nonce. |
| 51 | - give_validate_nonce( $payment_data['gateway_nonce'], 'give-gateway' ); |
|
| 52 | - $payment_id = give_create_payment( $payment_data ); |
|
| 51 | + give_validate_nonce($payment_data['gateway_nonce'], 'give-gateway'); |
|
| 52 | + $payment_id = give_create_payment($payment_data); |
|
| 53 | 53 | |
| 54 | 54 | // Check payment. |
| 55 | - if ( empty( $payment_id ) ) { |
|
| 55 | + if (empty($payment_id)) { |
|
| 56 | 56 | // Record the error. |
| 57 | 57 | give_record_gateway_error( |
| 58 | - esc_html__( 'Payment Error', 'give' ), |
|
| 58 | + esc_html__('Payment Error', 'give'), |
|
| 59 | 59 | sprintf( |
| 60 | 60 | /* translators: %s: payment data */ |
| 61 | - esc_html__( 'Payment creation failed before sending donor to PayPal. Payment data: %s', 'give' ), |
|
| 62 | - json_encode( $payment_data ) |
|
| 61 | + esc_html__('Payment creation failed before sending donor to PayPal. Payment data: %s', 'give'), |
|
| 62 | + json_encode($payment_data) |
|
| 63 | 63 | ), |
| 64 | 64 | $payment_id |
| 65 | 65 | ); |
| 66 | 66 | // Problems? Send back. |
| 67 | - give_send_back_to_checkout( '?payment-mode=' . $payment_data['post_data']['give-gateway'] ); |
|
| 67 | + give_send_back_to_checkout('?payment-mode='.$payment_data['post_data']['give-gateway']); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // Redirect to PayPal. |
| 71 | - wp_redirect( give_build_paypal_url( $payment_id, $payment_data ) ); |
|
| 71 | + wp_redirect(give_build_paypal_url($payment_id, $payment_data)); |
|
| 72 | 72 | exit; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | -add_action( 'give_gateway_paypal', 'give_process_paypal_payment' ); |
|
| 75 | +add_action('give_gateway_paypal', 'give_process_paypal_payment'); |
|
| 76 | 76 | |
| 77 | 77 | /** |
| 78 | 78 | * Listens for a PayPal IPN requests and then sends to the processing function |
@@ -82,17 +82,17 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | function give_listen_for_paypal_ipn() { |
| 84 | 84 | // Regular PayPal IPN |
| 85 | - if ( isset( $_GET['give-listener'] ) && $_GET['give-listener'] == 'IPN' ) { |
|
| 85 | + if (isset($_GET['give-listener']) && $_GET['give-listener'] == 'IPN') { |
|
| 86 | 86 | /** |
| 87 | 87 | * Fires while verifying PayPal IPN |
| 88 | 88 | * |
| 89 | 89 | * @since 1.0 |
| 90 | 90 | */ |
| 91 | - do_action( 'give_verify_paypal_ipn' ); |
|
| 91 | + do_action('give_verify_paypal_ipn'); |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | -add_action( 'init', 'give_listen_for_paypal_ipn' ); |
|
| 95 | +add_action('init', 'give_listen_for_paypal_ipn'); |
|
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * Process PayPal IPN |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | function give_process_paypal_ipn() { |
| 104 | 104 | |
| 105 | 105 | // Check the request method is POST |
| 106 | - if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] != 'POST' ) { |
|
| 106 | + if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] != 'POST') { |
|
| 107 | 107 | return; |
| 108 | 108 | } |
| 109 | 109 | |
@@ -111,11 +111,11 @@ discard block |
||
| 111 | 111 | $post_data = ''; |
| 112 | 112 | |
| 113 | 113 | // Fallback just in case post_max_size is lower than needed |
| 114 | - if ( ini_get( 'allow_url_fopen' ) ) { |
|
| 115 | - $post_data = file_get_contents( 'php://input' ); |
|
| 114 | + if (ini_get('allow_url_fopen')) { |
|
| 115 | + $post_data = file_get_contents('php://input'); |
|
| 116 | 116 | } else { |
| 117 | 117 | // If allow_url_fopen is not enabled, then make sure that post_max_size is large enough |
| 118 | - ini_set( 'post_max_size', '12M' ); |
|
| 118 | + ini_set('post_max_size', '12M'); |
|
| 119 | 119 | } |
| 120 | 120 | // Start the encoded data collection with notification command |
| 121 | 121 | $encoded_data = 'cmd=_notify-validate'; |
@@ -124,39 +124,39 @@ discard block |
||
| 124 | 124 | $arg_separator = give_get_php_arg_separator_output(); |
| 125 | 125 | |
| 126 | 126 | // Verify there is a post_data |
| 127 | - if ( $post_data || strlen( $post_data ) > 0 ) { |
|
| 127 | + if ($post_data || strlen($post_data) > 0) { |
|
| 128 | 128 | // Append the data |
| 129 | - $encoded_data .= $arg_separator . $post_data; |
|
| 129 | + $encoded_data .= $arg_separator.$post_data; |
|
| 130 | 130 | } else { |
| 131 | 131 | // Check if POST is empty |
| 132 | - if ( empty( $_POST ) ) { |
|
| 132 | + if (empty($_POST)) { |
|
| 133 | 133 | // Nothing to do |
| 134 | 134 | return; |
| 135 | 135 | } else { |
| 136 | 136 | // Loop through each POST |
| 137 | - foreach ( $_POST as $key => $value ) { |
|
| 137 | + foreach ($_POST as $key => $value) { |
|
| 138 | 138 | // Encode the value and append the data. |
| 139 | - $encoded_data .= $arg_separator . "$key=" . urlencode( $value ); |
|
| 139 | + $encoded_data .= $arg_separator."$key=".urlencode($value); |
|
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | // Convert collected post data to an array. |
| 145 | - parse_str( $encoded_data, $encoded_data_array ); |
|
| 145 | + parse_str($encoded_data, $encoded_data_array); |
|
| 146 | 146 | |
| 147 | - foreach ( $encoded_data_array as $key => $value ) { |
|
| 147 | + foreach ($encoded_data_array as $key => $value) { |
|
| 148 | 148 | |
| 149 | - if ( false !== strpos( $key, 'amp;' ) ) { |
|
| 150 | - $new_key = str_replace( '&', '&', $key ); |
|
| 151 | - $new_key = str_replace( 'amp;', '&', $new_key ); |
|
| 149 | + if (false !== strpos($key, 'amp;')) { |
|
| 150 | + $new_key = str_replace('&', '&', $key); |
|
| 151 | + $new_key = str_replace('amp;', '&', $new_key); |
|
| 152 | 152 | |
| 153 | - unset( $encoded_data_array[ $key ] ); |
|
| 154 | - $encoded_data_array[ $new_key ] = $value; |
|
| 153 | + unset($encoded_data_array[$key]); |
|
| 154 | + $encoded_data_array[$new_key] = $value; |
|
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // Validate IPN request w/ PayPal if user hasn't disabled this security measure |
| 159 | - if ( give_is_setting_enabled( give_get_option( 'paypal_verification' ) ) ) { |
|
| 159 | + if (give_is_setting_enabled(give_get_option('paypal_verification'))) { |
|
| 160 | 160 | |
| 161 | 161 | $remote_post_vars = array( |
| 162 | 162 | 'method' => 'POST', |
@@ -176,28 +176,28 @@ discard block |
||
| 176 | 176 | ); |
| 177 | 177 | |
| 178 | 178 | // Validate the IPN. |
| 179 | - $api_response = wp_remote_post( give_get_paypal_redirect(), $remote_post_vars ); |
|
| 179 | + $api_response = wp_remote_post(give_get_paypal_redirect(), $remote_post_vars); |
|
| 180 | 180 | |
| 181 | - if ( is_wp_error( $api_response ) ) { |
|
| 181 | + if (is_wp_error($api_response)) { |
|
| 182 | 182 | give_record_gateway_error( |
| 183 | - esc_html__( 'IPN Error', 'give' ), |
|
| 183 | + esc_html__('IPN Error', 'give'), |
|
| 184 | 184 | sprintf( |
| 185 | 185 | /* translators: %s: Paypal IPN response */ |
| 186 | - esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ), |
|
| 187 | - json_encode( $api_response ) |
|
| 186 | + esc_html__('Invalid IPN verification response. IPN data: %s', 'give'), |
|
| 187 | + json_encode($api_response) |
|
| 188 | 188 | ) |
| 189 | 189 | ); |
| 190 | 190 | |
| 191 | 191 | return; // Something went wrong |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - if ( $api_response['body'] !== 'VERIFIED' ) { |
|
| 194 | + if ($api_response['body'] !== 'VERIFIED') { |
|
| 195 | 195 | give_record_gateway_error( |
| 196 | - esc_html__( 'IPN Error', 'give' ), |
|
| 196 | + esc_html__('IPN Error', 'give'), |
|
| 197 | 197 | sprintf( |
| 198 | 198 | /* translators: %s: Paypal IPN response */ |
| 199 | - esc_html__( 'Invalid IPN verification response. IPN data: %s', 'give' ), |
|
| 200 | - json_encode( $api_response ) |
|
| 199 | + esc_html__('Invalid IPN verification response. IPN data: %s', 'give'), |
|
| 200 | + json_encode($api_response) |
|
| 201 | 201 | ) |
| 202 | 202 | ); |
| 203 | 203 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | // Check if $post_data_array has been populated |
| 209 | - if ( ! is_array( $encoded_data_array ) && ! empty( $encoded_data_array ) ) { |
|
| 209 | + if ( ! is_array($encoded_data_array) && ! empty($encoded_data_array)) { |
|
| 210 | 210 | return; |
| 211 | 211 | } |
| 212 | 212 | |
@@ -215,12 +215,12 @@ discard block |
||
| 215 | 215 | 'payment_status' => '', |
| 216 | 216 | ); |
| 217 | 217 | |
| 218 | - $encoded_data_array = wp_parse_args( $encoded_data_array, $defaults ); |
|
| 218 | + $encoded_data_array = wp_parse_args($encoded_data_array, $defaults); |
|
| 219 | 219 | |
| 220 | - $payment_id = isset( $encoded_data_array['custom'] ) ? absint( $encoded_data_array['custom'] ) : 0; |
|
| 220 | + $payment_id = isset($encoded_data_array['custom']) ? absint($encoded_data_array['custom']) : 0; |
|
| 221 | 221 | $txn_type = $encoded_data_array['txn_type']; |
| 222 | 222 | |
| 223 | - if ( has_action( 'give_paypal_' . $txn_type ) ) { |
|
| 223 | + if (has_action('give_paypal_'.$txn_type)) { |
|
| 224 | 224 | /** |
| 225 | 225 | * Fires while processing PayPal IPN $txn_type. |
| 226 | 226 | * |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | * @param array $encoded_data_array Encoded data. |
| 232 | 232 | * @param int $payment_id Payment id. |
| 233 | 233 | */ |
| 234 | - do_action( "give_paypal_{$txn_type}", $encoded_data_array, $payment_id ); |
|
| 234 | + do_action("give_paypal_{$txn_type}", $encoded_data_array, $payment_id); |
|
| 235 | 235 | } else { |
| 236 | 236 | /** |
| 237 | 237 | * Fires while process PayPal IPN. |
@@ -243,12 +243,12 @@ discard block |
||
| 243 | 243 | * @param array $encoded_data_array Encoded data. |
| 244 | 244 | * @param int $payment_id Payment id. |
| 245 | 245 | */ |
| 246 | - do_action( 'give_paypal_web_accept', $encoded_data_array, $payment_id ); |
|
| 246 | + do_action('give_paypal_web_accept', $encoded_data_array, $payment_id); |
|
| 247 | 247 | } |
| 248 | 248 | exit; |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | -add_action( 'give_verify_paypal_ipn', 'give_process_paypal_ipn' ); |
|
| 251 | +add_action('give_verify_paypal_ipn', 'give_process_paypal_ipn'); |
|
| 252 | 252 | |
| 253 | 253 | /** |
| 254 | 254 | * Process web accept (one time) payment IPNs. |
@@ -260,128 +260,128 @@ discard block |
||
| 260 | 260 | * |
| 261 | 261 | * @return void |
| 262 | 262 | */ |
| 263 | -function give_process_paypal_web_accept_and_cart( $data, $payment_id ) { |
|
| 263 | +function give_process_paypal_web_accept_and_cart($data, $payment_id) { |
|
| 264 | 264 | |
| 265 | 265 | // Only allow through these transaction types. |
| 266 | - if ( $data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && strtolower( $data['payment_status'] ) != 'refunded' ) { |
|
| 266 | + if ($data['txn_type'] != 'web_accept' && $data['txn_type'] != 'cart' && strtolower($data['payment_status']) != 'refunded') { |
|
| 267 | 267 | return; |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | // Need $payment_id to continue. |
| 271 | - if ( empty( $payment_id ) ) { |
|
| 271 | + if (empty($payment_id)) { |
|
| 272 | 272 | return; |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | // Collect donation payment details. |
| 276 | 276 | $paypal_amount = $data['mc_gross']; |
| 277 | - $payment_status = strtolower( $data['payment_status'] ); |
|
| 278 | - $currency_code = strtolower( $data['mc_currency'] ); |
|
| 279 | - $business_email = isset( $data['business'] ) && is_email( $data['business'] ) ? trim( $data['business'] ) : trim( $data['receiver_email'] ); |
|
| 280 | - $payment_meta = give_get_payment_meta( $payment_id ); |
|
| 277 | + $payment_status = strtolower($data['payment_status']); |
|
| 278 | + $currency_code = strtolower($data['mc_currency']); |
|
| 279 | + $business_email = isset($data['business']) && is_email($data['business']) ? trim($data['business']) : trim($data['receiver_email']); |
|
| 280 | + $payment_meta = give_get_payment_meta($payment_id); |
|
| 281 | 281 | |
| 282 | 282 | // Must be a PayPal standard IPN. |
| 283 | - if ( give_get_payment_gateway( $payment_id ) != 'paypal' ) { |
|
| 283 | + if (give_get_payment_gateway($payment_id) != 'paypal') { |
|
| 284 | 284 | return; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | // Verify payment recipient |
| 288 | - if ( strcasecmp( $business_email, trim( give_get_option( 'paypal_email' ) ) ) != 0 ) { |
|
| 288 | + if (strcasecmp($business_email, trim(give_get_option('paypal_email'))) != 0) { |
|
| 289 | 289 | |
| 290 | 290 | give_record_gateway_error( |
| 291 | - esc_html__( 'IPN Error', 'give' ), |
|
| 291 | + esc_html__('IPN Error', 'give'), |
|
| 292 | 292 | sprintf( |
| 293 | 293 | /* translators: %s: Paypal IPN response */ |
| 294 | - esc_html__( 'Invalid business email in IPN response. IPN data: %s', 'give' ), |
|
| 295 | - json_encode( $data ) |
|
| 294 | + esc_html__('Invalid business email in IPN response. IPN data: %s', 'give'), |
|
| 295 | + json_encode($data) |
|
| 296 | 296 | ), |
| 297 | 297 | $payment_id |
| 298 | 298 | ); |
| 299 | - give_update_payment_status( $payment_id, 'failed' ); |
|
| 300 | - give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid PayPal business email.', 'give' ) ); |
|
| 299 | + give_update_payment_status($payment_id, 'failed'); |
|
| 300 | + give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid PayPal business email.', 'give')); |
|
| 301 | 301 | |
| 302 | 302 | return; |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | // Verify payment currency. |
| 306 | - if ( $currency_code != strtolower( $payment_meta['currency'] ) ) { |
|
| 306 | + if ($currency_code != strtolower($payment_meta['currency'])) { |
|
| 307 | 307 | |
| 308 | 308 | give_record_gateway_error( |
| 309 | - esc_html__( 'IPN Error', 'give' ), |
|
| 309 | + esc_html__('IPN Error', 'give'), |
|
| 310 | 310 | sprintf( |
| 311 | 311 | /* translators: %s: Paypal IPN response */ |
| 312 | - esc_html__( 'Invalid currency in IPN response. IPN data: %s', 'give' ), |
|
| 313 | - json_encode( $data ) |
|
| 312 | + esc_html__('Invalid currency in IPN response. IPN data: %s', 'give'), |
|
| 313 | + json_encode($data) |
|
| 314 | 314 | ), |
| 315 | 315 | $payment_id |
| 316 | 316 | ); |
| 317 | - give_update_payment_status( $payment_id, 'failed' ); |
|
| 318 | - give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) ); |
|
| 317 | + give_update_payment_status($payment_id, 'failed'); |
|
| 318 | + give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid currency in PayPal IPN.', 'give')); |
|
| 319 | 319 | |
| 320 | 320 | return; |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | // Process refunds & reversed. |
| 324 | - if ( $payment_status == 'refunded' || $payment_status == 'reversed' ) { |
|
| 325 | - give_process_paypal_refund( $data, $payment_id ); |
|
| 324 | + if ($payment_status == 'refunded' || $payment_status == 'reversed') { |
|
| 325 | + give_process_paypal_refund($data, $payment_id); |
|
| 326 | 326 | |
| 327 | 327 | return; |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | // Only complete payments once. |
| 331 | - if ( get_post_status( $payment_id ) == 'publish' ) { |
|
| 331 | + if (get_post_status($payment_id) == 'publish') { |
|
| 332 | 332 | return; |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | // Retrieve the total donation amount (before PayPal). |
| 336 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
| 336 | + $payment_amount = give_get_payment_amount($payment_id); |
|
| 337 | 337 | |
| 338 | 338 | // Check that the donation PP and local db amounts match. |
| 339 | - if ( number_format( (float) $paypal_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) { |
|
| 339 | + if (number_format((float) $paypal_amount, 2) < number_format((float) $payment_amount, 2)) { |
|
| 340 | 340 | // The prices don't match |
| 341 | 341 | give_record_gateway_error( |
| 342 | - esc_html__( 'IPN Error', 'give' ), |
|
| 342 | + esc_html__('IPN Error', 'give'), |
|
| 343 | 343 | sprintf( |
| 344 | 344 | /* translators: %s: Paypal IPN response */ |
| 345 | - esc_html__( 'Invalid payment amount in IPN response. IPN data: %s', 'give' ), |
|
| 346 | - json_encode( $data ) |
|
| 345 | + esc_html__('Invalid payment amount in IPN response. IPN data: %s', 'give'), |
|
| 346 | + json_encode($data) |
|
| 347 | 347 | ), |
| 348 | 348 | $payment_id |
| 349 | 349 | ); |
| 350 | - give_update_payment_status( $payment_id, 'failed' ); |
|
| 351 | - give_insert_payment_note( $payment_id, esc_html__( 'Payment failed due to invalid amount in PayPal IPN.', 'give' ) ); |
|
| 350 | + give_update_payment_status($payment_id, 'failed'); |
|
| 351 | + give_insert_payment_note($payment_id, esc_html__('Payment failed due to invalid amount in PayPal IPN.', 'give')); |
|
| 352 | 352 | |
| 353 | 353 | return; |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | // Process completed donations. |
| 357 | - if ( $payment_status == 'completed' || give_is_test_mode() ) { |
|
| 357 | + if ($payment_status == 'completed' || give_is_test_mode()) { |
|
| 358 | 358 | |
| 359 | 359 | give_insert_payment_note( |
| 360 | 360 | $payment_id, |
| 361 | 361 | sprintf( |
| 362 | 362 | /* translators: %s: Paypal transaction ID */ |
| 363 | - esc_html__( 'PayPal Transaction ID: %s', 'give' ), |
|
| 363 | + esc_html__('PayPal Transaction ID: %s', 'give'), |
|
| 364 | 364 | $data['txn_id'] |
| 365 | 365 | ) |
| 366 | 366 | ); |
| 367 | - give_set_payment_transaction_id( $payment_id, $data['txn_id'] ); |
|
| 368 | - give_update_payment_status( $payment_id, 'publish' ); |
|
| 367 | + give_set_payment_transaction_id($payment_id, $data['txn_id']); |
|
| 368 | + give_update_payment_status($payment_id, 'publish'); |
|
| 369 | 369 | |
| 370 | - } elseif ( 'pending' == $payment_status && isset( $data['pending_reason'] ) ) { |
|
| 370 | + } elseif ('pending' == $payment_status && isset($data['pending_reason'])) { |
|
| 371 | 371 | |
| 372 | 372 | // Look for possible pending reasons, such as an echeck. |
| 373 | - $note = give_paypal_get_pending_donation_note( strtolower( $data['pending_reason'] ) ); |
|
| 373 | + $note = give_paypal_get_pending_donation_note(strtolower($data['pending_reason'])); |
|
| 374 | 374 | |
| 375 | - if ( ! empty( $note ) ) { |
|
| 375 | + if ( ! empty($note)) { |
|
| 376 | 376 | |
| 377 | - give_insert_payment_note( $payment_id, $note ); |
|
| 377 | + give_insert_payment_note($payment_id, $note); |
|
| 378 | 378 | |
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | } |
| 383 | 383 | |
| 384 | -add_action( 'give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2 ); |
|
| 384 | +add_action('give_paypal_web_accept', 'give_process_paypal_web_accept_and_cart', 10, 2); |
|
| 385 | 385 | |
| 386 | 386 | /** |
| 387 | 387 | * Process PayPal IPN Refunds |
@@ -393,27 +393,27 @@ discard block |
||
| 393 | 393 | * |
| 394 | 394 | * @return void |
| 395 | 395 | */ |
| 396 | -function give_process_paypal_refund( $data, $payment_id = 0 ) { |
|
| 396 | +function give_process_paypal_refund($data, $payment_id = 0) { |
|
| 397 | 397 | |
| 398 | 398 | // Collect payment details |
| 399 | - if ( empty( $payment_id ) ) { |
|
| 399 | + if (empty($payment_id)) { |
|
| 400 | 400 | return; |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | - if ( get_post_status( $payment_id ) == 'refunded' ) { |
|
| 403 | + if (get_post_status($payment_id) == 'refunded') { |
|
| 404 | 404 | return; // Only refund payments once |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | - $payment_amount = give_get_payment_amount( $payment_id ); |
|
| 407 | + $payment_amount = give_get_payment_amount($payment_id); |
|
| 408 | 408 | $refund_amount = $data['payment_gross'] * - 1; |
| 409 | 409 | |
| 410 | - if ( number_format( (float) $refund_amount, 2 ) < number_format( (float) $payment_amount, 2 ) ) { |
|
| 410 | + if (number_format((float) $refund_amount, 2) < number_format((float) $payment_amount, 2)) { |
|
| 411 | 411 | |
| 412 | 412 | give_insert_payment_note( |
| 413 | 413 | $payment_id, |
| 414 | 414 | sprintf( |
| 415 | 415 | /* translators: %s: Paypal parent transaction ID */ |
| 416 | - esc_html__( 'Partial PayPal refund processed: %s', 'give' ), |
|
| 416 | + esc_html__('Partial PayPal refund processed: %s', 'give'), |
|
| 417 | 417 | $data['parent_txn_id'] |
| 418 | 418 | ) |
| 419 | 419 | ); |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | $payment_id, |
| 427 | 427 | sprintf( |
| 428 | 428 | /* translators: 1: Paypal parent transaction ID 2. Paypal reason code */ |
| 429 | - esc_html__( 'PayPal Payment #%1$s Refunded for reason: %2$s', 'give' ), |
|
| 429 | + esc_html__('PayPal Payment #%1$s Refunded for reason: %2$s', 'give'), |
|
| 430 | 430 | $data['parent_txn_id'], |
| 431 | 431 | $data['reason_code'] |
| 432 | 432 | ) |
@@ -435,11 +435,11 @@ discard block |
||
| 435 | 435 | $payment_id, |
| 436 | 436 | sprintf( |
| 437 | 437 | /* translators: %s: Paypal transaction ID */ |
| 438 | - esc_html__( 'PayPal Refund Transaction ID: %s', 'give' ), |
|
| 438 | + esc_html__('PayPal Refund Transaction ID: %s', 'give'), |
|
| 439 | 439 | $data['txn_id'] |
| 440 | 440 | ) |
| 441 | 441 | ); |
| 442 | - give_update_payment_status( $payment_id, 'refunded' ); |
|
| 442 | + give_update_payment_status($payment_id, 'refunded'); |
|
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | /** |
@@ -451,24 +451,24 @@ discard block |
||
| 451 | 451 | * |
| 452 | 452 | * @return string |
| 453 | 453 | */ |
| 454 | -function give_get_paypal_redirect( $ssl_check = false ) { |
|
| 454 | +function give_get_paypal_redirect($ssl_check = false) { |
|
| 455 | 455 | |
| 456 | - if ( is_ssl() || ! $ssl_check ) { |
|
| 456 | + if (is_ssl() || ! $ssl_check) { |
|
| 457 | 457 | $protocol = 'https://'; |
| 458 | 458 | } else { |
| 459 | 459 | $protocol = 'http://'; |
| 460 | 460 | } |
| 461 | 461 | |
| 462 | 462 | // Check the current payment mode |
| 463 | - if ( give_is_test_mode() ) { |
|
| 463 | + if (give_is_test_mode()) { |
|
| 464 | 464 | // Test mode |
| 465 | - $paypal_uri = $protocol . 'www.sandbox.paypal.com/cgi-bin/webscr'; |
|
| 465 | + $paypal_uri = $protocol.'www.sandbox.paypal.com/cgi-bin/webscr'; |
|
| 466 | 466 | } else { |
| 467 | 467 | // Live mode |
| 468 | - $paypal_uri = $protocol . 'www.paypal.com/cgi-bin/webscr'; |
|
| 468 | + $paypal_uri = $protocol.'www.paypal.com/cgi-bin/webscr'; |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | - return apply_filters( 'give_paypal_uri', $paypal_uri ); |
|
| 471 | + return apply_filters('give_paypal_uri', $paypal_uri); |
|
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | /** |
@@ -478,9 +478,9 @@ discard block |
||
| 478 | 478 | * @return string |
| 479 | 479 | */ |
| 480 | 480 | function give_get_paypal_page_style() { |
| 481 | - $page_style = trim( give_get_option( 'paypal_page_style', 'PayPal' ) ); |
|
| 481 | + $page_style = trim(give_get_option('paypal_page_style', 'PayPal')); |
|
| 482 | 482 | |
| 483 | - return apply_filters( 'give_paypal_page_style', $page_style ); |
|
| 483 | + return apply_filters('give_paypal_page_style', $page_style); |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | /** |
@@ -494,26 +494,26 @@ discard block |
||
| 494 | 494 | * |
| 495 | 495 | * @return string |
| 496 | 496 | */ |
| 497 | -function give_paypal_success_page_content( $content ) { |
|
| 497 | +function give_paypal_success_page_content($content) { |
|
| 498 | 498 | |
| 499 | - if ( ! isset( $_GET['payment-id'] ) && ! give_get_purchase_session() ) { |
|
| 499 | + if ( ! isset($_GET['payment-id']) && ! give_get_purchase_session()) { |
|
| 500 | 500 | return $content; |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | - $payment_id = isset( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : false; |
|
| 503 | + $payment_id = isset($_GET['payment-id']) ? absint($_GET['payment-id']) : false; |
|
| 504 | 504 | |
| 505 | - if ( ! $payment_id ) { |
|
| 505 | + if ( ! $payment_id) { |
|
| 506 | 506 | $session = give_get_purchase_session(); |
| 507 | - $payment_id = give_get_purchase_id_by_key( $session['purchase_key'] ); |
|
| 507 | + $payment_id = give_get_purchase_id_by_key($session['purchase_key']); |
|
| 508 | 508 | } |
| 509 | 509 | |
| 510 | - $payment = get_post( $payment_id ); |
|
| 511 | - if ( $payment && 'pending' == $payment->post_status ) { |
|
| 510 | + $payment = get_post($payment_id); |
|
| 511 | + if ($payment && 'pending' == $payment->post_status) { |
|
| 512 | 512 | |
| 513 | 513 | // Payment is still pending so show processing indicator to fix the race condition. |
| 514 | 514 | ob_start(); |
| 515 | 515 | |
| 516 | - give_get_template_part( 'payment', 'processing' ); |
|
| 516 | + give_get_template_part('payment', 'processing'); |
|
| 517 | 517 | |
| 518 | 518 | $content = ob_get_clean(); |
| 519 | 519 | |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | -add_filter( 'give_payment_confirm_paypal', 'give_paypal_success_page_content' ); |
|
| 526 | +add_filter('give_payment_confirm_paypal', 'give_paypal_success_page_content'); |
|
| 527 | 527 | |
| 528 | 528 | /** |
| 529 | 529 | * Given a Payment ID, extract the transaction ID |
@@ -534,22 +534,22 @@ discard block |
||
| 534 | 534 | * |
| 535 | 535 | * @return string Transaction ID |
| 536 | 536 | */ |
| 537 | -function give_paypal_get_payment_transaction_id( $payment_id ) { |
|
| 537 | +function give_paypal_get_payment_transaction_id($payment_id) { |
|
| 538 | 538 | |
| 539 | 539 | $transaction_id = ''; |
| 540 | - $notes = give_get_payment_notes( $payment_id ); |
|
| 540 | + $notes = give_get_payment_notes($payment_id); |
|
| 541 | 541 | |
| 542 | - foreach ( $notes as $note ) { |
|
| 543 | - if ( preg_match( '/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match ) ) { |
|
| 542 | + foreach ($notes as $note) { |
|
| 543 | + if (preg_match('/^PayPal Transaction ID: ([^\s]+)/', $note->comment_content, $match)) { |
|
| 544 | 544 | $transaction_id = $match[1]; |
| 545 | 545 | continue; |
| 546 | 546 | } |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | - return apply_filters( 'give_paypal_set_payment_transaction_id', $transaction_id, $payment_id ); |
|
| 549 | + return apply_filters('give_paypal_set_payment_transaction_id', $transaction_id, $payment_id); |
|
| 550 | 550 | } |
| 551 | 551 | |
| 552 | -add_filter( 'give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1 ); |
|
| 552 | +add_filter('give_get_payment_transaction_id-paypal', 'give_paypal_get_payment_transaction_id', 10, 1); |
|
| 553 | 553 | |
| 554 | 554 | /** |
| 555 | 555 | * Given a transaction ID, generate a link to the PayPal transaction ID details |
@@ -561,16 +561,16 @@ discard block |
||
| 561 | 561 | * |
| 562 | 562 | * @return string A link to the PayPal transaction details |
| 563 | 563 | */ |
| 564 | -function give_paypal_link_transaction_id( $transaction_id, $payment_id ) { |
|
| 564 | +function give_paypal_link_transaction_id($transaction_id, $payment_id) { |
|
| 565 | 565 | |
| 566 | 566 | $paypal_base_url = 'https://history.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id='; |
| 567 | - $transaction_url = '<a href="' . esc_url( $paypal_base_url . $transaction_id ) . '" target="_blank">' . $transaction_id . '</a>'; |
|
| 567 | + $transaction_url = '<a href="'.esc_url($paypal_base_url.$transaction_id).'" target="_blank">'.$transaction_id.'</a>'; |
|
| 568 | 568 | |
| 569 | - return apply_filters( 'give_paypal_link_payment_details_transaction_id', $transaction_url ); |
|
| 569 | + return apply_filters('give_paypal_link_payment_details_transaction_id', $transaction_url); |
|
| 570 | 570 | |
| 571 | 571 | } |
| 572 | 572 | |
| 573 | -add_filter( 'give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2 ); |
|
| 573 | +add_filter('give_payment_details_transaction_id-paypal', 'give_paypal_link_transaction_id', 10, 2); |
|
| 574 | 574 | |
| 575 | 575 | |
| 576 | 576 | /** |
@@ -582,64 +582,64 @@ discard block |
||
| 582 | 582 | * |
| 583 | 583 | * @return string |
| 584 | 584 | */ |
| 585 | -function give_paypal_get_pending_donation_note( $pending_reason ) { |
|
| 585 | +function give_paypal_get_pending_donation_note($pending_reason) { |
|
| 586 | 586 | |
| 587 | 587 | $note = ''; |
| 588 | 588 | |
| 589 | - switch ( $pending_reason ) { |
|
| 589 | + switch ($pending_reason) { |
|
| 590 | 590 | |
| 591 | 591 | case 'echeck' : |
| 592 | 592 | |
| 593 | - $note = esc_html__( 'Payment made via eCheck and will clear automatically in 5-8 days.', 'give' ); |
|
| 593 | + $note = esc_html__('Payment made via eCheck and will clear automatically in 5-8 days.', 'give'); |
|
| 594 | 594 | |
| 595 | 595 | break; |
| 596 | 596 | |
| 597 | 597 | case 'address' : |
| 598 | 598 | |
| 599 | - $note = esc_html__( 'Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give' ); |
|
| 599 | + $note = esc_html__('Payment requires a confirmed donor address and must be accepted manually through PayPal.', 'give'); |
|
| 600 | 600 | |
| 601 | 601 | break; |
| 602 | 602 | |
| 603 | 603 | case 'intl' : |
| 604 | 604 | |
| 605 | - $note = esc_html__( 'Payment must be accepted manually through PayPal due to international account regulations.', 'give' ); |
|
| 605 | + $note = esc_html__('Payment must be accepted manually through PayPal due to international account regulations.', 'give'); |
|
| 606 | 606 | |
| 607 | 607 | break; |
| 608 | 608 | |
| 609 | 609 | case 'multi-currency' : |
| 610 | 610 | |
| 611 | - $note = esc_html__( 'Payment received in non-shop currency and must be accepted manually through PayPal.', 'give' ); |
|
| 611 | + $note = esc_html__('Payment received in non-shop currency and must be accepted manually through PayPal.', 'give'); |
|
| 612 | 612 | |
| 613 | 613 | break; |
| 614 | 614 | |
| 615 | 615 | case 'paymentreview' : |
| 616 | 616 | case 'regulatory_review' : |
| 617 | 617 | |
| 618 | - $note = esc_html__( 'Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give' ); |
|
| 618 | + $note = esc_html__('Payment is being reviewed by PayPal staff as high-risk or in possible violation of government regulations.', 'give'); |
|
| 619 | 619 | |
| 620 | 620 | break; |
| 621 | 621 | |
| 622 | 622 | case 'unilateral' : |
| 623 | 623 | |
| 624 | - $note = esc_html__( 'Payment was sent to non-confirmed or non-registered email address.', 'give' ); |
|
| 624 | + $note = esc_html__('Payment was sent to non-confirmed or non-registered email address.', 'give'); |
|
| 625 | 625 | |
| 626 | 626 | break; |
| 627 | 627 | |
| 628 | 628 | case 'upgrade' : |
| 629 | 629 | |
| 630 | - $note = esc_html__( 'PayPal account must be upgraded before this payment can be accepted.', 'give' ); |
|
| 630 | + $note = esc_html__('PayPal account must be upgraded before this payment can be accepted.', 'give'); |
|
| 631 | 631 | |
| 632 | 632 | break; |
| 633 | 633 | |
| 634 | 634 | case 'verify' : |
| 635 | 635 | |
| 636 | - $note = esc_html__( 'PayPal account is not verified. Verify account in order to accept this donation.', 'give' ); |
|
| 636 | + $note = esc_html__('PayPal account is not verified. Verify account in order to accept this donation.', 'give'); |
|
| 637 | 637 | |
| 638 | 638 | break; |
| 639 | 639 | |
| 640 | 640 | case 'other' : |
| 641 | 641 | |
| 642 | - $note = esc_html__( 'Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give' ); |
|
| 642 | + $note = esc_html__('Payment is pending for unknown reasons. Contact PayPal support for assistance.', 'give'); |
|
| 643 | 643 | |
| 644 | 644 | break; |
| 645 | 645 | |
@@ -657,49 +657,49 @@ discard block |
||
| 657 | 657 | * |
| 658 | 658 | * @return mixed|string |
| 659 | 659 | */ |
| 660 | -function give_build_paypal_url( $payment_id, $payment_data ) { |
|
| 660 | +function give_build_paypal_url($payment_id, $payment_data) { |
|
| 661 | 661 | // Only send to PayPal if the pending payment is created successfully. |
| 662 | - $listener_url = add_query_arg( 'give-listener', 'IPN', home_url( 'index.php' ) ); |
|
| 662 | + $listener_url = add_query_arg('give-listener', 'IPN', home_url('index.php')); |
|
| 663 | 663 | |
| 664 | 664 | // Get the success url. |
| 665 | - $return_url = add_query_arg( array( |
|
| 665 | + $return_url = add_query_arg(array( |
|
| 666 | 666 | 'payment-confirmation' => 'paypal', |
| 667 | 667 | 'payment-id' => $payment_id, |
| 668 | 668 | |
| 669 | - ), get_permalink( give_get_option( 'success_page' ) ) ); |
|
| 669 | + ), get_permalink(give_get_option('success_page'))); |
|
| 670 | 670 | |
| 671 | 671 | // Get the PayPal redirect uri. |
| 672 | - $paypal_redirect = trailingslashit( give_get_paypal_redirect() ) . '?'; |
|
| 672 | + $paypal_redirect = trailingslashit(give_get_paypal_redirect()).'?'; |
|
| 673 | 673 | |
| 674 | 674 | // Item name. |
| 675 | - $item_name = give_build_paypal_item_title( $payment_data ); |
|
| 675 | + $item_name = give_build_paypal_item_title($payment_data); |
|
| 676 | 676 | |
| 677 | 677 | // Setup PayPal API params. |
| 678 | 678 | $paypal_args = array( |
| 679 | - 'business' => give_get_option( 'paypal_email', false ), |
|
| 679 | + 'business' => give_get_option('paypal_email', false), |
|
| 680 | 680 | 'first_name' => $payment_data['user_info']['first_name'], |
| 681 | 681 | 'last_name' => $payment_data['user_info']['last_name'], |
| 682 | 682 | 'email' => $payment_data['user_email'], |
| 683 | 683 | 'invoice' => $payment_data['purchase_key'], |
| 684 | 684 | 'amount' => $payment_data['price'], |
| 685 | - 'item_name' => stripslashes( $item_name ), |
|
| 685 | + 'item_name' => stripslashes($item_name), |
|
| 686 | 686 | 'no_shipping' => '1', |
| 687 | 687 | 'shipping' => '0', |
| 688 | 688 | 'no_note' => '1', |
| 689 | 689 | 'currency_code' => give_get_currency(), |
| 690 | - 'charset' => get_bloginfo( 'charset' ), |
|
| 690 | + 'charset' => get_bloginfo('charset'), |
|
| 691 | 691 | 'custom' => $payment_id, |
| 692 | 692 | 'rm' => '2', |
| 693 | 693 | 'return' => $return_url, |
| 694 | - 'cancel_return' => give_get_failed_transaction_uri( '?payment-id=' . $payment_id ), |
|
| 694 | + 'cancel_return' => give_get_failed_transaction_uri('?payment-id='.$payment_id), |
|
| 695 | 695 | 'notify_url' => $listener_url, |
| 696 | 696 | 'page_style' => give_get_paypal_page_style(), |
| 697 | - 'cbt' => get_bloginfo( 'name' ), |
|
| 697 | + 'cbt' => get_bloginfo('name'), |
|
| 698 | 698 | 'bn' => 'givewp_SP', |
| 699 | 699 | ); |
| 700 | 700 | |
| 701 | 701 | // Add user address if present. |
| 702 | - if ( ! empty( $payment_data['user_info']['address'] ) ) { |
|
| 702 | + if ( ! empty($payment_data['user_info']['address'])) { |
|
| 703 | 703 | $default_address = array( |
| 704 | 704 | 'line1' => '', |
| 705 | 705 | 'line2' => '', |
@@ -709,13 +709,13 @@ discard block |
||
| 709 | 709 | 'country' => '', |
| 710 | 710 | ); |
| 711 | 711 | |
| 712 | - $address = wp_parse_args( $payment_data['user_info']['address'], $default_address ); |
|
| 712 | + $address = wp_parse_args($payment_data['user_info']['address'], $default_address); |
|
| 713 | 713 | |
| 714 | 714 | $paypal_args['address1'] = $address['line1']; |
| 715 | 715 | $paypal_args['address2'] = $address['line2']; |
| 716 | 716 | $paypal_args['city'] = $address['city']; |
| 717 | 717 | $paypal_args['state'] = $address['state']; |
| 718 | - $paypal_args['zip'] = $address['zip']; |
|
| 718 | + $paypal_args['zip'] = $address['zip']; |
|
| 719 | 719 | $paypal_args['country'] = $address['country']; |
| 720 | 720 | } |
| 721 | 721 | |
@@ -730,13 +730,13 @@ discard block |
||
| 730 | 730 | * @param array $paypal_args |
| 731 | 731 | * @param array $payment_data |
| 732 | 732 | */ |
| 733 | - $paypal_args = apply_filters( 'give_paypal_redirect_args', $paypal_args, $payment_data ); |
|
| 733 | + $paypal_args = apply_filters('give_paypal_redirect_args', $paypal_args, $payment_data); |
|
| 734 | 734 | |
| 735 | 735 | // Build query. |
| 736 | - $paypal_redirect .= http_build_query( $paypal_args ); |
|
| 736 | + $paypal_redirect .= http_build_query($paypal_args); |
|
| 737 | 737 | |
| 738 | 738 | // Fix for some sites that encode the entities. |
| 739 | - $paypal_redirect = str_replace( '&', '&', $paypal_redirect ); |
|
| 739 | + $paypal_redirect = str_replace('&', '&', $paypal_redirect); |
|
| 740 | 740 | |
| 741 | 741 | return $paypal_redirect; |
| 742 | 742 | } |
@@ -751,7 +751,7 @@ discard block |
||
| 751 | 751 | function give_get_paypal_button_type() { |
| 752 | 752 | // paypal_button_type can be donation or standard. |
| 753 | 753 | $paypal_button_type = '_donations'; |
| 754 | - if ( give_get_option( 'paypal_button_type' ) === 'standard' ) { |
|
| 754 | + if (give_get_option('paypal_button_type') === 'standard') { |
|
| 755 | 755 | $paypal_button_type = '_xclick'; |
| 756 | 756 | } |
| 757 | 757 | |
@@ -768,32 +768,32 @@ discard block |
||
| 768 | 768 | * |
| 769 | 769 | * @return string |
| 770 | 770 | */ |
| 771 | -function give_build_paypal_item_title( $payment_data ) { |
|
| 772 | - $form_id = intval( $payment_data['post_data']['give-form-id'] ); |
|
| 771 | +function give_build_paypal_item_title($payment_data) { |
|
| 772 | + $form_id = intval($payment_data['post_data']['give-form-id']); |
|
| 773 | 773 | $item_name = $payment_data['post_data']['give-form-title']; |
| 774 | 774 | |
| 775 | 775 | // Verify has variable prices. |
| 776 | - if ( give_has_variable_prices( $form_id ) && isset( $payment_data['post_data']['give-price-id'] ) ) { |
|
| 776 | + if (give_has_variable_prices($form_id) && isset($payment_data['post_data']['give-price-id'])) { |
|
| 777 | 777 | |
| 778 | - $item_price_level_text = give_get_price_option_name( $form_id, $payment_data['post_data']['give-price-id'] ); |
|
| 779 | - $price_level_amount = give_get_price_option_amount( $form_id, $payment_data['post_data']['give-price-id'] ); |
|
| 778 | + $item_price_level_text = give_get_price_option_name($form_id, $payment_data['post_data']['give-price-id']); |
|
| 779 | + $price_level_amount = give_get_price_option_amount($form_id, $payment_data['post_data']['give-price-id']); |
|
| 780 | 780 | |
| 781 | 781 | // Donation given doesn't match selected level (must be a custom amount). |
| 782 | - if ( $price_level_amount != give_sanitize_amount( $payment_data['price'] ) ) { |
|
| 783 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 782 | + if ($price_level_amount != give_sanitize_amount($payment_data['price'])) { |
|
| 783 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 784 | 784 | // user custom amount text if any, fallback to default if not. |
| 785 | - $item_name .= ' - ' . give_check_variable( $custom_amount_text, 'empty', esc_html__( 'Custom Amount', 'give' ) ); |
|
| 785 | + $item_name .= ' - '.give_check_variable($custom_amount_text, 'empty', esc_html__('Custom Amount', 'give')); |
|
| 786 | 786 | |
| 787 | 787 | } //Is there any donation level text? |
| 788 | - elseif ( ! empty( $item_price_level_text ) ) { |
|
| 789 | - $item_name .= ' - ' . $item_price_level_text; |
|
| 788 | + elseif ( ! empty($item_price_level_text)) { |
|
| 789 | + $item_name .= ' - '.$item_price_level_text; |
|
| 790 | 790 | } |
| 791 | 791 | |
| 792 | 792 | } //Single donation: Custom Amount. |
| 793 | - elseif ( give_get_form_price( $form_id ) !== give_sanitize_amount( $payment_data['price'] ) ) { |
|
| 794 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 793 | + elseif (give_get_form_price($form_id) !== give_sanitize_amount($payment_data['price'])) { |
|
| 794 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 795 | 795 | // user custom amount text if any, fallback to default if not. |
| 796 | - $item_name .= ' - ' . give_check_variable( $custom_amount_text, 'empty', esc_html__( 'Custom Amount', 'give' ) ); |
|
| 796 | + $item_name .= ' - '.give_check_variable($custom_amount_text, 'empty', esc_html__('Custom Amount', 'give')); |
|
| 797 | 797 | } |
| 798 | 798 | |
| 799 | 799 | return $item_name; |
@@ -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 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * |
| 20 | 20 | * @since 1.0 |
| 21 | 21 | */ |
| 22 | -class Give_Forms_Widget extends WP_Widget{ |
|
| 22 | +class Give_Forms_Widget extends WP_Widget { |
|
| 23 | 23 | /** |
| 24 | 24 | * The widget class name |
| 25 | 25 | * |
@@ -30,19 +30,19 @@ discard block |
||
| 30 | 30 | /** |
| 31 | 31 | * Instantiate the class |
| 32 | 32 | */ |
| 33 | - public function __construct(){ |
|
| 34 | - $this->self = get_class( $this ); |
|
| 33 | + public function __construct() { |
|
| 34 | + $this->self = get_class($this); |
|
| 35 | 35 | |
| 36 | 36 | parent::__construct( |
| 37 | - strtolower( $this->self ), |
|
| 38 | - esc_html__( 'Give - Donation Form', 'give' ), |
|
| 37 | + strtolower($this->self), |
|
| 38 | + esc_html__('Give - Donation Form', 'give'), |
|
| 39 | 39 | array( |
| 40 | - 'description' => esc_html__( 'Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give' ) |
|
| 40 | + 'description' => esc_html__('Display a Give Donation Form in your theme\'s widget powered sidebar.', 'give') |
|
| 41 | 41 | ) |
| 42 | 42 | ); |
| 43 | 43 | |
| 44 | - add_action( 'widgets_init', array( $this, 'widget_init' ) ); |
|
| 45 | - add_action( 'admin_enqueue_scripts', array( $this, 'admin_widget_scripts' ) ); |
|
| 44 | + add_action('widgets_init', array($this, 'widget_init')); |
|
| 45 | + add_action('admin_enqueue_scripts', array($this, 'admin_widget_scripts')); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /** |
@@ -52,23 +52,23 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @return void |
| 54 | 54 | */ |
| 55 | - public function admin_widget_scripts( $hook ){ |
|
| 55 | + public function admin_widget_scripts($hook) { |
|
| 56 | 56 | // Directories of assets |
| 57 | - $js_dir = GIVE_PLUGIN_URL . 'assets/js/admin/'; |
|
| 58 | - $js_plugins = GIVE_PLUGIN_URL . 'assets/js/plugins/'; |
|
| 59 | - $css_dir = GIVE_PLUGIN_URL . 'assets/css/'; |
|
| 57 | + $js_dir = GIVE_PLUGIN_URL.'assets/js/admin/'; |
|
| 58 | + $js_plugins = GIVE_PLUGIN_URL.'assets/js/plugins/'; |
|
| 59 | + $css_dir = GIVE_PLUGIN_URL.'assets/css/'; |
|
| 60 | 60 | |
| 61 | 61 | // Use minified libraries if SCRIPT_DEBUG is turned off |
| 62 | - $suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min'; |
|
| 62 | + $suffix = (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG) ? '' : '.min'; |
|
| 63 | 63 | |
| 64 | 64 | // Widget Script |
| 65 | - if ( $hook == 'widgets.php' ) { |
|
| 65 | + if ($hook == 'widgets.php') { |
|
| 66 | 66 | |
| 67 | - wp_enqueue_style( 'give-qtip-css', $css_dir . 'jquery.qtip' . $suffix . '.css' ); |
|
| 67 | + wp_enqueue_style('give-qtip-css', $css_dir.'jquery.qtip'.$suffix.'.css'); |
|
| 68 | 68 | |
| 69 | - wp_enqueue_script( 'give-qtip', $js_plugins . 'jquery.qtip' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION ); |
|
| 69 | + wp_enqueue_script('give-qtip', $js_plugins.'jquery.qtip'.$suffix.'.js', array('jquery'), GIVE_VERSION); |
|
| 70 | 70 | |
| 71 | - wp_enqueue_script( 'give-admin-widgets-scripts', $js_dir . 'admin-widgets' . $suffix . '.js', array( 'jquery' ), GIVE_VERSION, false ); |
|
| 71 | + wp_enqueue_script('give-admin-widgets-scripts', $js_dir.'admin-widgets'.$suffix.'.js', array('jquery'), GIVE_VERSION, false); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | * before_widget, and after_widget. |
| 80 | 80 | * @param array $instance The settings for the particular instance of the widget. |
| 81 | 81 | */ |
| 82 | - public function widget( $args, $instance ){ |
|
| 83 | - $title = !empty( $instance['title'] ) ? $instance['title'] : ''; |
|
| 84 | - $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); |
|
| 82 | + public function widget($args, $instance) { |
|
| 83 | + $title = ! empty($instance['title']) ? $instance['title'] : ''; |
|
| 84 | + $title = apply_filters('widget_title', $title, $instance, $this->id_base); |
|
| 85 | 85 | |
| 86 | 86 | echo $args['before_widget']; |
| 87 | 87 | |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | * |
| 91 | 91 | * @since 1.0 |
| 92 | 92 | */ |
| 93 | - do_action( 'give_before_forms_widget' ); |
|
| 93 | + do_action('give_before_forms_widget'); |
|
| 94 | 94 | |
| 95 | - echo $title ? $args['before_title'] . $title . $args['after_title'] : ''; |
|
| 95 | + echo $title ? $args['before_title'].$title.$args['after_title'] : ''; |
|
| 96 | 96 | |
| 97 | - give_get_donation_form( $instance ); |
|
| 97 | + give_get_donation_form($instance); |
|
| 98 | 98 | |
| 99 | 99 | echo $args['after_widget']; |
| 100 | 100 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * |
| 104 | 104 | * @since 1.0 |
| 105 | 105 | */ |
| 106 | - do_action( 'give_after_forms_widget' ); |
|
| 106 | + do_action('give_after_forms_widget'); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @return string |
| 115 | 115 | */ |
| 116 | - public function form( $instance ){ |
|
| 116 | + public function form($instance) { |
|
| 117 | 117 | $defaults = array( |
| 118 | 118 | 'title' => '', |
| 119 | 119 | 'id' => '', |
@@ -123,84 +123,84 @@ discard block |
||
| 123 | 123 | 'continue_button_title' => '', |
| 124 | 124 | ); |
| 125 | 125 | |
| 126 | - $instance = wp_parse_args( (array) $instance, $defaults ); |
|
| 126 | + $instance = wp_parse_args((array) $instance, $defaults); |
|
| 127 | 127 | |
| 128 | 128 | // Backward compatibility: Set float labels as default if, it was set as empty previous. |
| 129 | - $instance['float_labels'] = empty( $instance['float_labels'] ) ? 'global' : $instance['float_labels']; |
|
| 129 | + $instance['float_labels'] = empty($instance['float_labels']) ? 'global' : $instance['float_labels']; |
|
| 130 | 130 | |
| 131 | 131 | // Query Give Forms |
| 132 | 132 | $args = array( |
| 133 | 133 | 'post_type' => 'give_forms', |
| 134 | - 'posts_per_page' => - 1, |
|
| 134 | + 'posts_per_page' => -1, |
|
| 135 | 135 | 'post_status' => 'publish', |
| 136 | 136 | ); |
| 137 | 137 | |
| 138 | - $give_forms = get_posts( $args ); |
|
| 138 | + $give_forms = get_posts($args); |
|
| 139 | 139 | ?> |
| 140 | 140 | <div class="give_forms_widget_container"> |
| 141 | 141 | |
| 142 | 142 | <?php // Widget: widget Title. ?> |
| 143 | 143 | <p> |
| 144 | - <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'give' ); ?></label> |
|
| 145 | - <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php esc_attr_e( $instance['title'] ); ?>" /><br> |
|
| 146 | - <small class="give-field-description"><?php esc_html_e( 'Leave blank to hide the widget title.', 'give' ); ?></small> |
|
| 144 | + <label for="<?php echo $this->get_field_id('title'); ?>"><?php esc_html_e('Title:', 'give'); ?></label> |
|
| 145 | + <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php esc_attr_e($instance['title']); ?>" /><br> |
|
| 146 | + <small class="give-field-description"><?php esc_html_e('Leave blank to hide the widget title.', 'give'); ?></small> |
|
| 147 | 147 | </p> |
| 148 | 148 | |
| 149 | 149 | <?php // Widget: Give Form?> |
| 150 | 150 | <p> |
| 151 | - <label for="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"><?php esc_html_e( 'Give Form:', 'give' ); ?></label> |
|
| 152 | - <select class="widefat" name="<?php echo esc_attr( $this->get_field_name( 'id' ) ); ?>" id="<?php echo esc_attr( $this->get_field_id( 'id' ) ); ?>"> |
|
| 153 | - <option value="current"><?php esc_html_e( '- Select -', 'give' ); ?></option> |
|
| 154 | - <?php foreach ( $give_forms as $give_form ) { ?> |
|
| 155 | - <?php $form_title = empty( $give_form->post_title ) ? sprintf( __( 'Untitled (#%s)', 'give' ), $give_form->ID ) : $give_form->post_title; ?> |
|
| 156 | - <option <?php selected( absint( $instance['id'] ), $give_form->ID ); ?> value="<?php echo esc_attr( $give_form->ID ); ?>"><?php echo $form_title; ?></option> |
|
| 151 | + <label for="<?php echo esc_attr($this->get_field_id('id')); ?>"><?php esc_html_e('Give Form:', 'give'); ?></label> |
|
| 152 | + <select class="widefat" name="<?php echo esc_attr($this->get_field_name('id')); ?>" id="<?php echo esc_attr($this->get_field_id('id')); ?>"> |
|
| 153 | + <option value="current"><?php esc_html_e('- Select -', 'give'); ?></option> |
|
| 154 | + <?php foreach ($give_forms as $give_form) { ?> |
|
| 155 | + <?php $form_title = empty($give_form->post_title) ? sprintf(__('Untitled (#%s)', 'give'), $give_form->ID) : $give_form->post_title; ?> |
|
| 156 | + <option <?php selected(absint($instance['id']), $give_form->ID); ?> value="<?php echo esc_attr($give_form->ID); ?>"><?php echo $form_title; ?></option> |
|
| 157 | 157 | <?php } ?> |
| 158 | 158 | </select><br> |
| 159 | - <small class="give-field-description"><?php esc_html_e( 'Select a Give Form to embed in this widget.', 'give' ); ?></small> |
|
| 159 | + <small class="give-field-description"><?php esc_html_e('Select a Give Form to embed in this widget.', 'give'); ?></small> |
|
| 160 | 160 | </p> |
| 161 | 161 | |
| 162 | 162 | <?php // Widget: Display Style ?> |
| 163 | 163 | <p class="give_forms_display_style_setting_row"> |
| 164 | - <label for="<?php echo esc_attr( $this->get_field_id( 'display_style' ) ); ?>"><?php esc_html_e( 'Display Style:', 'give' ); ?></label><br> |
|
| 165 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-onpage" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="onpage" <?php checked( $instance['display_style'], 'onpage' ); ?>> <?php echo esc_html__( 'All Fields', 'give' ); ?></label> |
|
| 166 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-reveal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="reveal" <?php checked( $instance['display_style'], 'reveal' ); ?>> <?php echo esc_html__( 'Reveal', 'give' ); ?></label> |
|
| 167 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-modal" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="modal" <?php checked( $instance['display_style'], 'modal' ); ?>> <?php echo esc_html__( 'Modal', 'give' ); ?></label> |
|
| 168 | - <label for="<?php echo $this->get_field_id( 'display_style' ); ?>-button"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'display_style' ); ?>-button" name="<?php echo $this->get_field_name( 'display_style' ); ?>" value="button" <?php checked( $instance['display_style'], 'button' ); ?>> <?php echo esc_html__( 'Button', 'give' ); ?></label><br> |
|
| 164 | + <label for="<?php echo esc_attr($this->get_field_id('display_style')); ?>"><?php esc_html_e('Display Style:', 'give'); ?></label><br> |
|
| 165 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-onpage"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-onpage" name="<?php echo $this->get_field_name('display_style'); ?>" value="onpage" <?php checked($instance['display_style'], 'onpage'); ?>> <?php echo esc_html__('All Fields', 'give'); ?></label> |
|
| 166 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-reveal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-reveal" name="<?php echo $this->get_field_name('display_style'); ?>" value="reveal" <?php checked($instance['display_style'], 'reveal'); ?>> <?php echo esc_html__('Reveal', 'give'); ?></label> |
|
| 167 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-modal"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-modal" name="<?php echo $this->get_field_name('display_style'); ?>" value="modal" <?php checked($instance['display_style'], 'modal'); ?>> <?php echo esc_html__('Modal', 'give'); ?></label> |
|
| 168 | + <label for="<?php echo $this->get_field_id('display_style'); ?>-button"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('display_style'); ?>-button" name="<?php echo $this->get_field_name('display_style'); ?>" value="button" <?php checked($instance['display_style'], 'button'); ?>> <?php echo esc_html__('Button', 'give'); ?></label><br> |
|
| 169 | 169 | <small class="give-field-description"> |
| 170 | - <?php echo esc_html__( 'Select a Give Form style.', 'give' ); ?> |
|
| 170 | + <?php echo esc_html__('Select a Give Form style.', 'give'); ?> |
|
| 171 | 171 | </small> |
| 172 | 172 | </p> |
| 173 | 173 | |
| 174 | 174 | <?php // Widget: Continue Button Title. ?> |
| 175 | 175 | <p class="give_forms_continue_button_title_setting_row"> |
| 176 | - <label for="<?php echo $this->get_field_id( 'continue_button_title' ); ?>"><?php esc_html_e( 'Button Text:', 'give' ); ?></label> |
|
| 177 | - <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'continue_button_title' ); ?>" name="<?php echo $this->get_field_name( 'continue_button_title' ); ?>" value="<?php esc_attr_e( $instance['continue_button_title'] ); ?>" /><br> |
|
| 178 | - <small class="give-field-description"><?php esc_html_e( 'The button label for displaying the additional payment fields.', 'give' ); ?></small> |
|
| 176 | + <label for="<?php echo $this->get_field_id('continue_button_title'); ?>"><?php esc_html_e('Button Text:', 'give'); ?></label> |
|
| 177 | + <input type="text" class="widefat" id="<?php echo $this->get_field_id('continue_button_title'); ?>" name="<?php echo $this->get_field_name('continue_button_title'); ?>" value="<?php esc_attr_e($instance['continue_button_title']); ?>" /><br> |
|
| 178 | + <small class="give-field-description"><?php esc_html_e('The button label for displaying the additional payment fields.', 'give'); ?></small> |
|
| 179 | 179 | </p> |
| 180 | 180 | |
| 181 | 181 | <?php // Widget: Floating Labels ?> |
| 182 | 182 | <p> |
| 183 | - <label for="<?php echo esc_attr( $this->get_field_id( 'float_labels' ) ); ?>"><?php esc_html_e( 'Floating Labels (optional):', 'give' ); ?></label><br> |
|
| 184 | - <label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-global" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="global" <?php checked( $instance['float_labels'], 'global' ); ?>> <?php echo esc_html__( 'Global Option', 'give' ); ?></label> |
|
| 185 | - <label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-enabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="enabled" <?php checked( $instance['float_labels'], 'enabled' ); ?>> <?php echo esc_html__( 'Yes', 'give' ); ?></label> |
|
| 186 | - <label for="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'float_labels' ); ?>-disabled" name="<?php echo $this->get_field_name( 'float_labels' ); ?>" value="disabled" <?php checked( $instance['float_labels'], 'disabled' ); ?>> <?php echo esc_html__( 'No', 'give' ); ?></label><br> |
|
| 183 | + <label for="<?php echo esc_attr($this->get_field_id('float_labels')); ?>"><?php esc_html_e('Floating Labels (optional):', 'give'); ?></label><br> |
|
| 184 | + <label for="<?php echo $this->get_field_id('float_labels'); ?>-global"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-global" name="<?php echo $this->get_field_name('float_labels'); ?>" value="global" <?php checked($instance['float_labels'], 'global'); ?>> <?php echo esc_html__('Global Option', 'give'); ?></label> |
|
| 185 | + <label for="<?php echo $this->get_field_id('float_labels'); ?>-enabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-enabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="enabled" <?php checked($instance['float_labels'], 'enabled'); ?>> <?php echo esc_html__('Yes', 'give'); ?></label> |
|
| 186 | + <label for="<?php echo $this->get_field_id('float_labels'); ?>-disabled"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('float_labels'); ?>-disabled" name="<?php echo $this->get_field_name('float_labels'); ?>" value="disabled" <?php checked($instance['float_labels'], 'disabled'); ?>> <?php echo esc_html__('No', 'give'); ?></label><br> |
|
| 187 | 187 | <small class="give-field-description"> |
| 188 | 188 | <?php |
| 189 | 189 | printf( |
| 190 | 190 | /* translators: %s: http://docs.givewp.com/form-floating-labels */ |
| 191 | - __( 'Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give' ), |
|
| 192 | - esc_url( 'http://docs.givewp.com/form-floating-labels' ) |
|
| 191 | + __('Override the <a href="%s" target="_blank">floating labels</a> setting for this Give form.', 'give'), |
|
| 192 | + esc_url('http://docs.givewp.com/form-floating-labels') |
|
| 193 | 193 | ); |
| 194 | 194 | ?></small> |
| 195 | 195 | </p> |
| 196 | 196 | |
| 197 | 197 | <?php // Widget: Display Content ?> |
| 198 | 198 | <p> |
| 199 | - <label for="<?php echo esc_attr( $this->get_field_id( 'show_content' ) ); ?>"><?php esc_html_e( 'Display Content (optional):', 'give' ); ?></label><br> |
|
| 200 | - <label for="<?php echo $this->get_field_id( 'show_content' ); ?>-none"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-none" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="none" <?php checked( $instance['show_content'], 'none' ); ?>> <?php echo esc_html__( 'None', 'give' ); ?></label> |
|
| 201 | - <label for="<?php echo $this->get_field_id( 'show_content' ); ?>-above"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-above" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="above" <?php checked( $instance['show_content'], 'above' ); ?>> <?php echo esc_html__( 'Above', 'give' ); ?></label> |
|
| 202 | - <label for="<?php echo $this->get_field_id( 'show_content' ); ?>-below"><input type="radio" class="widefat" id="<?php echo $this->get_field_id( 'show_content' ); ?>-below" name="<?php echo $this->get_field_name( 'show_content' ); ?>" value="below" <?php checked( $instance['show_content'], 'below' ); ?>> <?php echo esc_html__( 'Below', 'give' ); ?></label><br> |
|
| 203 | - <small class="give-field-description"><?php esc_html_e( 'Override the display content setting for this Give form.', 'give' ); ?></small> |
|
| 199 | + <label for="<?php echo esc_attr($this->get_field_id('show_content')); ?>"><?php esc_html_e('Display Content (optional):', 'give'); ?></label><br> |
|
| 200 | + <label for="<?php echo $this->get_field_id('show_content'); ?>-none"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-none" name="<?php echo $this->get_field_name('show_content'); ?>" value="none" <?php checked($instance['show_content'], 'none'); ?>> <?php echo esc_html__('None', 'give'); ?></label> |
|
| 201 | + <label for="<?php echo $this->get_field_id('show_content'); ?>-above"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-above" name="<?php echo $this->get_field_name('show_content'); ?>" value="above" <?php checked($instance['show_content'], 'above'); ?>> <?php echo esc_html__('Above', 'give'); ?></label> |
|
| 202 | + <label for="<?php echo $this->get_field_id('show_content'); ?>-below"><input type="radio" class="widefat" id="<?php echo $this->get_field_id('show_content'); ?>-below" name="<?php echo $this->get_field_name('show_content'); ?>" value="below" <?php checked($instance['show_content'], 'below'); ?>> <?php echo esc_html__('Below', 'give'); ?></label><br> |
|
| 203 | + <small class="give-field-description"><?php esc_html_e('Override the display content setting for this Give form.', 'give'); ?></small> |
|
| 204 | 204 | </div> |
| 205 | 205 | <?php |
| 206 | 206 | } |
@@ -210,8 +210,8 @@ discard block |
||
| 210 | 210 | * |
| 211 | 211 | * @return void |
| 212 | 212 | */ |
| 213 | - function widget_init(){ |
|
| 214 | - register_widget( $this->self ); |
|
| 213 | + function widget_init() { |
|
| 214 | + register_widget($this->self); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | /** |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | * |
| 223 | 223 | * @return array |
| 224 | 224 | */ |
| 225 | - public function update( $new_instance, $old_instance ){ |
|
| 225 | + public function update($new_instance, $old_instance) { |
|
| 226 | 226 | $this->flush_widget_cache(); |
| 227 | 227 | |
| 228 | 228 | return $new_instance; |
@@ -233,8 +233,8 @@ discard block |
||
| 233 | 233 | * |
| 234 | 234 | * @return void |
| 235 | 235 | */ |
| 236 | - public function flush_widget_cache(){ |
|
| 237 | - wp_cache_delete( $this->self, 'widget' ); |
|
| 236 | + public function flush_widget_cache() { |
|
| 237 | + wp_cache_delete($this->self, 'widget'); |
|
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -23,14 +23,14 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | global $typenow; |
| 25 | 25 | |
| 26 | - if ( $typenow != 'give_forms' ) { |
|
| 26 | + if ($typenow != 'give_forms') { |
|
| 27 | 27 | return true; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | return false; |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | -add_filter( 'give_shortcode_button_condition', 'give_shortcode_button_condition' ); |
|
| 33 | +add_filter('give_shortcode_button_condition', 'give_shortcode_button_condition'); |
|
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @return int|false |
| 42 | 42 | */ |
| 43 | -function get_form_id_from_args( $args ) { |
|
| 43 | +function get_form_id_from_args($args) { |
|
| 44 | 44 | |
| 45 | - if ( isset( $args['form_id'] ) && $args['form_id'] != 0 ) { |
|
| 45 | + if (isset($args['form_id']) && $args['form_id'] != 0) { |
|
| 46 | 46 | |
| 47 | - return intval( $args['form_id'] ); |
|
| 47 | + return intval($args['form_id']); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | return false; |
@@ -59,23 +59,23 @@ discard block |
||
| 59 | 59 | * |
| 60 | 60 | * @return bool |
| 61 | 61 | */ |
| 62 | -function give_is_float_labels_enabled( $args ) { |
|
| 62 | +function give_is_float_labels_enabled($args) { |
|
| 63 | 63 | |
| 64 | 64 | $float_labels = ''; |
| 65 | 65 | |
| 66 | - if ( ! empty( $args['float_labels'] ) ) { |
|
| 66 | + if ( ! empty($args['float_labels'])) { |
|
| 67 | 67 | $float_labels = $args['float_labels']; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if ( empty( $float_labels ) ) { |
|
| 71 | - $float_labels = get_post_meta( $args['form_id'], '_give_form_floating_labels', true ); |
|
| 70 | + if (empty($float_labels)) { |
|
| 71 | + $float_labels = get_post_meta($args['form_id'], '_give_form_floating_labels', true); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if ( empty( $float_labels ) || ( 'global' === $float_labels ) ) { |
|
| 75 | - $float_labels = give_get_option( 'floatlabels', 'disabled' ); |
|
| 74 | + if (empty($float_labels) || ('global' === $float_labels)) { |
|
| 75 | + $float_labels = give_get_option('floatlabels', 'disabled'); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - return give_is_setting_enabled( $float_labels ); |
|
| 78 | + return give_is_setting_enabled($float_labels); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | /** |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $can_checkout = true; |
| 93 | 93 | |
| 94 | - return (bool) apply_filters( 'give_can_checkout', $can_checkout ); |
|
| 94 | + return (bool) apply_filters('give_can_checkout', $can_checkout); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | function give_get_success_page_uri() { |
| 106 | 106 | $give_options = give_get_settings(); |
| 107 | 107 | |
| 108 | - $success_page = isset( $give_options['success_page'] ) ? get_permalink( absint( $give_options['success_page'] ) ) : get_bloginfo( 'url' ); |
|
| 108 | + $success_page = isset($give_options['success_page']) ? get_permalink(absint($give_options['success_page'])) : get_bloginfo('url'); |
|
| 109 | 109 | |
| 110 | - return apply_filters( 'give_get_success_page_uri', $success_page ); |
|
| 110 | + return apply_filters('give_get_success_page_uri', $success_page); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -119,9 +119,9 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | function give_is_success_page() { |
| 121 | 121 | $give_options = give_get_settings(); |
| 122 | - $is_success_page = isset( $give_options['success_page'] ) ? is_page( $give_options['success_page'] ) : false; |
|
| 122 | + $is_success_page = isset($give_options['success_page']) ? is_page($give_options['success_page']) : false; |
|
| 123 | 123 | |
| 124 | - return apply_filters( 'give_is_success_page', $is_success_page ); |
|
| 124 | + return apply_filters('give_is_success_page', $is_success_page); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -135,17 +135,17 @@ discard block |
||
| 135 | 135 | * @since 1.0 |
| 136 | 136 | * @return void |
| 137 | 137 | */ |
| 138 | -function give_send_to_success_page( $query_string = null ) { |
|
| 138 | +function give_send_to_success_page($query_string = null) { |
|
| 139 | 139 | |
| 140 | 140 | $redirect = give_get_success_page_uri(); |
| 141 | 141 | |
| 142 | - if ( $query_string ) { |
|
| 142 | + if ($query_string) { |
|
| 143 | 143 | $redirect .= $query_string; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - $gateway = isset( $_REQUEST['give-gateway'] ) ? $_REQUEST['give-gateway'] : ''; |
|
| 146 | + $gateway = isset($_REQUEST['give-gateway']) ? $_REQUEST['give-gateway'] : ''; |
|
| 147 | 147 | |
| 148 | - wp_redirect( apply_filters( 'give_success_page_redirect', $redirect, $gateway, $query_string ) ); |
|
| 148 | + wp_redirect(apply_filters('give_success_page_redirect', $redirect, $gateway, $query_string)); |
|
| 149 | 149 | give_die(); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -161,19 +161,19 @@ discard block |
||
| 161 | 161 | * @since 1.0 |
| 162 | 162 | * @return Void |
| 163 | 163 | */ |
| 164 | -function give_send_back_to_checkout( $args = array() ) { |
|
| 164 | +function give_send_back_to_checkout($args = array()) { |
|
| 165 | 165 | |
| 166 | - $url = isset( $_POST['give-current-url'] ) ? sanitize_text_field( $_POST['give-current-url'] ) : ''; |
|
| 166 | + $url = isset($_POST['give-current-url']) ? sanitize_text_field($_POST['give-current-url']) : ''; |
|
| 167 | 167 | $form_id = 0; |
| 168 | 168 | |
| 169 | 169 | // Set the form_id. |
| 170 | - if ( isset( $_POST['give-form-id'] ) ) { |
|
| 171 | - $form_id = sanitize_text_field( $_POST['give-form-id'] ); |
|
| 170 | + if (isset($_POST['give-form-id'])) { |
|
| 171 | + $form_id = sanitize_text_field($_POST['give-form-id']); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | // Need a URL to continue. If none, redirect back to single form. |
| 175 | - if ( empty( $url ) ) { |
|
| 176 | - wp_safe_redirect( get_permalink( $form_id ) ); |
|
| 175 | + if (empty($url)) { |
|
| 176 | + wp_safe_redirect(get_permalink($form_id)); |
|
| 177 | 177 | give_die(); |
| 178 | 178 | } |
| 179 | 179 | |
@@ -182,41 +182,41 @@ discard block |
||
| 182 | 182 | ); |
| 183 | 183 | |
| 184 | 184 | // Set the $level_id. |
| 185 | - if ( isset( $_POST['give-price-id'] ) ) { |
|
| 186 | - $defaults['level-id'] = sanitize_text_field( $_POST['give-price-id'] ); |
|
| 185 | + if (isset($_POST['give-price-id'])) { |
|
| 186 | + $defaults['level-id'] = sanitize_text_field($_POST['give-price-id']); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | // Check for backward compatibility. |
| 190 | - if ( is_string( $args ) ) { |
|
| 191 | - $args = str_replace( '?', '', $args ); |
|
| 190 | + if (is_string($args)) { |
|
| 191 | + $args = str_replace('?', '', $args); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - $args = wp_parse_args( $args, $defaults ); |
|
| 194 | + $args = wp_parse_args($args, $defaults); |
|
| 195 | 195 | |
| 196 | 196 | // Merge URL query with $args to maintain third-party URL parameters after redirect. |
| 197 | - $url_data = wp_parse_url( $url ); |
|
| 197 | + $url_data = wp_parse_url($url); |
|
| 198 | 198 | |
| 199 | 199 | // Check if an array to prevent notices before parsing. |
| 200 | - if ( isset( $url_data['query'] ) && ! empty( $url_data['query'] ) ) { |
|
| 201 | - parse_str( $url_data['query'], $query ); |
|
| 200 | + if (isset($url_data['query']) && ! empty($url_data['query'])) { |
|
| 201 | + parse_str($url_data['query'], $query); |
|
| 202 | 202 | |
| 203 | 203 | // Precaution: don't allow any CC info. |
| 204 | - unset( $query['card_number'] ); |
|
| 205 | - unset( $query['card_cvc'] ); |
|
| 204 | + unset($query['card_number']); |
|
| 205 | + unset($query['card_cvc']); |
|
| 206 | 206 | |
| 207 | 207 | } else { |
| 208 | 208 | // No $url_data so pass empty array. |
| 209 | 209 | $query = array(); |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | - $new_query = array_merge( $args, $query ); |
|
| 213 | - $new_query_string = http_build_query( $new_query ); |
|
| 212 | + $new_query = array_merge($args, $query); |
|
| 213 | + $new_query_string = http_build_query($new_query); |
|
| 214 | 214 | |
| 215 | 215 | // Assemble URL parts. |
| 216 | - $redirect = home_url( '/' . $url_data['path'] . '?' . $new_query_string . '#give-form-' . $form_id . '-wrap' ); |
|
| 216 | + $redirect = home_url('/'.$url_data['path'].'?'.$new_query_string.'#give-form-'.$form_id.'-wrap'); |
|
| 217 | 217 | |
| 218 | 218 | // Redirect them. |
| 219 | - wp_safe_redirect( apply_filters( 'give_send_back_to_checkout', $redirect, $args ) ); |
|
| 219 | + wp_safe_redirect(apply_filters('give_send_back_to_checkout', $redirect, $args)); |
|
| 220 | 220 | give_die(); |
| 221 | 221 | |
| 222 | 222 | } |
@@ -232,16 +232,16 @@ discard block |
||
| 232 | 232 | * @since 1.0 |
| 233 | 233 | * @return string |
| 234 | 234 | */ |
| 235 | -function give_get_success_page_url( $query_string = null ) { |
|
| 235 | +function give_get_success_page_url($query_string = null) { |
|
| 236 | 236 | |
| 237 | - $success_page = give_get_option( 'success_page', 0 ); |
|
| 238 | - $success_page = get_permalink( $success_page ); |
|
| 237 | + $success_page = give_get_option('success_page', 0); |
|
| 238 | + $success_page = get_permalink($success_page); |
|
| 239 | 239 | |
| 240 | - if ( $query_string ) { |
|
| 240 | + if ($query_string) { |
|
| 241 | 241 | $success_page .= $query_string; |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - return apply_filters( 'give_success_page_url', $success_page ); |
|
| 244 | + return apply_filters('give_success_page_url', $success_page); |
|
| 245 | 245 | |
| 246 | 246 | } |
| 247 | 247 | |
@@ -254,15 +254,15 @@ discard block |
||
| 254 | 254 | * |
| 255 | 255 | * @return mixed|void Full URL to the Failed Donation Page, if present, home page if it doesn't exist |
| 256 | 256 | */ |
| 257 | -function give_get_failed_transaction_uri( $extras = false ) { |
|
| 257 | +function give_get_failed_transaction_uri($extras = false) { |
|
| 258 | 258 | $give_options = give_get_settings(); |
| 259 | 259 | |
| 260 | - $uri = ! empty( $give_options['failure_page'] ) ? trailingslashit( get_permalink( $give_options['failure_page'] ) ) : home_url(); |
|
| 261 | - if ( $extras ) { |
|
| 260 | + $uri = ! empty($give_options['failure_page']) ? trailingslashit(get_permalink($give_options['failure_page'])) : home_url(); |
|
| 261 | + if ($extras) { |
|
| 262 | 262 | $uri .= $extras; |
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - return apply_filters( 'give_get_failed_transaction_uri', $uri ); |
|
| 265 | + return apply_filters('give_get_failed_transaction_uri', $uri); |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /** |
@@ -273,9 +273,9 @@ discard block |
||
| 273 | 273 | */ |
| 274 | 274 | function give_is_failed_transaction_page() { |
| 275 | 275 | $give_options = give_get_settings(); |
| 276 | - $ret = isset( $give_options['failure_page'] ) ? is_page( $give_options['failure_page'] ) : false; |
|
| 276 | + $ret = isset($give_options['failure_page']) ? is_page($give_options['failure_page']) : false; |
|
| 277 | 277 | |
| 278 | - return apply_filters( 'give_is_failure_page', $ret ); |
|
| 278 | + return apply_filters('give_is_failure_page', $ret); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
@@ -287,18 +287,18 @@ discard block |
||
| 287 | 287 | */ |
| 288 | 288 | function give_listen_for_failed_payments() { |
| 289 | 289 | |
| 290 | - $failed_page = give_get_option( 'failure_page', 0 ); |
|
| 290 | + $failed_page = give_get_option('failure_page', 0); |
|
| 291 | 291 | |
| 292 | - if ( ! empty( $failed_page ) && is_page( $failed_page ) && ! empty( $_GET['payment-id'] ) ) { |
|
| 292 | + if ( ! empty($failed_page) && is_page($failed_page) && ! empty($_GET['payment-id'])) { |
|
| 293 | 293 | |
| 294 | - $payment_id = absint( $_GET['payment-id'] ); |
|
| 295 | - give_update_payment_status( $payment_id, 'failed' ); |
|
| 294 | + $payment_id = absint($_GET['payment-id']); |
|
| 295 | + give_update_payment_status($payment_id, 'failed'); |
|
| 296 | 296 | |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | -add_action( 'template_redirect', 'give_listen_for_failed_payments' ); |
|
| 301 | +add_action('template_redirect', 'give_listen_for_failed_payments'); |
|
| 302 | 302 | |
| 303 | 303 | /** |
| 304 | 304 | * Retrieve the Donation History page URI |
@@ -311,9 +311,9 @@ discard block |
||
| 311 | 311 | function give_get_history_page_uri() { |
| 312 | 312 | $give_options = give_get_settings(); |
| 313 | 313 | |
| 314 | - $history_page = isset( $give_options['history_page'] ) ? get_permalink( absint( $give_options['history_page'] ) ) : get_bloginfo( 'url' ); |
|
| 314 | + $history_page = isset($give_options['history_page']) ? get_permalink(absint($give_options['history_page'])) : get_bloginfo('url'); |
|
| 315 | 315 | |
| 316 | - return apply_filters( 'give_get_history_page_uri', $history_page ); |
|
| 316 | + return apply_filters('give_get_history_page_uri', $history_page); |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | /** |
@@ -326,11 +326,11 @@ discard block |
||
| 326 | 326 | * @since 1.0 |
| 327 | 327 | * @return bool |
| 328 | 328 | */ |
| 329 | -function give_field_is_required( $field = '', $form_id ) { |
|
| 329 | +function give_field_is_required($field = '', $form_id) { |
|
| 330 | 330 | |
| 331 | - $required_fields = give_get_required_fields( $form_id ); |
|
| 331 | + $required_fields = give_get_required_fields($form_id); |
|
| 332 | 332 | |
| 333 | - return array_key_exists( $field, $required_fields ); |
|
| 333 | + return array_key_exists($field, $required_fields); |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | /** |
@@ -348,14 +348,14 @@ discard block |
||
| 348 | 348 | * |
| 349 | 349 | * @return void |
| 350 | 350 | */ |
| 351 | -function give_record_sale_in_log( $give_form_id = 0, $payment_id, $price_id = false, $sale_date = null ) { |
|
| 351 | +function give_record_sale_in_log($give_form_id = 0, $payment_id, $price_id = false, $sale_date = null) { |
|
| 352 | 352 | global $give_logs; |
| 353 | 353 | |
| 354 | 354 | $log_data = array( |
| 355 | 355 | 'post_parent' => $give_form_id, |
| 356 | 356 | 'log_type' => 'sale', |
| 357 | - 'post_date' => isset( $sale_date ) ? $sale_date : null, |
|
| 358 | - 'post_date_gmt' => isset( $sale_date ) ? $sale_date : null, |
|
| 357 | + 'post_date' => isset($sale_date) ? $sale_date : null, |
|
| 358 | + 'post_date_gmt' => isset($sale_date) ? $sale_date : null, |
|
| 359 | 359 | ); |
| 360 | 360 | |
| 361 | 361 | $log_meta = array( |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | 'price_id' => (int) $price_id, |
| 364 | 364 | ); |
| 365 | 365 | |
| 366 | - $give_logs->insert_log( $log_data, $log_meta ); |
|
| 366 | + $give_logs->insert_log($log_data, $log_meta); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | |
@@ -377,11 +377,11 @@ discard block |
||
| 377 | 377 | * |
| 378 | 378 | * @return bool|int |
| 379 | 379 | */ |
| 380 | -function give_increase_purchase_count( $form_id = 0, $quantity = 1 ) { |
|
| 380 | +function give_increase_purchase_count($form_id = 0, $quantity = 1) { |
|
| 381 | 381 | $quantity = (int) $quantity; |
| 382 | - $form = new Give_Donate_Form( $form_id ); |
|
| 382 | + $form = new Give_Donate_Form($form_id); |
|
| 383 | 383 | |
| 384 | - return $form->increase_sales( $quantity ); |
|
| 384 | + return $form->increase_sales($quantity); |
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | /** |
@@ -394,11 +394,11 @@ discard block |
||
| 394 | 394 | * |
| 395 | 395 | * @return bool|int |
| 396 | 396 | */ |
| 397 | -function give_decrease_purchase_count( $form_id = 0, $quantity = 1 ) { |
|
| 397 | +function give_decrease_purchase_count($form_id = 0, $quantity = 1) { |
|
| 398 | 398 | $quantity = (int) $quantity; |
| 399 | - $form = new Give_Donate_Form( $form_id ); |
|
| 399 | + $form = new Give_Donate_Form($form_id); |
|
| 400 | 400 | |
| 401 | - return $form->decrease_sales( $quantity ); |
|
| 401 | + return $form->decrease_sales($quantity); |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | /** |
@@ -411,10 +411,10 @@ discard block |
||
| 411 | 411 | * |
| 412 | 412 | * @return bool|int |
| 413 | 413 | */ |
| 414 | -function give_increase_earnings( $give_form_id = 0, $amount ) { |
|
| 415 | - $form = new Give_Donate_Form( $give_form_id ); |
|
| 414 | +function give_increase_earnings($give_form_id = 0, $amount) { |
|
| 415 | + $form = new Give_Donate_Form($give_form_id); |
|
| 416 | 416 | |
| 417 | - return $form->increase_earnings( $amount ); |
|
| 417 | + return $form->increase_earnings($amount); |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | /** |
@@ -427,10 +427,10 @@ discard block |
||
| 427 | 427 | * |
| 428 | 428 | * @return bool|int |
| 429 | 429 | */ |
| 430 | -function give_decrease_earnings( $form_id = 0, $amount ) { |
|
| 431 | - $form = new Give_Donate_Form( $form_id ); |
|
| 430 | +function give_decrease_earnings($form_id = 0, $amount) { |
|
| 431 | + $form = new Give_Donate_Form($form_id); |
|
| 432 | 432 | |
| 433 | - return $form->decrease_earnings( $amount ); |
|
| 433 | + return $form->decrease_earnings($amount); |
|
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | |
@@ -443,8 +443,8 @@ discard block |
||
| 443 | 443 | * |
| 444 | 444 | * @return int $earnings Earnings for a certain form |
| 445 | 445 | */ |
| 446 | -function give_get_form_earnings_stats( $form_id = 0 ) { |
|
| 447 | - $give_form = new Give_Donate_Form( $form_id ); |
|
| 446 | +function give_get_form_earnings_stats($form_id = 0) { |
|
| 447 | + $give_form = new Give_Donate_Form($form_id); |
|
| 448 | 448 | |
| 449 | 449 | return $give_form->earnings; |
| 450 | 450 | } |
@@ -459,8 +459,8 @@ discard block |
||
| 459 | 459 | * |
| 460 | 460 | * @return int $sales Amount of sales for a certain form |
| 461 | 461 | */ |
| 462 | -function give_get_form_sales_stats( $give_form_id = 0 ) { |
|
| 463 | - $give_form = new Give_Donate_Form( $give_form_id ); |
|
| 462 | +function give_get_form_sales_stats($give_form_id = 0) { |
|
| 463 | + $give_form = new Give_Donate_Form($give_form_id); |
|
| 464 | 464 | |
| 465 | 465 | return $give_form->sales; |
| 466 | 466 | } |
@@ -475,16 +475,16 @@ discard block |
||
| 475 | 475 | * |
| 476 | 476 | * @return float $sales Average monthly sales |
| 477 | 477 | */ |
| 478 | -function give_get_average_monthly_form_sales( $form_id = 0 ) { |
|
| 479 | - $sales = give_get_form_sales_stats( $form_id ); |
|
| 480 | - $release_date = get_post_field( 'post_date', $form_id ); |
|
| 478 | +function give_get_average_monthly_form_sales($form_id = 0) { |
|
| 479 | + $sales = give_get_form_sales_stats($form_id); |
|
| 480 | + $release_date = get_post_field('post_date', $form_id); |
|
| 481 | 481 | |
| 482 | - $diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) ); |
|
| 482 | + $diff = abs(current_time('timestamp') - strtotime($release_date)); |
|
| 483 | 483 | |
| 484 | - $months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication |
|
| 484 | + $months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication |
|
| 485 | 485 | |
| 486 | - if ( $months > 0 ) { |
|
| 487 | - $sales = ( $sales / $months ); |
|
| 486 | + if ($months > 0) { |
|
| 487 | + $sales = ($sales / $months); |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | return $sales; |
@@ -500,16 +500,16 @@ discard block |
||
| 500 | 500 | * |
| 501 | 501 | * @return float $earnings Average monthly earnings |
| 502 | 502 | */ |
| 503 | -function give_get_average_monthly_form_earnings( $form_id = 0 ) { |
|
| 504 | - $earnings = give_get_form_earnings_stats( $form_id ); |
|
| 505 | - $release_date = get_post_field( 'post_date', $form_id ); |
|
| 503 | +function give_get_average_monthly_form_earnings($form_id = 0) { |
|
| 504 | + $earnings = give_get_form_earnings_stats($form_id); |
|
| 505 | + $release_date = get_post_field('post_date', $form_id); |
|
| 506 | 506 | |
| 507 | - $diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) ); |
|
| 507 | + $diff = abs(current_time('timestamp') - strtotime($release_date)); |
|
| 508 | 508 | |
| 509 | - $months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication |
|
| 509 | + $months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication |
|
| 510 | 510 | |
| 511 | - if ( $months > 0 ) { |
|
| 512 | - $earnings = ( $earnings / $months ); |
|
| 511 | + if ($months > 0) { |
|
| 512 | + $earnings = ($earnings / $months); |
|
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | return $earnings < 0 ? 0 : $earnings; |
@@ -529,23 +529,23 @@ discard block |
||
| 529 | 529 | * |
| 530 | 530 | * @return string $price_name Name of the price option |
| 531 | 531 | */ |
| 532 | -function give_get_price_option_name( $form_id = 0, $price_id = 0, $payment_id = 0 ) { |
|
| 532 | +function give_get_price_option_name($form_id = 0, $price_id = 0, $payment_id = 0) { |
|
| 533 | 533 | |
| 534 | - $prices = give_get_variable_prices( $form_id ); |
|
| 534 | + $prices = give_get_variable_prices($form_id); |
|
| 535 | 535 | $price_name = ''; |
| 536 | 536 | |
| 537 | - foreach ( $prices as $price ) { |
|
| 537 | + foreach ($prices as $price) { |
|
| 538 | 538 | |
| 539 | - if ( intval( $price['_give_id']['level_id'] ) == intval( $price_id ) ) { |
|
| 539 | + if (intval($price['_give_id']['level_id']) == intval($price_id)) { |
|
| 540 | 540 | |
| 541 | - $price_text = isset( $price['_give_text'] ) ? $price['_give_text'] : ''; |
|
| 542 | - $price_fallback = give_currency_filter( give_format_amount( $price['_give_amount'] ) ); |
|
| 543 | - $price_name = ! empty( $price_text ) ? $price_text : $price_fallback; |
|
| 541 | + $price_text = isset($price['_give_text']) ? $price['_give_text'] : ''; |
|
| 542 | + $price_fallback = give_currency_filter(give_format_amount($price['_give_amount'])); |
|
| 543 | + $price_name = ! empty($price_text) ? $price_text : $price_fallback; |
|
| 544 | 544 | |
| 545 | 545 | } |
| 546 | 546 | } |
| 547 | 547 | |
| 548 | - return apply_filters( 'give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id ); |
|
| 548 | + return apply_filters('give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id); |
|
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | |
@@ -558,14 +558,14 @@ discard block |
||
| 558 | 558 | * |
| 559 | 559 | * @return string $range A fully formatted price range |
| 560 | 560 | */ |
| 561 | -function give_price_range( $form_id = 0 ) { |
|
| 562 | - $low = give_get_lowest_price_option( $form_id ); |
|
| 563 | - $high = give_get_highest_price_option( $form_id ); |
|
| 564 | - $range = '<span class="give_price_range_low">' . give_currency_filter( give_format_amount( $low ) ) . '</span>'; |
|
| 561 | +function give_price_range($form_id = 0) { |
|
| 562 | + $low = give_get_lowest_price_option($form_id); |
|
| 563 | + $high = give_get_highest_price_option($form_id); |
|
| 564 | + $range = '<span class="give_price_range_low">'.give_currency_filter(give_format_amount($low)).'</span>'; |
|
| 565 | 565 | $range .= '<span class="give_price_range_sep"> – </span>'; |
| 566 | - $range .= '<span class="give_price_range_high">' . give_currency_filter( give_format_amount( $high ) ) . '</span>'; |
|
| 566 | + $range .= '<span class="give_price_range_high">'.give_currency_filter(give_format_amount($high)).'</span>'; |
|
| 567 | 567 | |
| 568 | - return apply_filters( 'give_price_range', $range, $form_id, $low, $high ); |
|
| 568 | + return apply_filters('give_price_range', $range, $form_id, $low, $high); |
|
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | |
@@ -580,35 +580,35 @@ discard block |
||
| 580 | 580 | * |
| 581 | 581 | * @return int ID of the lowest price |
| 582 | 582 | */ |
| 583 | -function give_get_lowest_price_id( $form_id = 0 ) { |
|
| 583 | +function give_get_lowest_price_id($form_id = 0) { |
|
| 584 | 584 | |
| 585 | - if ( empty( $form_id ) ) { |
|
| 585 | + if (empty($form_id)) { |
|
| 586 | 586 | $form_id = get_the_ID(); |
| 587 | 587 | } |
| 588 | 588 | |
| 589 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
| 590 | - return give_get_form_price( $form_id ); |
|
| 589 | + if ( ! give_has_variable_prices($form_id)) { |
|
| 590 | + return give_get_form_price($form_id); |
|
| 591 | 591 | } |
| 592 | 592 | |
| 593 | - $prices = give_get_variable_prices( $form_id ); |
|
| 593 | + $prices = give_get_variable_prices($form_id); |
|
| 594 | 594 | |
| 595 | 595 | $min = $min_id = 0; |
| 596 | 596 | |
| 597 | - if ( ! empty( $prices ) ) { |
|
| 597 | + if ( ! empty($prices)) { |
|
| 598 | 598 | |
| 599 | - foreach ( $prices as $key => $price ) { |
|
| 599 | + foreach ($prices as $key => $price) { |
|
| 600 | 600 | |
| 601 | - if ( empty( $price['_give_amount'] ) ) { |
|
| 601 | + if (empty($price['_give_amount'])) { |
|
| 602 | 602 | continue; |
| 603 | 603 | } |
| 604 | 604 | |
| 605 | - if ( ! isset( $min ) ) { |
|
| 605 | + if ( ! isset($min)) { |
|
| 606 | 606 | $min = $price['_give_amount']; |
| 607 | 607 | } else { |
| 608 | - $min = min( $min, $price['_give_amount'] ); |
|
| 608 | + $min = min($min, $price['_give_amount']); |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | - if ( $price['_give_amount'] == $min ) { |
|
| 611 | + if ($price['_give_amount'] == $min) { |
|
| 612 | 612 | $min_id = $price['_give_id']['level_id']; |
| 613 | 613 | } |
| 614 | 614 | } |
@@ -626,45 +626,45 @@ discard block |
||
| 626 | 626 | * |
| 627 | 627 | * @return float Amount of the lowest price |
| 628 | 628 | */ |
| 629 | -function give_get_lowest_price_option( $form_id = 0 ) { |
|
| 630 | - if ( empty( $form_id ) ) { |
|
| 629 | +function give_get_lowest_price_option($form_id = 0) { |
|
| 630 | + if (empty($form_id)) { |
|
| 631 | 631 | $form_id = get_the_ID(); |
| 632 | 632 | } |
| 633 | 633 | |
| 634 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
| 635 | - return give_get_form_price( $form_id ); |
|
| 634 | + if ( ! give_has_variable_prices($form_id)) { |
|
| 635 | + return give_get_form_price($form_id); |
|
| 636 | 636 | } |
| 637 | 637 | |
| 638 | - $prices = give_get_variable_prices( $form_id ); |
|
| 638 | + $prices = give_get_variable_prices($form_id); |
|
| 639 | 639 | |
| 640 | 640 | $low = 0; |
| 641 | 641 | |
| 642 | - if ( ! empty( $prices ) ) { |
|
| 642 | + if ( ! empty($prices)) { |
|
| 643 | 643 | |
| 644 | 644 | $min = $min_id = 0; |
| 645 | 645 | |
| 646 | - foreach ( $prices as $key => $price ) { |
|
| 646 | + foreach ($prices as $key => $price) { |
|
| 647 | 647 | |
| 648 | - if ( empty( $price['_give_amount'] ) ) { |
|
| 648 | + if (empty($price['_give_amount'])) { |
|
| 649 | 649 | continue; |
| 650 | 650 | } |
| 651 | 651 | |
| 652 | - if ( ! isset( $min ) ) { |
|
| 652 | + if ( ! isset($min)) { |
|
| 653 | 653 | $min = $price['_give_amount']; |
| 654 | 654 | } else { |
| 655 | - $min = min( $min, give_sanitize_amount( $price['_give_amount'] ) ); |
|
| 655 | + $min = min($min, give_sanitize_amount($price['_give_amount'])); |
|
| 656 | 656 | } |
| 657 | 657 | |
| 658 | - if ( $price['_give_amount'] == $min ) { |
|
| 658 | + if ($price['_give_amount'] == $min) { |
|
| 659 | 659 | $min_id = $key; |
| 660 | 660 | } |
| 661 | 661 | } |
| 662 | 662 | |
| 663 | - $low = $prices[ $min_id ]['_give_amount']; |
|
| 663 | + $low = $prices[$min_id]['_give_amount']; |
|
| 664 | 664 | |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | - return give_sanitize_amount( $low ); |
|
| 667 | + return give_sanitize_amount($low); |
|
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | /** |
@@ -676,41 +676,41 @@ discard block |
||
| 676 | 676 | * |
| 677 | 677 | * @return float Amount of the highest price |
| 678 | 678 | */ |
| 679 | -function give_get_highest_price_option( $form_id = 0 ) { |
|
| 679 | +function give_get_highest_price_option($form_id = 0) { |
|
| 680 | 680 | |
| 681 | - if ( empty( $form_id ) ) { |
|
| 681 | + if (empty($form_id)) { |
|
| 682 | 682 | $form_id = get_the_ID(); |
| 683 | 683 | } |
| 684 | 684 | |
| 685 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
| 686 | - return give_get_form_price( $form_id ); |
|
| 685 | + if ( ! give_has_variable_prices($form_id)) { |
|
| 686 | + return give_get_form_price($form_id); |
|
| 687 | 687 | } |
| 688 | 688 | |
| 689 | - $prices = give_get_variable_prices( $form_id ); |
|
| 689 | + $prices = give_get_variable_prices($form_id); |
|
| 690 | 690 | |
| 691 | 691 | $high = 0.00; |
| 692 | 692 | |
| 693 | - if ( ! empty( $prices ) ) { |
|
| 693 | + if ( ! empty($prices)) { |
|
| 694 | 694 | |
| 695 | 695 | $max_id = $max = 0; |
| 696 | 696 | |
| 697 | - foreach ( $prices as $key => $price ) { |
|
| 698 | - if ( empty( $price['_give_amount'] ) ) { |
|
| 697 | + foreach ($prices as $key => $price) { |
|
| 698 | + if (empty($price['_give_amount'])) { |
|
| 699 | 699 | continue; |
| 700 | 700 | } |
| 701 | - $give_amount = give_sanitize_amount( $price['_give_amount'] ); |
|
| 701 | + $give_amount = give_sanitize_amount($price['_give_amount']); |
|
| 702 | 702 | |
| 703 | - $max = max( $max, $give_amount ); |
|
| 703 | + $max = max($max, $give_amount); |
|
| 704 | 704 | |
| 705 | - if ( $give_amount == $max ) { |
|
| 705 | + if ($give_amount == $max) { |
|
| 706 | 706 | $max_id = $key; |
| 707 | 707 | } |
| 708 | 708 | } |
| 709 | 709 | |
| 710 | - $high = $prices[ $max_id ]['_give_amount']; |
|
| 710 | + $high = $prices[$max_id]['_give_amount']; |
|
| 711 | 711 | } |
| 712 | 712 | |
| 713 | - return give_sanitize_amount( $high ); |
|
| 713 | + return give_sanitize_amount($high); |
|
| 714 | 714 | } |
| 715 | 715 | |
| 716 | 716 | /** |
@@ -722,15 +722,15 @@ discard block |
||
| 722 | 722 | * |
| 723 | 723 | * @return mixed string|int Price of the form |
| 724 | 724 | */ |
| 725 | -function give_get_form_price( $form_id = 0 ) { |
|
| 725 | +function give_get_form_price($form_id = 0) { |
|
| 726 | 726 | |
| 727 | - if ( empty( $form_id ) ) { |
|
| 727 | + if (empty($form_id)) { |
|
| 728 | 728 | return false; |
| 729 | 729 | } |
| 730 | 730 | |
| 731 | - $form = new Give_Donate_Form( $form_id ); |
|
| 731 | + $form = new Give_Donate_Form($form_id); |
|
| 732 | 732 | |
| 733 | - return $form->__get( 'price' ); |
|
| 733 | + return $form->__get('price'); |
|
| 734 | 734 | } |
| 735 | 735 | |
| 736 | 736 | /** |
@@ -742,15 +742,15 @@ discard block |
||
| 742 | 742 | * |
| 743 | 743 | * @return mixed string|int Minimum price of the form |
| 744 | 744 | */ |
| 745 | -function give_get_form_minimum_price( $form_id = 0 ) { |
|
| 745 | +function give_get_form_minimum_price($form_id = 0) { |
|
| 746 | 746 | |
| 747 | - if ( empty( $form_id ) ) { |
|
| 747 | + if (empty($form_id)) { |
|
| 748 | 748 | return false; |
| 749 | 749 | } |
| 750 | 750 | |
| 751 | - $form = new Give_Donate_Form( $form_id ); |
|
| 751 | + $form = new Give_Donate_Form($form_id); |
|
| 752 | 752 | |
| 753 | - return $form->__get( 'minimum_price' ); |
|
| 753 | + return $form->__get('minimum_price'); |
|
| 754 | 754 | |
| 755 | 755 | } |
| 756 | 756 | |
@@ -765,51 +765,51 @@ discard block |
||
| 765 | 765 | * |
| 766 | 766 | * @return int $formatted_price |
| 767 | 767 | */ |
| 768 | -function give_price( $form_id = 0, $echo = true, $price_id = false ) { |
|
| 768 | +function give_price($form_id = 0, $echo = true, $price_id = false) { |
|
| 769 | 769 | |
| 770 | - if ( empty( $form_id ) ) { |
|
| 770 | + if (empty($form_id)) { |
|
| 771 | 771 | $form_id = get_the_ID(); |
| 772 | 772 | } |
| 773 | 773 | |
| 774 | - if ( give_has_variable_prices( $form_id ) ) { |
|
| 774 | + if (give_has_variable_prices($form_id)) { |
|
| 775 | 775 | |
| 776 | - $prices = give_get_variable_prices( $form_id ); |
|
| 776 | + $prices = give_get_variable_prices($form_id); |
|
| 777 | 777 | |
| 778 | - if ( false !== $price_id ) { |
|
| 778 | + if (false !== $price_id) { |
|
| 779 | 779 | |
| 780 | 780 | // loop through multi-prices to see which is default |
| 781 | - foreach ( $prices as $price ) { |
|
| 781 | + foreach ($prices as $price) { |
|
| 782 | 782 | // this is the default price |
| 783 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
| 783 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
| 784 | 784 | $price = (float) $price['_give_amount']; |
| 785 | 785 | }; |
| 786 | 786 | } |
| 787 | 787 | } else { |
| 788 | 788 | |
| 789 | - $price = give_get_lowest_price_option( $form_id ); |
|
| 789 | + $price = give_get_lowest_price_option($form_id); |
|
| 790 | 790 | } |
| 791 | 791 | |
| 792 | - $price = give_sanitize_amount( $price ); |
|
| 792 | + $price = give_sanitize_amount($price); |
|
| 793 | 793 | |
| 794 | 794 | } else { |
| 795 | 795 | |
| 796 | - $price = give_get_form_price( $form_id ); |
|
| 796 | + $price = give_get_form_price($form_id); |
|
| 797 | 797 | |
| 798 | 798 | } |
| 799 | 799 | |
| 800 | - $price = apply_filters( 'give_form_price', give_sanitize_amount( $price ), $form_id ); |
|
| 801 | - $formatted_price = '<span class="give_price" id="give_price_' . $form_id . '">' . $price . '</span>'; |
|
| 802 | - $formatted_price = apply_filters( 'give_form_price_after_html', $formatted_price, $form_id, $price ); |
|
| 800 | + $price = apply_filters('give_form_price', give_sanitize_amount($price), $form_id); |
|
| 801 | + $formatted_price = '<span class="give_price" id="give_price_'.$form_id.'">'.$price.'</span>'; |
|
| 802 | + $formatted_price = apply_filters('give_form_price_after_html', $formatted_price, $form_id, $price); |
|
| 803 | 803 | |
| 804 | - if ( $echo ) { |
|
| 804 | + if ($echo) { |
|
| 805 | 805 | echo $formatted_price; |
| 806 | 806 | } else { |
| 807 | 807 | return $formatted_price; |
| 808 | 808 | } |
| 809 | 809 | } |
| 810 | 810 | |
| 811 | -add_filter( 'give_form_price', 'give_format_amount', 10 ); |
|
| 812 | -add_filter( 'give_form_price', 'give_currency_filter', 20 ); |
|
| 811 | +add_filter('give_form_price', 'give_format_amount', 10); |
|
| 812 | +add_filter('give_form_price', 'give_currency_filter', 20); |
|
| 813 | 813 | |
| 814 | 814 | |
| 815 | 815 | /** |
@@ -822,19 +822,19 @@ discard block |
||
| 822 | 822 | * |
| 823 | 823 | * @return float $amount Amount of the price option |
| 824 | 824 | */ |
| 825 | -function give_get_price_option_amount( $form_id = 0, $price_id = 0 ) { |
|
| 826 | - $prices = give_get_variable_prices( $form_id ); |
|
| 825 | +function give_get_price_option_amount($form_id = 0, $price_id = 0) { |
|
| 826 | + $prices = give_get_variable_prices($form_id); |
|
| 827 | 827 | |
| 828 | 828 | $amount = 0.00; |
| 829 | 829 | |
| 830 | - foreach ( $prices as $price ) { |
|
| 831 | - if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) { |
|
| 832 | - $amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00; |
|
| 830 | + foreach ($prices as $price) { |
|
| 831 | + if (isset($price['_give_id']['level_id']) && $price['_give_id']['level_id'] == $price_id) { |
|
| 832 | + $amount = isset($price['_give_amount']) ? $price['_give_amount'] : 0.00; |
|
| 833 | 833 | break; |
| 834 | 834 | }; |
| 835 | 835 | } |
| 836 | 836 | |
| 837 | - return apply_filters( 'give_get_price_option_amount', give_sanitize_amount( $amount ), $form_id, $price_id ); |
|
| 837 | + return apply_filters('give_get_price_option_amount', give_sanitize_amount($amount), $form_id, $price_id); |
|
| 838 | 838 | } |
| 839 | 839 | |
| 840 | 840 | /** |
@@ -846,13 +846,13 @@ discard block |
||
| 846 | 846 | * |
| 847 | 847 | * @return mixed string|int Goal of the form |
| 848 | 848 | */ |
| 849 | -function give_get_form_goal( $form_id = 0 ) { |
|
| 849 | +function give_get_form_goal($form_id = 0) { |
|
| 850 | 850 | |
| 851 | - if ( empty( $form_id ) ) { |
|
| 851 | + if (empty($form_id)) { |
|
| 852 | 852 | return false; |
| 853 | 853 | } |
| 854 | 854 | |
| 855 | - $form = new Give_Donate_Form( $form_id ); |
|
| 855 | + $form = new Give_Donate_Form($form_id); |
|
| 856 | 856 | |
| 857 | 857 | return $form->goal; |
| 858 | 858 | |
@@ -868,27 +868,27 @@ discard block |
||
| 868 | 868 | * |
| 869 | 869 | * @return string $formatted_goal |
| 870 | 870 | */ |
| 871 | -function give_goal( $form_id = 0, $echo = true ) { |
|
| 871 | +function give_goal($form_id = 0, $echo = true) { |
|
| 872 | 872 | |
| 873 | - if ( empty( $form_id ) ) { |
|
| 873 | + if (empty($form_id)) { |
|
| 874 | 874 | $form_id = get_the_ID(); |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | - $goal = give_get_form_goal( $form_id ); |
|
| 877 | + $goal = give_get_form_goal($form_id); |
|
| 878 | 878 | |
| 879 | - $goal = apply_filters( 'give_form_goal', give_sanitize_amount( $goal ), $form_id ); |
|
| 880 | - $formatted_goal = '<span class="give_price" id="give_price_' . $form_id . '">' . $goal . '</span>'; |
|
| 881 | - $formatted_goal = apply_filters( 'give_form_price_after_html', $formatted_goal, $form_id, $goal ); |
|
| 879 | + $goal = apply_filters('give_form_goal', give_sanitize_amount($goal), $form_id); |
|
| 880 | + $formatted_goal = '<span class="give_price" id="give_price_'.$form_id.'">'.$goal.'</span>'; |
|
| 881 | + $formatted_goal = apply_filters('give_form_price_after_html', $formatted_goal, $form_id, $goal); |
|
| 882 | 882 | |
| 883 | - if ( $echo ) { |
|
| 883 | + if ($echo) { |
|
| 884 | 884 | echo $formatted_goal; |
| 885 | 885 | } else { |
| 886 | 886 | return $formatted_goal; |
| 887 | 887 | } |
| 888 | 888 | } |
| 889 | 889 | |
| 890 | -add_filter( 'give_form_goal', 'give_format_amount', 10 ); |
|
| 891 | -add_filter( 'give_form_goal', 'give_currency_filter', 20 ); |
|
| 890 | +add_filter('give_form_goal', 'give_format_amount', 10); |
|
| 891 | +add_filter('give_form_goal', 'give_currency_filter', 20); |
|
| 892 | 892 | |
| 893 | 893 | |
| 894 | 894 | /** |
@@ -900,15 +900,15 @@ discard block |
||
| 900 | 900 | * |
| 901 | 901 | * @return bool $ret Whether or not the logged_in_only setting is set |
| 902 | 902 | */ |
| 903 | -function give_logged_in_only( $form_id ) { |
|
| 903 | +function give_logged_in_only($form_id) { |
|
| 904 | 904 | // If _give_logged_in_only is set to enable then guest can donate from that specific form. |
| 905 | 905 | // Otherwise it is member only donation form. |
| 906 | - $val = get_post_meta( $form_id, '_give_logged_in_only', true ); |
|
| 907 | - $val = ! empty( $val ) ? $val : 'enabled'; |
|
| 906 | + $val = get_post_meta($form_id, '_give_logged_in_only', true); |
|
| 907 | + $val = ! empty($val) ? $val : 'enabled'; |
|
| 908 | 908 | |
| 909 | - $ret = ! give_is_setting_enabled( $val ); |
|
| 909 | + $ret = ! give_is_setting_enabled($val); |
|
| 910 | 910 | |
| 911 | - return (bool) apply_filters( 'give_logged_in_only', $ret, $form_id ); |
|
| 911 | + return (bool) apply_filters('give_logged_in_only', $ret, $form_id); |
|
| 912 | 912 | } |
| 913 | 913 | |
| 914 | 914 | |
@@ -921,11 +921,11 @@ discard block |
||
| 921 | 921 | * |
| 922 | 922 | * @return string |
| 923 | 923 | */ |
| 924 | -function give_show_login_register_option( $form_id ) { |
|
| 924 | +function give_show_login_register_option($form_id) { |
|
| 925 | 925 | |
| 926 | - $show_register_form = get_post_meta( $form_id, '_give_show_register_form', true ); |
|
| 926 | + $show_register_form = get_post_meta($form_id, '_give_show_register_form', true); |
|
| 927 | 927 | |
| 928 | - return apply_filters( 'give_show_register_form', $show_register_form, $form_id ); |
|
| 928 | + return apply_filters('give_show_register_form', $show_register_form, $form_id); |
|
| 929 | 929 | |
| 930 | 930 | } |
| 931 | 931 | |
@@ -941,12 +941,12 @@ discard block |
||
| 941 | 941 | * |
| 942 | 942 | * @return array |
| 943 | 943 | */ |
| 944 | -function _give_get_prefill_form_field_values( $form_id ) { |
|
| 944 | +function _give_get_prefill_form_field_values($form_id) { |
|
| 945 | 945 | $logged_in_donor_info = array(); |
| 946 | 946 | |
| 947 | - if ( is_user_logged_in() ) : |
|
| 948 | - $donor_data = get_userdata( get_current_user_id() ); |
|
| 949 | - $donor_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
| 947 | + if (is_user_logged_in()) : |
|
| 948 | + $donor_data = get_userdata(get_current_user_id()); |
|
| 949 | + $donor_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
| 950 | 950 | |
| 951 | 951 | $logged_in_donor_info = array( |
| 952 | 952 | // First name. |
@@ -959,42 +959,42 @@ discard block |
||
| 959 | 959 | 'give_email' => $donor_data->user_email, |
| 960 | 960 | |
| 961 | 961 | // Street address 1. |
| 962 | - 'card_address' => ( ! empty( $donor_address['line1'] ) ? $donor_address['line1'] : '' ), |
|
| 962 | + 'card_address' => ( ! empty($donor_address['line1']) ? $donor_address['line1'] : ''), |
|
| 963 | 963 | |
| 964 | 964 | // Street address 2. |
| 965 | - 'card_address_2' => ( ! empty( $donor_address['line2'] ) ? $donor_address['line2'] : '' ), |
|
| 965 | + 'card_address_2' => ( ! empty($donor_address['line2']) ? $donor_address['line2'] : ''), |
|
| 966 | 966 | |
| 967 | 967 | // Country. |
| 968 | - 'billing_country' => ( ! empty( $donor_address['country'] ) ? $donor_address['country'] : '' ), |
|
| 968 | + 'billing_country' => ( ! empty($donor_address['country']) ? $donor_address['country'] : ''), |
|
| 969 | 969 | |
| 970 | 970 | // State. |
| 971 | - 'card_state' => ( ! empty( $donor_address['state'] ) ? $donor_address['state'] : '' ), |
|
| 971 | + 'card_state' => ( ! empty($donor_address['state']) ? $donor_address['state'] : ''), |
|
| 972 | 972 | |
| 973 | 973 | // City. |
| 974 | - 'card_city' => ( ! empty( $donor_address['city'] ) ? $donor_address['city'] : '' ), |
|
| 974 | + 'card_city' => ( ! empty($donor_address['city']) ? $donor_address['city'] : ''), |
|
| 975 | 975 | |
| 976 | 976 | // Zipcode |
| 977 | - 'card_zip' => ( ! empty( $donor_address['zip'] ) ? $donor_address['zip'] : '' ), |
|
| 977 | + 'card_zip' => ( ! empty($donor_address['zip']) ? $donor_address['zip'] : ''), |
|
| 978 | 978 | ); |
| 979 | 979 | endif; |
| 980 | 980 | |
| 981 | 981 | // Bailout: Auto fill form field values only form form which donor is donating. |
| 982 | 982 | if ( |
| 983 | - empty( $_GET['form-id'] ) |
|
| 983 | + empty($_GET['form-id']) |
|
| 984 | 984 | || ! $form_id |
| 985 | - || ( $form_id !== absint( $_GET['form-id'] ) ) |
|
| 985 | + || ($form_id !== absint($_GET['form-id'])) |
|
| 986 | 986 | ) { |
| 987 | 987 | return $logged_in_donor_info; |
| 988 | 988 | } |
| 989 | 989 | |
| 990 | 990 | // Get purchase data. |
| 991 | - $give_purchase_data = Give()->session->get( 'give_purchase' ); |
|
| 991 | + $give_purchase_data = Give()->session->get('give_purchase'); |
|
| 992 | 992 | |
| 993 | 993 | // Get donor info from form data. |
| 994 | - $give_donor_info_in_session = empty( $give_purchase_data['post_data'] ) |
|
| 994 | + $give_donor_info_in_session = empty($give_purchase_data['post_data']) |
|
| 995 | 995 | ? array() |
| 996 | 996 | : $give_purchase_data['post_data']; |
| 997 | 997 | |
| 998 | 998 | // Output. |
| 999 | - return wp_parse_args( $give_donor_info_in_session, $logged_in_donor_info ); |
|
| 999 | + return wp_parse_args($give_donor_info_in_session, $logged_in_donor_info); |
|
| 1000 | 1000 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -23,50 +23,50 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return string Donation form. |
| 25 | 25 | */ |
| 26 | -function give_get_donation_form( $args = array() ) { |
|
| 26 | +function give_get_donation_form($args = array()) { |
|
| 27 | 27 | |
| 28 | 28 | global $post; |
| 29 | 29 | |
| 30 | - $form_id = is_object( $post ) ? $post->ID : 0; |
|
| 30 | + $form_id = is_object($post) ? $post->ID : 0; |
|
| 31 | 31 | |
| 32 | - if ( isset( $args['id'] ) ) { |
|
| 32 | + if (isset($args['id'])) { |
|
| 33 | 33 | $form_id = $args['id']; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - $defaults = apply_filters( 'give_form_args_defaults', array( |
|
| 36 | + $defaults = apply_filters('give_form_args_defaults', array( |
|
| 37 | 37 | 'form_id' => $form_id, |
| 38 | - ) ); |
|
| 38 | + )); |
|
| 39 | 39 | |
| 40 | - $args = wp_parse_args( $args, $defaults ); |
|
| 40 | + $args = wp_parse_args($args, $defaults); |
|
| 41 | 41 | |
| 42 | - $form = new Give_Donate_Form( $args['form_id'] ); |
|
| 42 | + $form = new Give_Donate_Form($args['form_id']); |
|
| 43 | 43 | |
| 44 | 44 | //bail if no form ID. |
| 45 | - if ( empty( $form->ID ) ) { |
|
| 45 | + if (empty($form->ID)) { |
|
| 46 | 46 | return false; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - $payment_mode = give_get_chosen_gateway( $form->ID ); |
|
| 49 | + $payment_mode = give_get_chosen_gateway($form->ID); |
|
| 50 | 50 | |
| 51 | - $form_action = add_query_arg( apply_filters( 'give_form_action_args', array( |
|
| 51 | + $form_action = add_query_arg(apply_filters('give_form_action_args', array( |
|
| 52 | 52 | 'payment-mode' => $payment_mode, |
| 53 | - ) ), |
|
| 53 | + )), |
|
| 54 | 54 | give_get_current_page_url() |
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | 57 | //Sanity Check: Donation form not published or user doesn't have permission to view drafts. |
| 58 | 58 | if ( |
| 59 | - ( 'publish' !== $form->post_status && ! current_user_can( 'edit_give_forms', $form->ID ) ) |
|
| 60 | - || ( 'trash' === $form->post_status ) |
|
| 59 | + ('publish' !== $form->post_status && ! current_user_can('edit_give_forms', $form->ID)) |
|
| 60 | + || ('trash' === $form->post_status) |
|
| 61 | 61 | ) { |
| 62 | 62 | return false; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | //Get the form wrap CSS classes. |
| 66 | - $form_wrap_classes = $form->get_form_wrap_classes( $args ); |
|
| 66 | + $form_wrap_classes = $form->get_form_wrap_classes($args); |
|
| 67 | 67 | |
| 68 | 68 | //Get the <form> tag wrap CSS classes. |
| 69 | - $form_classes = $form->get_form_classes( $args ); |
|
| 69 | + $form_classes = $form->get_form_classes($args); |
|
| 70 | 70 | |
| 71 | 71 | ob_start(); |
| 72 | 72 | |
@@ -78,19 +78,19 @@ discard block |
||
| 78 | 78 | * @param int $form_id The form ID. |
| 79 | 79 | * @param array $args An array of form arguments. |
| 80 | 80 | */ |
| 81 | - do_action( 'give_pre_form_output', $form->ID, $args ); |
|
| 81 | + do_action('give_pre_form_output', $form->ID, $args); |
|
| 82 | 82 | |
| 83 | 83 | ?> |
| 84 | 84 | <div id="give-form-<?php echo $form->ID; ?>-wrap" class="<?php echo $form_wrap_classes; ?>"> |
| 85 | 85 | |
| 86 | - <?php if ( $form->is_close_donation_form() ) { |
|
| 86 | + <?php if ($form->is_close_donation_form()) { |
|
| 87 | 87 | |
| 88 | 88 | // Get Goal thank you message. |
| 89 | - $goal_achieved_message = get_post_meta( $form->ID, '_give_form_goal_achieved_message', true ); |
|
| 90 | - $goal_achieved_message = ! empty( $goal_achieved_message ) ? apply_filters( 'the_content', $goal_achieved_message ) : ''; |
|
| 89 | + $goal_achieved_message = get_post_meta($form->ID, '_give_form_goal_achieved_message', true); |
|
| 90 | + $goal_achieved_message = ! empty($goal_achieved_message) ? apply_filters('the_content', $goal_achieved_message) : ''; |
|
| 91 | 91 | |
| 92 | 92 | // Print thank you message. |
| 93 | - echo apply_filters( 'give_goal_closed_output', $goal_achieved_message, $form->ID ); |
|
| 93 | + echo apply_filters('give_goal_closed_output', $goal_achieved_message, $form->ID); |
|
| 94 | 94 | |
| 95 | 95 | } else { |
| 96 | 96 | /** |
@@ -98,10 +98,10 @@ discard block |
||
| 98 | 98 | * 1. if show_title params set to true |
| 99 | 99 | * 2. if admin set form display_style to button |
| 100 | 100 | */ |
| 101 | - $form_title = apply_filters( 'give_form_title', '<h2 class="give-form-title">' . get_the_title( $form_id ) . '</h2>' ); |
|
| 101 | + $form_title = apply_filters('give_form_title', '<h2 class="give-form-title">'.get_the_title($form_id).'</h2>'); |
|
| 102 | 102 | if ( |
| 103 | - ( isset( $args['show_title'] ) && $args['show_title'] == true ) |
|
| 104 | - && ! doing_action( 'give_single_form_summary' ) |
|
| 103 | + (isset($args['show_title']) && $args['show_title'] == true) |
|
| 104 | + && ! doing_action('give_single_form_summary') |
|
| 105 | 105 | ) { |
| 106 | 106 | echo $form_title; |
| 107 | 107 | } |
@@ -114,19 +114,19 @@ discard block |
||
| 114 | 114 | * @param int $form_id The form ID. |
| 115 | 115 | * @param array $args An array of form arguments. |
| 116 | 116 | */ |
| 117 | - do_action( 'give_pre_form', $form->ID, $args ); |
|
| 117 | + do_action('give_pre_form', $form->ID, $args); |
|
| 118 | 118 | ?> |
| 119 | 119 | |
| 120 | 120 | <form id="give-form-<?php echo $form_id; ?>" class="<?php echo $form_classes; ?>" |
| 121 | - action="<?php echo esc_url_raw( $form_action ); ?>" method="post"> |
|
| 121 | + action="<?php echo esc_url_raw($form_action); ?>" method="post"> |
|
| 122 | 122 | <input type="hidden" name="give-form-id" value="<?php echo $form->ID; ?>"/> |
| 123 | - <input type="hidden" name="give-form-title" value="<?php echo htmlentities( $form->post_title ); ?>"/> |
|
| 123 | + <input type="hidden" name="give-form-title" value="<?php echo htmlentities($form->post_title); ?>"/> |
|
| 124 | 124 | <input type="hidden" name="give-current-url" |
| 125 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
| 125 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
| 126 | 126 | <input type="hidden" name="give-form-url" |
| 127 | - value="<?php echo htmlspecialchars( give_get_current_page_url() ); ?>"/> |
|
| 127 | + value="<?php echo htmlspecialchars(give_get_current_page_url()); ?>"/> |
|
| 128 | 128 | <input type="hidden" name="give-form-minimum" |
| 129 | - value="<?php echo give_format_amount( give_get_form_minimum_price( $form->ID ) ); ?>"/> |
|
| 129 | + value="<?php echo give_format_amount(give_get_form_minimum_price($form->ID)); ?>"/> |
|
| 130 | 130 | |
| 131 | 131 | <!-- The following field is for robots only, invisible to humans: --> |
| 132 | 132 | <span class="give-hidden" style="display: none !important;"> |
@@ -138,13 +138,13 @@ discard block |
||
| 138 | 138 | <?php |
| 139 | 139 | |
| 140 | 140 | // Price ID hidden field for variable (mult-level) donation forms. |
| 141 | - if ( give_has_variable_prices( $form_id ) ) { |
|
| 141 | + if (give_has_variable_prices($form_id)) { |
|
| 142 | 142 | // Get default selected price ID. |
| 143 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
| 143 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
| 144 | 144 | $price_id = 0; |
| 145 | 145 | //loop through prices. |
| 146 | - foreach ( $prices as $price ) { |
|
| 147 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
| 146 | + foreach ($prices as $price) { |
|
| 147 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
| 148 | 148 | $price_id = $price['_give_id']['level_id']; |
| 149 | 149 | }; |
| 150 | 150 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @param int $form_id The form ID. |
| 161 | 161 | * @param array $args An array of form arguments. |
| 162 | 162 | */ |
| 163 | - do_action( 'give_checkout_form_top', $form->ID, $args ); |
|
| 163 | + do_action('give_checkout_form_top', $form->ID, $args); |
|
| 164 | 164 | |
| 165 | 165 | /** |
| 166 | 166 | * Fires while outputing donation form, for payment gatways fields. |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | * @param int $form_id The form ID. |
| 171 | 171 | * @param array $args An array of form arguments. |
| 172 | 172 | */ |
| 173 | - do_action( 'give_payment_mode_select', $form->ID, $args ); |
|
| 173 | + do_action('give_payment_mode_select', $form->ID, $args); |
|
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | 176 | * Fires while outputing donation form, after all other fields. |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * @param int $form_id The form ID. |
| 181 | 181 | * @param array $args An array of form arguments. |
| 182 | 182 | */ |
| 183 | - do_action( 'give_checkout_form_bottom', $form->ID, $args ); |
|
| 183 | + do_action('give_checkout_form_bottom', $form->ID, $args); |
|
| 184 | 184 | |
| 185 | 185 | ?> |
| 186 | 186 | </form> |
@@ -194,12 +194,12 @@ discard block |
||
| 194 | 194 | * @param int $form_id The form ID. |
| 195 | 195 | * @param array $args An array of form arguments. |
| 196 | 196 | */ |
| 197 | - do_action( 'give_post_form', $form->ID, $args ); |
|
| 197 | + do_action('give_post_form', $form->ID, $args); |
|
| 198 | 198 | |
| 199 | 199 | } |
| 200 | 200 | ?> |
| 201 | 201 | |
| 202 | - </div><!--end #give-form-<?php echo absint( $form->ID ); ?>--> |
|
| 202 | + </div><!--end #give-form-<?php echo absint($form->ID); ?>--> |
|
| 203 | 203 | <?php |
| 204 | 204 | |
| 205 | 205 | /** |
@@ -210,11 +210,11 @@ discard block |
||
| 210 | 210 | * @param int $form_id The form ID. |
| 211 | 211 | * @param array $args An array of form arguments. |
| 212 | 212 | */ |
| 213 | - do_action( 'give_post_form_output', $form->ID, $args ); |
|
| 213 | + do_action('give_post_form_output', $form->ID, $args); |
|
| 214 | 214 | |
| 215 | 215 | $final_output = ob_get_clean(); |
| 216 | 216 | |
| 217 | - echo apply_filters( 'give_donate_form', $final_output, $args ); |
|
| 217 | + echo apply_filters('give_donate_form', $final_output, $args); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | /** |
@@ -231,11 +231,11 @@ discard block |
||
| 231 | 231 | * |
| 232 | 232 | * @return string |
| 233 | 233 | */ |
| 234 | -function give_show_purchase_form( $form_id ) { |
|
| 234 | +function give_show_purchase_form($form_id) { |
|
| 235 | 235 | |
| 236 | - $payment_mode = give_get_chosen_gateway( $form_id ); |
|
| 236 | + $payment_mode = give_get_chosen_gateway($form_id); |
|
| 237 | 237 | |
| 238 | - if ( ! isset( $form_id ) && isset( $_POST['give_form_id'] ) ) { |
|
| 238 | + if ( ! isset($form_id) && isset($_POST['give_form_id'])) { |
|
| 239 | 239 | $form_id = $_POST['give_form_id']; |
| 240 | 240 | } |
| 241 | 241 | |
@@ -244,33 +244,33 @@ discard block |
||
| 244 | 244 | * |
| 245 | 245 | * @since 1.7 |
| 246 | 246 | */ |
| 247 | - do_action( 'give_donation_form_top', $form_id ); |
|
| 247 | + do_action('give_donation_form_top', $form_id); |
|
| 248 | 248 | |
| 249 | - if ( give_can_checkout() && isset( $form_id ) ) { |
|
| 249 | + if (give_can_checkout() && isset($form_id)) { |
|
| 250 | 250 | |
| 251 | 251 | /** |
| 252 | 252 | * Fires while displaying donation form, before registration login. |
| 253 | 253 | * |
| 254 | 254 | * @since 1.7 |
| 255 | 255 | */ |
| 256 | - do_action( 'give_donation_form_before_register_login', $form_id ); |
|
| 256 | + do_action('give_donation_form_before_register_login', $form_id); |
|
| 257 | 257 | |
| 258 | 258 | /** |
| 259 | 259 | * Fire when register/login form fields render. |
| 260 | 260 | * |
| 261 | 261 | * @since 1.7 |
| 262 | 262 | */ |
| 263 | - do_action( 'give_donation_form_register_login_fields', $form_id ); |
|
| 263 | + do_action('give_donation_form_register_login_fields', $form_id); |
|
| 264 | 264 | |
| 265 | 265 | /** |
| 266 | 266 | * Fire when credit card form fields render. |
| 267 | 267 | * |
| 268 | 268 | * @since 1.7 |
| 269 | 269 | */ |
| 270 | - do_action( 'give_donation_form_before_cc_form', $form_id ); |
|
| 270 | + do_action('give_donation_form_before_cc_form', $form_id); |
|
| 271 | 271 | |
| 272 | 272 | // Load the credit card form and allow gateways to load their own if they wish. |
| 273 | - if ( has_action( 'give_' . $payment_mode . '_cc_form' ) ) { |
|
| 273 | + if (has_action('give_'.$payment_mode.'_cc_form')) { |
|
| 274 | 274 | /** |
| 275 | 275 | * Fires while displaying donation form, credit card form fields for a given gateway. |
| 276 | 276 | * |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | * |
| 279 | 279 | * @param int $form_id The form ID. |
| 280 | 280 | */ |
| 281 | - do_action( "give_{$payment_mode}_cc_form", $form_id ); |
|
| 281 | + do_action("give_{$payment_mode}_cc_form", $form_id); |
|
| 282 | 282 | } else { |
| 283 | 283 | /** |
| 284 | 284 | * Fires while displaying donation form, credit card form fields. |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | * |
| 288 | 288 | * @param int $form_id The form ID. |
| 289 | 289 | */ |
| 290 | - do_action( 'give_cc_form', $form_id ); |
|
| 290 | + do_action('give_cc_form', $form_id); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | * |
| 296 | 296 | * @since 1.7 |
| 297 | 297 | */ |
| 298 | - do_action( 'give_donation_form_after_cc_form', $form_id ); |
|
| 298 | + do_action('give_donation_form_after_cc_form', $form_id); |
|
| 299 | 299 | |
| 300 | 300 | } else { |
| 301 | 301 | /** |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | * |
| 304 | 304 | * @since 1.7 |
| 305 | 305 | */ |
| 306 | - do_action( 'give_donation_form_no_access', $form_id ); |
|
| 306 | + do_action('give_donation_form_no_access', $form_id); |
|
| 307 | 307 | |
| 308 | 308 | } |
| 309 | 309 | |
@@ -312,10 +312,10 @@ discard block |
||
| 312 | 312 | * |
| 313 | 313 | * @since 1.7 |
| 314 | 314 | */ |
| 315 | - do_action( 'give_donation_form_bottom', $form_id ); |
|
| 315 | + do_action('give_donation_form_bottom', $form_id); |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | -add_action( 'give_donation_form', 'give_show_purchase_form' ); |
|
| 318 | +add_action('give_donation_form', 'give_show_purchase_form'); |
|
| 319 | 319 | |
| 320 | 320 | /** |
| 321 | 321 | * Give Show Login/Register Form Fields. |
@@ -326,11 +326,11 @@ discard block |
||
| 326 | 326 | * |
| 327 | 327 | * @return void |
| 328 | 328 | */ |
| 329 | -function give_show_register_login_fields( $form_id ) { |
|
| 329 | +function give_show_register_login_fields($form_id) { |
|
| 330 | 330 | |
| 331 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 331 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 332 | 332 | |
| 333 | - if ( ( $show_register_form === 'registration' || ( $show_register_form === 'both' && ! isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
| 333 | + if (($show_register_form === 'registration' || ($show_register_form === 'both' && ! isset($_GET['login']))) && ! is_user_logged_in()) : |
|
| 334 | 334 | ?> |
| 335 | 335 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 336 | 336 | <?php |
@@ -339,11 +339,11 @@ discard block |
||
| 339 | 339 | * |
| 340 | 340 | * @since 1.7 |
| 341 | 341 | */ |
| 342 | - do_action( 'give_donation_form_register_fields', $form_id ); |
|
| 342 | + do_action('give_donation_form_register_fields', $form_id); |
|
| 343 | 343 | ?> |
| 344 | 344 | </div> |
| 345 | 345 | <?php |
| 346 | - elseif ( ( $show_register_form === 'login' || ( $show_register_form === 'both' && isset( $_GET['login'] ) ) ) && ! is_user_logged_in() ) : |
|
| 346 | + elseif (($show_register_form === 'login' || ($show_register_form === 'both' && isset($_GET['login']))) && ! is_user_logged_in()) : |
|
| 347 | 347 | ?> |
| 348 | 348 | <div id="give-checkout-login-register-<?php echo $form_id; ?>"> |
| 349 | 349 | <?php |
@@ -352,23 +352,23 @@ discard block |
||
| 352 | 352 | * |
| 353 | 353 | * @since 1.7 |
| 354 | 354 | */ |
| 355 | - do_action( 'give_donation_form_login_fields', $form_id ); |
|
| 355 | + do_action('give_donation_form_login_fields', $form_id); |
|
| 356 | 356 | ?> |
| 357 | 357 | </div> |
| 358 | 358 | <?php |
| 359 | 359 | endif; |
| 360 | 360 | |
| 361 | - if ( ( ! isset( $_GET['login'] ) && is_user_logged_in() ) || ! isset( $show_register_form ) || 'none' === $show_register_form || 'login' === $show_register_form ) { |
|
| 361 | + if (( ! isset($_GET['login']) && is_user_logged_in()) || ! isset($show_register_form) || 'none' === $show_register_form || 'login' === $show_register_form) { |
|
| 362 | 362 | /** |
| 363 | 363 | * Fire when user info render. |
| 364 | 364 | * |
| 365 | 365 | * @since 1.7 |
| 366 | 366 | */ |
| 367 | - do_action( 'give_donation_form_after_user_info', $form_id ); |
|
| 367 | + do_action('give_donation_form_after_user_info', $form_id); |
|
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | |
| 371 | -add_action( 'give_donation_form_register_login_fields', 'give_show_register_login_fields' ); |
|
| 371 | +add_action('give_donation_form_register_login_fields', 'give_show_register_login_fields'); |
|
| 372 | 372 | |
| 373 | 373 | /** |
| 374 | 374 | * Donation Amount Field. |
@@ -383,16 +383,16 @@ discard block |
||
| 383 | 383 | * |
| 384 | 384 | * @return void |
| 385 | 385 | */ |
| 386 | -function give_output_donation_amount_top( $form_id = 0, $args = array() ) { |
|
| 386 | +function give_output_donation_amount_top($form_id = 0, $args = array()) { |
|
| 387 | 387 | |
| 388 | 388 | $give_options = give_get_settings(); |
| 389 | - $variable_pricing = give_has_variable_prices( $form_id ); |
|
| 390 | - $allow_custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
| 391 | - $currency_position = isset( $give_options['currency_position'] ) ? $give_options['currency_position'] : 'before'; |
|
| 392 | - $symbol = give_currency_symbol( give_get_currency() ); |
|
| 393 | - $currency_output = '<span class="give-currency-symbol give-currency-position-' . $currency_position . '">' . $symbol . '</span>'; |
|
| 394 | - $default_amount = give_format_amount( give_get_default_form_amount( $form_id ) ); |
|
| 395 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 389 | + $variable_pricing = give_has_variable_prices($form_id); |
|
| 390 | + $allow_custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
| 391 | + $currency_position = isset($give_options['currency_position']) ? $give_options['currency_position'] : 'before'; |
|
| 392 | + $symbol = give_currency_symbol(give_get_currency()); |
|
| 393 | + $currency_output = '<span class="give-currency-symbol give-currency-position-'.$currency_position.'">'.$symbol.'</span>'; |
|
| 394 | + $default_amount = give_format_amount(give_get_default_form_amount($form_id)); |
|
| 395 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 396 | 396 | |
| 397 | 397 | /** |
| 398 | 398 | * Fires while displaying donation form, before donation level fields. |
@@ -402,20 +402,20 @@ discard block |
||
| 402 | 402 | * @param int $form_id The form ID. |
| 403 | 403 | * @param array $args An array of form arguments. |
| 404 | 404 | */ |
| 405 | - do_action( 'give_before_donation_levels', $form_id, $args ); |
|
| 405 | + do_action('give_before_donation_levels', $form_id, $args); |
|
| 406 | 406 | |
| 407 | 407 | //Set Price, No Custom Amount Allowed means hidden price field |
| 408 | - if ( ! give_is_setting_enabled( $allow_custom_amount ) ) { |
|
| 408 | + if ( ! give_is_setting_enabled($allow_custom_amount)) { |
|
| 409 | 409 | ?> |
| 410 | - <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
| 410 | + <label class="give-hidden" for="give-amount-hidden"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
| 411 | 411 | <input id="give-amount" class="give-amount-hidden" type="hidden" name="give-amount" |
| 412 | 412 | value="<?php echo $default_amount; ?>" required aria-required="true"/> |
| 413 | 413 | <div class="set-price give-donation-amount form-row-wide"> |
| 414 | - <?php if ( $currency_position == 'before' ) { |
|
| 414 | + <?php if ($currency_position == 'before') { |
|
| 415 | 415 | echo $currency_output; |
| 416 | 416 | } ?> |
| 417 | 417 | <span id="give-amount-text" class="give-text-input give-amount-top"><?php echo $default_amount; ?></span> |
| 418 | - <?php if ( $currency_position == 'after' ) { |
|
| 418 | + <?php if ($currency_position == 'after') { |
|
| 419 | 419 | echo $currency_output; |
| 420 | 420 | } ?> |
| 421 | 421 | </div> |
@@ -425,13 +425,13 @@ discard block |
||
| 425 | 425 | ?> |
| 426 | 426 | <div class="give-total-wrap"> |
| 427 | 427 | <div class="give-donation-amount form-row-wide"> |
| 428 | - <?php if ( $currency_position == 'before' ) { |
|
| 428 | + <?php if ($currency_position == 'before') { |
|
| 429 | 429 | echo $currency_output; |
| 430 | 430 | } ?> |
| 431 | - <label class="give-hidden" for="give-amount"><?php esc_html_e( 'Donation Amount:', 'give' ); ?></label> |
|
| 431 | + <label class="give-hidden" for="give-amount"><?php esc_html_e('Donation Amount:', 'give'); ?></label> |
|
| 432 | 432 | <input class="give-text-input give-amount-top" id="give-amount" name="give-amount" type="tel" |
| 433 | 433 | placeholder="" value="<?php echo $default_amount; ?>" autocomplete="off"> |
| 434 | - <?php if ( $currency_position == 'after' ) { |
|
| 434 | + <?php if ($currency_position == 'after') { |
|
| 435 | 435 | echo $currency_output; |
| 436 | 436 | } ?> |
| 437 | 437 | </div> |
@@ -446,16 +446,16 @@ discard block |
||
| 446 | 446 | * @param int $form_id The form ID. |
| 447 | 447 | * @param array $args An array of form arguments. |
| 448 | 448 | */ |
| 449 | - do_action( 'give_after_donation_amount', $form_id, $args ); |
|
| 449 | + do_action('give_after_donation_amount', $form_id, $args); |
|
| 450 | 450 | |
| 451 | 451 | //Custom Amount Text |
| 452 | - if ( ! $variable_pricing && give_is_setting_enabled( $allow_custom_amount ) && ! empty( $custom_amount_text ) ) { ?> |
|
| 452 | + if ( ! $variable_pricing && give_is_setting_enabled($allow_custom_amount) && ! empty($custom_amount_text)) { ?> |
|
| 453 | 453 | <p class="give-custom-amount-text"><?php echo $custom_amount_text; ?></p> |
| 454 | 454 | <?php } |
| 455 | 455 | |
| 456 | 456 | //Output Variable Pricing Levels. |
| 457 | - if ( $variable_pricing ) { |
|
| 458 | - give_output_levels( $form_id ); |
|
| 457 | + if ($variable_pricing) { |
|
| 458 | + give_output_levels($form_id); |
|
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | /** |
@@ -466,10 +466,10 @@ discard block |
||
| 466 | 466 | * @param int $form_id The form ID. |
| 467 | 467 | * @param array $args An array of form arguments. |
| 468 | 468 | */ |
| 469 | - do_action( 'give_after_donation_levels', $form_id, $args ); |
|
| 469 | + do_action('give_after_donation_levels', $form_id, $args); |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | -add_action( 'give_checkout_form_top', 'give_output_donation_amount_top', 10, 2 ); |
|
| 472 | +add_action('give_checkout_form_top', 'give_output_donation_amount_top', 10, 2); |
|
| 473 | 473 | |
| 474 | 474 | /** |
| 475 | 475 | * Outputs the Donation Levels in various formats such as dropdown, radios, and buttons. |
@@ -480,32 +480,32 @@ discard block |
||
| 480 | 480 | * |
| 481 | 481 | * @return string Donation levels. |
| 482 | 482 | */ |
| 483 | -function give_output_levels( $form_id ) { |
|
| 483 | +function give_output_levels($form_id) { |
|
| 484 | 484 | |
| 485 | 485 | //Get variable pricing. |
| 486 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
| 487 | - $display_style = get_post_meta( $form_id, '_give_display_style', true ); |
|
| 488 | - $custom_amount = get_post_meta( $form_id, '_give_custom_amount', true ); |
|
| 489 | - $custom_amount_text = get_post_meta( $form_id, '_give_custom_amount_text', true ); |
|
| 490 | - if ( empty( $custom_amount_text ) ) { |
|
| 491 | - $custom_amount_text = esc_html__( 'Give a Custom Amount', 'give' ); |
|
| 486 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
| 487 | + $display_style = get_post_meta($form_id, '_give_display_style', true); |
|
| 488 | + $custom_amount = get_post_meta($form_id, '_give_custom_amount', true); |
|
| 489 | + $custom_amount_text = get_post_meta($form_id, '_give_custom_amount_text', true); |
|
| 490 | + if (empty($custom_amount_text)) { |
|
| 491 | + $custom_amount_text = esc_html__('Give a Custom Amount', 'give'); |
|
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | $output = ''; |
| 495 | 495 | $counter = 0; |
| 496 | 496 | |
| 497 | - switch ( $display_style ) { |
|
| 497 | + switch ($display_style) { |
|
| 498 | 498 | case 'buttons': |
| 499 | 499 | |
| 500 | 500 | $output .= '<ul id="give-donation-level-button-wrap" class="give-donation-levels-wrap give-list-inline">'; |
| 501 | 501 | |
| 502 | - foreach ( $prices as $price ) { |
|
| 503 | - $counter ++; |
|
| 504 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
| 505 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-' . $counter . ' ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'give-default-level' : '' ), $form_id, $price ); |
|
| 502 | + foreach ($prices as $price) { |
|
| 503 | + $counter++; |
|
| 504 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
| 505 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-btn give-btn give-btn-level-'.$counter.' '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'give-default-level' : ''), $form_id, $price); |
|
| 506 | 506 | |
| 507 | 507 | $output .= '<li>'; |
| 508 | - $output .= '<button type="button" data-price-id="' . $price['_give_id']['level_id'] . '" class=" ' . $level_classes . '" value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 508 | + $output .= '<button type="button" data-price-id="'.$price['_give_id']['level_id'].'" class=" '.$level_classes.'" value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 509 | 509 | $output .= $level_text; |
| 510 | 510 | $output .= '</button>'; |
| 511 | 511 | $output .= '</li>'; |
@@ -513,7 +513,7 @@ discard block |
||
| 513 | 513 | } |
| 514 | 514 | |
| 515 | 515 | //Custom Amount. |
| 516 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
| 516 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
| 517 | 517 | $output .= '<li>'; |
| 518 | 518 | $output .= '<button type="button" data-price-id="custom" class="give-donation-level-btn give-btn give-btn-level-custom" value="custom">'; |
| 519 | 519 | $output .= $custom_amount_text; |
@@ -529,23 +529,23 @@ discard block |
||
| 529 | 529 | |
| 530 | 530 | $output .= '<ul id="give-donation-level-radio-list" class="give-donation-levels-wrap">'; |
| 531 | 531 | |
| 532 | - foreach ( $prices as $price ) { |
|
| 533 | - $counter ++; |
|
| 534 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
| 535 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-' . $counter . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
| 532 | + foreach ($prices as $price) { |
|
| 533 | + $counter++; |
|
| 534 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
| 535 | + $level_classes = apply_filters('give_form_level_classes', 'give-radio-input give-radio-input-level give-radio-level-'.$counter.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
| 536 | 536 | |
| 537 | 537 | $output .= '<li>'; |
| 538 | - $output .= '<input type="radio" data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" name="give-radio-donation-level" id="give-radio-level-' . $counter . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'checked="checked"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 539 | - $output .= '<label for="give-radio-level-' . $counter . '">' . $level_text . '</label>'; |
|
| 538 | + $output .= '<input type="radio" data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" name="give-radio-donation-level" id="give-radio-level-'.$counter.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'checked="checked"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 539 | + $output .= '<label for="give-radio-level-'.$counter.'">'.$level_text.'</label>'; |
|
| 540 | 540 | $output .= '</li>'; |
| 541 | 541 | |
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | //Custom Amount. |
| 545 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
| 545 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
| 546 | 546 | $output .= '<li>'; |
| 547 | 547 | $output .= '<input type="radio" data-price-id="custom" class="give-radio-input give-radio-input-level give-radio-level-custom" name="give-radio-donation-level" id="give-radio-level-custom" value="custom">'; |
| 548 | - $output .= '<label for="give-radio-level-custom">' . $custom_amount_text . '</label>'; |
|
| 548 | + $output .= '<label for="give-radio-level-custom">'.$custom_amount_text.'</label>'; |
|
| 549 | 549 | $output .= '</li>'; |
| 550 | 550 | } |
| 551 | 551 | |
@@ -555,23 +555,23 @@ discard block |
||
| 555 | 555 | |
| 556 | 556 | case 'dropdown': |
| 557 | 557 | |
| 558 | - $output .= '<label for="give-donation-level" class="give-hidden">' . esc_html__( 'Choose Your Donation Amount', 'give' ) . ':</label>'; |
|
| 559 | - $output .= '<select id="give-donation-level-' . $form_id . '" class="give-select give-select-level give-donation-levels-wrap">'; |
|
| 558 | + $output .= '<label for="give-donation-level" class="give-hidden">'.esc_html__('Choose Your Donation Amount', 'give').':</label>'; |
|
| 559 | + $output .= '<select id="give-donation-level-'.$form_id.'" class="give-select give-select-level give-donation-levels-wrap">'; |
|
| 560 | 560 | |
| 561 | 561 | //first loop through prices. |
| 562 | - foreach ( $prices as $price ) { |
|
| 563 | - $level_text = apply_filters( 'give_form_level_text', ! empty( $price['_give_text'] ) ? $price['_give_text'] : give_currency_filter( give_format_amount( $price['_give_amount'] ) ), $form_id, $price ); |
|
| 564 | - $level_classes = apply_filters( 'give_form_level_classes', 'give-donation-level-' . $form_id . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? ' give-default-level' : '' ), $form_id, $price ); |
|
| 562 | + foreach ($prices as $price) { |
|
| 563 | + $level_text = apply_filters('give_form_level_text', ! empty($price['_give_text']) ? $price['_give_text'] : give_currency_filter(give_format_amount($price['_give_amount'])), $form_id, $price); |
|
| 564 | + $level_classes = apply_filters('give_form_level_classes', 'give-donation-level-'.$form_id.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? ' give-default-level' : ''), $form_id, $price); |
|
| 565 | 565 | |
| 566 | - $output .= '<option data-price-id="' . $price['_give_id']['level_id'] . '" class="' . $level_classes . '" ' . ( ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) ? 'selected="selected"' : '' ) . ' value="' . give_format_amount( $price['_give_amount'] ) . '">'; |
|
| 566 | + $output .= '<option data-price-id="'.$price['_give_id']['level_id'].'" class="'.$level_classes.'" '.((isset($price['_give_default']) && $price['_give_default'] === 'default') ? 'selected="selected"' : '').' value="'.give_format_amount($price['_give_amount']).'">'; |
|
| 567 | 567 | $output .= $level_text; |
| 568 | 568 | $output .= '</option>'; |
| 569 | 569 | |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | //Custom Amount. |
| 573 | - if ( give_is_setting_enabled( $custom_amount ) && ! empty( $custom_amount_text ) ) { |
|
| 574 | - $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">' . $custom_amount_text . '</option>'; |
|
| 573 | + if (give_is_setting_enabled($custom_amount) && ! empty($custom_amount_text)) { |
|
| 574 | + $output .= '<option data-price-id="custom" class="give-donation-level-custom" value="custom">'.$custom_amount_text.'</option>'; |
|
| 575 | 575 | } |
| 576 | 576 | |
| 577 | 577 | $output .= '</select>'; |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | break; |
| 580 | 580 | } |
| 581 | 581 | |
| 582 | - echo apply_filters( 'give_form_level_output', $output, $form_id ); |
|
| 582 | + echo apply_filters('give_form_level_output', $output, $form_id); |
|
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | /** |
@@ -594,27 +594,27 @@ discard block |
||
| 594 | 594 | * |
| 595 | 595 | * @return string Checkout button. |
| 596 | 596 | */ |
| 597 | -function give_display_checkout_button( $form_id, $args ) { |
|
| 597 | +function give_display_checkout_button($form_id, $args) { |
|
| 598 | 598 | |
| 599 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
| 599 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
| 600 | 600 | ? $args['display_style'] |
| 601 | - : get_post_meta( $form_id, '_give_payment_display', true ); |
|
| 601 | + : get_post_meta($form_id, '_give_payment_display', true); |
|
| 602 | 602 | |
| 603 | - if ( 'button' === $display_option ) { |
|
| 603 | + if ('button' === $display_option) { |
|
| 604 | 604 | $display_option = 'modal'; |
| 605 | - } elseif ( $display_option === 'onpage' ) { |
|
| 605 | + } elseif ($display_option === 'onpage') { |
|
| 606 | 606 | return ''; |
| 607 | 607 | } |
| 608 | 608 | |
| 609 | - $display_label_field = get_post_meta( $form_id, '_give_reveal_label', true ); |
|
| 610 | - $display_label = ! empty( $args['continue_button_title'] ) ? $args['continue_button_title'] : ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
| 609 | + $display_label_field = get_post_meta($form_id, '_give_reveal_label', true); |
|
| 610 | + $display_label = ! empty($args['continue_button_title']) ? $args['continue_button_title'] : ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
| 611 | 611 | |
| 612 | - $output = '<button type="button" class="give-btn give-btn-' . $display_option . '">' . $display_label . '</button>'; |
|
| 612 | + $output = '<button type="button" class="give-btn give-btn-'.$display_option.'">'.$display_label.'</button>'; |
|
| 613 | 613 | |
| 614 | - echo apply_filters( 'give_display_checkout_button', $output ); |
|
| 614 | + echo apply_filters('give_display_checkout_button', $output); |
|
| 615 | 615 | } |
| 616 | 616 | |
| 617 | -add_action( 'give_after_donation_levels', 'give_display_checkout_button', 10, 2 ); |
|
| 617 | +add_action('give_after_donation_levels', 'give_display_checkout_button', 10, 2); |
|
| 618 | 618 | |
| 619 | 619 | /** |
| 620 | 620 | * Shows the User Info fields in the Personal Info box, more fields can be added via the hooks provided. |
@@ -625,57 +625,57 @@ discard block |
||
| 625 | 625 | * |
| 626 | 626 | * @return void |
| 627 | 627 | */ |
| 628 | -function give_user_info_fields( $form_id ) { |
|
| 628 | +function give_user_info_fields($form_id) { |
|
| 629 | 629 | // Get user info. |
| 630 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
| 630 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
| 631 | 631 | |
| 632 | 632 | /** |
| 633 | 633 | * Fire before user personal information fields |
| 634 | 634 | * |
| 635 | 635 | * @since 1.7 |
| 636 | 636 | */ |
| 637 | - do_action( 'give_donation_form_before_personal_info', $form_id ); |
|
| 637 | + do_action('give_donation_form_before_personal_info', $form_id); |
|
| 638 | 638 | ?> |
| 639 | 639 | <fieldset id="give_checkout_user_info"> |
| 640 | - <legend><?php echo apply_filters( 'give_checkout_personal_info_text', esc_html__( 'Personal Info', 'give' ) ); ?></legend> |
|
| 640 | + <legend><?php echo apply_filters('give_checkout_personal_info_text', esc_html__('Personal Info', 'give')); ?></legend> |
|
| 641 | 641 | <p id="give-first-name-wrap" class="form-row form-row-first form-row-responsive"> |
| 642 | 642 | <label class="give-label" for="give-first"> |
| 643 | - <?php esc_html_e( 'First Name', 'give' ); ?> |
|
| 644 | - <?php if ( give_field_is_required( 'give_first', $form_id ) ) : ?> |
|
| 643 | + <?php esc_html_e('First Name', 'give'); ?> |
|
| 644 | + <?php if (give_field_is_required('give_first', $form_id)) : ?> |
|
| 645 | 645 | <span class="give-required-indicator">*</span> |
| 646 | 646 | <?php endif ?> |
| 647 | 647 | <span class="give-tooltip give-icon give-icon-question" |
| 648 | - data-tooltip="<?php esc_attr_e( 'We will use this to personalize your account experience.', 'give' ); ?>"></span> |
|
| 648 | + data-tooltip="<?php esc_attr_e('We will use this to personalize your account experience.', 'give'); ?>"></span> |
|
| 649 | 649 | </label> |
| 650 | 650 | <input |
| 651 | 651 | class="give-input required" |
| 652 | 652 | type="text" |
| 653 | 653 | name="give_first" |
| 654 | - placeholder="<?php esc_attr_e( 'First Name', 'give' ); ?>" |
|
| 654 | + placeholder="<?php esc_attr_e('First Name', 'give'); ?>" |
|
| 655 | 655 | id="give-first" |
| 656 | - value="<?php echo isset( $give_user_info['give_first'] ) ? $give_user_info['give_first'] : ''; ?>" |
|
| 657 | - <?php echo( give_field_is_required( 'give_first', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 656 | + value="<?php echo isset($give_user_info['give_first']) ? $give_user_info['give_first'] : ''; ?>" |
|
| 657 | + <?php echo(give_field_is_required('give_first', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 658 | 658 | /> |
| 659 | 659 | </p> |
| 660 | 660 | |
| 661 | 661 | <p id="give-last-name-wrap" class="form-row form-row-last form-row-responsive"> |
| 662 | 662 | <label class="give-label" for="give-last"> |
| 663 | - <?php esc_html_e( 'Last Name', 'give' ); ?> |
|
| 664 | - <?php if ( give_field_is_required( 'give_last', $form_id ) ) : ?> |
|
| 663 | + <?php esc_html_e('Last Name', 'give'); ?> |
|
| 664 | + <?php if (give_field_is_required('give_last', $form_id)) : ?> |
|
| 665 | 665 | <span class="give-required-indicator">*</span> |
| 666 | 666 | <?php endif ?> |
| 667 | 667 | <span class="give-tooltip give-icon give-icon-question" |
| 668 | - data-tooltip="<?php esc_attr_e( 'We will use this as well to personalize your account experience.', 'give' ); ?>"></span> |
|
| 668 | + data-tooltip="<?php esc_attr_e('We will use this as well to personalize your account experience.', 'give'); ?>"></span> |
|
| 669 | 669 | </label> |
| 670 | 670 | |
| 671 | 671 | <input |
| 672 | - class="give-input<?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required' : '' ); ?>" |
|
| 672 | + class="give-input<?php echo(give_field_is_required('give_last', $form_id) ? ' required' : ''); ?>" |
|
| 673 | 673 | type="text" |
| 674 | 674 | name="give_last" |
| 675 | 675 | id="give-last" |
| 676 | - placeholder="<?php esc_attr_e( 'Last Name', 'give' ); ?>" |
|
| 677 | - value="<?php echo isset( $give_user_info['give_last'] ) ? $give_user_info['give_last'] : ''; ?>" |
|
| 678 | - <?php echo( give_field_is_required( 'give_last', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 676 | + placeholder="<?php esc_attr_e('Last Name', 'give'); ?>" |
|
| 677 | + value="<?php echo isset($give_user_info['give_last']) ? $give_user_info['give_last'] : ''; ?>" |
|
| 678 | + <?php echo(give_field_is_required('give_last', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 679 | 679 | /> |
| 680 | 680 | </p> |
| 681 | 681 | |
@@ -685,26 +685,26 @@ discard block |
||
| 685 | 685 | * |
| 686 | 686 | * @since 1.7 |
| 687 | 687 | */ |
| 688 | - do_action( 'give_donation_form_before_email', $form_id ); |
|
| 688 | + do_action('give_donation_form_before_email', $form_id); |
|
| 689 | 689 | ?> |
| 690 | 690 | <p id="give-email-wrap" class="form-row form-row-wide"> |
| 691 | 691 | <label class="give-label" for="give-email"> |
| 692 | - <?php esc_html_e( 'Email Address', 'give' ); ?> |
|
| 693 | - <?php if ( give_field_is_required( 'give_email', $form_id ) ) { ?> |
|
| 692 | + <?php esc_html_e('Email Address', 'give'); ?> |
|
| 693 | + <?php if (give_field_is_required('give_email', $form_id)) { ?> |
|
| 694 | 694 | <span class="give-required-indicator">*</span> |
| 695 | 695 | <?php } ?> |
| 696 | 696 | <span class="give-tooltip give-icon give-icon-question" |
| 697 | - data-tooltip="<?php esc_attr_e( 'We will send the donation receipt to this address.', 'give' ); ?>"></span> |
|
| 697 | + data-tooltip="<?php esc_attr_e('We will send the donation receipt to this address.', 'give'); ?>"></span> |
|
| 698 | 698 | </label> |
| 699 | 699 | |
| 700 | 700 | <input |
| 701 | 701 | class="give-input required" |
| 702 | 702 | type="email" |
| 703 | 703 | name="give_email" |
| 704 | - placeholder="<?php esc_attr_e( 'Email Address', 'give' ); ?>" |
|
| 704 | + placeholder="<?php esc_attr_e('Email Address', 'give'); ?>" |
|
| 705 | 705 | id="give-email" |
| 706 | - value="<?php echo isset( $give_user_info['give_email'] ) ? $give_user_info['give_email'] : ''; ?>" |
|
| 707 | - <?php echo( give_field_is_required( 'give_email', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 706 | + value="<?php echo isset($give_user_info['give_email']) ? $give_user_info['give_email'] : ''; ?>" |
|
| 707 | + <?php echo(give_field_is_required('give_email', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 708 | 708 | /> |
| 709 | 709 | |
| 710 | 710 | </p> |
@@ -714,14 +714,14 @@ discard block |
||
| 714 | 714 | * |
| 715 | 715 | * @since 1.7 |
| 716 | 716 | */ |
| 717 | - do_action( 'give_donation_form_after_email', $form_id ); |
|
| 717 | + do_action('give_donation_form_after_email', $form_id); |
|
| 718 | 718 | |
| 719 | 719 | /** |
| 720 | 720 | * Fire after personal email field |
| 721 | 721 | * |
| 722 | 722 | * @since 1.7 |
| 723 | 723 | */ |
| 724 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
| 724 | + do_action('give_donation_form_user_info', $form_id); |
|
| 725 | 725 | ?> |
| 726 | 726 | </fieldset> |
| 727 | 727 | <?php |
@@ -730,11 +730,11 @@ discard block |
||
| 730 | 730 | * |
| 731 | 731 | * @since 1.7 |
| 732 | 732 | */ |
| 733 | - do_action( 'give_donation_form_after_personal_info', $form_id ); |
|
| 733 | + do_action('give_donation_form_after_personal_info', $form_id); |
|
| 734 | 734 | } |
| 735 | 735 | |
| 736 | -add_action( 'give_donation_form_after_user_info', 'give_user_info_fields' ); |
|
| 737 | -add_action( 'give_register_fields_before', 'give_user_info_fields' ); |
|
| 736 | +add_action('give_donation_form_after_user_info', 'give_user_info_fields'); |
|
| 737 | +add_action('give_register_fields_before', 'give_user_info_fields'); |
|
| 738 | 738 | |
| 739 | 739 | /** |
| 740 | 740 | * Renders the credit card info form. |
@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | * |
| 746 | 746 | * @return void |
| 747 | 747 | */ |
| 748 | -function give_get_cc_form( $form_id ) { |
|
| 748 | +function give_get_cc_form($form_id) { |
|
| 749 | 749 | |
| 750 | 750 | ob_start(); |
| 751 | 751 | |
@@ -756,53 +756,53 @@ discard block |
||
| 756 | 756 | * |
| 757 | 757 | * @param int $form_id The form ID. |
| 758 | 758 | */ |
| 759 | - do_action( 'give_before_cc_fields', $form_id ); |
|
| 759 | + do_action('give_before_cc_fields', $form_id); |
|
| 760 | 760 | ?> |
| 761 | 761 | <fieldset id="give_cc_fields-<?php echo $form_id ?>" class="give-do-validate"> |
| 762 | - <legend><?php echo apply_filters( 'give_credit_card_fieldset_heading', esc_html__( 'Credit Card Info', 'give' ) ); ?></legend> |
|
| 763 | - <?php if ( is_ssl() ) : ?> |
|
| 762 | + <legend><?php echo apply_filters('give_credit_card_fieldset_heading', esc_html__('Credit Card Info', 'give')); ?></legend> |
|
| 763 | + <?php if (is_ssl()) : ?> |
|
| 764 | 764 | <div id="give_secure_site_wrapper-<?php echo $form_id ?>"> |
| 765 | 765 | <span class="give-icon padlock"></span> |
| 766 | - <span><?php esc_html_e( 'This is a secure SSL encrypted payment.', 'give' ); ?></span> |
|
| 766 | + <span><?php esc_html_e('This is a secure SSL encrypted payment.', 'give'); ?></span> |
|
| 767 | 767 | </div> |
| 768 | 768 | <?php endif; ?> |
| 769 | 769 | <p id="give-card-number-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive"> |
| 770 | 770 | <label for="card_number-<?php echo $form_id ?>" class="give-label"> |
| 771 | - <?php esc_html_e( 'Card Number', 'give' ); ?> |
|
| 771 | + <?php esc_html_e('Card Number', 'give'); ?> |
|
| 772 | 772 | <span class="give-required-indicator">*</span> |
| 773 | 773 | <span class="give-tooltip give-icon give-icon-question" |
| 774 | - data-tooltip="<?php esc_attr_e( 'The (typically) 16 digits on the front of your credit card.', 'give' ); ?>"></span> |
|
| 774 | + data-tooltip="<?php esc_attr_e('The (typically) 16 digits on the front of your credit card.', 'give'); ?>"></span> |
|
| 775 | 775 | <span class="card-type"></span> |
| 776 | 776 | </label> |
| 777 | 777 | |
| 778 | 778 | <input type="tel" autocomplete="off" name="card_number" id="card_number-<?php echo $form_id ?>" |
| 779 | - class="card-number give-input required" placeholder="<?php esc_attr_e( 'Card number', 'give' ); ?>" |
|
| 779 | + class="card-number give-input required" placeholder="<?php esc_attr_e('Card number', 'give'); ?>" |
|
| 780 | 780 | required aria-required="true"/> |
| 781 | 781 | </p> |
| 782 | 782 | |
| 783 | 783 | <p id="give-card-cvc-wrap-<?php echo $form_id ?>" class="form-row form-row-one-third form-row-responsive"> |
| 784 | 784 | <label for="card_cvc-<?php echo $form_id ?>" class="give-label"> |
| 785 | - <?php esc_html_e( 'CVC', 'give' ); ?> |
|
| 785 | + <?php esc_html_e('CVC', 'give'); ?> |
|
| 786 | 786 | <span class="give-required-indicator">*</span> |
| 787 | 787 | <span class="give-tooltip give-icon give-icon-question" |
| 788 | - data-tooltip="<?php esc_attr_e( 'The 3 digit (back) or 4 digit (front) value on your card.', 'give' ); ?>"></span> |
|
| 788 | + data-tooltip="<?php esc_attr_e('The 3 digit (back) or 4 digit (front) value on your card.', 'give'); ?>"></span> |
|
| 789 | 789 | </label> |
| 790 | 790 | |
| 791 | 791 | <input type="tel" size="4" autocomplete="off" name="card_cvc" id="card_cvc-<?php echo $form_id ?>" |
| 792 | - class="card-cvc give-input required" placeholder="<?php esc_attr_e( 'Security code', 'give' ); ?>" |
|
| 792 | + class="card-cvc give-input required" placeholder="<?php esc_attr_e('Security code', 'give'); ?>" |
|
| 793 | 793 | required aria-required="true"/> |
| 794 | 794 | </p> |
| 795 | 795 | |
| 796 | 796 | <p id="give-card-name-wrap-<?php echo $form_id ?>" class="form-row form-row-two-thirds form-row-responsive"> |
| 797 | 797 | <label for="card_name-<?php echo $form_id ?>" class="give-label"> |
| 798 | - <?php esc_html_e( 'Name on the Card', 'give' ); ?> |
|
| 798 | + <?php esc_html_e('Name on the Card', 'give'); ?> |
|
| 799 | 799 | <span class="give-required-indicator">*</span> |
| 800 | 800 | <span class="give-tooltip give-icon give-icon-question" |
| 801 | - data-tooltip="<?php esc_attr_e( 'The name printed on the front of your credit card.', 'give' ); ?>"></span> |
|
| 801 | + data-tooltip="<?php esc_attr_e('The name printed on the front of your credit card.', 'give'); ?>"></span> |
|
| 802 | 802 | </label> |
| 803 | 803 | |
| 804 | 804 | <input type="text" autocomplete="off" name="card_name" id="card_name-<?php echo $form_id ?>" |
| 805 | - class="card-name give-input required" placeholder="<?php esc_attr_e( 'Card name', 'give' ); ?>" |
|
| 805 | + class="card-name give-input required" placeholder="<?php esc_attr_e('Card name', 'give'); ?>" |
|
| 806 | 806 | required aria-required="true"/> |
| 807 | 807 | </p> |
| 808 | 808 | <?php |
@@ -813,14 +813,14 @@ discard block |
||
| 813 | 813 | * |
| 814 | 814 | * @param int $form_id The form ID. |
| 815 | 815 | */ |
| 816 | - do_action( 'give_before_cc_expiration' ); |
|
| 816 | + do_action('give_before_cc_expiration'); |
|
| 817 | 817 | ?> |
| 818 | 818 | <p class="card-expiration form-row form-row-one-third form-row-responsive"> |
| 819 | 819 | <label for="card_expiry-<?php echo $form_id ?>" class="give-label"> |
| 820 | - <?php esc_html_e( 'Expiration', 'give' ); ?> |
|
| 820 | + <?php esc_html_e('Expiration', 'give'); ?> |
|
| 821 | 821 | <span class="give-required-indicator">*</span> |
| 822 | 822 | <span class="give-tooltip give-icon give-icon-question" |
| 823 | - data-tooltip="<?php esc_attr_e( 'The date your credit card expires, typically on the front of the card.', 'give' ); ?>"></span> |
|
| 823 | + data-tooltip="<?php esc_attr_e('The date your credit card expires, typically on the front of the card.', 'give'); ?>"></span> |
|
| 824 | 824 | </label> |
| 825 | 825 | |
| 826 | 826 | <input type="hidden" id="card_exp_month-<?php echo $form_id ?>" name="card_exp_month" |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | class="card-expiry-year"/> |
| 830 | 830 | |
| 831 | 831 | <input type="tel" autocomplete="off" name="card_expiry" id="card_expiry-<?php echo $form_id ?>" |
| 832 | - class="card-expiry give-input required" placeholder="<?php esc_attr_e( 'MM / YY', 'give' ); ?>" |
|
| 832 | + class="card-expiry give-input required" placeholder="<?php esc_attr_e('MM / YY', 'give'); ?>" |
|
| 833 | 833 | required aria-required="true"/> |
| 834 | 834 | </p> |
| 835 | 835 | <?php |
@@ -840,7 +840,7 @@ discard block |
||
| 840 | 840 | * |
| 841 | 841 | * @param int $form_id The form ID. |
| 842 | 842 | */ |
| 843 | - do_action( 'give_after_cc_expiration', $form_id ); |
|
| 843 | + do_action('give_after_cc_expiration', $form_id); |
|
| 844 | 844 | ?> |
| 845 | 845 | </fieldset> |
| 846 | 846 | <?php |
@@ -851,12 +851,12 @@ discard block |
||
| 851 | 851 | * |
| 852 | 852 | * @param int $form_id The form ID. |
| 853 | 853 | */ |
| 854 | - do_action( 'give_after_cc_fields', $form_id ); |
|
| 854 | + do_action('give_after_cc_fields', $form_id); |
|
| 855 | 855 | |
| 856 | 856 | echo ob_get_clean(); |
| 857 | 857 | } |
| 858 | 858 | |
| 859 | -add_action( 'give_cc_form', 'give_get_cc_form' ); |
|
| 859 | +add_action('give_cc_form', 'give_get_cc_form'); |
|
| 860 | 860 | |
| 861 | 861 | /** |
| 862 | 862 | * Outputs the default credit card address fields. |
@@ -867,24 +867,24 @@ discard block |
||
| 867 | 867 | * |
| 868 | 868 | * @return void |
| 869 | 869 | */ |
| 870 | -function give_default_cc_address_fields( $form_id ) { |
|
| 870 | +function give_default_cc_address_fields($form_id) { |
|
| 871 | 871 | // Get user info. |
| 872 | - $give_user_info = _give_get_prefill_form_field_values( $form_id ); |
|
| 872 | + $give_user_info = _give_get_prefill_form_field_values($form_id); |
|
| 873 | 873 | |
| 874 | 874 | $logged_in = is_user_logged_in(); |
| 875 | 875 | |
| 876 | - if ( $logged_in ) { |
|
| 877 | - $user_address = get_user_meta( get_current_user_id(), '_give_user_address', true ); |
|
| 876 | + if ($logged_in) { |
|
| 877 | + $user_address = get_user_meta(get_current_user_id(), '_give_user_address', true); |
|
| 878 | 878 | } |
| 879 | - $line1 = $logged_in && ! empty( $user_address['line1'] ) ? $user_address['line1'] : ''; |
|
| 880 | - $line2 = $logged_in && ! empty( $user_address['line2'] ) ? $user_address['line2'] : ''; |
|
| 881 | - $city = $logged_in && ! empty( $user_address['city'] ) ? $user_address['city'] : ''; |
|
| 882 | - $zip = $logged_in && ! empty( $user_address['zip'] ) ? $user_address['zip'] : ''; |
|
| 879 | + $line1 = $logged_in && ! empty($user_address['line1']) ? $user_address['line1'] : ''; |
|
| 880 | + $line2 = $logged_in && ! empty($user_address['line2']) ? $user_address['line2'] : ''; |
|
| 881 | + $city = $logged_in && ! empty($user_address['city']) ? $user_address['city'] : ''; |
|
| 882 | + $zip = $logged_in && ! empty($user_address['zip']) ? $user_address['zip'] : ''; |
|
| 883 | 883 | |
| 884 | 884 | ob_start(); |
| 885 | 885 | ?> |
| 886 | 886 | <fieldset id="give_cc_address" class="cc-address"> |
| 887 | - <legend><?php echo apply_filters( 'give_billing_details_fieldset_heading', esc_html__( 'Billing Details', 'give' ) ); ?></legend> |
|
| 887 | + <legend><?php echo apply_filters('give_billing_details_fieldset_heading', esc_html__('Billing Details', 'give')); ?></legend> |
|
| 888 | 888 | <?php |
| 889 | 889 | /** |
| 890 | 890 | * Fires while rendering credit card billing form, before address fields. |
@@ -893,79 +893,79 @@ discard block |
||
| 893 | 893 | * |
| 894 | 894 | * @param int $form_id The form ID. |
| 895 | 895 | */ |
| 896 | - do_action( 'give_cc_billing_top' ); |
|
| 896 | + do_action('give_cc_billing_top'); |
|
| 897 | 897 | ?> |
| 898 | 898 | <p id="give-card-address-wrap" class="form-row form-row-wide"> |
| 899 | 899 | <label for="card_address" class="give-label"> |
| 900 | - <?php esc_html_e( 'Address 1', 'give' ); ?> |
|
| 900 | + <?php esc_html_e('Address 1', 'give'); ?> |
|
| 901 | 901 | <?php |
| 902 | - if ( give_field_is_required( 'card_address', $form_id ) ) : ?> |
|
| 902 | + if (give_field_is_required('card_address', $form_id)) : ?> |
|
| 903 | 903 | <span class="give-required-indicator">*</span> |
| 904 | 904 | <?php endif; ?> |
| 905 | 905 | <span class="give-tooltip give-icon give-icon-question" |
| 906 | - data-tooltip="<?php esc_attr_e( 'The primary billing address for your credit card.', 'give' ); ?>"></span> |
|
| 906 | + data-tooltip="<?php esc_attr_e('The primary billing address for your credit card.', 'give'); ?>"></span> |
|
| 907 | 907 | </label> |
| 908 | 908 | |
| 909 | 909 | <input |
| 910 | 910 | type="text" |
| 911 | 911 | id="card_address" |
| 912 | 912 | name="card_address" |
| 913 | - class="card-address give-input<?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required' : '' ); ?>" |
|
| 914 | - placeholder="<?php esc_attr_e( 'Address line 1', 'give' ); ?>" |
|
| 915 | - value="<?php echo isset( $give_user_info['card_address'] ) ? $give_user_info['card_address'] : ''; ?>" |
|
| 916 | - <?php echo( give_field_is_required( 'card_address', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 913 | + class="card-address give-input<?php echo(give_field_is_required('card_address', $form_id) ? ' required' : ''); ?>" |
|
| 914 | + placeholder="<?php esc_attr_e('Address line 1', 'give'); ?>" |
|
| 915 | + value="<?php echo isset($give_user_info['card_address']) ? $give_user_info['card_address'] : ''; ?>" |
|
| 916 | + <?php echo(give_field_is_required('card_address', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 917 | 917 | /> |
| 918 | 918 | </p> |
| 919 | 919 | |
| 920 | 920 | <p id="give-card-address-2-wrap" class="form-row form-row-wide"> |
| 921 | 921 | <label for="card_address_2" class="give-label"> |
| 922 | - <?php esc_html_e( 'Address 2', 'give' ); ?> |
|
| 923 | - <?php if ( give_field_is_required( 'card_address_2', $form_id ) ) : ?> |
|
| 922 | + <?php esc_html_e('Address 2', 'give'); ?> |
|
| 923 | + <?php if (give_field_is_required('card_address_2', $form_id)) : ?> |
|
| 924 | 924 | <span class="give-required-indicator">*</span> |
| 925 | 925 | <?php endif; ?> |
| 926 | 926 | <span class="give-tooltip give-icon give-icon-question" |
| 927 | - data-tooltip="<?php esc_attr_e( '(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give' ); ?>"></span> |
|
| 927 | + data-tooltip="<?php esc_attr_e('(optional) The suite, apt no, PO box, etc, associated with your billing address.', 'give'); ?>"></span> |
|
| 928 | 928 | </label> |
| 929 | 929 | |
| 930 | 930 | <input |
| 931 | 931 | type="text" |
| 932 | 932 | id="card_address_2" |
| 933 | 933 | name="card_address_2" |
| 934 | - class="card-address-2 give-input<?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required' : '' ); ?>" |
|
| 935 | - placeholder="<?php esc_attr_e( 'Address line 2', 'give' ); ?>" |
|
| 936 | - value="<?php echo isset( $give_user_info['card_address_2'] ) ? $give_user_info['card_address_2'] : ''; ?>" |
|
| 937 | - <?php echo( give_field_is_required( 'card_address_2', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 934 | + class="card-address-2 give-input<?php echo(give_field_is_required('card_address_2', $form_id) ? ' required' : ''); ?>" |
|
| 935 | + placeholder="<?php esc_attr_e('Address line 2', 'give'); ?>" |
|
| 936 | + value="<?php echo isset($give_user_info['card_address_2']) ? $give_user_info['card_address_2'] : ''; ?>" |
|
| 937 | + <?php echo(give_field_is_required('card_address_2', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 938 | 938 | /> |
| 939 | 939 | </p> |
| 940 | 940 | |
| 941 | 941 | <p id="give-card-city-wrap" class="form-row form-row-first form-row-responsive"> |
| 942 | 942 | <label for="card_city" class="give-label"> |
| 943 | - <?php esc_html_e( 'City', 'give' ); ?> |
|
| 944 | - <?php if ( give_field_is_required( 'card_city', $form_id ) ) : ?> |
|
| 943 | + <?php esc_html_e('City', 'give'); ?> |
|
| 944 | + <?php if (give_field_is_required('card_city', $form_id)) : ?> |
|
| 945 | 945 | <span class="give-required-indicator">*</span> |
| 946 | 946 | <?php endif; ?> |
| 947 | 947 | <span class="give-tooltip give-icon give-icon-question" |
| 948 | - data-tooltip="<?php esc_attr_e( 'The city for your billing address.', 'give' ); ?>"></span> |
|
| 948 | + data-tooltip="<?php esc_attr_e('The city for your billing address.', 'give'); ?>"></span> |
|
| 949 | 949 | </label> |
| 950 | 950 | <input |
| 951 | 951 | type="text" |
| 952 | 952 | id="card_city" |
| 953 | 953 | name="card_city" |
| 954 | - class="card-city give-input<?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required' : '' ); ?>" |
|
| 955 | - placeholder="<?php esc_attr_e( 'City', 'give' ); ?>" |
|
| 956 | - value="<?php echo isset( $give_user_info['card_city'] ) ? $give_user_info['card_city'] : ''; ?>" |
|
| 957 | - <?php echo( give_field_is_required( 'card_city', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 954 | + class="card-city give-input<?php echo(give_field_is_required('card_city', $form_id) ? ' required' : ''); ?>" |
|
| 955 | + placeholder="<?php esc_attr_e('City', 'give'); ?>" |
|
| 956 | + value="<?php echo isset($give_user_info['card_city']) ? $give_user_info['card_city'] : ''; ?>" |
|
| 957 | + <?php echo(give_field_is_required('card_city', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 958 | 958 | /> |
| 959 | 959 | </p> |
| 960 | 960 | |
| 961 | 961 | <p id="give-card-zip-wrap" class="form-row form-row-last form-row-responsive"> |
| 962 | 962 | <label for="card_zip" class="give-label"> |
| 963 | - <?php esc_html_e( 'Zip / Postal Code', 'give' ); ?> |
|
| 964 | - <?php if ( give_field_is_required( 'card_zip', $form_id ) ) : ?> |
|
| 963 | + <?php esc_html_e('Zip / Postal Code', 'give'); ?> |
|
| 964 | + <?php if (give_field_is_required('card_zip', $form_id)) : ?> |
|
| 965 | 965 | <span class="give-required-indicator">*</span> |
| 966 | 966 | <?php endif; ?> |
| 967 | 967 | <span class="give-tooltip give-icon give-icon-question" |
| 968 | - data-tooltip="<?php esc_attr_e( 'The zip or postal code for your billing address.', 'give' ); ?>"></span> |
|
| 968 | + data-tooltip="<?php esc_attr_e('The zip or postal code for your billing address.', 'give'); ?>"></span> |
|
| 969 | 969 | </label> |
| 970 | 970 | |
| 971 | 971 | <input |
@@ -973,40 +973,40 @@ discard block |
||
| 973 | 973 | size="4" |
| 974 | 974 | id="card_zip" |
| 975 | 975 | name="card_zip" |
| 976 | - class="card-zip give-input<?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required' : '' ); ?>" |
|
| 977 | - placeholder="<?php esc_attr_e( 'Zip / Postal Code', 'give' ); ?>" |
|
| 978 | - value="<?php echo isset( $give_user_info['card_zip'] ) ? $give_user_info['card_zip'] : ''; ?>" |
|
| 979 | - <?php echo( give_field_is_required( 'card_zip', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 976 | + class="card-zip give-input<?php echo(give_field_is_required('card_zip', $form_id) ? ' required' : ''); ?>" |
|
| 977 | + placeholder="<?php esc_attr_e('Zip / Postal Code', 'give'); ?>" |
|
| 978 | + value="<?php echo isset($give_user_info['card_zip']) ? $give_user_info['card_zip'] : ''; ?>" |
|
| 979 | + <?php echo(give_field_is_required('card_zip', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 980 | 980 | /> |
| 981 | 981 | </p> |
| 982 | 982 | |
| 983 | 983 | <p id="give-card-country-wrap" class="form-row form-row-first form-row-responsive"> |
| 984 | 984 | <label for="billing_country" class="give-label"> |
| 985 | - <?php esc_html_e( 'Country', 'give' ); ?> |
|
| 986 | - <?php if ( give_field_is_required( 'billing_country', $form_id ) ) : ?> |
|
| 985 | + <?php esc_html_e('Country', 'give'); ?> |
|
| 986 | + <?php if (give_field_is_required('billing_country', $form_id)) : ?> |
|
| 987 | 987 | <span class="give-required-indicator">*</span> |
| 988 | 988 | <?php endif; ?> |
| 989 | 989 | <span class="give-tooltip give-icon give-icon-question" |
| 990 | - data-tooltip="<?php esc_attr_e( 'The country for your billing address.', 'give' ); ?>"></span> |
|
| 990 | + data-tooltip="<?php esc_attr_e('The country for your billing address.', 'give'); ?>"></span> |
|
| 991 | 991 | </label> |
| 992 | 992 | |
| 993 | 993 | <select |
| 994 | 994 | name="billing_country" |
| 995 | 995 | id="billing_country" |
| 996 | - class="billing-country billing_country give-select<?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required' : '' ); ?>" |
|
| 997 | - <?php echo( give_field_is_required( 'billing_country', $form_id ) ? ' required aria-required="true" ' : '' ); ?> |
|
| 996 | + class="billing-country billing_country give-select<?php echo(give_field_is_required('billing_country', $form_id) ? ' required' : ''); ?>" |
|
| 997 | + <?php echo(give_field_is_required('billing_country', $form_id) ? ' required aria-required="true" ' : ''); ?> |
|
| 998 | 998 | > |
| 999 | 999 | <?php |
| 1000 | 1000 | |
| 1001 | 1001 | $selected_country = give_get_country(); |
| 1002 | 1002 | |
| 1003 | - if ( ! empty( $give_user_info['billing_country'] ) && '*' !== $give_user_info['billing_country'] ) { |
|
| 1003 | + if ( ! empty($give_user_info['billing_country']) && '*' !== $give_user_info['billing_country']) { |
|
| 1004 | 1004 | $selected_country = $give_user_info['billing_country']; |
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | 1007 | $countries = give_get_country_list(); |
| 1008 | - foreach ( $countries as $country_code => $country ) { |
|
| 1009 | - echo '<option value="' . esc_attr( $country_code ) . '"' . selected( $country_code, $selected_country, false ) . '>' . $country . '</option>'; |
|
| 1008 | + foreach ($countries as $country_code => $country) { |
|
| 1009 | + echo '<option value="'.esc_attr($country_code).'"'.selected($country_code, $selected_country, false).'>'.$country.'</option>'; |
|
| 1010 | 1010 | } |
| 1011 | 1011 | ?> |
| 1012 | 1012 | </select> |
@@ -1014,37 +1014,37 @@ discard block |
||
| 1014 | 1014 | |
| 1015 | 1015 | <p id="give-card-state-wrap" class="form-row form-row-last form-row-responsive"> |
| 1016 | 1016 | <label for="card_state" class="give-label"> |
| 1017 | - <?php esc_html_e( 'State / Province', 'give' ); ?> |
|
| 1018 | - <?php if ( give_field_is_required( 'card_state', $form_id ) ) : ?> |
|
| 1017 | + <?php esc_html_e('State / Province', 'give'); ?> |
|
| 1018 | + <?php if (give_field_is_required('card_state', $form_id)) : ?> |
|
| 1019 | 1019 | <span class="give-required-indicator">*</span> |
| 1020 | 1020 | <?php endif; ?> |
| 1021 | 1021 | <span class="give-tooltip give-icon give-icon-question" |
| 1022 | - data-tooltip="<?php esc_attr_e( 'The state or province for your billing address.', 'give' ); ?>"></span> |
|
| 1022 | + data-tooltip="<?php esc_attr_e('The state or province for your billing address.', 'give'); ?>"></span> |
|
| 1023 | 1023 | </label> |
| 1024 | 1024 | |
| 1025 | 1025 | <?php |
| 1026 | 1026 | $selected_state = give_get_state(); |
| 1027 | - $states = give_get_states( $selected_country ); |
|
| 1027 | + $states = give_get_states($selected_country); |
|
| 1028 | 1028 | |
| 1029 | - if ( ! empty( $give_user_info['card_state'] ) ) { |
|
| 1029 | + if ( ! empty($give_user_info['card_state'])) { |
|
| 1030 | 1030 | $selected_state = $give_user_info['card_state']; |
| 1031 | 1031 | } |
| 1032 | 1032 | |
| 1033 | - if ( ! empty( $states ) ) : ?> |
|
| 1033 | + if ( ! empty($states)) : ?> |
|
| 1034 | 1034 | <select |
| 1035 | 1035 | name="card_state" |
| 1036 | 1036 | id="card_state" |
| 1037 | - class="card_state give-select<?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required' : '' ); ?>" |
|
| 1038 | - <?php echo( give_field_is_required( 'card_state', $form_id ) ? ' required aria-required="true" ' : '' ); ?>> |
|
| 1037 | + class="card_state give-select<?php echo(give_field_is_required('card_state', $form_id) ? ' required' : ''); ?>" |
|
| 1038 | + <?php echo(give_field_is_required('card_state', $form_id) ? ' required aria-required="true" ' : ''); ?>> |
|
| 1039 | 1039 | <?php |
| 1040 | - foreach ( $states as $state_code => $state ) { |
|
| 1041 | - echo '<option value="' . $state_code . '"' . selected( $state_code, $selected_state, false ) . '>' . $state . '</option>'; |
|
| 1040 | + foreach ($states as $state_code => $state) { |
|
| 1041 | + echo '<option value="'.$state_code.'"'.selected($state_code, $selected_state, false).'>'.$state.'</option>'; |
|
| 1042 | 1042 | } |
| 1043 | 1043 | ?> |
| 1044 | 1044 | </select> |
| 1045 | 1045 | <?php else : ?> |
| 1046 | 1046 | <input type="text" size="6" name="card_state" id="card_state" class="card_state give-input" |
| 1047 | - placeholder="<?php esc_attr_e( 'State / Province', 'give' ); ?>"/> |
|
| 1047 | + placeholder="<?php esc_attr_e('State / Province', 'give'); ?>"/> |
|
| 1048 | 1048 | <?php endif; ?> |
| 1049 | 1049 | </p> |
| 1050 | 1050 | <?php |
@@ -1055,14 +1055,14 @@ discard block |
||
| 1055 | 1055 | * |
| 1056 | 1056 | * @param int $form_id The form ID. |
| 1057 | 1057 | */ |
| 1058 | - do_action( 'give_cc_billing_bottom' ); |
|
| 1058 | + do_action('give_cc_billing_bottom'); |
|
| 1059 | 1059 | ?> |
| 1060 | 1060 | </fieldset> |
| 1061 | 1061 | <?php |
| 1062 | 1062 | echo ob_get_clean(); |
| 1063 | 1063 | } |
| 1064 | 1064 | |
| 1065 | -add_action( 'give_after_cc_fields', 'give_default_cc_address_fields' ); |
|
| 1065 | +add_action('give_after_cc_fields', 'give_default_cc_address_fields'); |
|
| 1066 | 1066 | |
| 1067 | 1067 | |
| 1068 | 1068 | /** |
@@ -1075,24 +1075,24 @@ discard block |
||
| 1075 | 1075 | * |
| 1076 | 1076 | * @return string |
| 1077 | 1077 | */ |
| 1078 | -function give_get_register_fields( $form_id ) { |
|
| 1078 | +function give_get_register_fields($form_id) { |
|
| 1079 | 1079 | |
| 1080 | 1080 | global $user_ID; |
| 1081 | 1081 | |
| 1082 | - if ( is_user_logged_in() ) { |
|
| 1083 | - $user_data = get_userdata( $user_ID ); |
|
| 1082 | + if (is_user_logged_in()) { |
|
| 1083 | + $user_data = get_userdata($user_ID); |
|
| 1084 | 1084 | } |
| 1085 | 1085 | |
| 1086 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 1086 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 1087 | 1087 | |
| 1088 | 1088 | ob_start(); ?> |
| 1089 | 1089 | <fieldset id="give-register-fields-<?php echo $form_id; ?>"> |
| 1090 | 1090 | |
| 1091 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 1091 | + <?php if ($show_register_form == 'both') { ?> |
|
| 1092 | 1092 | <div class="give-login-account-wrap"> |
| 1093 | - <p class="give-login-message"><?php esc_html_e( 'Already have an account?', 'give' ); ?> |
|
| 1094 | - <a href="<?php echo esc_url( add_query_arg( 'login', 1 ) ); ?>" class="give-checkout-login" |
|
| 1095 | - data-action="give_checkout_login"><?php esc_html_e( 'Login', 'give' ); ?></a> |
|
| 1093 | + <p class="give-login-message"><?php esc_html_e('Already have an account?', 'give'); ?> |
|
| 1094 | + <a href="<?php echo esc_url(add_query_arg('login', 1)); ?>" class="give-checkout-login" |
|
| 1095 | + data-action="give_checkout_login"><?php esc_html_e('Login', 'give'); ?></a> |
|
| 1096 | 1096 | </p> |
| 1097 | 1097 | <p class="give-loading-text"> |
| 1098 | 1098 | <span class="give-loading-animation"></span> |
@@ -1108,15 +1108,15 @@ discard block |
||
| 1108 | 1108 | * |
| 1109 | 1109 | * @param int $form_id The form ID. |
| 1110 | 1110 | */ |
| 1111 | - do_action( 'give_register_fields_before', $form_id ); |
|
| 1111 | + do_action('give_register_fields_before', $form_id); |
|
| 1112 | 1112 | ?> |
| 1113 | 1113 | |
| 1114 | 1114 | <fieldset id="give-register-account-fields-<?php echo $form_id; ?>"> |
| 1115 | 1115 | <legend> |
| 1116 | 1116 | <?php |
| 1117 | - echo apply_filters( 'give_create_account_fieldset_heading', esc_html__( 'Create an account', 'give' ) ); |
|
| 1118 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1119 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
| 1117 | + echo apply_filters('give_create_account_fieldset_heading', esc_html__('Create an account', 'give')); |
|
| 1118 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1119 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
| 1120 | 1120 | } |
| 1121 | 1121 | ?> |
| 1122 | 1122 | </legend> |
@@ -1128,54 +1128,54 @@ discard block |
||
| 1128 | 1128 | * |
| 1129 | 1129 | * @param int $form_id The form ID. |
| 1130 | 1130 | */ |
| 1131 | - do_action( 'give_register_account_fields_before', $form_id ); |
|
| 1131 | + do_action('give_register_account_fields_before', $form_id); |
|
| 1132 | 1132 | ?> |
| 1133 | 1133 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" |
| 1134 | 1134 | class="form-row form-row-one-third form-row-first form-row-responsive"> |
| 1135 | 1135 | <label for="give-user-login-<?php echo $form_id; ?>"> |
| 1136 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
| 1137 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1136 | + <?php esc_html_e('Username', 'give'); ?> |
|
| 1137 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1138 | 1138 | <span class="give-required-indicator">*</span> |
| 1139 | 1139 | <?php } ?> |
| 1140 | 1140 | <span class="give-tooltip give-icon give-icon-question" |
| 1141 | - data-tooltip="<?php esc_attr_e( 'The username you will use to log into your account.', 'give' ); ?>"></span> |
|
| 1141 | + data-tooltip="<?php esc_attr_e('The username you will use to log into your account.', 'give'); ?>"></span> |
|
| 1142 | 1142 | </label> |
| 1143 | 1143 | |
| 1144 | 1144 | <input name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" class="give-input" |
| 1145 | 1145 | type="text" |
| 1146 | - placeholder="<?php esc_attr_e( 'Username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1146 | + placeholder="<?php esc_attr_e('Username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1147 | 1147 | </div> |
| 1148 | 1148 | |
| 1149 | 1149 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" |
| 1150 | 1150 | class="form-row form-row-one-third form-row-responsive"> |
| 1151 | 1151 | <label for="give-user-pass-<?php echo $form_id; ?>"> |
| 1152 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
| 1153 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1152 | + <?php esc_html_e('Password', 'give'); ?> |
|
| 1153 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1154 | 1154 | <span class="give-required-indicator">*</span> |
| 1155 | 1155 | <?php } ?> |
| 1156 | 1156 | <span class="give-tooltip give-icon give-icon-question" |
| 1157 | - data-tooltip="<?php esc_attr_e( 'The password used to access your account.', 'give' ); ?>"></span> |
|
| 1157 | + data-tooltip="<?php esc_attr_e('The password used to access your account.', 'give'); ?>"></span> |
|
| 1158 | 1158 | </label> |
| 1159 | 1159 | |
| 1160 | 1160 | <input name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" class="give-input" |
| 1161 | - placeholder="<?php esc_attr_e( 'Password', 'give' ); ?>" |
|
| 1162 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1161 | + placeholder="<?php esc_attr_e('Password', 'give'); ?>" |
|
| 1162 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1163 | 1163 | </div> |
| 1164 | 1164 | |
| 1165 | 1165 | <div id="give-user-pass-confirm-wrap-<?php echo $form_id; ?>" |
| 1166 | 1166 | class="give-register-password form-row form-row-one-third form-row-responsive"> |
| 1167 | 1167 | <label for="give-user-pass-confirm-<?php echo $form_id; ?>"> |
| 1168 | - <?php esc_html_e( 'Confirm PW', 'give' ); ?> |
|
| 1169 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1168 | + <?php esc_html_e('Confirm PW', 'give'); ?> |
|
| 1169 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1170 | 1170 | <span class="give-required-indicator">*</span> |
| 1171 | 1171 | <?php } ?> |
| 1172 | 1172 | <span class="give-tooltip give-icon give-icon-question" |
| 1173 | - data-tooltip="<?php esc_attr_e( 'Please retype your password to confirm.', 'give' ); ?>"></span> |
|
| 1173 | + data-tooltip="<?php esc_attr_e('Please retype your password to confirm.', 'give'); ?>"></span> |
|
| 1174 | 1174 | </label> |
| 1175 | 1175 | |
| 1176 | 1176 | <input name="give_user_pass_confirm" id="give-user-pass-confirm-<?php echo $form_id; ?>" |
| 1177 | - class="give-input" placeholder="<?php esc_attr_e( 'Confirm password', 'give' ); ?>" |
|
| 1178 | - type="password"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1177 | + class="give-input" placeholder="<?php esc_attr_e('Confirm password', 'give'); ?>" |
|
| 1178 | + type="password"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1179 | 1179 | </div> |
| 1180 | 1180 | <?php |
| 1181 | 1181 | /** |
@@ -1185,7 +1185,7 @@ discard block |
||
| 1185 | 1185 | * |
| 1186 | 1186 | * @param int $form_id The form ID. |
| 1187 | 1187 | */ |
| 1188 | - do_action( 'give_register_account_fields_after', $form_id ); |
|
| 1188 | + do_action('give_register_account_fields_after', $form_id); |
|
| 1189 | 1189 | ?> |
| 1190 | 1190 | </fieldset> |
| 1191 | 1191 | |
@@ -1197,7 +1197,7 @@ discard block |
||
| 1197 | 1197 | * |
| 1198 | 1198 | * @param int $form_id The form ID. |
| 1199 | 1199 | */ |
| 1200 | - do_action( 'give_register_fields_after', $form_id ); |
|
| 1200 | + do_action('give_register_fields_after', $form_id); |
|
| 1201 | 1201 | ?> |
| 1202 | 1202 | |
| 1203 | 1203 | <input type="hidden" name="give-purchase-var" value="needs-to-register"/> |
@@ -1208,7 +1208,7 @@ discard block |
||
| 1208 | 1208 | * |
| 1209 | 1209 | * @since 1.7 |
| 1210 | 1210 | */ |
| 1211 | - do_action( 'give_donation_form_user_info', $form_id ); |
|
| 1211 | + do_action('give_donation_form_user_info', $form_id); |
|
| 1212 | 1212 | ?> |
| 1213 | 1213 | |
| 1214 | 1214 | </fieldset> |
@@ -1216,7 +1216,7 @@ discard block |
||
| 1216 | 1216 | echo ob_get_clean(); |
| 1217 | 1217 | } |
| 1218 | 1218 | |
| 1219 | -add_action( 'give_donation_form_register_fields', 'give_get_register_fields' ); |
|
| 1219 | +add_action('give_donation_form_register_fields', 'give_get_register_fields'); |
|
| 1220 | 1220 | |
| 1221 | 1221 | /** |
| 1222 | 1222 | * Gets the login fields for the login form on the checkout. This function hooks |
@@ -1229,27 +1229,27 @@ discard block |
||
| 1229 | 1229 | * |
| 1230 | 1230 | * @return string |
| 1231 | 1231 | */ |
| 1232 | -function give_get_login_fields( $form_id ) { |
|
| 1232 | +function give_get_login_fields($form_id) { |
|
| 1233 | 1233 | |
| 1234 | - $form_id = isset( $_POST['form_id'] ) ? $_POST['form_id'] : $form_id; |
|
| 1235 | - $show_register_form = give_show_login_register_option( $form_id ); |
|
| 1234 | + $form_id = isset($_POST['form_id']) ? $_POST['form_id'] : $form_id; |
|
| 1235 | + $show_register_form = give_show_login_register_option($form_id); |
|
| 1236 | 1236 | |
| 1237 | 1237 | ob_start(); |
| 1238 | 1238 | ?> |
| 1239 | 1239 | <fieldset id="give-login-fields-<?php echo $form_id; ?>"> |
| 1240 | - <legend><?php echo apply_filters( 'give_account_login_fieldset_heading', esc_html__( 'Login to Your Account', 'give' ) ); |
|
| 1241 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1242 | - echo ' <span class="sub-text">' . esc_html__( '(optional)', 'give' ) . '</span>'; |
|
| 1240 | + <legend><?php echo apply_filters('give_account_login_fieldset_heading', esc_html__('Login to Your Account', 'give')); |
|
| 1241 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1242 | + echo ' <span class="sub-text">'.esc_html__('(optional)', 'give').'</span>'; |
|
| 1243 | 1243 | } ?> |
| 1244 | 1244 | </legend> |
| 1245 | - <?php if ( $show_register_form == 'both' ) { ?> |
|
| 1245 | + <?php if ($show_register_form == 'both') { ?> |
|
| 1246 | 1246 | <p class="give-new-account-link"> |
| 1247 | - <?php esc_html_e( 'Need to create an account?', 'give' ); ?> |
|
| 1248 | - <a href="<?php echo remove_query_arg( 'login' ); ?>" class="give-checkout-register-cancel" |
|
| 1247 | + <?php esc_html_e('Need to create an account?', 'give'); ?> |
|
| 1248 | + <a href="<?php echo remove_query_arg('login'); ?>" class="give-checkout-register-cancel" |
|
| 1249 | 1249 | data-action="give_checkout_register"> |
| 1250 | - <?php esc_html_e( 'Register', 'give' ); |
|
| 1251 | - if ( ! give_logged_in_only( $form_id ) ) { |
|
| 1252 | - echo ' ' . esc_html__( 'or checkout as a guest »', 'give' ); |
|
| 1250 | + <?php esc_html_e('Register', 'give'); |
|
| 1251 | + if ( ! give_logged_in_only($form_id)) { |
|
| 1252 | + echo ' '.esc_html__('or checkout as a guest »', 'give'); |
|
| 1253 | 1253 | } ?> |
| 1254 | 1254 | </a> |
| 1255 | 1255 | </p> |
@@ -1265,49 +1265,49 @@ discard block |
||
| 1265 | 1265 | * |
| 1266 | 1266 | * @param int $form_id The form ID. |
| 1267 | 1267 | */ |
| 1268 | - do_action( 'give_checkout_login_fields_before', $form_id ); |
|
| 1268 | + do_action('give_checkout_login_fields_before', $form_id); |
|
| 1269 | 1269 | ?> |
| 1270 | 1270 | <div id="give-user-login-wrap-<?php echo $form_id; ?>" class="form-row form-row-first form-row-responsive"> |
| 1271 | 1271 | <label class="give-label" for="give-user-login-<?php echo $form_id; ?>"> |
| 1272 | - <?php esc_html_e( 'Username', 'give' ); ?> |
|
| 1273 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1272 | + <?php esc_html_e('Username', 'give'); ?> |
|
| 1273 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1274 | 1274 | <span class="give-required-indicator">*</span> |
| 1275 | 1275 | <?php } ?> |
| 1276 | 1276 | </label> |
| 1277 | 1277 | |
| 1278 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" type="text" |
|
| 1278 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" type="text" |
|
| 1279 | 1279 | name="give_user_login" id="give-user-login-<?php echo $form_id; ?>" value="" |
| 1280 | - placeholder="<?php esc_attr_e( 'Your username', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1280 | + placeholder="<?php esc_attr_e('Your username', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1281 | 1281 | </div> |
| 1282 | 1282 | |
| 1283 | 1283 | <div id="give-user-pass-wrap-<?php echo $form_id; ?>" |
| 1284 | 1284 | class="give_login_password form-row form-row-last form-row-responsive"> |
| 1285 | 1285 | <label class="give-label" for="give-user-pass-<?php echo $form_id; ?>"> |
| 1286 | - <?php esc_html_e( 'Password', 'give' ); ?> |
|
| 1287 | - <?php if ( give_logged_in_only( $form_id ) ) { ?> |
|
| 1286 | + <?php esc_html_e('Password', 'give'); ?> |
|
| 1287 | + <?php if (give_logged_in_only($form_id)) { ?> |
|
| 1288 | 1288 | <span class="give-required-indicator">*</span> |
| 1289 | 1289 | <?php } ?> |
| 1290 | 1290 | </label> |
| 1291 | - <input class="give-input<?php echo ( give_logged_in_only( $form_id ) ) ? ' required' : ''; ?>" |
|
| 1291 | + <input class="give-input<?php echo (give_logged_in_only($form_id)) ? ' required' : ''; ?>" |
|
| 1292 | 1292 | type="password" name="give_user_pass" id="give-user-pass-<?php echo $form_id; ?>" |
| 1293 | - placeholder="<?php esc_attr_e( 'Your password', 'give' ); ?>"<?php echo ( give_logged_in_only( $form_id ) ) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1293 | + placeholder="<?php esc_attr_e('Your password', 'give'); ?>"<?php echo (give_logged_in_only($form_id)) ? ' required aria-required="true" ' : ''; ?>/> |
|
| 1294 | 1294 | <input type="hidden" name="give-purchase-var" value="needs-to-login"/> |
| 1295 | 1295 | </div> |
| 1296 | 1296 | |
| 1297 | 1297 | <div id="give-forgot-password-wrap-<?php echo $form_id; ?>" class="give_login_forgot_password"> |
| 1298 | 1298 | <span class="give-forgot-password "> |
| 1299 | 1299 | <a href="<?php echo wp_lostpassword_url() ?>" |
| 1300 | - target="_blank"><?php esc_html_e( 'Reset Password', 'give' ) ?></a> |
|
| 1300 | + target="_blank"><?php esc_html_e('Reset Password', 'give') ?></a> |
|
| 1301 | 1301 | </span> |
| 1302 | 1302 | </div> |
| 1303 | 1303 | |
| 1304 | 1304 | <div id="give-user-login-submit-<?php echo $form_id; ?>" class="give-clearfix"> |
| 1305 | 1305 | <input type="submit" class="give-submit give-btn button" name="give_login_submit" |
| 1306 | - value="<?php esc_attr_e( 'Login', 'give' ); ?>"/> |
|
| 1307 | - <?php if ( $show_register_form !== 'login' ) { ?> |
|
| 1306 | + value="<?php esc_attr_e('Login', 'give'); ?>"/> |
|
| 1307 | + <?php if ($show_register_form !== 'login') { ?> |
|
| 1308 | 1308 | <input type="button" data-action="give_cancel_login" |
| 1309 | 1309 | class="give-cancel-login give-checkout-register-cancel give-btn button" name="give_login_cancel" |
| 1310 | - value="<?php esc_attr_e( 'Cancel', 'give' ); ?>"/> |
|
| 1310 | + value="<?php esc_attr_e('Cancel', 'give'); ?>"/> |
|
| 1311 | 1311 | <?php } ?> |
| 1312 | 1312 | <span class="give-loading-animation"></span> |
| 1313 | 1313 | </div> |
@@ -1319,14 +1319,14 @@ discard block |
||
| 1319 | 1319 | * |
| 1320 | 1320 | * @param int $form_id The form ID. |
| 1321 | 1321 | */ |
| 1322 | - do_action( 'give_checkout_login_fields_after', $form_id ); |
|
| 1322 | + do_action('give_checkout_login_fields_after', $form_id); |
|
| 1323 | 1323 | ?> |
| 1324 | 1324 | </fieldset><!--end #give-login-fields--> |
| 1325 | 1325 | <?php |
| 1326 | 1326 | echo ob_get_clean(); |
| 1327 | 1327 | } |
| 1328 | 1328 | |
| 1329 | -add_action( 'give_donation_form_login_fields', 'give_get_login_fields', 10, 1 ); |
|
| 1329 | +add_action('give_donation_form_login_fields', 'give_get_login_fields', 10, 1); |
|
| 1330 | 1330 | |
| 1331 | 1331 | /** |
| 1332 | 1332 | * Payment Mode Select. |
@@ -1342,9 +1342,9 @@ discard block |
||
| 1342 | 1342 | * |
| 1343 | 1343 | * @return void |
| 1344 | 1344 | */ |
| 1345 | -function give_payment_mode_select( $form_id ) { |
|
| 1345 | +function give_payment_mode_select($form_id) { |
|
| 1346 | 1346 | |
| 1347 | - $gateways = give_get_enabled_payment_gateways( $form_id ); |
|
| 1347 | + $gateways = give_get_enabled_payment_gateways($form_id); |
|
| 1348 | 1348 | |
| 1349 | 1349 | /** |
| 1350 | 1350 | * Fires while selecting payment gateways, before the fields. |
@@ -1353,10 +1353,10 @@ discard block |
||
| 1353 | 1353 | * |
| 1354 | 1354 | * @param int $form_id The form ID. |
| 1355 | 1355 | */ |
| 1356 | - do_action( 'give_payment_mode_top', $form_id ); |
|
| 1356 | + do_action('give_payment_mode_top', $form_id); |
|
| 1357 | 1357 | ?> |
| 1358 | 1358 | |
| 1359 | - <fieldset id="give-payment-mode-select" <?php if ( count( $gateways ) <= 1 ) { |
|
| 1359 | + <fieldset id="give-payment-mode-select" <?php if (count($gateways) <= 1) { |
|
| 1360 | 1360 | echo 'style="display: none;"'; |
| 1361 | 1361 | } ?>> |
| 1362 | 1362 | <?php |
@@ -1367,10 +1367,10 @@ discard block |
||
| 1367 | 1367 | * |
| 1368 | 1368 | * @param int $form_id The form ID. |
| 1369 | 1369 | */ |
| 1370 | - do_action( 'give_payment_mode_before_gateways_wrap' ); |
|
| 1370 | + do_action('give_payment_mode_before_gateways_wrap'); |
|
| 1371 | 1371 | ?> |
| 1372 | 1372 | <legend |
| 1373 | - class="give-payment-mode-label"><?php echo apply_filters( 'give_checkout_payment_method_text', esc_html__( 'Select Payment Method', 'give' ) ); ?> |
|
| 1373 | + class="give-payment-mode-label"><?php echo apply_filters('give_checkout_payment_method_text', esc_html__('Select Payment Method', 'give')); ?> |
|
| 1374 | 1374 | <span class="give-loading-text"><span |
| 1375 | 1375 | class="give-loading-animation"></span> |
| 1376 | 1376 | </span> |
@@ -1383,26 +1383,26 @@ discard block |
||
| 1383 | 1383 | * |
| 1384 | 1384 | * @since 1.7 |
| 1385 | 1385 | */ |
| 1386 | - do_action( 'give_payment_mode_before_gateways' ) |
|
| 1386 | + do_action('give_payment_mode_before_gateways') |
|
| 1387 | 1387 | ?> |
| 1388 | 1388 | <ul id="give-gateway-radio-list"> |
| 1389 | 1389 | <?php |
| 1390 | 1390 | /** |
| 1391 | 1391 | * Loop through the active payment gateways. |
| 1392 | 1392 | */ |
| 1393 | - $selected_gateway = give_get_chosen_gateway( $form_id ); |
|
| 1393 | + $selected_gateway = give_get_chosen_gateway($form_id); |
|
| 1394 | 1394 | |
| 1395 | - foreach ( $gateways as $gateway_id => $gateway ) : |
|
| 1395 | + foreach ($gateways as $gateway_id => $gateway) : |
|
| 1396 | 1396 | //Determine the default gateway. |
| 1397 | - $checked = checked( $gateway_id, $selected_gateway, false ); |
|
| 1397 | + $checked = checked($gateway_id, $selected_gateway, false); |
|
| 1398 | 1398 | $checked_class = $checked ? ' class="give-gateway-option-selected"' : ''; ?> |
| 1399 | 1399 | <li<?php echo $checked_class ?>> |
| 1400 | 1400 | <input type="radio" name="payment-mode" class="give-gateway" |
| 1401 | - id="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
| 1402 | - value="<?php echo esc_attr( $gateway_id ); ?>"<?php echo $checked; ?>> |
|
| 1403 | - <label for="give-gateway-<?php echo esc_attr( $gateway_id ) . '-' . $form_id; ?>" |
|
| 1401 | + id="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
| 1402 | + value="<?php echo esc_attr($gateway_id); ?>"<?php echo $checked; ?>> |
|
| 1403 | + <label for="give-gateway-<?php echo esc_attr($gateway_id).'-'.$form_id; ?>" |
|
| 1404 | 1404 | class="give-gateway-option" |
| 1405 | - id="give-gateway-option-<?php echo esc_attr( $gateway_id ); ?>"> <?php echo esc_html( $gateway['checkout_label'] ); ?></label> |
|
| 1405 | + id="give-gateway-option-<?php echo esc_attr($gateway_id); ?>"> <?php echo esc_html($gateway['checkout_label']); ?></label> |
|
| 1406 | 1406 | </li> |
| 1407 | 1407 | <?php |
| 1408 | 1408 | endforeach; |
@@ -1414,7 +1414,7 @@ discard block |
||
| 1414 | 1414 | * |
| 1415 | 1415 | * @since 1.7 |
| 1416 | 1416 | */ |
| 1417 | - do_action( 'give_payment_mode_after_gateways' ); |
|
| 1417 | + do_action('give_payment_mode_after_gateways'); |
|
| 1418 | 1418 | ?> |
| 1419 | 1419 | </div> |
| 1420 | 1420 | <?php |
@@ -1425,7 +1425,7 @@ discard block |
||
| 1425 | 1425 | * |
| 1426 | 1426 | * @param int $form_id The form ID. |
| 1427 | 1427 | */ |
| 1428 | - do_action( 'give_payment_mode_after_gateways_wrap' ); |
|
| 1428 | + do_action('give_payment_mode_after_gateways_wrap'); |
|
| 1429 | 1429 | ?> |
| 1430 | 1430 | </fieldset> |
| 1431 | 1431 | |
@@ -1437,7 +1437,7 @@ discard block |
||
| 1437 | 1437 | * |
| 1438 | 1438 | * @param int $form_id The form ID. |
| 1439 | 1439 | */ |
| 1440 | - do_action( 'give_payment_mode_bottom', $form_id ); |
|
| 1440 | + do_action('give_payment_mode_bottom', $form_id); |
|
| 1441 | 1441 | ?> |
| 1442 | 1442 | |
| 1443 | 1443 | <div id="give_purchase_form_wrap"> |
@@ -1448,7 +1448,7 @@ discard block |
||
| 1448 | 1448 | * |
| 1449 | 1449 | * @since 1.7 |
| 1450 | 1450 | */ |
| 1451 | - do_action( 'give_donation_form', $form_id ); |
|
| 1451 | + do_action('give_donation_form', $form_id); |
|
| 1452 | 1452 | ?> |
| 1453 | 1453 | |
| 1454 | 1454 | </div> |
@@ -1459,10 +1459,10 @@ discard block |
||
| 1459 | 1459 | * |
| 1460 | 1460 | * @since 1.7 |
| 1461 | 1461 | */ |
| 1462 | - do_action( 'give_donation_form_wrap_bottom', $form_id ); |
|
| 1462 | + do_action('give_donation_form_wrap_bottom', $form_id); |
|
| 1463 | 1463 | } |
| 1464 | 1464 | |
| 1465 | -add_action( 'give_payment_mode_select', 'give_payment_mode_select' ); |
|
| 1465 | +add_action('give_payment_mode_select', 'give_payment_mode_select'); |
|
| 1466 | 1466 | |
| 1467 | 1467 | /** |
| 1468 | 1468 | * Renders the Checkout Agree to Terms, this displays a checkbox for users to |
@@ -1475,31 +1475,31 @@ discard block |
||
| 1475 | 1475 | * |
| 1476 | 1476 | * @return bool |
| 1477 | 1477 | */ |
| 1478 | -function give_terms_agreement( $form_id ) { |
|
| 1479 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
| 1478 | +function give_terms_agreement($form_id) { |
|
| 1479 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
| 1480 | 1480 | |
| 1481 | 1481 | // Bailout if per form and global term and conditions is not setup. |
| 1482 | 1482 | if ( |
| 1483 | - give_is_setting_enabled( $form_option, 'global' ) |
|
| 1484 | - && give_is_setting_enabled( give_get_option( 'terms' ) ) |
|
| 1483 | + give_is_setting_enabled($form_option, 'global') |
|
| 1484 | + && give_is_setting_enabled(give_get_option('terms')) |
|
| 1485 | 1485 | ) { |
| 1486 | - $label = give_get_option( 'agree_to_terms_label', esc_html__( 'Agree to Terms?', 'give' ) ); |
|
| 1487 | - $terms = $terms = give_get_option( 'agreement_text', '' ); |
|
| 1488 | - $edit_term_url = admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions' ); |
|
| 1486 | + $label = give_get_option('agree_to_terms_label', esc_html__('Agree to Terms?', 'give')); |
|
| 1487 | + $terms = $terms = give_get_option('agreement_text', ''); |
|
| 1488 | + $edit_term_url = admin_url('edit.php?post_type=give_forms&page=give-settings&tab=display§ion=term-and-conditions'); |
|
| 1489 | 1489 | |
| 1490 | - } elseif ( give_is_setting_enabled( $form_option ) ) { |
|
| 1491 | - $label = ( $label = get_post_meta( $form_id, '_give_agree_label', true ) ) ? stripslashes( $label ) : esc_html__( 'Agree to Terms?', 'give' ); |
|
| 1492 | - $terms = get_post_meta( $form_id, '_give_agree_text', true ); |
|
| 1493 | - $edit_term_url = admin_url( 'post.php?post=' . $form_id . '&action=edit#form_terms_options' ); |
|
| 1490 | + } elseif (give_is_setting_enabled($form_option)) { |
|
| 1491 | + $label = ($label = get_post_meta($form_id, '_give_agree_label', true)) ? stripslashes($label) : esc_html__('Agree to Terms?', 'give'); |
|
| 1492 | + $terms = get_post_meta($form_id, '_give_agree_text', true); |
|
| 1493 | + $edit_term_url = admin_url('post.php?post='.$form_id.'&action=edit#form_terms_options'); |
|
| 1494 | 1494 | |
| 1495 | 1495 | } else { |
| 1496 | 1496 | return false; |
| 1497 | 1497 | } |
| 1498 | 1498 | |
| 1499 | 1499 | // Bailout: Check if term and conditions text is empty or not. |
| 1500 | - if ( empty( $terms ) ) { |
|
| 1501 | - if ( is_user_logged_in() && current_user_can( 'edit_give_forms' ) ) { |
|
| 1502 | - echo sprintf( __( 'Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give' ), $edit_term_url ); |
|
| 1500 | + if (empty($terms)) { |
|
| 1501 | + if (is_user_logged_in() && current_user_can('edit_give_forms')) { |
|
| 1502 | + echo sprintf(__('Please enter valid terms and conditions in <a href="%s">this form\'s settings</a>.', 'give'), $edit_term_url); |
|
| 1503 | 1503 | } |
| 1504 | 1504 | |
| 1505 | 1505 | return false; |
@@ -1507,7 +1507,7 @@ discard block |
||
| 1507 | 1507 | |
| 1508 | 1508 | ?> |
| 1509 | 1509 | <fieldset id="give_terms_agreement"> |
| 1510 | - <legend><?php echo apply_filters( 'give_terms_agreement_text', esc_html__( 'Terms', 'give' ) ); ?></legend> |
|
| 1510 | + <legend><?php echo apply_filters('give_terms_agreement_text', esc_html__('Terms', 'give')); ?></legend> |
|
| 1511 | 1511 | <div id="give_terms" class="give_terms-<?php echo $form_id; ?>" style="display:none;"> |
| 1512 | 1512 | <?php |
| 1513 | 1513 | /** |
@@ -1515,22 +1515,22 @@ discard block |
||
| 1515 | 1515 | * |
| 1516 | 1516 | * @since 1.0 |
| 1517 | 1517 | */ |
| 1518 | - do_action( 'give_before_terms' ); |
|
| 1518 | + do_action('give_before_terms'); |
|
| 1519 | 1519 | |
| 1520 | - echo wpautop( stripslashes( $terms ) ); |
|
| 1520 | + echo wpautop(stripslashes($terms)); |
|
| 1521 | 1521 | /** |
| 1522 | 1522 | * Fires while rendering terms of agreement, after the fields. |
| 1523 | 1523 | * |
| 1524 | 1524 | * @since 1.0 |
| 1525 | 1525 | */ |
| 1526 | - do_action( 'give_after_terms' ); |
|
| 1526 | + do_action('give_after_terms'); |
|
| 1527 | 1527 | ?> |
| 1528 | 1528 | </div> |
| 1529 | 1529 | <div id="give_show_terms"> |
| 1530 | 1530 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
| 1531 | - aria-controls="give_terms"><?php esc_html_e( 'Show Terms', 'give' ); ?></a> |
|
| 1531 | + aria-controls="give_terms"><?php esc_html_e('Show Terms', 'give'); ?></a> |
|
| 1532 | 1532 | <a href="#" class="give_terms_links give_terms_links-<?php echo $form_id; ?>" role="button" |
| 1533 | - aria-controls="give_terms" style="display:none;"><?php esc_html_e( 'Hide Terms', 'give' ); ?></a> |
|
| 1533 | + aria-controls="give_terms" style="display:none;"><?php esc_html_e('Hide Terms', 'give'); ?></a> |
|
| 1534 | 1534 | </div> |
| 1535 | 1535 | |
| 1536 | 1536 | <input name="give_agree_to_terms" class="required" type="checkbox" |
@@ -1541,7 +1541,7 @@ discard block |
||
| 1541 | 1541 | <?php |
| 1542 | 1542 | } |
| 1543 | 1543 | |
| 1544 | -add_action( 'give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1 ); |
|
| 1544 | +add_action('give_donation_form_after_cc_form', 'give_terms_agreement', 8888, 1); |
|
| 1545 | 1545 | |
| 1546 | 1546 | /** |
| 1547 | 1547 | * Checkout Final Total. |
@@ -1554,29 +1554,29 @@ discard block |
||
| 1554 | 1554 | * |
| 1555 | 1555 | * @return void |
| 1556 | 1556 | */ |
| 1557 | -function give_checkout_final_total( $form_id ) { |
|
| 1557 | +function give_checkout_final_total($form_id) { |
|
| 1558 | 1558 | |
| 1559 | - if ( isset( $_POST['give_total'] ) ) { |
|
| 1560 | - $total = apply_filters( 'give_donation_total', $_POST['give_total'] ); |
|
| 1559 | + if (isset($_POST['give_total'])) { |
|
| 1560 | + $total = apply_filters('give_donation_total', $_POST['give_total']); |
|
| 1561 | 1561 | } else { |
| 1562 | 1562 | //default total. |
| 1563 | - $total = give_get_default_form_amount( $form_id ); |
|
| 1563 | + $total = give_get_default_form_amount($form_id); |
|
| 1564 | 1564 | } |
| 1565 | 1565 | //Only proceed if give_total available. |
| 1566 | - if ( empty( $total ) ) { |
|
| 1566 | + if (empty($total)) { |
|
| 1567 | 1567 | return; |
| 1568 | 1568 | } |
| 1569 | 1569 | ?> |
| 1570 | 1570 | <p id="give-final-total-wrap" class="form-wrap "> |
| 1571 | 1571 | <span |
| 1572 | - class="give-donation-total-label"><?php echo apply_filters( 'give_donation_total_label', esc_html__( 'Donation Total:', 'give' ) ); ?></span> |
|
| 1572 | + class="give-donation-total-label"><?php echo apply_filters('give_donation_total_label', esc_html__('Donation Total:', 'give')); ?></span> |
|
| 1573 | 1573 | <span class="give-final-total-amount" |
| 1574 | - data-total="<?php echo give_format_amount( $total ); ?>"><?php echo give_currency_filter( give_format_amount( $total ) ); ?></span> |
|
| 1574 | + data-total="<?php echo give_format_amount($total); ?>"><?php echo give_currency_filter(give_format_amount($total)); ?></span> |
|
| 1575 | 1575 | </p> |
| 1576 | 1576 | <?php |
| 1577 | 1577 | } |
| 1578 | 1578 | |
| 1579 | -add_action( 'give_donation_form_before_submit', 'give_checkout_final_total', 999 ); |
|
| 1579 | +add_action('give_donation_form_before_submit', 'give_checkout_final_total', 999); |
|
| 1580 | 1580 | |
| 1581 | 1581 | /** |
| 1582 | 1582 | * Renders the Checkout Submit section. |
@@ -1587,7 +1587,7 @@ discard block |
||
| 1587 | 1587 | * |
| 1588 | 1588 | * @return void |
| 1589 | 1589 | */ |
| 1590 | -function give_checkout_submit( $form_id ) { |
|
| 1590 | +function give_checkout_submit($form_id) { |
|
| 1591 | 1591 | ?> |
| 1592 | 1592 | <fieldset id="give_purchase_submit"> |
| 1593 | 1593 | <?php |
@@ -1596,24 +1596,24 @@ discard block |
||
| 1596 | 1596 | * |
| 1597 | 1597 | * @since 1.7 |
| 1598 | 1598 | */ |
| 1599 | - do_action( 'give_donation_form_before_submit', $form_id ); |
|
| 1599 | + do_action('give_donation_form_before_submit', $form_id); |
|
| 1600 | 1600 | |
| 1601 | - give_checkout_hidden_fields( $form_id ); |
|
| 1601 | + give_checkout_hidden_fields($form_id); |
|
| 1602 | 1602 | |
| 1603 | - echo give_checkout_button_purchase( $form_id ); |
|
| 1603 | + echo give_checkout_button_purchase($form_id); |
|
| 1604 | 1604 | |
| 1605 | 1605 | /** |
| 1606 | 1606 | * Fire after donation form submit. |
| 1607 | 1607 | * |
| 1608 | 1608 | * @since 1.7 |
| 1609 | 1609 | */ |
| 1610 | - do_action( 'give_donation_form_after_submit', $form_id ); |
|
| 1610 | + do_action('give_donation_form_after_submit', $form_id); |
|
| 1611 | 1611 | ?> |
| 1612 | 1612 | </fieldset> |
| 1613 | 1613 | <?php |
| 1614 | 1614 | } |
| 1615 | 1615 | |
| 1616 | -add_action( 'give_donation_form_after_cc_form', 'give_checkout_submit', 9999 ); |
|
| 1616 | +add_action('give_donation_form_after_cc_form', 'give_checkout_submit', 9999); |
|
| 1617 | 1617 | |
| 1618 | 1618 | /** |
| 1619 | 1619 | * Give Checkout Button. |
@@ -1626,10 +1626,10 @@ discard block |
||
| 1626 | 1626 | * |
| 1627 | 1627 | * @return string |
| 1628 | 1628 | */ |
| 1629 | -function give_checkout_button_purchase( $form_id ) { |
|
| 1629 | +function give_checkout_button_purchase($form_id) { |
|
| 1630 | 1630 | |
| 1631 | - $display_label_field = get_post_meta( $form_id, '_give_checkout_label', true ); |
|
| 1632 | - $display_label = ( ! empty( $display_label_field ) ? $display_label_field : esc_html__( 'Donate Now', 'give' ) ); |
|
| 1631 | + $display_label_field = get_post_meta($form_id, '_give_checkout_label', true); |
|
| 1632 | + $display_label = ( ! empty($display_label_field) ? $display_label_field : esc_html__('Donate Now', 'give')); |
|
| 1633 | 1633 | ob_start(); ?> |
| 1634 | 1634 | <div class="give-submit-button-wrap give-clearfix"> |
| 1635 | 1635 | <input type="submit" class="give-submit give-btn" id="give-purchase-button" name="give-purchase" |
@@ -1637,7 +1637,7 @@ discard block |
||
| 1637 | 1637 | <span class="give-loading-animation"></span> |
| 1638 | 1638 | </div> |
| 1639 | 1639 | <?php |
| 1640 | - return apply_filters( 'give_checkout_button_purchase', ob_get_clean(), $form_id ); |
|
| 1640 | + return apply_filters('give_checkout_button_purchase', ob_get_clean(), $form_id); |
|
| 1641 | 1641 | } |
| 1642 | 1642 | |
| 1643 | 1643 | /** |
@@ -1651,18 +1651,18 @@ discard block |
||
| 1651 | 1651 | * |
| 1652 | 1652 | * @return void |
| 1653 | 1653 | */ |
| 1654 | -function give_agree_to_terms_js( $form_id ) { |
|
| 1654 | +function give_agree_to_terms_js($form_id) { |
|
| 1655 | 1655 | |
| 1656 | - $form_option = get_post_meta( $form_id, '_give_terms_option', true ); |
|
| 1656 | + $form_option = get_post_meta($form_id, '_give_terms_option', true); |
|
| 1657 | 1657 | |
| 1658 | - if ( give_is_setting_enabled( $form_option, array( 'enabled', 'global' ) ) ) { |
|
| 1658 | + if (give_is_setting_enabled($form_option, array('enabled', 'global'))) { |
|
| 1659 | 1659 | ?> |
| 1660 | 1660 | <script type="text/javascript"> |
| 1661 | 1661 | jQuery(document).ready(function ($) { |
| 1662 | - $('body').on('click', '.give_terms_links-<?php echo $form_id;?>', function (e) { |
|
| 1662 | + $('body').on('click', '.give_terms_links-<?php echo $form_id; ?>', function (e) { |
|
| 1663 | 1663 | e.preventDefault(); |
| 1664 | - $('.give_terms-<?php echo $form_id;?>').slideToggle(); |
|
| 1665 | - $('.give_terms_links-<?php echo $form_id;?>').toggle(); |
|
| 1664 | + $('.give_terms-<?php echo $form_id; ?>').slideToggle(); |
|
| 1665 | + $('.give_terms_links-<?php echo $form_id; ?>').toggle(); |
|
| 1666 | 1666 | return false; |
| 1667 | 1667 | }); |
| 1668 | 1668 | }); |
@@ -1671,7 +1671,7 @@ discard block |
||
| 1671 | 1671 | } |
| 1672 | 1672 | } |
| 1673 | 1673 | |
| 1674 | -add_action( 'give_checkout_form_top', 'give_agree_to_terms_js', 10, 2 ); |
|
| 1674 | +add_action('give_checkout_form_top', 'give_agree_to_terms_js', 10, 2); |
|
| 1675 | 1675 | |
| 1676 | 1676 | /** |
| 1677 | 1677 | * Show Give Goals. |
@@ -1685,17 +1685,17 @@ discard block |
||
| 1685 | 1685 | * |
| 1686 | 1686 | * @return mixed |
| 1687 | 1687 | */ |
| 1688 | -function give_show_goal_progress( $form_id, $args ) { |
|
| 1688 | +function give_show_goal_progress($form_id, $args) { |
|
| 1689 | 1689 | |
| 1690 | 1690 | ob_start(); |
| 1691 | - give_get_template( 'shortcode-goal', array( 'form_id' => $form_id, 'args' => $args ) ); |
|
| 1691 | + give_get_template('shortcode-goal', array('form_id' => $form_id, 'args' => $args)); |
|
| 1692 | 1692 | |
| 1693 | - echo apply_filters( 'give_goal_output', ob_get_clean() ); |
|
| 1693 | + echo apply_filters('give_goal_output', ob_get_clean()); |
|
| 1694 | 1694 | |
| 1695 | 1695 | return true; |
| 1696 | 1696 | } |
| 1697 | 1697 | |
| 1698 | -add_action( 'give_pre_form', 'give_show_goal_progress', 10, 2 ); |
|
| 1698 | +add_action('give_pre_form', 'give_show_goal_progress', 10, 2); |
|
| 1699 | 1699 | |
| 1700 | 1700 | |
| 1701 | 1701 | /** |
@@ -1708,10 +1708,10 @@ discard block |
||
| 1708 | 1708 | * |
| 1709 | 1709 | * @return mixed|string |
| 1710 | 1710 | */ |
| 1711 | -function give_get_form_content_placement( $form_id, $args ) { |
|
| 1711 | +function give_get_form_content_placement($form_id, $args) { |
|
| 1712 | 1712 | $show_content = ''; |
| 1713 | 1713 | |
| 1714 | - if ( isset( $args['show_content'] ) && ! empty( $args['show_content'] ) ) { |
|
| 1714 | + if (isset($args['show_content']) && ! empty($args['show_content'])) { |
|
| 1715 | 1715 | // Content positions. |
| 1716 | 1716 | $content_placement = array( |
| 1717 | 1717 | 'above' => 'give_pre_form', |
@@ -1719,18 +1719,18 @@ discard block |
||
| 1719 | 1719 | ); |
| 1720 | 1720 | |
| 1721 | 1721 | // Check if content position already decoded. |
| 1722 | - if ( in_array( $args['show_content'], $content_placement ) ) { |
|
| 1722 | + if (in_array($args['show_content'], $content_placement)) { |
|
| 1723 | 1723 | return $args['show_content']; |
| 1724 | 1724 | } |
| 1725 | 1725 | |
| 1726 | - $show_content = ( 'none' !== $args['show_content'] ? $content_placement[ $args['show_content'] ] : '' ); |
|
| 1726 | + $show_content = ('none' !== $args['show_content'] ? $content_placement[$args['show_content']] : ''); |
|
| 1727 | 1727 | |
| 1728 | - } elseif ( give_is_setting_enabled( get_post_meta( $form_id, '_give_display_content', true ) ) ) { |
|
| 1729 | - $show_content = get_post_meta( $form_id, '_give_content_placement', true ); |
|
| 1728 | + } elseif (give_is_setting_enabled(get_post_meta($form_id, '_give_display_content', true))) { |
|
| 1729 | + $show_content = get_post_meta($form_id, '_give_content_placement', true); |
|
| 1730 | 1730 | |
| 1731 | - } elseif ( 'none' !== get_post_meta( $form_id, '_give_content_option', true ) ) { |
|
| 1731 | + } elseif ('none' !== get_post_meta($form_id, '_give_content_option', true)) { |
|
| 1732 | 1732 | // Backward compatibility for _give_content_option for v18. |
| 1733 | - $show_content = get_post_meta( $form_id, '_give_content_option', true ); |
|
| 1733 | + $show_content = get_post_meta($form_id, '_give_content_option', true); |
|
| 1734 | 1734 | } |
| 1735 | 1735 | |
| 1736 | 1736 | return $show_content; |
@@ -1746,20 +1746,20 @@ discard block |
||
| 1746 | 1746 | * |
| 1747 | 1747 | * @return void|bool |
| 1748 | 1748 | */ |
| 1749 | -function give_form_content( $form_id, $args ) { |
|
| 1749 | +function give_form_content($form_id, $args) { |
|
| 1750 | 1750 | |
| 1751 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
| 1751 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
| 1752 | 1752 | |
| 1753 | 1753 | // Bailout. |
| 1754 | - if ( empty( $show_content ) ) { |
|
| 1754 | + if (empty($show_content)) { |
|
| 1755 | 1755 | return false; |
| 1756 | 1756 | } |
| 1757 | 1757 | |
| 1758 | 1758 | // Add action according to value. |
| 1759 | - add_action( $show_content, 'give_form_display_content', 10, 2 ); |
|
| 1759 | + add_action($show_content, 'give_form_display_content', 10, 2); |
|
| 1760 | 1760 | } |
| 1761 | 1761 | |
| 1762 | -add_action( 'give_pre_form_output', 'give_form_content', 10, 2 ); |
|
| 1762 | +add_action('give_pre_form_output', 'give_form_content', 10, 2); |
|
| 1763 | 1763 | |
| 1764 | 1764 | /** |
| 1765 | 1765 | * Renders Post Form Content. |
@@ -1773,22 +1773,22 @@ discard block |
||
| 1773 | 1773 | * |
| 1774 | 1774 | * @return void |
| 1775 | 1775 | */ |
| 1776 | -function give_form_display_content( $form_id, $args ) { |
|
| 1776 | +function give_form_display_content($form_id, $args) { |
|
| 1777 | 1777 | |
| 1778 | - $content = wpautop( get_post_meta( $form_id, '_give_form_content', true ) ); |
|
| 1779 | - $show_content = give_get_form_content_placement( $form_id, $args ); |
|
| 1778 | + $content = wpautop(get_post_meta($form_id, '_give_form_content', true)); |
|
| 1779 | + $show_content = give_get_form_content_placement($form_id, $args); |
|
| 1780 | 1780 | |
| 1781 | - if ( give_is_setting_enabled( give_get_option( 'the_content_filter' ) ) ) { |
|
| 1782 | - $content = apply_filters( 'the_content', $content ); |
|
| 1781 | + if (give_is_setting_enabled(give_get_option('the_content_filter'))) { |
|
| 1782 | + $content = apply_filters('the_content', $content); |
|
| 1783 | 1783 | } |
| 1784 | 1784 | |
| 1785 | - $output = '<div id="give-form-content-' . $form_id . '" class="give-form-content-wrap ' . $show_content . '-content">' . $content . '</div>'; |
|
| 1785 | + $output = '<div id="give-form-content-'.$form_id.'" class="give-form-content-wrap '.$show_content.'-content">'.$content.'</div>'; |
|
| 1786 | 1786 | |
| 1787 | - echo apply_filters( 'give_form_content_output', $output ); |
|
| 1787 | + echo apply_filters('give_form_content_output', $output); |
|
| 1788 | 1788 | |
| 1789 | 1789 | //remove action to prevent content output on addition forms on page. |
| 1790 | 1790 | //@see: https://github.com/WordImpress/Give/issues/634. |
| 1791 | - remove_action( $show_content, 'give_form_display_content' ); |
|
| 1791 | + remove_action($show_content, 'give_form_display_content'); |
|
| 1792 | 1792 | } |
| 1793 | 1793 | |
| 1794 | 1794 | /** |
@@ -1800,7 +1800,7 @@ discard block |
||
| 1800 | 1800 | * |
| 1801 | 1801 | * @return void |
| 1802 | 1802 | */ |
| 1803 | -function give_checkout_hidden_fields( $form_id ) { |
|
| 1803 | +function give_checkout_hidden_fields($form_id) { |
|
| 1804 | 1804 | |
| 1805 | 1805 | /** |
| 1806 | 1806 | * Fires while rendering hidden checkout fields, before the fields. |
@@ -1809,13 +1809,13 @@ discard block |
||
| 1809 | 1809 | * |
| 1810 | 1810 | * @param int $form_id The form ID. |
| 1811 | 1811 | */ |
| 1812 | - do_action( 'give_hidden_fields_before', $form_id ); |
|
| 1812 | + do_action('give_hidden_fields_before', $form_id); |
|
| 1813 | 1813 | |
| 1814 | - if ( is_user_logged_in() ) { ?> |
|
| 1814 | + if (is_user_logged_in()) { ?> |
|
| 1815 | 1815 | <input type="hidden" name="give-user-id" value="<?php echo get_current_user_id(); ?>"/> |
| 1816 | 1816 | <?php } ?> |
| 1817 | 1817 | <input type="hidden" name="give_action" value="purchase"/> |
| 1818 | - <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway( $form_id ); ?>"/> |
|
| 1818 | + <input type="hidden" name="give-gateway" value="<?php echo give_get_chosen_gateway($form_id); ?>"/> |
|
| 1819 | 1819 | <?php |
| 1820 | 1820 | /** |
| 1821 | 1821 | * Fires while rendering hidden checkout fields, after the fields. |
@@ -1824,7 +1824,7 @@ discard block |
||
| 1824 | 1824 | * |
| 1825 | 1825 | * @param int $form_id The form ID. |
| 1826 | 1826 | */ |
| 1827 | - do_action( 'give_hidden_fields_after', $form_id ); |
|
| 1827 | + do_action('give_hidden_fields_after', $form_id); |
|
| 1828 | 1828 | |
| 1829 | 1829 | } |
| 1830 | 1830 | |
@@ -1839,20 +1839,20 @@ discard block |
||
| 1839 | 1839 | * |
| 1840 | 1840 | * @return string $content Filtered content. |
| 1841 | 1841 | */ |
| 1842 | -function give_filter_success_page_content( $content ) { |
|
| 1842 | +function give_filter_success_page_content($content) { |
|
| 1843 | 1843 | |
| 1844 | 1844 | $give_options = give_get_settings(); |
| 1845 | 1845 | |
| 1846 | - if ( isset( $give_options['success_page'] ) && isset( $_GET['payment-confirmation'] ) && is_page( $give_options['success_page'] ) ) { |
|
| 1847 | - if ( has_filter( 'give_payment_confirm_' . $_GET['payment-confirmation'] ) ) { |
|
| 1848 | - $content = apply_filters( 'give_payment_confirm_' . $_GET['payment-confirmation'], $content ); |
|
| 1846 | + if (isset($give_options['success_page']) && isset($_GET['payment-confirmation']) && is_page($give_options['success_page'])) { |
|
| 1847 | + if (has_filter('give_payment_confirm_'.$_GET['payment-confirmation'])) { |
|
| 1848 | + $content = apply_filters('give_payment_confirm_'.$_GET['payment-confirmation'], $content); |
|
| 1849 | 1849 | } |
| 1850 | 1850 | } |
| 1851 | 1851 | |
| 1852 | 1852 | return $content; |
| 1853 | 1853 | } |
| 1854 | 1854 | |
| 1855 | -add_filter( 'the_content', 'give_filter_success_page_content' ); |
|
| 1855 | +add_filter('the_content', 'give_filter_success_page_content'); |
|
| 1856 | 1856 | |
| 1857 | 1857 | /** |
| 1858 | 1858 | * Test Mode Frontend Warning. |
@@ -1863,12 +1863,12 @@ discard block |
||
| 1863 | 1863 | */ |
| 1864 | 1864 | function give_test_mode_frontend_warning() { |
| 1865 | 1865 | |
| 1866 | - if ( give_is_test_mode() ) { |
|
| 1867 | - echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>' . esc_html__( 'Notice:', 'give' ) . '</strong> ' . esc_html__( 'Test mode is enabled. While in test mode no live donations are processed.', 'give' ) . '</p></div>'; |
|
| 1866 | + if (give_is_test_mode()) { |
|
| 1867 | + echo '<div class="give_error give_warning" id="give_error_test_mode"><p><strong>'.esc_html__('Notice:', 'give').'</strong> '.esc_html__('Test mode is enabled. While in test mode no live donations are processed.', 'give').'</p></div>'; |
|
| 1868 | 1868 | } |
| 1869 | 1869 | } |
| 1870 | 1870 | |
| 1871 | -add_action( 'give_pre_form', 'give_test_mode_frontend_warning', 10 ); |
|
| 1871 | +add_action('give_pre_form', 'give_test_mode_frontend_warning', 10); |
|
| 1872 | 1872 | |
| 1873 | 1873 | /** |
| 1874 | 1874 | * Members-only Form. |
@@ -1882,21 +1882,21 @@ discard block |
||
| 1882 | 1882 | * |
| 1883 | 1883 | * @return string |
| 1884 | 1884 | */ |
| 1885 | -function give_members_only_form( $final_output, $args ) { |
|
| 1885 | +function give_members_only_form($final_output, $args) { |
|
| 1886 | 1886 | |
| 1887 | - $form_id = isset( $args['form_id'] ) ? $args['form_id'] : 0; |
|
| 1887 | + $form_id = isset($args['form_id']) ? $args['form_id'] : 0; |
|
| 1888 | 1888 | |
| 1889 | 1889 | //Sanity Check: Must have form_id & not be logged in. |
| 1890 | - if ( empty( $form_id ) || is_user_logged_in() ) { |
|
| 1890 | + if (empty($form_id) || is_user_logged_in()) { |
|
| 1891 | 1891 | return $final_output; |
| 1892 | 1892 | } |
| 1893 | 1893 | |
| 1894 | 1894 | //Logged in only and Register / Login set to none. |
| 1895 | - if ( give_logged_in_only( $form_id ) && give_show_login_register_option( $form_id ) == 'none' ) { |
|
| 1895 | + if (give_logged_in_only($form_id) && give_show_login_register_option($form_id) == 'none') { |
|
| 1896 | 1896 | |
| 1897 | - $final_output = give_output_error( esc_html__( 'Please log in in order to complete your donation.', 'give' ), false ); |
|
| 1897 | + $final_output = give_output_error(esc_html__('Please log in in order to complete your donation.', 'give'), false); |
|
| 1898 | 1898 | |
| 1899 | - return apply_filters( 'give_members_only_output', $final_output, $form_id ); |
|
| 1899 | + return apply_filters('give_members_only_output', $final_output, $form_id); |
|
| 1900 | 1900 | |
| 1901 | 1901 | } |
| 1902 | 1902 | |
@@ -1904,4 +1904,4 @@ discard block |
||
| 1904 | 1904 | |
| 1905 | 1905 | } |
| 1906 | 1906 | |
| 1907 | -add_filter( 'give_donate_form', 'give_members_only_form', 10, 2 ); |
|
| 1907 | +add_filter('give_donate_form', 'give_members_only_form', 10, 2); |
|
@@ -46,21 +46,21 @@ discard block |
||
| 46 | 46 | */ |
| 47 | 47 | function __construct() { |
| 48 | 48 | $this->metabox_id = 'give-metabox-form-data'; |
| 49 | - $this->metabox_label = esc_html__( 'Donation Form Options', 'give' ); |
|
| 49 | + $this->metabox_label = esc_html__('Donation Form Options', 'give'); |
|
| 50 | 50 | |
| 51 | 51 | // Setup. |
| 52 | - add_action( 'admin_init', array( $this, 'setup' ) ); |
|
| 52 | + add_action('admin_init', array($this, 'setup')); |
|
| 53 | 53 | |
| 54 | 54 | // Add metabox. |
| 55 | - add_action( 'add_meta_boxes', array( $this, 'add_meta_box' ), 30 ); |
|
| 55 | + add_action('add_meta_boxes', array($this, 'add_meta_box'), 30); |
|
| 56 | 56 | |
| 57 | 57 | // Save form meta. |
| 58 | - add_action( 'save_post_give_forms', array( $this, 'save' ), 10, 2 ); |
|
| 58 | + add_action('save_post_give_forms', array($this, 'save'), 10, 2); |
|
| 59 | 59 | |
| 60 | 60 | // cmb2 old setting loaders. |
| 61 | 61 | // add_filter( 'give_metabox_form_data_settings', array( $this, 'cmb2_metabox_settings' ) ); |
| 62 | 62 | // Add offline donations options. |
| 63 | - add_filter( 'give_metabox_form_data_settings', array( $this, 'add_offline_donations_setting_tab' ), 0, 1 ); |
|
| 63 | + add_filter('give_metabox_form_data_settings', array($this, 'add_offline_donations_setting_tab'), 0, 1); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
@@ -83,18 +83,18 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | function get_settings() { |
| 85 | 85 | $post_id = give_get_admin_post_id(); |
| 86 | - $price = give_get_form_price( $post_id ); |
|
| 87 | - $custom_amount_minimum = give_get_form_minimum_price( $post_id ); |
|
| 88 | - $goal = give_get_form_goal( $post_id ); |
|
| 86 | + $price = give_get_form_price($post_id); |
|
| 87 | + $custom_amount_minimum = give_get_form_minimum_price($post_id); |
|
| 88 | + $goal = give_get_form_goal($post_id); |
|
| 89 | 89 | |
| 90 | 90 | // No empty prices - min. 1.00 for new forms |
| 91 | - if ( empty( $price ) && is_null( $post_id ) ) { |
|
| 92 | - $price = esc_attr( give_format_decimal( '1.00' ) ); |
|
| 91 | + if (empty($price) && is_null($post_id)) { |
|
| 92 | + $price = esc_attr(give_format_decimal('1.00')); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // Min. $1.00 for new forms |
| 96 | - if ( empty( $custom_amount_minimum ) ) { |
|
| 97 | - $custom_amount_minimum = esc_attr( give_format_decimal( '1.00' ) ); |
|
| 96 | + if (empty($custom_amount_minimum)) { |
|
| 97 | + $custom_amount_minimum = esc_attr(give_format_decimal('1.00')); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // Start with an underscore to hide fields from custom fields list |
@@ -104,215 +104,215 @@ discard block |
||
| 104 | 104 | /** |
| 105 | 105 | * Repeatable Field Groups |
| 106 | 106 | */ |
| 107 | - 'form_field_options' => apply_filters( 'give_forms_field_options', array( |
|
| 107 | + 'form_field_options' => apply_filters('give_forms_field_options', array( |
|
| 108 | 108 | 'id' => 'form_field_options', |
| 109 | - 'title' => esc_html__( 'Donation Options', 'give' ), |
|
| 109 | + 'title' => esc_html__('Donation Options', 'give'), |
|
| 110 | 110 | 'icon-html' => '<span class="give-icon give-icon-heart"></span>', |
| 111 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
| 111 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
| 112 | 112 | // Donation Option |
| 113 | 113 | array( |
| 114 | - 'name' => esc_html__( 'Donation Option', 'give' ), |
|
| 115 | - 'description' => esc_html__( 'Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give' ), |
|
| 116 | - 'id' => $prefix . 'price_option', |
|
| 114 | + 'name' => esc_html__('Donation Option', 'give'), |
|
| 115 | + 'description' => esc_html__('Do you want this form to have one set donation price or multiple levels (for example, $10, $20, $50)?', 'give'), |
|
| 116 | + 'id' => $prefix.'price_option', |
|
| 117 | 117 | 'type' => 'radio_inline', |
| 118 | 118 | 'default' => 'set', |
| 119 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
| 120 | - 'set' => esc_html__( 'Set Donation', 'give' ), |
|
| 121 | - 'multi' => esc_html__( 'Multi-level Donation', 'give' ), |
|
| 122 | - ) ), |
|
| 119 | + 'options' => apply_filters('give_forms_price_options', array( |
|
| 120 | + 'set' => esc_html__('Set Donation', 'give'), |
|
| 121 | + 'multi' => esc_html__('Multi-level Donation', 'give'), |
|
| 122 | + )), |
|
| 123 | 123 | ), |
| 124 | 124 | array( |
| 125 | - 'name' => esc_html__( 'Set Donation', 'give' ), |
|
| 126 | - 'description' => esc_html__( 'This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give' ), |
|
| 127 | - 'id' => $prefix . 'set_price', |
|
| 125 | + 'name' => esc_html__('Set Donation', 'give'), |
|
| 126 | + 'description' => esc_html__('This is the set donation amount for this form. If you have a "Custom Amount Minimum" set, make sure it is less than this amount.', 'give'), |
|
| 127 | + 'id' => $prefix.'set_price', |
|
| 128 | 128 | 'type' => 'text_small', |
| 129 | 129 | 'data_type' => 'price', |
| 130 | 130 | 'attributes' => array( |
| 131 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
| 132 | - 'value' => give_format_decimal( $price ), |
|
| 131 | + 'placeholder' => give_format_decimal('1.00'), |
|
| 132 | + 'value' => give_format_decimal($price), |
|
| 133 | 133 | 'class' => 'give-money-field', |
| 134 | 134 | ), |
| 135 | 135 | ), |
| 136 | 136 | // Display Style |
| 137 | 137 | array( |
| 138 | - 'name' => esc_html__( 'Display Style', 'give' ), |
|
| 139 | - 'description' => esc_html__( 'Set how the donations levels will display on the form.', 'give' ), |
|
| 140 | - 'id' => $prefix . 'display_style', |
|
| 138 | + 'name' => esc_html__('Display Style', 'give'), |
|
| 139 | + 'description' => esc_html__('Set how the donations levels will display on the form.', 'give'), |
|
| 140 | + 'id' => $prefix.'display_style', |
|
| 141 | 141 | 'type' => 'radio_inline', |
| 142 | 142 | 'default' => 'buttons', |
| 143 | 143 | 'options' => array( |
| 144 | - 'buttons' => esc_html__( 'Buttons', 'give' ), |
|
| 145 | - 'radios' => esc_html__( 'Radios', 'give' ), |
|
| 146 | - 'dropdown' => esc_html__( 'Dropdown', 'give' ), |
|
| 144 | + 'buttons' => esc_html__('Buttons', 'give'), |
|
| 145 | + 'radios' => esc_html__('Radios', 'give'), |
|
| 146 | + 'dropdown' => esc_html__('Dropdown', 'give'), |
|
| 147 | 147 | ), |
| 148 | 148 | ), |
| 149 | 149 | // Custom Amount |
| 150 | 150 | array( |
| 151 | - 'name' => esc_html__( 'Custom Amount', 'give' ), |
|
| 152 | - 'description' => esc_html__( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
| 153 | - 'id' => $prefix . 'custom_amount', |
|
| 151 | + 'name' => esc_html__('Custom Amount', 'give'), |
|
| 152 | + 'description' => esc_html__('Do you want the user to be able to input their own donation amount?', 'give'), |
|
| 153 | + 'id' => $prefix.'custom_amount', |
|
| 154 | 154 | 'type' => 'radio_inline', |
| 155 | 155 | 'default' => 'disabled', |
| 156 | 156 | 'options' => array( |
| 157 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
| 158 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
| 157 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
| 158 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
| 159 | 159 | ), |
| 160 | 160 | ), |
| 161 | 161 | array( |
| 162 | - 'name' => esc_html__( 'Minimum Amount', 'give' ), |
|
| 163 | - 'description' => esc_html__( 'Enter the minimum custom donation amount.', 'give' ), |
|
| 164 | - 'id' => $prefix . 'custom_amount_minimum', |
|
| 162 | + 'name' => esc_html__('Minimum Amount', 'give'), |
|
| 163 | + 'description' => esc_html__('Enter the minimum custom donation amount.', 'give'), |
|
| 164 | + 'id' => $prefix.'custom_amount_minimum', |
|
| 165 | 165 | 'type' => 'text_small', |
| 166 | 166 | 'data_type' => 'price', |
| 167 | 167 | 'attributes' => array( |
| 168 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
| 169 | - 'value' => give_format_decimal( $custom_amount_minimum ), |
|
| 168 | + 'placeholder' => give_format_decimal('1.00'), |
|
| 169 | + 'value' => give_format_decimal($custom_amount_minimum), |
|
| 170 | 170 | 'class' => 'give-money-field', |
| 171 | 171 | ), |
| 172 | 172 | ), |
| 173 | 173 | array( |
| 174 | - 'name' => esc_html__( 'Custom Amount Text', 'give' ), |
|
| 175 | - 'description' => esc_html__( 'This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give' ), |
|
| 176 | - 'id' => $prefix . 'custom_amount_text', |
|
| 174 | + 'name' => esc_html__('Custom Amount Text', 'give'), |
|
| 175 | + 'description' => esc_html__('This text appears as a label below the custom amount field for set donation forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option).', 'give'), |
|
| 176 | + 'id' => $prefix.'custom_amount_text', |
|
| 177 | 177 | 'type' => 'text_medium', |
| 178 | 178 | 'attributes' => array( |
| 179 | 179 | 'rows' => 3, |
| 180 | - 'placeholder' => esc_attr__( 'Give a Custom Amount', 'give' ), |
|
| 180 | + 'placeholder' => esc_attr__('Give a Custom Amount', 'give'), |
|
| 181 | 181 | ), |
| 182 | 182 | ), |
| 183 | 183 | // Donation Levels: Repeatable CMB2 Group |
| 184 | 184 | array( |
| 185 | - 'id' => $prefix . 'donation_levels', |
|
| 185 | + 'id' => $prefix.'donation_levels', |
|
| 186 | 186 | 'type' => 'group', |
| 187 | 187 | 'options' => array( |
| 188 | - 'add_button' => esc_html__( 'Add Level', 'give' ), |
|
| 189 | - 'header_title' => esc_html__( 'Donation Level', 'give' ), |
|
| 188 | + 'add_button' => esc_html__('Add Level', 'give'), |
|
| 189 | + 'header_title' => esc_html__('Donation Level', 'give'), |
|
| 190 | 190 | 'remove_button' => '<span class="dashicons dashicons-no"></span>', |
| 191 | 191 | ), |
| 192 | 192 | // Fields array works the same, except id's only need to be unique for this group. |
| 193 | 193 | // Prefix is not needed. |
| 194 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
| 194 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
| 195 | 195 | array( |
| 196 | - 'name' => esc_html__( 'ID', 'give' ), |
|
| 197 | - 'id' => $prefix . 'id', |
|
| 196 | + 'name' => esc_html__('ID', 'give'), |
|
| 197 | + 'id' => $prefix.'id', |
|
| 198 | 198 | 'type' => 'levels_id', |
| 199 | 199 | ), |
| 200 | 200 | array( |
| 201 | - 'name' => esc_html__( 'Amount', 'give' ), |
|
| 202 | - 'id' => $prefix . 'amount', |
|
| 201 | + 'name' => esc_html__('Amount', 'give'), |
|
| 202 | + 'id' => $prefix.'amount', |
|
| 203 | 203 | 'type' => 'text_small', |
| 204 | 204 | 'data_type' => 'price', |
| 205 | 205 | 'attributes' => array( |
| 206 | - 'placeholder' => give_format_decimal( '1.00' ), |
|
| 206 | + 'placeholder' => give_format_decimal('1.00'), |
|
| 207 | 207 | 'class' => 'give-money-field', |
| 208 | 208 | ), |
| 209 | 209 | ), |
| 210 | 210 | array( |
| 211 | - 'name' => esc_html__( 'Text', 'give' ), |
|
| 212 | - 'id' => $prefix . 'text', |
|
| 211 | + 'name' => esc_html__('Text', 'give'), |
|
| 212 | + 'id' => $prefix.'text', |
|
| 213 | 213 | 'type' => 'text', |
| 214 | 214 | 'attributes' => array( |
| 215 | - 'placeholder' => esc_html__( 'Donation Level', 'give' ), |
|
| 215 | + 'placeholder' => esc_html__('Donation Level', 'give'), |
|
| 216 | 216 | 'class' => 'give-multilevel-text-field', |
| 217 | 217 | ), |
| 218 | 218 | ), |
| 219 | 219 | array( |
| 220 | - 'name' => esc_html__( 'Default', 'give' ), |
|
| 221 | - 'id' => $prefix . 'default', |
|
| 220 | + 'name' => esc_html__('Default', 'give'), |
|
| 221 | + 'id' => $prefix.'default', |
|
| 222 | 222 | 'type' => 'give_default_radio_inline', |
| 223 | 223 | ), |
| 224 | - ) ), |
|
| 224 | + )), |
|
| 225 | 225 | ), |
| 226 | 226 | array( |
| 227 | 227 | 'name' => 'donation_options_docs', |
| 228 | 228 | 'type' => 'docs_link', |
| 229 | 229 | 'url' => 'http://docs.givewp.com/form-donation-options', |
| 230 | - 'title' => esc_html__( 'Donation Options', 'give' ), |
|
| 230 | + 'title' => esc_html__('Donation Options', 'give'), |
|
| 231 | 231 | ), |
| 232 | 232 | ), |
| 233 | 233 | $post_id |
| 234 | 234 | ), |
| 235 | - ) ), |
|
| 235 | + )), |
|
| 236 | 236 | |
| 237 | 237 | /** |
| 238 | 238 | * Display Options |
| 239 | 239 | */ |
| 240 | - 'form_display_options' => apply_filters( 'give_form_display_options', array( |
|
| 240 | + 'form_display_options' => apply_filters('give_form_display_options', array( |
|
| 241 | 241 | 'id' => 'form_display_options', |
| 242 | - 'title' => esc_html__( 'Form Display', 'give' ), |
|
| 242 | + 'title' => esc_html__('Form Display', 'give'), |
|
| 243 | 243 | 'icon-html' => '<span class="give-icon give-icon-display"></span>', |
| 244 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
| 244 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
| 245 | 245 | array( |
| 246 | - 'name' => esc_html__( 'Display Options', 'give' ), |
|
| 247 | - 'desc' => sprintf( __( 'How would you like to display donation information for this form?', 'give' ), '#' ), |
|
| 248 | - 'id' => $prefix . 'payment_display', |
|
| 246 | + 'name' => esc_html__('Display Options', 'give'), |
|
| 247 | + 'desc' => sprintf(__('How would you like to display donation information for this form?', 'give'), '#'), |
|
| 248 | + 'id' => $prefix.'payment_display', |
|
| 249 | 249 | 'type' => 'radio_inline', |
| 250 | 250 | 'options' => array( |
| 251 | - 'onpage' => esc_html__( 'All Fields', 'give' ), |
|
| 252 | - 'modal' => esc_html__( 'Modal', 'give' ), |
|
| 253 | - 'reveal' => esc_html__( 'Reveal', 'give' ), |
|
| 254 | - 'button' => esc_html__( 'Button', 'give' ), |
|
| 251 | + 'onpage' => esc_html__('All Fields', 'give'), |
|
| 252 | + 'modal' => esc_html__('Modal', 'give'), |
|
| 253 | + 'reveal' => esc_html__('Reveal', 'give'), |
|
| 254 | + 'button' => esc_html__('Button', 'give'), |
|
| 255 | 255 | ), |
| 256 | 256 | 'default' => 'onpage', |
| 257 | 257 | ), |
| 258 | 258 | array( |
| 259 | - 'id' => $prefix . 'reveal_label', |
|
| 260 | - 'name' => esc_html__( 'Continue Button', 'give' ), |
|
| 261 | - 'desc' => esc_html__( 'The button label for displaying the additional payment fields.', 'give' ), |
|
| 259 | + 'id' => $prefix.'reveal_label', |
|
| 260 | + 'name' => esc_html__('Continue Button', 'give'), |
|
| 261 | + 'desc' => esc_html__('The button label for displaying the additional payment fields.', 'give'), |
|
| 262 | 262 | 'type' => 'text_small', |
| 263 | 263 | 'attributes' => array( |
| 264 | - 'placeholder' => esc_attr__( 'Donate Now', 'give' ), |
|
| 264 | + 'placeholder' => esc_attr__('Donate Now', 'give'), |
|
| 265 | 265 | ), |
| 266 | 266 | ), |
| 267 | 267 | array( |
| 268 | - 'id' => $prefix . 'checkout_label', |
|
| 269 | - 'name' => esc_html__( 'Submit Button', 'give' ), |
|
| 270 | - 'desc' => esc_html__( 'The button label for completing a donation.', 'give' ), |
|
| 268 | + 'id' => $prefix.'checkout_label', |
|
| 269 | + 'name' => esc_html__('Submit Button', 'give'), |
|
| 270 | + 'desc' => esc_html__('The button label for completing a donation.', 'give'), |
|
| 271 | 271 | 'type' => 'text_small', |
| 272 | 272 | 'attributes' => array( |
| 273 | - 'placeholder' => esc_html__( 'Donate Now', 'give' ), |
|
| 273 | + 'placeholder' => esc_html__('Donate Now', 'give'), |
|
| 274 | 274 | ), |
| 275 | 275 | ), |
| 276 | 276 | array( |
| 277 | - 'name' => esc_html__( 'Default Gateway', 'give' ), |
|
| 278 | - 'desc' => esc_html__( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
| 279 | - 'id' => $prefix . 'default_gateway', |
|
| 277 | + 'name' => esc_html__('Default Gateway', 'give'), |
|
| 278 | + 'desc' => esc_html__('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
| 279 | + 'id' => $prefix.'default_gateway', |
|
| 280 | 280 | 'type' => 'default_gateway', |
| 281 | 281 | ), |
| 282 | 282 | array( |
| 283 | - 'name' => esc_html__( 'Guest Donations', 'give' ), |
|
| 284 | - 'desc' => esc_html__( 'Do you want to allow non-logged-in users to make donations?', 'give' ), |
|
| 285 | - 'id' => $prefix . 'logged_in_only', |
|
| 283 | + 'name' => esc_html__('Guest Donations', 'give'), |
|
| 284 | + 'desc' => esc_html__('Do you want to allow non-logged-in users to make donations?', 'give'), |
|
| 285 | + 'id' => $prefix.'logged_in_only', |
|
| 286 | 286 | 'type' => 'radio_inline', |
| 287 | 287 | 'default' => 'enabled', |
| 288 | 288 | 'options' => array( |
| 289 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
| 290 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
| 289 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
| 290 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
| 291 | 291 | ), |
| 292 | 292 | ), |
| 293 | 293 | array( |
| 294 | - 'name' => esc_html__( 'Registration', 'give' ), |
|
| 295 | - 'desc' => esc_html__( 'Display the registration and login forms in the payment section for non-logged-in users.', 'give' ), |
|
| 296 | - 'id' => $prefix . 'show_register_form', |
|
| 294 | + 'name' => esc_html__('Registration', 'give'), |
|
| 295 | + 'desc' => esc_html__('Display the registration and login forms in the payment section for non-logged-in users.', 'give'), |
|
| 296 | + 'id' => $prefix.'show_register_form', |
|
| 297 | 297 | 'type' => 'radio', |
| 298 | 298 | 'options' => array( |
| 299 | - 'none' => esc_html__( 'None', 'give' ), |
|
| 300 | - 'registration' => esc_html__( 'Registration', 'give' ), |
|
| 301 | - 'login' => esc_html__( 'Login', 'give' ), |
|
| 302 | - 'both' => esc_html__( 'Registration + Login', 'give' ), |
|
| 299 | + 'none' => esc_html__('None', 'give'), |
|
| 300 | + 'registration' => esc_html__('Registration', 'give'), |
|
| 301 | + 'login' => esc_html__('Login', 'give'), |
|
| 302 | + 'both' => esc_html__('Registration + Login', 'give'), |
|
| 303 | 303 | ), |
| 304 | 304 | 'default' => 'none', |
| 305 | 305 | ), |
| 306 | 306 | array( |
| 307 | - 'name' => esc_html__( 'Floating Labels', 'give' ), |
|
| 307 | + 'name' => esc_html__('Floating Labels', 'give'), |
|
| 308 | 308 | /* translators: %s: forms http://docs.givewp.com/form-floating-labels */ |
| 309 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( 'http://docs.givewp.com/form-floating-labels' ) ), |
|
| 310 | - 'id' => $prefix . 'form_floating_labels', |
|
| 309 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form. Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url('http://docs.givewp.com/form-floating-labels')), |
|
| 310 | + 'id' => $prefix.'form_floating_labels', |
|
| 311 | 311 | 'type' => 'radio_inline', |
| 312 | 312 | 'options' => array( |
| 313 | - 'global' => esc_html__( 'Global Option', 'give' ), |
|
| 314 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
| 315 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
| 313 | + 'global' => esc_html__('Global Option', 'give'), |
|
| 314 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
| 315 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
| 316 | 316 | ), |
| 317 | 317 | 'default' => 'global', |
| 318 | 318 | ), |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | 'name' => 'form_display_docs', |
| 321 | 321 | 'type' => 'docs_link', |
| 322 | 322 | 'url' => 'http://docs.givewp.com/form-display-options', |
| 323 | - 'title' => esc_html__( 'Form Display', 'give' ), |
|
| 323 | + 'title' => esc_html__('Form Display', 'give'), |
|
| 324 | 324 | ), |
| 325 | 325 | ), |
| 326 | 326 | $post_id |
@@ -331,191 +331,191 @@ discard block |
||
| 331 | 331 | /** |
| 332 | 332 | * Donation Goals |
| 333 | 333 | */ |
| 334 | - 'donation_goal_options' => apply_filters( 'give_donation_goal_options', array( |
|
| 334 | + 'donation_goal_options' => apply_filters('give_donation_goal_options', array( |
|
| 335 | 335 | 'id' => 'donation_goal_options', |
| 336 | - 'title' => esc_html__( 'Donation Goal', 'give' ), |
|
| 336 | + 'title' => esc_html__('Donation Goal', 'give'), |
|
| 337 | 337 | 'icon-html' => '<span class="give-icon give-icon-target"></span>', |
| 338 | - 'fields' => apply_filters( 'give_forms_donation_goal_metabox_fields', array( |
|
| 338 | + 'fields' => apply_filters('give_forms_donation_goal_metabox_fields', array( |
|
| 339 | 339 | // Goals |
| 340 | 340 | array( |
| 341 | - 'name' => esc_html__( 'Donation Goal', 'give' ), |
|
| 342 | - 'description' => esc_html__( 'Do you want to set a donation goal for this form?', 'give' ), |
|
| 343 | - 'id' => $prefix . 'goal_option', |
|
| 341 | + 'name' => esc_html__('Donation Goal', 'give'), |
|
| 342 | + 'description' => esc_html__('Do you want to set a donation goal for this form?', 'give'), |
|
| 343 | + 'id' => $prefix.'goal_option', |
|
| 344 | 344 | 'type' => 'radio_inline', |
| 345 | 345 | 'default' => 'disabled', |
| 346 | 346 | 'options' => array( |
| 347 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
| 348 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
| 347 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
| 348 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
| 349 | 349 | ), |
| 350 | 350 | ), |
| 351 | 351 | array( |
| 352 | - 'name' => esc_html__( 'Goal Amount', 'give' ), |
|
| 353 | - 'description' => esc_html__( 'This is the monetary goal amount you want to reach for this form.', 'give' ), |
|
| 354 | - 'id' => $prefix . 'set_goal', |
|
| 352 | + 'name' => esc_html__('Goal Amount', 'give'), |
|
| 353 | + 'description' => esc_html__('This is the monetary goal amount you want to reach for this form.', 'give'), |
|
| 354 | + 'id' => $prefix.'set_goal', |
|
| 355 | 355 | 'type' => 'text_small', |
| 356 | 356 | 'data_type' => 'price', |
| 357 | 357 | 'attributes' => array( |
| 358 | - 'placeholder' => give_format_decimal( '0.00' ), |
|
| 359 | - 'value' => give_format_decimal( $goal ), |
|
| 358 | + 'placeholder' => give_format_decimal('0.00'), |
|
| 359 | + 'value' => give_format_decimal($goal), |
|
| 360 | 360 | 'class' => 'give-money-field', |
| 361 | 361 | ), |
| 362 | 362 | ), |
| 363 | 363 | |
| 364 | 364 | array( |
| 365 | - 'name' => esc_html__( 'Goal Format', 'give' ), |
|
| 366 | - 'description' => esc_html__( 'Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give' ), |
|
| 367 | - 'id' => $prefix . 'goal_format', |
|
| 365 | + 'name' => esc_html__('Goal Format', 'give'), |
|
| 366 | + 'description' => esc_html__('Do you want to display the total amount raised based on your monetary goal or a percentage? For instance, "$500 of $1,000 raised" or "50% funded".', 'give'), |
|
| 367 | + 'id' => $prefix.'goal_format', |
|
| 368 | 368 | 'type' => 'radio_inline', |
| 369 | 369 | 'default' => 'amount', |
| 370 | 370 | 'options' => array( |
| 371 | - 'amount' => esc_html__( 'Amount', 'give' ), |
|
| 372 | - 'percentage' => esc_html__( 'Percentage', 'give' ), |
|
| 371 | + 'amount' => esc_html__('Amount', 'give'), |
|
| 372 | + 'percentage' => esc_html__('Percentage', 'give'), |
|
| 373 | 373 | ), |
| 374 | 374 | ), |
| 375 | 375 | array( |
| 376 | - 'name' => esc_html__( 'Progress Bar Color', 'give' ), |
|
| 377 | - 'desc' => esc_html__( 'Customize the color of the goal progress bar.', 'give' ), |
|
| 378 | - 'id' => $prefix . 'goal_color', |
|
| 376 | + 'name' => esc_html__('Progress Bar Color', 'give'), |
|
| 377 | + 'desc' => esc_html__('Customize the color of the goal progress bar.', 'give'), |
|
| 378 | + 'id' => $prefix.'goal_color', |
|
| 379 | 379 | 'type' => 'colorpicker', |
| 380 | 380 | 'default' => '#2bc253', |
| 381 | 381 | ), |
| 382 | 382 | |
| 383 | 383 | array( |
| 384 | - 'name' => esc_html__( 'Close Form', 'give' ), |
|
| 385 | - 'desc' => esc_html__( 'Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give' ), |
|
| 386 | - 'id' => $prefix . 'close_form_when_goal_achieved', |
|
| 384 | + 'name' => esc_html__('Close Form', 'give'), |
|
| 385 | + 'desc' => esc_html__('Do you want to close the donation forms and stop accepting donations once this goal has been met?', 'give'), |
|
| 386 | + 'id' => $prefix.'close_form_when_goal_achieved', |
|
| 387 | 387 | 'type' => 'radio_inline', |
| 388 | 388 | 'default' => 'disabled', |
| 389 | 389 | 'options' => array( |
| 390 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
| 391 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
| 390 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
| 391 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
| 392 | 392 | ), |
| 393 | 393 | ), |
| 394 | 394 | array( |
| 395 | - 'name' => __( 'Goal Achieved Message', 'give' ), |
|
| 396 | - 'desc' => __( 'Do you want to display a custom message when the goal is closed?', 'give' ), |
|
| 397 | - 'id' => $prefix . 'form_goal_achieved_message', |
|
| 395 | + 'name' => __('Goal Achieved Message', 'give'), |
|
| 396 | + 'desc' => __('Do you want to display a custom message when the goal is closed?', 'give'), |
|
| 397 | + 'id' => $prefix.'form_goal_achieved_message', |
|
| 398 | 398 | 'type' => 'wysiwyg', |
| 399 | - 'default' => __( 'Thank you to all our donors, we have met our fundraising goal.', 'give' ), |
|
| 399 | + 'default' => __('Thank you to all our donors, we have met our fundraising goal.', 'give'), |
|
| 400 | 400 | ), |
| 401 | 401 | array( |
| 402 | 402 | 'name' => 'donation_goal_docs', |
| 403 | 403 | 'type' => 'docs_link', |
| 404 | 404 | 'url' => 'http://docs.givewp.com/form-donation-goal', |
| 405 | - 'title' => esc_html__( 'Donation Goal', 'give' ), |
|
| 405 | + 'title' => esc_html__('Donation Goal', 'give'), |
|
| 406 | 406 | ), |
| 407 | 407 | ), |
| 408 | 408 | $post_id |
| 409 | 409 | ), |
| 410 | - ) ), |
|
| 410 | + )), |
|
| 411 | 411 | |
| 412 | 412 | /** |
| 413 | 413 | * Content Field |
| 414 | 414 | */ |
| 415 | - 'form_content_options' => apply_filters( 'give_forms_content_options', array( |
|
| 415 | + 'form_content_options' => apply_filters('give_forms_content_options', array( |
|
| 416 | 416 | 'id' => 'form_content_options', |
| 417 | - 'title' => esc_html__( 'Form Content', 'give' ), |
|
| 417 | + 'title' => esc_html__('Form Content', 'give'), |
|
| 418 | 418 | 'icon-html' => '<span class="give-icon give-icon-edit"></span>', |
| 419 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
| 419 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
| 420 | 420 | |
| 421 | 421 | // Donation content. |
| 422 | 422 | array( |
| 423 | - 'name' => esc_html__( 'Display Content', 'give' ), |
|
| 424 | - 'description' => esc_html__( 'Do you want to add custom content to this form?', 'give' ), |
|
| 425 | - 'id' => $prefix . 'display_content', |
|
| 423 | + 'name' => esc_html__('Display Content', 'give'), |
|
| 424 | + 'description' => esc_html__('Do you want to add custom content to this form?', 'give'), |
|
| 425 | + 'id' => $prefix.'display_content', |
|
| 426 | 426 | 'type' => 'radio_inline', |
| 427 | 427 | 'options' => array( |
| 428 | - 'enabled' => esc_html__( 'Enabled', 'give' ), |
|
| 429 | - 'disabled' => esc_html__( 'Disabled', 'give' ), |
|
| 428 | + 'enabled' => esc_html__('Enabled', 'give'), |
|
| 429 | + 'disabled' => esc_html__('Disabled', 'give'), |
|
| 430 | 430 | ), |
| 431 | 431 | 'default' => 'disabled', |
| 432 | 432 | ), |
| 433 | 433 | |
| 434 | 434 | // Content placement. |
| 435 | 435 | array( |
| 436 | - 'name' => esc_html__( 'Content Placement', 'give' ), |
|
| 437 | - 'description' => esc_html__( 'This option controls where the content appears within the donation form.', 'give' ), |
|
| 438 | - 'id' => $prefix . 'content_placement', |
|
| 436 | + 'name' => esc_html__('Content Placement', 'give'), |
|
| 437 | + 'description' => esc_html__('This option controls where the content appears within the donation form.', 'give'), |
|
| 438 | + 'id' => $prefix.'content_placement', |
|
| 439 | 439 | 'type' => 'radio_inline', |
| 440 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
| 441 | - 'give_pre_form' => esc_html__( 'Above fields', 'give' ), |
|
| 442 | - 'give_post_form' => esc_html__( 'Below fields', 'give' ), |
|
| 440 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
| 441 | + 'give_pre_form' => esc_html__('Above fields', 'give'), |
|
| 442 | + 'give_post_form' => esc_html__('Below fields', 'give'), |
|
| 443 | 443 | ) |
| 444 | 444 | ), |
| 445 | 445 | 'default' => 'give_pre_form', |
| 446 | 446 | ), |
| 447 | 447 | array( |
| 448 | - 'name' => esc_html__( 'Content', 'give' ), |
|
| 449 | - 'description' => esc_html__( 'This content will display on the single give form page.', 'give' ), |
|
| 450 | - 'id' => $prefix . 'form_content', |
|
| 448 | + 'name' => esc_html__('Content', 'give'), |
|
| 449 | + 'description' => esc_html__('This content will display on the single give form page.', 'give'), |
|
| 450 | + 'id' => $prefix.'form_content', |
|
| 451 | 451 | 'type' => 'wysiwyg', |
| 452 | 452 | ), |
| 453 | 453 | array( |
| 454 | 454 | 'name' => 'form_content_docs', |
| 455 | 455 | 'type' => 'docs_link', |
| 456 | 456 | 'url' => 'http://docs.givewp.com/form-content', |
| 457 | - 'title' => esc_html__( 'Form Content', 'give' ), |
|
| 457 | + 'title' => esc_html__('Form Content', 'give'), |
|
| 458 | 458 | ), |
| 459 | 459 | ), |
| 460 | 460 | $post_id |
| 461 | 461 | ), |
| 462 | - ) ), |
|
| 462 | + )), |
|
| 463 | 463 | |
| 464 | 464 | /** |
| 465 | 465 | * Terms & Conditions |
| 466 | 466 | */ |
| 467 | - 'form_terms_options' => apply_filters( 'give_forms_terms_options', array( |
|
| 467 | + 'form_terms_options' => apply_filters('give_forms_terms_options', array( |
|
| 468 | 468 | 'id' => 'form_terms_options', |
| 469 | - 'title' => esc_html__( 'Terms & Conditions', 'give' ), |
|
| 469 | + 'title' => esc_html__('Terms & Conditions', 'give'), |
|
| 470 | 470 | 'icon-html' => '<span class="give-icon give-icon-checklist"></span>', |
| 471 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
| 471 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
| 472 | 472 | // Donation Option |
| 473 | 473 | array( |
| 474 | - 'name' => esc_html__( 'Terms and Conditions', 'give' ), |
|
| 475 | - 'description' => esc_html__( 'Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give' ), |
|
| 476 | - 'id' => $prefix . 'terms_option', |
|
| 474 | + 'name' => esc_html__('Terms and Conditions', 'give'), |
|
| 475 | + 'description' => esc_html__('Do you want to require the donor to accept terms prior to being able to complete their donation?', 'give'), |
|
| 476 | + 'id' => $prefix.'terms_option', |
|
| 477 | 477 | 'type' => 'radio_inline', |
| 478 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
| 479 | - 'global' => esc_html__( 'Global Option', 'give' ), |
|
| 480 | - 'enabled' => esc_html__( 'Customize', 'give' ), |
|
| 481 | - 'disabled' => esc_html__( 'Disable', 'give' ), |
|
| 478 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
| 479 | + 'global' => esc_html__('Global Option', 'give'), |
|
| 480 | + 'enabled' => esc_html__('Customize', 'give'), |
|
| 481 | + 'disabled' => esc_html__('Disable', 'give'), |
|
| 482 | 482 | ) |
| 483 | 483 | ), |
| 484 | 484 | 'default' => 'global', |
| 485 | 485 | ), |
| 486 | 486 | array( |
| 487 | - 'id' => $prefix . 'agree_label', |
|
| 488 | - 'name' => esc_html__( 'Agreement Label', 'give' ), |
|
| 489 | - 'desc' => esc_html__( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
| 487 | + 'id' => $prefix.'agree_label', |
|
| 488 | + 'name' => esc_html__('Agreement Label', 'give'), |
|
| 489 | + 'desc' => esc_html__('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
| 490 | 490 | 'type' => 'text', |
| 491 | 491 | 'size' => 'regular', |
| 492 | 492 | 'attributes' => array( |
| 493 | - 'placeholder' => esc_attr__( 'Agree to Terms?', 'give' ), |
|
| 493 | + 'placeholder' => esc_attr__('Agree to Terms?', 'give'), |
|
| 494 | 494 | ), |
| 495 | 495 | ), |
| 496 | 496 | array( |
| 497 | - 'id' => $prefix . 'agree_text', |
|
| 498 | - 'name' => esc_html__( 'Agreement Text', 'give' ), |
|
| 499 | - 'desc' => esc_html__( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
| 497 | + 'id' => $prefix.'agree_text', |
|
| 498 | + 'name' => esc_html__('Agreement Text', 'give'), |
|
| 499 | + 'desc' => esc_html__('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
| 500 | 500 | 'type' => 'wysiwyg', |
| 501 | 501 | ), |
| 502 | 502 | array( |
| 503 | 503 | 'name' => 'terms_docs', |
| 504 | 504 | 'type' => 'docs_link', |
| 505 | 505 | 'url' => 'http://docs.givewp.com/form-terms', |
| 506 | - 'title' => esc_html__( 'Terms and Conditions', 'give' ), |
|
| 506 | + 'title' => esc_html__('Terms and Conditions', 'give'), |
|
| 507 | 507 | ), |
| 508 | 508 | ), |
| 509 | 509 | $post_id |
| 510 | 510 | ), |
| 511 | - ) ), |
|
| 511 | + )), |
|
| 512 | 512 | ); |
| 513 | 513 | |
| 514 | 514 | |
| 515 | 515 | /** |
| 516 | 516 | * Filter the metabox tabbed panel settings. |
| 517 | 517 | */ |
| 518 | - $settings = apply_filters( 'give_metabox_form_data_settings', $settings, $post_id ); |
|
| 518 | + $settings = apply_filters('give_metabox_form_data_settings', $settings, $post_id); |
|
| 519 | 519 | |
| 520 | 520 | // Output. |
| 521 | 521 | return $settings; |
@@ -531,8 +531,8 @@ discard block |
||
| 531 | 531 | add_meta_box( |
| 532 | 532 | $this->get_metabox_ID(), |
| 533 | 533 | $this->get_metabox_label(), |
| 534 | - array( $this, 'output' ), |
|
| 535 | - array( 'give_forms' ), |
|
| 534 | + array($this, 'output'), |
|
| 535 | + array('give_forms'), |
|
| 536 | 536 | 'normal', |
| 537 | 537 | 'high' |
| 538 | 538 | ); |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | function enqueue_script() { |
| 549 | 549 | global $post; |
| 550 | 550 | |
| 551 | - if ( is_object( $post ) && 'give_forms' === $post->post_type ) { |
|
| 551 | + if (is_object($post) && 'give_forms' === $post->post_type) { |
|
| 552 | 552 | |
| 553 | 553 | } |
| 554 | 554 | } |
@@ -583,32 +583,32 @@ discard block |
||
| 583 | 583 | public function get_tabs() { |
| 584 | 584 | $tabs = array(); |
| 585 | 585 | |
| 586 | - if ( ! empty( $this->settings ) ) { |
|
| 587 | - foreach ( $this->settings as $setting ) { |
|
| 588 | - if ( ! isset( $setting['id'] ) || ! isset( $setting['title'] ) ) { |
|
| 586 | + if ( ! empty($this->settings)) { |
|
| 587 | + foreach ($this->settings as $setting) { |
|
| 588 | + if ( ! isset($setting['id']) || ! isset($setting['title'])) { |
|
| 589 | 589 | continue; |
| 590 | 590 | } |
| 591 | 591 | $tab = array( |
| 592 | 592 | 'id' => $setting['id'], |
| 593 | 593 | 'label' => $setting['title'], |
| 594 | - 'icon-html' => ( ! empty( $setting['icon-html'] ) ? $setting['icon-html'] : '' ), |
|
| 594 | + 'icon-html' => ( ! empty($setting['icon-html']) ? $setting['icon-html'] : ''), |
|
| 595 | 595 | ); |
| 596 | 596 | |
| 597 | - if ( $this->has_sub_tab( $setting ) ) { |
|
| 598 | - if ( empty( $setting['sub-fields'] ) ) { |
|
| 597 | + if ($this->has_sub_tab($setting)) { |
|
| 598 | + if (empty($setting['sub-fields'])) { |
|
| 599 | 599 | $tab = array(); |
| 600 | 600 | } else { |
| 601 | - foreach ( $setting['sub-fields'] as $sub_fields ) { |
|
| 601 | + foreach ($setting['sub-fields'] as $sub_fields) { |
|
| 602 | 602 | $tab['sub-fields'][] = array( |
| 603 | 603 | 'id' => $sub_fields['id'], |
| 604 | 604 | 'label' => $sub_fields['title'], |
| 605 | - 'icon-html' => ( ! empty( $sub_fields['icon-html'] ) ? $sub_fields['icon-html'] : '' ), |
|
| 605 | + 'icon-html' => ( ! empty($sub_fields['icon-html']) ? $sub_fields['icon-html'] : ''), |
|
| 606 | 606 | ); |
| 607 | 607 | } |
| 608 | 608 | } |
| 609 | 609 | } |
| 610 | 610 | |
| 611 | - if ( ! empty( $tab ) ) { |
|
| 611 | + if ( ! empty($tab)) { |
|
| 612 | 612 | $tabs[] = $tab; |
| 613 | 613 | } |
| 614 | 614 | } |
@@ -625,27 +625,27 @@ discard block |
||
| 625 | 625 | */ |
| 626 | 626 | public function output() { |
| 627 | 627 | // Bailout. |
| 628 | - if ( $form_data_tabs = $this->get_tabs() ) { |
|
| 629 | - wp_nonce_field( 'give_save_form_meta', 'give_form_meta_nonce' ); |
|
| 628 | + if ($form_data_tabs = $this->get_tabs()) { |
|
| 629 | + wp_nonce_field('give_save_form_meta', 'give_form_meta_nonce'); |
|
| 630 | 630 | ?> |
| 631 | 631 | <div class="give-metabox-panel-wrap"> |
| 632 | 632 | <ul class="give-form-data-tabs give-metabox-tabs"> |
| 633 | - <?php foreach ( $form_data_tabs as $index => $form_data_tab ) : ?> |
|
| 634 | - <li class="<?php echo "{$form_data_tab['id']}_tab" . ( ! $index ? ' active' : '' ) . ( $this->has_sub_tab( $form_data_tab ) ? ' has-sub-fields' : '' ); ?>"> |
|
| 633 | + <?php foreach ($form_data_tabs as $index => $form_data_tab) : ?> |
|
| 634 | + <li class="<?php echo "{$form_data_tab['id']}_tab".( ! $index ? ' active' : '').($this->has_sub_tab($form_data_tab) ? ' has-sub-fields' : ''); ?>"> |
|
| 635 | 635 | <a href="#<?php echo $form_data_tab['id']; ?>"> |
| 636 | - <?php if ( ! empty( $form_data_tab['icon-html'] ) ) : ?> |
|
| 636 | + <?php if ( ! empty($form_data_tab['icon-html'])) : ?> |
|
| 637 | 637 | <?php echo $form_data_tab['icon-html']; ?> |
| 638 | 638 | <?php else : ?> |
| 639 | 639 | <span class="give-icon give-icon-default"></span> |
| 640 | 640 | <?php endif; ?> |
| 641 | 641 | <span class="give-label"><?php echo $form_data_tab['label']; ?></span> |
| 642 | 642 | </a> |
| 643 | - <?php if ( $this->has_sub_tab( $form_data_tab ) ) : ?> |
|
| 643 | + <?php if ($this->has_sub_tab($form_data_tab)) : ?> |
|
| 644 | 644 | <ul class="give-metabox-sub-tabs give-hidden"> |
| 645 | - <?php foreach ( $form_data_tab['sub-fields'] as $sub_tab ) : ?> |
|
| 645 | + <?php foreach ($form_data_tab['sub-fields'] as $sub_tab) : ?> |
|
| 646 | 646 | <li class="<?php echo "{$sub_tab['id']}_tab"; ?>"> |
| 647 | 647 | <a href="#<?php echo $sub_tab['id']; ?>"> |
| 648 | - <?php if ( ! empty( $sub_tab['icon-html'] ) ) : ?> |
|
| 648 | + <?php if ( ! empty($sub_tab['icon-html'])) : ?> |
|
| 649 | 649 | <?php echo $sub_tab['icon-html']; ?> |
| 650 | 650 | <?php else : ?> |
| 651 | 651 | <span class="give-icon give-icon-default"></span> |
@@ -661,30 +661,30 @@ discard block |
||
| 661 | 661 | </ul> |
| 662 | 662 | |
| 663 | 663 | <?php $show_first_tab_content = true; ?> |
| 664 | - <?php foreach ( $this->settings as $setting ) : ?> |
|
| 665 | - <?php if ( ! $this->has_sub_tab( $setting ) ) : ?> |
|
| 666 | - <?php do_action( "give_before_{$setting['id']}_settings" ); ?> |
|
| 664 | + <?php foreach ($this->settings as $setting) : ?> |
|
| 665 | + <?php if ( ! $this->has_sub_tab($setting)) : ?> |
|
| 666 | + <?php do_action("give_before_{$setting['id']}_settings"); ?> |
|
| 667 | 667 | |
| 668 | 668 | <div id="<?php echo $setting['id']; ?>" |
| 669 | - class="panel give_options_panel<?php echo( $show_first_tab_content ? '' : ' give-hidden' ); |
|
| 669 | + class="panel give_options_panel<?php echo($show_first_tab_content ? '' : ' give-hidden'); |
|
| 670 | 670 | $show_first_tab_content = false; ?>"> |
| 671 | - <?php if ( ! empty( $setting['fields'] ) ) : ?> |
|
| 672 | - <?php foreach ( $setting['fields'] as $field ) : ?> |
|
| 673 | - <?php give_render_field( $field ); ?> |
|
| 671 | + <?php if ( ! empty($setting['fields'])) : ?> |
|
| 672 | + <?php foreach ($setting['fields'] as $field) : ?> |
|
| 673 | + <?php give_render_field($field); ?> |
|
| 674 | 674 | <?php endforeach; ?> |
| 675 | 675 | <?php endif; ?> |
| 676 | 676 | </div> |
| 677 | 677 | |
| 678 | - <?php do_action( "give_after_{$setting['id']}_settings" ); ?> |
|
| 678 | + <?php do_action("give_after_{$setting['id']}_settings"); ?> |
|
| 679 | 679 | <?php else: ?> |
| 680 | - <?php if ( $this->has_sub_tab( $setting ) ) : ?> |
|
| 681 | - <?php if ( ! empty( $setting['sub-fields'] ) ) : ?> |
|
| 682 | - <?php foreach ( $setting['sub-fields'] as $index => $sub_fields ) : ?> |
|
| 680 | + <?php if ($this->has_sub_tab($setting)) : ?> |
|
| 681 | + <?php if ( ! empty($setting['sub-fields'])) : ?> |
|
| 682 | + <?php foreach ($setting['sub-fields'] as $index => $sub_fields) : ?> |
|
| 683 | 683 | <div id="<?php echo $sub_fields['id']; ?>" |
| 684 | 684 | class="panel give_options_panel give-hidden"> |
| 685 | - <?php if ( ! empty( $sub_fields['fields'] ) ) : ?> |
|
| 686 | - <?php foreach ( $sub_fields['fields'] as $sub_field ) : ?> |
|
| 687 | - <?php give_render_field( $sub_field ); ?> |
|
| 685 | + <?php if ( ! empty($sub_fields['fields'])) : ?> |
|
| 686 | + <?php foreach ($sub_fields['fields'] as $sub_field) : ?> |
|
| 687 | + <?php give_render_field($sub_field); ?> |
|
| 688 | 688 | <?php endforeach; ?> |
| 689 | 689 | <?php endif; ?> |
| 690 | 690 | </div> |
@@ -708,9 +708,9 @@ discard block |
||
| 708 | 708 | * |
| 709 | 709 | * @return bool |
| 710 | 710 | */ |
| 711 | - private function has_sub_tab( $field_setting ) { |
|
| 711 | + private function has_sub_tab($field_setting) { |
|
| 712 | 712 | $has_sub_tab = false; |
| 713 | - if ( array_key_exists( 'sub-fields', $field_setting ) ) { |
|
| 713 | + if (array_key_exists('sub-fields', $field_setting)) { |
|
| 714 | 714 | $has_sub_tab = true; |
| 715 | 715 | } |
| 716 | 716 | |
@@ -724,13 +724,13 @@ discard block |
||
| 724 | 724 | * @return array |
| 725 | 725 | */ |
| 726 | 726 | function cmb2_metabox_settings() { |
| 727 | - $all_cmb2_settings = apply_filters( 'cmb2_meta_boxes', array() ); |
|
| 727 | + $all_cmb2_settings = apply_filters('cmb2_meta_boxes', array()); |
|
| 728 | 728 | $give_forms_settings = $all_cmb2_settings; |
| 729 | 729 | |
| 730 | 730 | // Filter settings: Use only give forms related settings. |
| 731 | - foreach ( $all_cmb2_settings as $index => $setting ) { |
|
| 732 | - if ( ! in_array( 'give_forms', $setting['object_types'] ) ) { |
|
| 733 | - unset( $give_forms_settings[ $index ] ); |
|
| 731 | + foreach ($all_cmb2_settings as $index => $setting) { |
|
| 732 | + if ( ! in_array('give_forms', $setting['object_types'])) { |
|
| 733 | + unset($give_forms_settings[$index]); |
|
| 734 | 734 | } |
| 735 | 735 | } |
| 736 | 736 | |
@@ -748,114 +748,114 @@ discard block |
||
| 748 | 748 | * |
| 749 | 749 | * @return void |
| 750 | 750 | */ |
| 751 | - public function save( $post_id, $post ) { |
|
| 751 | + public function save($post_id, $post) { |
|
| 752 | 752 | |
| 753 | 753 | // $post_id and $post are required. |
| 754 | - if ( empty( $post_id ) || empty( $post ) ) { |
|
| 754 | + if (empty($post_id) || empty($post)) { |
|
| 755 | 755 | return; |
| 756 | 756 | } |
| 757 | 757 | |
| 758 | 758 | // Don't save meta boxes for revisions or autosaves. |
| 759 | - if ( defined( 'DOING_AUTOSAVE' ) || is_int( wp_is_post_revision( $post ) ) || is_int( wp_is_post_autosave( $post ) ) ) { |
|
| 759 | + if (defined('DOING_AUTOSAVE') || is_int(wp_is_post_revision($post)) || is_int(wp_is_post_autosave($post))) { |
|
| 760 | 760 | return; |
| 761 | 761 | } |
| 762 | 762 | |
| 763 | 763 | // Check the nonce. |
| 764 | - if ( empty( $_POST['give_form_meta_nonce'] ) || ! wp_verify_nonce( $_POST['give_form_meta_nonce'], 'give_save_form_meta' ) ) { |
|
| 764 | + if (empty($_POST['give_form_meta_nonce']) || ! wp_verify_nonce($_POST['give_form_meta_nonce'], 'give_save_form_meta')) { |
|
| 765 | 765 | return; |
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | // Check the post being saved == the $post_id to prevent triggering this call for other save_post events. |
| 769 | - if ( empty( $_POST['post_ID'] ) || $_POST['post_ID'] != $post_id ) { |
|
| 769 | + if (empty($_POST['post_ID']) || $_POST['post_ID'] != $post_id) { |
|
| 770 | 770 | return; |
| 771 | 771 | } |
| 772 | 772 | |
| 773 | 773 | // Check user has permission to edit. |
| 774 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
| 774 | + if ( ! current_user_can('edit_post', $post_id)) { |
|
| 775 | 775 | return; |
| 776 | 776 | } |
| 777 | 777 | |
| 778 | 778 | // Fire action before saving form meta. |
| 779 | - do_action( 'give_pre_process_give_forms_meta', $post_id, $post ); |
|
| 779 | + do_action('give_pre_process_give_forms_meta', $post_id, $post); |
|
| 780 | 780 | |
| 781 | 781 | /** |
| 782 | 782 | * Filter the meta key to save. |
| 783 | 783 | * Third party addon developer can remove there meta keys from this array to handle saving data on there own. |
| 784 | 784 | */ |
| 785 | - $form_meta_keys = apply_filters( 'give_process_form_meta_keys', $this->get_meta_keys_from_settings() ); |
|
| 785 | + $form_meta_keys = apply_filters('give_process_form_meta_keys', $this->get_meta_keys_from_settings()); |
|
| 786 | 786 | |
| 787 | 787 | // Save form meta data. |
| 788 | - if ( ! empty( $form_meta_keys ) ) { |
|
| 789 | - foreach ( $form_meta_keys as $form_meta_key ) { |
|
| 788 | + if ( ! empty($form_meta_keys)) { |
|
| 789 | + foreach ($form_meta_keys as $form_meta_key) { |
|
| 790 | 790 | |
| 791 | 791 | // Set default value for checkbox fields. |
| 792 | 792 | if ( |
| 793 | - ! isset( $_POST[ $form_meta_key ] ) |
|
| 794 | - && ( 'checkbox' === $this->get_field_type( $form_meta_key ) ) |
|
| 793 | + ! isset($_POST[$form_meta_key]) |
|
| 794 | + && ('checkbox' === $this->get_field_type($form_meta_key)) |
|
| 795 | 795 | ) { |
| 796 | - $_POST[ $form_meta_key ] = ''; |
|
| 796 | + $_POST[$form_meta_key] = ''; |
|
| 797 | 797 | } |
| 798 | 798 | |
| 799 | - if ( isset( $_POST[ $form_meta_key ] ) ) { |
|
| 800 | - if ( $field_type = $this->get_field_type( $form_meta_key ) ) { |
|
| 801 | - switch ( $field_type ) { |
|
| 799 | + if (isset($_POST[$form_meta_key])) { |
|
| 800 | + if ($field_type = $this->get_field_type($form_meta_key)) { |
|
| 801 | + switch ($field_type) { |
|
| 802 | 802 | case 'textarea': |
| 803 | 803 | case 'wysiwyg': |
| 804 | - $form_meta_value = wp_kses_post( $_POST[ $form_meta_key ] ); |
|
| 805 | - update_post_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
| 804 | + $form_meta_value = wp_kses_post($_POST[$form_meta_key]); |
|
| 805 | + update_post_meta($post_id, $form_meta_key, $form_meta_value); |
|
| 806 | 806 | break; |
| 807 | 807 | |
| 808 | 808 | case 'group': |
| 809 | 809 | $form_meta_value = array(); |
| 810 | 810 | |
| 811 | - foreach ( $_POST[ $form_meta_key ] as $index => $group ) { |
|
| 811 | + foreach ($_POST[$form_meta_key] as $index => $group) { |
|
| 812 | 812 | |
| 813 | 813 | // Do not save template input field values. |
| 814 | - if ( '{{row-count-placeholder}}' === $index ) { |
|
| 814 | + if ('{{row-count-placeholder}}' === $index) { |
|
| 815 | 815 | continue; |
| 816 | 816 | } |
| 817 | 817 | |
| 818 | 818 | $group_meta_value = array(); |
| 819 | - foreach ( $group as $field_id => $field_value ) { |
|
| 820 | - switch ( $this->get_field_type( $field_id, $form_meta_key ) ) { |
|
| 819 | + foreach ($group as $field_id => $field_value) { |
|
| 820 | + switch ($this->get_field_type($field_id, $form_meta_key)) { |
|
| 821 | 821 | case 'wysiwyg': |
| 822 | - $group_meta_value[ $field_id ] = wp_kses_post( $field_value ); |
|
| 822 | + $group_meta_value[$field_id] = wp_kses_post($field_value); |
|
| 823 | 823 | break; |
| 824 | 824 | |
| 825 | 825 | default: |
| 826 | - $group_meta_value[ $field_id ] = give_clean( $field_value ); |
|
| 826 | + $group_meta_value[$field_id] = give_clean($field_value); |
|
| 827 | 827 | } |
| 828 | 828 | } |
| 829 | 829 | |
| 830 | - if ( ! empty( $group_meta_value ) ) { |
|
| 831 | - $form_meta_value[ $index ] = $group_meta_value; |
|
| 830 | + if ( ! empty($group_meta_value)) { |
|
| 831 | + $form_meta_value[$index] = $group_meta_value; |
|
| 832 | 832 | } |
| 833 | 833 | } |
| 834 | 834 | |
| 835 | 835 | |
| 836 | 836 | // Arrange repeater field keys in order. |
| 837 | - $form_meta_value = array_values( $form_meta_value ); |
|
| 837 | + $form_meta_value = array_values($form_meta_value); |
|
| 838 | 838 | |
| 839 | 839 | // Save data. |
| 840 | - update_post_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
| 840 | + update_post_meta($post_id, $form_meta_key, $form_meta_value); |
|
| 841 | 841 | break; |
| 842 | 842 | |
| 843 | 843 | default: |
| 844 | - $form_meta_value = give_clean( $_POST[ $form_meta_key ] ); |
|
| 844 | + $form_meta_value = give_clean($_POST[$form_meta_key]); |
|
| 845 | 845 | |
| 846 | 846 | // Save data. |
| 847 | - update_post_meta( $post_id, $form_meta_key, $form_meta_value ); |
|
| 847 | + update_post_meta($post_id, $form_meta_key, $form_meta_value); |
|
| 848 | 848 | } |
| 849 | 849 | |
| 850 | 850 | // Fire after saving form meta key. |
| 851 | - do_action( "give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post ); |
|
| 851 | + do_action("give_save_{$form_meta_key}", $form_meta_key, $form_meta_value, $post_id, $post); |
|
| 852 | 852 | } |
| 853 | 853 | } |
| 854 | 854 | } |
| 855 | 855 | } |
| 856 | 856 | |
| 857 | 857 | // Fire action after saving form meta. |
| 858 | - do_action( 'give_post_process_give_forms_meta', $post_id, $post ); |
|
| 858 | + do_action('give_post_process_give_forms_meta', $post_id, $post); |
|
| 859 | 859 | } |
| 860 | 860 | |
| 861 | 861 | |
@@ -868,10 +868,10 @@ discard block |
||
| 868 | 868 | * |
| 869 | 869 | * @return string |
| 870 | 870 | */ |
| 871 | - private function get_field_id( $field ) { |
|
| 871 | + private function get_field_id($field) { |
|
| 872 | 872 | $field_id = ''; |
| 873 | 873 | |
| 874 | - if ( array_key_exists( 'id', $field ) ) { |
|
| 874 | + if (array_key_exists('id', $field)) { |
|
| 875 | 875 | $field_id = $field['id']; |
| 876 | 876 | |
| 877 | 877 | } |
@@ -888,12 +888,12 @@ discard block |
||
| 888 | 888 | * |
| 889 | 889 | * @return array |
| 890 | 890 | */ |
| 891 | - private function get_fields_id( $setting ) { |
|
| 891 | + private function get_fields_id($setting) { |
|
| 892 | 892 | $meta_keys = array(); |
| 893 | 893 | |
| 894 | - if ( ! empty( $setting ) ) { |
|
| 895 | - foreach ( $setting['fields'] as $field ) { |
|
| 896 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
| 894 | + if ( ! empty($setting)) { |
|
| 895 | + foreach ($setting['fields'] as $field) { |
|
| 896 | + if ($field_id = $this->get_field_id($field)) { |
|
| 897 | 897 | $meta_keys[] = $field_id; |
| 898 | 898 | } |
| 899 | 899 | } |
@@ -911,14 +911,14 @@ discard block |
||
| 911 | 911 | * |
| 912 | 912 | * @return array |
| 913 | 913 | */ |
| 914 | - private function get_sub_fields_id( $setting ) { |
|
| 914 | + private function get_sub_fields_id($setting) { |
|
| 915 | 915 | $meta_keys = array(); |
| 916 | 916 | |
| 917 | - if ( $this->has_sub_tab( $setting ) && ! empty( $setting['sub-fields'] ) ) { |
|
| 918 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
| 919 | - if ( ! empty( $fields['fields'] ) ) { |
|
| 920 | - foreach ( $fields['fields'] as $field ) { |
|
| 921 | - if ( $field_id = $this->get_field_id( $field ) ) { |
|
| 917 | + if ($this->has_sub_tab($setting) && ! empty($setting['sub-fields'])) { |
|
| 918 | + foreach ($setting['sub-fields'] as $fields) { |
|
| 919 | + if ( ! empty($fields['fields'])) { |
|
| 920 | + foreach ($fields['fields'] as $field) { |
|
| 921 | + if ($field_id = $this->get_field_id($field)) { |
|
| 922 | 922 | $meta_keys[] = $field_id; |
| 923 | 923 | } |
| 924 | 924 | } |
@@ -939,14 +939,14 @@ discard block |
||
| 939 | 939 | private function get_meta_keys_from_settings() { |
| 940 | 940 | $meta_keys = array(); |
| 941 | 941 | |
| 942 | - foreach ( $this->settings as $setting ) { |
|
| 943 | - if ( $this->has_sub_tab( $setting ) ) { |
|
| 944 | - $meta_key = $this->get_sub_fields_id( $setting ); |
|
| 942 | + foreach ($this->settings as $setting) { |
|
| 943 | + if ($this->has_sub_tab($setting)) { |
|
| 944 | + $meta_key = $this->get_sub_fields_id($setting); |
|
| 945 | 945 | } else { |
| 946 | - $meta_key = $this->get_fields_id( $setting ); |
|
| 946 | + $meta_key = $this->get_fields_id($setting); |
|
| 947 | 947 | } |
| 948 | 948 | |
| 949 | - $meta_keys = array_merge( $meta_keys, $meta_key ); |
|
| 949 | + $meta_keys = array_merge($meta_keys, $meta_key); |
|
| 950 | 950 | } |
| 951 | 951 | |
| 952 | 952 | return $meta_keys; |
@@ -963,10 +963,10 @@ discard block |
||
| 963 | 963 | * |
| 964 | 964 | * @return string |
| 965 | 965 | */ |
| 966 | - function get_field_type( $field_id, $group_id = '' ) { |
|
| 967 | - $field = $this->get_setting_field( $field_id, $group_id ); |
|
| 966 | + function get_field_type($field_id, $group_id = '') { |
|
| 967 | + $field = $this->get_setting_field($field_id, $group_id); |
|
| 968 | 968 | |
| 969 | - $type = array_key_exists( 'type', $field ) |
|
| 969 | + $type = array_key_exists('type', $field) |
|
| 970 | 970 | ? $field['type'] |
| 971 | 971 | : ''; |
| 972 | 972 | |
@@ -984,12 +984,12 @@ discard block |
||
| 984 | 984 | * |
| 985 | 985 | * @return array |
| 986 | 986 | */ |
| 987 | - private function get_field( $setting, $field_id ) { |
|
| 987 | + private function get_field($setting, $field_id) { |
|
| 988 | 988 | $setting_field = array(); |
| 989 | 989 | |
| 990 | - if ( ! empty( $setting['fields'] ) ) { |
|
| 991 | - foreach ( $setting['fields'] as $field ) { |
|
| 992 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $field_id ) { |
|
| 990 | + if ( ! empty($setting['fields'])) { |
|
| 991 | + foreach ($setting['fields'] as $field) { |
|
| 992 | + if (array_key_exists('id', $field) && $field['id'] === $field_id) { |
|
| 993 | 993 | $setting_field = $field; |
| 994 | 994 | break; |
| 995 | 995 | } |
@@ -1009,12 +1009,12 @@ discard block |
||
| 1009 | 1009 | * |
| 1010 | 1010 | * @return array |
| 1011 | 1011 | */ |
| 1012 | - private function get_sub_field( $setting, $field_id ) { |
|
| 1012 | + private function get_sub_field($setting, $field_id) { |
|
| 1013 | 1013 | $setting_field = array(); |
| 1014 | 1014 | |
| 1015 | - if ( ! empty( $setting['sub-fields'] ) ) { |
|
| 1016 | - foreach ( $setting['sub-fields'] as $fields ) { |
|
| 1017 | - if ( $field = $this->get_field( $fields, $field_id ) ) { |
|
| 1015 | + if ( ! empty($setting['sub-fields'])) { |
|
| 1016 | + foreach ($setting['sub-fields'] as $fields) { |
|
| 1017 | + if ($field = $this->get_field($fields, $field_id)) { |
|
| 1018 | 1018 | $setting_field = $field; |
| 1019 | 1019 | break; |
| 1020 | 1020 | } |
@@ -1034,17 +1034,17 @@ discard block |
||
| 1034 | 1034 | * |
| 1035 | 1035 | * @return array |
| 1036 | 1036 | */ |
| 1037 | - function get_setting_field( $field_id, $group_id = '' ) { |
|
| 1037 | + function get_setting_field($field_id, $group_id = '') { |
|
| 1038 | 1038 | $setting_field = array(); |
| 1039 | 1039 | |
| 1040 | 1040 | $_field_id = $field_id; |
| 1041 | - $field_id = empty( $group_id ) ? $field_id : $group_id; |
|
| 1041 | + $field_id = empty($group_id) ? $field_id : $group_id; |
|
| 1042 | 1042 | |
| 1043 | - if ( ! empty( $this->settings ) ) { |
|
| 1044 | - foreach ( $this->settings as $setting ) { |
|
| 1043 | + if ( ! empty($this->settings)) { |
|
| 1044 | + foreach ($this->settings as $setting) { |
|
| 1045 | 1045 | if ( |
| 1046 | - ( $this->has_sub_tab( $setting ) && ( $setting_field = $this->get_sub_field( $setting, $field_id ) ) ) |
|
| 1047 | - || ( $setting_field = $this->get_field( $setting, $field_id ) ) |
|
| 1046 | + ($this->has_sub_tab($setting) && ($setting_field = $this->get_sub_field($setting, $field_id))) |
|
| 1047 | + || ($setting_field = $this->get_field($setting, $field_id)) |
|
| 1048 | 1048 | ) { |
| 1049 | 1049 | break; |
| 1050 | 1050 | } |
@@ -1053,9 +1053,9 @@ discard block |
||
| 1053 | 1053 | |
| 1054 | 1054 | |
| 1055 | 1055 | // Get field from group. |
| 1056 | - if ( ! empty( $group_id ) ) { |
|
| 1057 | - foreach ( $setting_field['fields'] as $field ) { |
|
| 1058 | - if ( array_key_exists( 'id', $field ) && $field['id'] === $_field_id ) { |
|
| 1056 | + if ( ! empty($group_id)) { |
|
| 1057 | + foreach ($setting_field['fields'] as $field) { |
|
| 1058 | + if (array_key_exists('id', $field) && $field['id'] === $_field_id) { |
|
| 1059 | 1059 | $setting_field = $field; |
| 1060 | 1060 | } |
| 1061 | 1061 | } |
@@ -1074,14 +1074,14 @@ discard block |
||
| 1074 | 1074 | * |
| 1075 | 1075 | * @return mixed |
| 1076 | 1076 | */ |
| 1077 | - function add_offline_donations_setting_tab( $settings ) { |
|
| 1078 | - if ( give_is_gateway_active( 'offline' ) ) { |
|
| 1079 | - $settings['offline_donations_options'] = apply_filters( 'give_forms_offline_donations_options', array( |
|
| 1077 | + function add_offline_donations_setting_tab($settings) { |
|
| 1078 | + if (give_is_gateway_active('offline')) { |
|
| 1079 | + $settings['offline_donations_options'] = apply_filters('give_forms_offline_donations_options', array( |
|
| 1080 | 1080 | 'id' => 'offline_donations_options', |
| 1081 | - 'title' => esc_html__( 'Offline Donations', 'give' ), |
|
| 1081 | + 'title' => esc_html__('Offline Donations', 'give'), |
|
| 1082 | 1082 | 'icon-html' => '<span class="give-icon give-icon-purse"></span>', |
| 1083 | - 'fields' => apply_filters( 'give_forms_offline_donations_metabox_fields', array() ), |
|
| 1084 | - ) ); |
|
| 1083 | + 'fields' => apply_filters('give_forms_offline_donations_metabox_fields', array()), |
|
| 1084 | + )); |
|
| 1085 | 1085 | } |
| 1086 | 1086 | |
| 1087 | 1087 | return $settings; |
@@ -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 | |
@@ -25,37 +25,37 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function give_do_automatic_upgrades() { |
| 27 | 27 | $did_upgrade = false; |
| 28 | - $give_version = preg_replace( '/[^0-9.].*/', '', get_option( 'give_version' ) ); |
|
| 28 | + $give_version = preg_replace('/[^0-9.].*/', '', get_option('give_version')); |
|
| 29 | 29 | |
| 30 | - if ( ! $give_version ) { |
|
| 30 | + if ( ! $give_version) { |
|
| 31 | 31 | // 1.0 is the first version to use this option so we must add it. |
| 32 | 32 | $give_version = '1.0'; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - switch ( true ) { |
|
| 35 | + switch (true) { |
|
| 36 | 36 | |
| 37 | - case version_compare( $give_version, '1.6', '<' ) : |
|
| 37 | + case version_compare($give_version, '1.6', '<') : |
|
| 38 | 38 | give_v16_upgrades(); |
| 39 | 39 | $did_upgrade = true; |
| 40 | 40 | break; |
| 41 | 41 | |
| 42 | - case version_compare( $give_version, '1.7', '<' ) : |
|
| 42 | + case version_compare($give_version, '1.7', '<') : |
|
| 43 | 43 | give_v17_upgrades(); |
| 44 | 44 | $did_upgrade = true; |
| 45 | 45 | break; |
| 46 | 46 | |
| 47 | - case version_compare( $give_version, '1.8', '<' ) : |
|
| 47 | + case version_compare($give_version, '1.8', '<') : |
|
| 48 | 48 | give_v18_upgrades(); |
| 49 | 49 | $did_upgrade = true; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - if ( $did_upgrade ) { |
|
| 53 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
| 52 | + if ($did_upgrade) { |
|
| 53 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | -add_action( 'admin_init', 'give_do_automatic_upgrades' ); |
|
| 58 | -add_action( 'give_upgrades', 'give_do_automatic_upgrades' ); |
|
| 57 | +add_action('admin_init', 'give_do_automatic_upgrades'); |
|
| 58 | +add_action('give_upgrades', 'give_do_automatic_upgrades'); |
|
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * Display Upgrade Notices |
@@ -65,18 +65,18 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | function give_show_upgrade_notices() { |
| 67 | 67 | // Don't show notices on the upgrades page. |
| 68 | - if ( isset( $_GET['page'] ) && $_GET['page'] == 'give-upgrades' ) { |
|
| 68 | + if (isset($_GET['page']) && $_GET['page'] == 'give-upgrades') { |
|
| 69 | 69 | return; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $give_version = get_option( 'give_version' ); |
|
| 72 | + $give_version = get_option('give_version'); |
|
| 73 | 73 | |
| 74 | - if ( ! $give_version ) { |
|
| 74 | + if ( ! $give_version) { |
|
| 75 | 75 | // 1.0 is the first version to use this option so we must add it. |
| 76 | 76 | $give_version = '1.0'; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
| 79 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
| 80 | 80 | |
| 81 | 81 | /* |
| 82 | 82 | * NOTICE: |
@@ -87,31 +87,31 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | |
| 89 | 89 | // v1.3.2 Upgrades |
| 90 | - if ( version_compare( $give_version, '1.3.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) { |
|
| 90 | + if (version_compare($give_version, '1.3.2', '<') || ! give_has_upgrade_completed('upgrade_give_payment_customer_id')) { |
|
| 91 | 91 | printf( |
| 92 | 92 | /* translators: %s: upgrade URL */ |
| 93 | - '<div class="updated"><p>' . __( 'Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>', |
|
| 94 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id' ) ) |
|
| 93 | + '<div class="updated"><p>'.__('Give needs to upgrade the donor database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>', |
|
| 94 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_payment_customer_id')) |
|
| 95 | 95 | ); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | // v1.3.4 Upgrades //ensure the user has gone through 1.3.4. |
| 99 | - if ( version_compare( $give_version, '1.3.4', '<' ) || ( ! give_has_upgrade_completed( 'upgrade_give_offline_status' ) && give_has_upgrade_completed( 'upgrade_give_payment_customer_id' ) ) ) { |
|
| 99 | + if (version_compare($give_version, '1.3.4', '<') || ( ! give_has_upgrade_completed('upgrade_give_offline_status') && give_has_upgrade_completed('upgrade_give_payment_customer_id'))) { |
|
| 100 | 100 | printf( |
| 101 | 101 | /* translators: %s: upgrade URL */ |
| 102 | - '<div class="updated"><p>' . __( 'Give needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give' ) . '</p></div>', |
|
| 103 | - esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status' ) ) |
|
| 102 | + '<div class="updated"><p>'.__('Give needs to upgrade the donations database, click <a href="%s">here</a> to start the upgrade.', 'give').'</p></div>', |
|
| 103 | + esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=upgrade_give_offline_status')) |
|
| 104 | 104 | ); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | // Check if we have a stalled upgrade. |
| 108 | 108 | $resume_upgrade = give_maybe_resume_upgrade(); |
| 109 | - if ( ! empty( $resume_upgrade ) ) { |
|
| 110 | - $resume_url = add_query_arg( $resume_upgrade, admin_url( 'index.php' ) ); |
|
| 109 | + if ( ! empty($resume_upgrade)) { |
|
| 110 | + $resume_url = add_query_arg($resume_upgrade, admin_url('index.php')); |
|
| 111 | 111 | echo Give_Notices::notice_html( |
| 112 | 112 | sprintf( |
| 113 | - __( 'Give needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'give' ), |
|
| 114 | - esc_url( $resume_url ) |
|
| 113 | + __('Give needs to complete a database upgrade that was previously started, click <a href="%s">here</a> to resume the upgrade.', 'give'), |
|
| 114 | + esc_url($resume_url) |
|
| 115 | 115 | ) |
| 116 | 116 | ); |
| 117 | 117 | |
@@ -119,11 +119,11 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | // v1.8 form metadata upgrades. |
| 122 | - if ( version_compare( $give_version, '1.8', '<' ) || ! give_has_upgrade_completed( 'v18_upgrades_form_metadata' ) ) { |
|
| 122 | + if (version_compare($give_version, '1.8', '<') || ! give_has_upgrade_completed('v18_upgrades_form_metadata')) { |
|
| 123 | 123 | echo Give_Notices::notice_html( |
| 124 | 124 | sprintf( |
| 125 | - esc_html__( 'Give needs to upgrade the form database, click %1$shere%2$s to start the upgrade.', 'give' ), |
|
| 126 | - '<a class="give-upgrade-link" href="' . esc_url( admin_url( 'index.php?page=give-upgrades&give-upgrade=give_v18_upgrades_form_metadata' ) ) . '">', |
|
| 125 | + esc_html__('Give needs to upgrade the form database, click %1$shere%2$s to start the upgrade.', 'give'), |
|
| 126 | + '<a class="give-upgrade-link" href="'.esc_url(admin_url('index.php?page=give-upgrades&give-upgrade=give_v18_upgrades_form_metadata')).'">', |
|
| 127 | 127 | '</a>' |
| 128 | 128 | ) |
| 129 | 129 | ); |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $upgrade_links.on( 'click', function(e){ |
| 139 | 139 | e.preventDefault(); |
| 140 | 140 | |
| 141 | - if( ! window.confirm( '<?php _e( 'Please make sure to create a database backup before initiating the upgrade.', 'give' ); ?>' ) ) { |
|
| 141 | + if( ! window.confirm( '<?php _e('Please make sure to create a database backup before initiating the upgrade.', 'give'); ?>' ) ) { |
|
| 142 | 142 | return; |
| 143 | 143 | } |
| 144 | 144 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | <?php |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | -add_action( 'admin_notices', 'give_show_upgrade_notices' ); |
|
| 154 | +add_action('admin_notices', 'give_show_upgrade_notices'); |
|
| 155 | 155 | |
| 156 | 156 | /** |
| 157 | 157 | * Triggers all upgrade functions |
@@ -163,29 +163,29 @@ discard block |
||
| 163 | 163 | */ |
| 164 | 164 | function give_trigger_upgrades() { |
| 165 | 165 | |
| 166 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 167 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
| 166 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 167 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
| 168 | 168 | 'response' => 403, |
| 169 | - ) ); |
|
| 169 | + )); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - $give_version = get_option( 'give_version' ); |
|
| 172 | + $give_version = get_option('give_version'); |
|
| 173 | 173 | |
| 174 | - if ( ! $give_version ) { |
|
| 174 | + if ( ! $give_version) { |
|
| 175 | 175 | // 1.0 is the first version to use this option so we must add it. |
| 176 | 176 | $give_version = '1.0'; |
| 177 | - add_option( 'give_version', $give_version ); |
|
| 177 | + add_option('give_version', $give_version); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - update_option( 'give_version', GIVE_VERSION ); |
|
| 181 | - delete_option( 'give_doing_upgrade' ); |
|
| 180 | + update_option('give_version', GIVE_VERSION); |
|
| 181 | + delete_option('give_doing_upgrade'); |
|
| 182 | 182 | |
| 183 | - if ( DOING_AJAX ) { |
|
| 184 | - die( 'complete' ); |
|
| 183 | + if (DOING_AJAX) { |
|
| 184 | + die('complete'); |
|
| 185 | 185 | } // End if(). |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | -add_action( 'wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades' ); |
|
| 188 | +add_action('wp_ajax_give_trigger_upgrades', 'give_trigger_upgrades'); |
|
| 189 | 189 | |
| 190 | 190 | /** |
| 191 | 191 | * Check if the upgrade routine has been run for a specific action |
@@ -196,15 +196,15 @@ discard block |
||
| 196 | 196 | * |
| 197 | 197 | * @return bool If the action has been added to the completed actions array |
| 198 | 198 | */ |
| 199 | -function give_has_upgrade_completed( $upgrade_action = '' ) { |
|
| 199 | +function give_has_upgrade_completed($upgrade_action = '') { |
|
| 200 | 200 | |
| 201 | - if ( empty( $upgrade_action ) ) { |
|
| 201 | + if (empty($upgrade_action)) { |
|
| 202 | 202 | return false; |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | $completed_upgrades = give_get_completed_upgrades(); |
| 206 | 206 | |
| 207 | - return in_array( $upgrade_action, $completed_upgrades ); |
|
| 207 | + return in_array($upgrade_action, $completed_upgrades); |
|
| 208 | 208 | |
| 209 | 209 | } |
| 210 | 210 | |
@@ -216,8 +216,8 @@ discard block |
||
| 216 | 216 | * @return mixed When nothing to resume returns false, otherwise starts the upgrade where it left off |
| 217 | 217 | */ |
| 218 | 218 | function give_maybe_resume_upgrade() { |
| 219 | - $doing_upgrade = get_option( 'give_doing_upgrade', false ); |
|
| 220 | - if ( empty( $doing_upgrade ) ) { |
|
| 219 | + $doing_upgrade = get_option('give_doing_upgrade', false); |
|
| 220 | + if (empty($doing_upgrade)) { |
|
| 221 | 221 | return false; |
| 222 | 222 | } |
| 223 | 223 | |
@@ -233,9 +233,9 @@ discard block |
||
| 233 | 233 | * |
| 234 | 234 | * @return bool If the function was successfully added |
| 235 | 235 | */ |
| 236 | -function give_set_upgrade_complete( $upgrade_action = '' ) { |
|
| 236 | +function give_set_upgrade_complete($upgrade_action = '') { |
|
| 237 | 237 | |
| 238 | - if ( empty( $upgrade_action ) ) { |
|
| 238 | + if (empty($upgrade_action)) { |
|
| 239 | 239 | return false; |
| 240 | 240 | } |
| 241 | 241 | |
@@ -243,9 +243,9 @@ discard block |
||
| 243 | 243 | $completed_upgrades[] = $upgrade_action; |
| 244 | 244 | |
| 245 | 245 | // Remove any blanks, and only show uniques. |
| 246 | - $completed_upgrades = array_unique( array_values( $completed_upgrades ) ); |
|
| 246 | + $completed_upgrades = array_unique(array_values($completed_upgrades)); |
|
| 247 | 247 | |
| 248 | - return update_option( 'give_completed_upgrades', $completed_upgrades ); |
|
| 248 | + return update_option('give_completed_upgrades', $completed_upgrades); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /** |
@@ -256,9 +256,9 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | function give_get_completed_upgrades() { |
| 258 | 258 | |
| 259 | - $completed_upgrades = get_option( 'give_completed_upgrades' ); |
|
| 259 | + $completed_upgrades = get_option('give_completed_upgrades'); |
|
| 260 | 260 | |
| 261 | - if ( false === $completed_upgrades ) { |
|
| 261 | + if (false === $completed_upgrades) { |
|
| 262 | 262 | $completed_upgrades = array(); |
| 263 | 263 | } |
| 264 | 264 | |
@@ -275,31 +275,31 @@ discard block |
||
| 275 | 275 | */ |
| 276 | 276 | function give_v132_upgrade_give_payment_customer_id() { |
| 277 | 277 | global $wpdb; |
| 278 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 279 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
| 278 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 279 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
| 280 | 280 | 'response' => 403, |
| 281 | - ) ); |
|
| 281 | + )); |
|
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - ignore_user_abort( true ); |
|
| 284 | + ignore_user_abort(true); |
|
| 285 | 285 | |
| 286 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 287 | - @set_time_limit( 0 ); |
|
| 286 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 287 | + @set_time_limit(0); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | // UPDATE DB METAKEYS. |
| 291 | 291 | $sql = "UPDATE $wpdb->postmeta SET meta_key = '_give_payment_customer_id' WHERE meta_key = '_give_payment_donor_id'"; |
| 292 | - $query = $wpdb->query( $sql ); |
|
| 292 | + $query = $wpdb->query($sql); |
|
| 293 | 293 | |
| 294 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
| 295 | - give_set_upgrade_complete( 'upgrade_give_payment_customer_id' ); |
|
| 296 | - delete_option( 'give_doing_upgrade' ); |
|
| 297 | - wp_redirect( admin_url() ); |
|
| 294 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
| 295 | + give_set_upgrade_complete('upgrade_give_payment_customer_id'); |
|
| 296 | + delete_option('give_doing_upgrade'); |
|
| 297 | + wp_redirect(admin_url()); |
|
| 298 | 298 | exit; |
| 299 | 299 | |
| 300 | 300 | } |
| 301 | 301 | |
| 302 | -add_action( 'give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id' ); |
|
| 302 | +add_action('give_upgrade_give_payment_customer_id', 'give_v132_upgrade_give_payment_customer_id'); |
|
| 303 | 303 | |
| 304 | 304 | /** |
| 305 | 305 | * Upgrades the Offline Status |
@@ -312,16 +312,16 @@ discard block |
||
| 312 | 312 | |
| 313 | 313 | global $wpdb; |
| 314 | 314 | |
| 315 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 316 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
| 315 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 316 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
| 317 | 317 | 'response' => 403, |
| 318 | - ) ); |
|
| 318 | + )); |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - ignore_user_abort( true ); |
|
| 321 | + ignore_user_abort(true); |
|
| 322 | 322 | |
| 323 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 324 | - @set_time_limit( 0 ); |
|
| 323 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 324 | + @set_time_limit(0); |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | // Get abandoned offline payments. |
@@ -331,31 +331,31 @@ discard block |
||
| 331 | 331 | $where .= "AND ( p.post_status = 'abandoned' )"; |
| 332 | 332 | $where .= "AND ( m.meta_key = '_give_payment_gateway' AND m.meta_value = 'offline' )"; |
| 333 | 333 | |
| 334 | - $sql = $select . $join . $where; |
|
| 335 | - $found_payments = $wpdb->get_col( $sql ); |
|
| 334 | + $sql = $select.$join.$where; |
|
| 335 | + $found_payments = $wpdb->get_col($sql); |
|
| 336 | 336 | |
| 337 | - foreach ( $found_payments as $payment ) { |
|
| 337 | + foreach ($found_payments as $payment) { |
|
| 338 | 338 | |
| 339 | 339 | // Only change ones marked abandoned since our release last week because the admin may have marked some abandoned themselves. |
| 340 | - $modified_time = get_post_modified_time( 'U', false, $payment ); |
|
| 340 | + $modified_time = get_post_modified_time('U', false, $payment); |
|
| 341 | 341 | |
| 342 | 342 | // 1450124863 = 12/10/2015 20:42:25. |
| 343 | - if ( $modified_time >= 1450124863 ) { |
|
| 343 | + if ($modified_time >= 1450124863) { |
|
| 344 | 344 | |
| 345 | - give_update_payment_status( $payment, 'pending' ); |
|
| 345 | + give_update_payment_status($payment, 'pending'); |
|
| 346 | 346 | |
| 347 | 347 | } |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
| 351 | - give_set_upgrade_complete( 'upgrade_give_offline_status' ); |
|
| 352 | - delete_option( 'give_doing_upgrade' ); |
|
| 353 | - wp_redirect( admin_url() ); |
|
| 350 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
| 351 | + give_set_upgrade_complete('upgrade_give_offline_status'); |
|
| 352 | + delete_option('give_doing_upgrade'); |
|
| 353 | + wp_redirect(admin_url()); |
|
| 354 | 354 | exit; |
| 355 | 355 | |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | -add_action( 'give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status' ); |
|
| 358 | +add_action('give_upgrade_give_offline_status', 'give_v134_upgrade_give_offline_status'); |
|
| 359 | 359 | |
| 360 | 360 | /** |
| 361 | 361 | * Cleanup User Roles |
@@ -366,17 +366,17 @@ discard block |
||
| 366 | 366 | */ |
| 367 | 367 | function give_v152_cleanup_users() { |
| 368 | 368 | |
| 369 | - $give_version = get_option( 'give_version' ); |
|
| 369 | + $give_version = get_option('give_version'); |
|
| 370 | 370 | |
| 371 | - if ( ! $give_version ) { |
|
| 371 | + if ( ! $give_version) { |
|
| 372 | 372 | // 1.0 is the first version to use this option so we must add it. |
| 373 | 373 | $give_version = '1.0'; |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | - $give_version = preg_replace( '/[^0-9.].*/', '', $give_version ); |
|
| 376 | + $give_version = preg_replace('/[^0-9.].*/', '', $give_version); |
|
| 377 | 377 | |
| 378 | 378 | // v1.5.2 Upgrades |
| 379 | - if ( version_compare( $give_version, '1.5.2', '<' ) || ! give_has_upgrade_completed( 'upgrade_give_user_caps_cleanup' ) ) { |
|
| 379 | + if (version_compare($give_version, '1.5.2', '<') || ! give_has_upgrade_completed('upgrade_give_user_caps_cleanup')) { |
|
| 380 | 380 | |
| 381 | 381 | // Delete all caps with "ss". |
| 382 | 382 | // Also delete all unused "campaign" roles. |
@@ -423,9 +423,9 @@ discard block |
||
| 423 | 423 | ); |
| 424 | 424 | |
| 425 | 425 | global $wp_roles; |
| 426 | - foreach ( $delete_caps as $cap ) { |
|
| 427 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
| 428 | - $wp_roles->remove_cap( $role, $cap ); |
|
| 426 | + foreach ($delete_caps as $cap) { |
|
| 427 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
| 428 | + $wp_roles->remove_cap($role, $cap); |
|
| 429 | 429 | } |
| 430 | 430 | } |
| 431 | 431 | |
@@ -435,15 +435,15 @@ discard block |
||
| 435 | 435 | $roles->add_caps(); |
| 436 | 436 | |
| 437 | 437 | // The Update Ran. |
| 438 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
| 439 | - give_set_upgrade_complete( 'upgrade_give_user_caps_cleanup' ); |
|
| 440 | - delete_option( 'give_doing_upgrade' ); |
|
| 438 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
| 439 | + give_set_upgrade_complete('upgrade_give_user_caps_cleanup'); |
|
| 440 | + delete_option('give_doing_upgrade'); |
|
| 441 | 441 | |
| 442 | 442 | }// End if(). |
| 443 | 443 | |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | -add_action( 'admin_init', 'give_v152_cleanup_users' ); |
|
| 446 | +add_action('admin_init', 'give_v152_cleanup_users'); |
|
| 447 | 447 | |
| 448 | 448 | /** |
| 449 | 449 | * 1.6 Upgrade routine to create the customer meta table. |
@@ -483,53 +483,53 @@ discard block |
||
| 483 | 483 | |
| 484 | 484 | // Get addons license key. |
| 485 | 485 | $addons = array(); |
| 486 | - foreach ( $give_options as $key => $value ) { |
|
| 487 | - if ( false !== strpos( $key, '_license_key' ) ) { |
|
| 488 | - $addons[ $key ] = $value; |
|
| 486 | + foreach ($give_options as $key => $value) { |
|
| 487 | + if (false !== strpos($key, '_license_key')) { |
|
| 488 | + $addons[$key] = $value; |
|
| 489 | 489 | } |
| 490 | 490 | } |
| 491 | 491 | |
| 492 | 492 | // Bailout: We do not have any addon license data to upgrade. |
| 493 | - if ( empty( $addons ) ) { |
|
| 493 | + if (empty($addons)) { |
|
| 494 | 494 | return false; |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | - foreach ( $addons as $key => $addon_license ) { |
|
| 497 | + foreach ($addons as $key => $addon_license) { |
|
| 498 | 498 | |
| 499 | 499 | // Get addon shortname. |
| 500 | - $shortname = str_replace( '_license_key', '', $key ); |
|
| 500 | + $shortname = str_replace('_license_key', '', $key); |
|
| 501 | 501 | |
| 502 | 502 | // Addon license option name. |
| 503 | - $addon_license_option_name = $shortname . '_license_active'; |
|
| 503 | + $addon_license_option_name = $shortname.'_license_active'; |
|
| 504 | 504 | |
| 505 | 505 | // bailout if license is empty. |
| 506 | - if ( empty( $addon_license ) ) { |
|
| 507 | - delete_option( $addon_license_option_name ); |
|
| 506 | + if (empty($addon_license)) { |
|
| 507 | + delete_option($addon_license_option_name); |
|
| 508 | 508 | continue; |
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | // Get addon name. |
| 512 | 512 | $addon_name = array(); |
| 513 | - $addon_name_parts = explode( '_', str_replace( 'give_', '', $shortname ) ); |
|
| 514 | - foreach ( $addon_name_parts as $name_part ) { |
|
| 513 | + $addon_name_parts = explode('_', str_replace('give_', '', $shortname)); |
|
| 514 | + foreach ($addon_name_parts as $name_part) { |
|
| 515 | 515 | |
| 516 | 516 | // Fix addon name |
| 517 | - switch ( $name_part ) { |
|
| 517 | + switch ($name_part) { |
|
| 518 | 518 | case 'authorizenet' : |
| 519 | 519 | $name_part = 'authorize.net'; |
| 520 | 520 | break; |
| 521 | 521 | } |
| 522 | 522 | |
| 523 | - $addon_name[] = ucfirst( $name_part ); |
|
| 523 | + $addon_name[] = ucfirst($name_part); |
|
| 524 | 524 | } |
| 525 | 525 | |
| 526 | - $addon_name = implode( ' ', $addon_name ); |
|
| 526 | + $addon_name = implode(' ', $addon_name); |
|
| 527 | 527 | |
| 528 | 528 | // Data to send to the API |
| 529 | 529 | $api_params = array( |
| 530 | 530 | 'edd_action' => 'activate_license', // never change from "edd_" to "give_"! |
| 531 | 531 | 'license' => $addon_license, |
| 532 | - 'item_name' => urlencode( $addon_name ), |
|
| 532 | + 'item_name' => urlencode($addon_name), |
|
| 533 | 533 | 'url' => home_url(), |
| 534 | 534 | ); |
| 535 | 535 | |
@@ -544,17 +544,17 @@ discard block |
||
| 544 | 544 | ); |
| 545 | 545 | |
| 546 | 546 | // Make sure there are no errors. |
| 547 | - if ( is_wp_error( $response ) ) { |
|
| 548 | - delete_option( $addon_license_option_name ); |
|
| 547 | + if (is_wp_error($response)) { |
|
| 548 | + delete_option($addon_license_option_name); |
|
| 549 | 549 | continue; |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | 552 | // Tell WordPress to look for updates. |
| 553 | - set_site_transient( 'update_plugins', null ); |
|
| 553 | + set_site_transient('update_plugins', null); |
|
| 554 | 554 | |
| 555 | 555 | // Decode license data. |
| 556 | - $license_data = json_decode( wp_remote_retrieve_body( $response ) ); |
|
| 557 | - update_option( $addon_license_option_name, $license_data ); |
|
| 556 | + $license_data = json_decode(wp_remote_retrieve_body($response)); |
|
| 557 | + update_option($addon_license_option_name, $license_data); |
|
| 558 | 558 | }// End foreach(). |
| 559 | 559 | } |
| 560 | 560 | |
@@ -584,9 +584,9 @@ discard block |
||
| 584 | 584 | ); |
| 585 | 585 | |
| 586 | 586 | global $wp_roles; |
| 587 | - foreach ( $delete_caps as $cap ) { |
|
| 588 | - foreach ( array_keys( $wp_roles->roles ) as $role ) { |
|
| 589 | - $wp_roles->remove_cap( $role, $cap ); |
|
| 587 | + foreach ($delete_caps as $cap) { |
|
| 588 | + foreach (array_keys($wp_roles->roles) as $role) { |
|
| 589 | + $wp_roles->remove_cap($role, $cap); |
|
| 590 | 590 | } |
| 591 | 591 | } |
| 592 | 592 | |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | function give_v18_upgrades_core_setting() { |
| 621 | 621 | // Core settings which changes from checkbox to radio. |
| 622 | 622 | $core_setting_names = array_merge( |
| 623 | - array_keys( give_v18_renamed_core_settings() ), |
|
| 623 | + array_keys(give_v18_renamed_core_settings()), |
|
| 624 | 624 | array( |
| 625 | 625 | 'uninstall_on_delete', |
| 626 | 626 | 'scripts_footer', |
@@ -632,48 +632,48 @@ discard block |
||
| 632 | 632 | ); |
| 633 | 633 | |
| 634 | 634 | // Bailout: If not any setting define. |
| 635 | - if ( $give_settings = get_option( 'give_settings' ) ) { |
|
| 635 | + if ($give_settings = get_option('give_settings')) { |
|
| 636 | 636 | |
| 637 | 637 | $setting_changed = false; |
| 638 | 638 | |
| 639 | 639 | // Loop: check each setting field. |
| 640 | - foreach ( $core_setting_names as $setting_name ) { |
|
| 640 | + foreach ($core_setting_names as $setting_name) { |
|
| 641 | 641 | // New setting name. |
| 642 | - $new_setting_name = preg_replace( '/^(enable_|disable_)/', '', $setting_name ); |
|
| 642 | + $new_setting_name = preg_replace('/^(enable_|disable_)/', '', $setting_name); |
|
| 643 | 643 | |
| 644 | 644 | // Continue: If setting already set. |
| 645 | 645 | if ( |
| 646 | - array_key_exists( $new_setting_name, $give_settings ) |
|
| 647 | - && in_array( $give_settings[ $new_setting_name ], array( 'enabled', 'disabled' ) ) |
|
| 646 | + array_key_exists($new_setting_name, $give_settings) |
|
| 647 | + && in_array($give_settings[$new_setting_name], array('enabled', 'disabled')) |
|
| 648 | 648 | ) { |
| 649 | 649 | continue; |
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | // Set checkbox value to radio value. |
| 653 | - $give_settings[ $setting_name ] = ( ! empty( $give_settings[ $setting_name ] ) && 'on' === $give_settings[ $setting_name ] ? 'enabled' : 'disabled' ); |
|
| 653 | + $give_settings[$setting_name] = ( ! empty($give_settings[$setting_name]) && 'on' === $give_settings[$setting_name] ? 'enabled' : 'disabled'); |
|
| 654 | 654 | |
| 655 | 655 | // @see https://github.com/WordImpress/Give/issues/1063 |
| 656 | - if ( false !== strpos( $setting_name, 'disable_' ) ) { |
|
| 656 | + if (false !== strpos($setting_name, 'disable_')) { |
|
| 657 | 657 | |
| 658 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'disabled' : 'enabled' ); |
|
| 659 | - } elseif ( false !== strpos( $setting_name, 'enable_' ) ) { |
|
| 658 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'disabled' : 'enabled'); |
|
| 659 | + } elseif (false !== strpos($setting_name, 'enable_')) { |
|
| 660 | 660 | |
| 661 | - $give_settings[ $new_setting_name ] = ( give_is_setting_enabled( $give_settings[ $setting_name ] ) ? 'enabled' : 'disabled' ); |
|
| 661 | + $give_settings[$new_setting_name] = (give_is_setting_enabled($give_settings[$setting_name]) ? 'enabled' : 'disabled'); |
|
| 662 | 662 | } |
| 663 | 663 | |
| 664 | 664 | // Tell bot to update core setting to db. |
| 665 | - if ( ! $setting_changed ) { |
|
| 665 | + if ( ! $setting_changed) { |
|
| 666 | 666 | $setting_changed = true; |
| 667 | 667 | } |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | // Update setting only if they changed. |
| 671 | - if ( $setting_changed ) { |
|
| 672 | - update_option( 'give_settings', $give_settings ); |
|
| 671 | + if ($setting_changed) { |
|
| 672 | + update_option('give_settings', $give_settings); |
|
| 673 | 673 | } |
| 674 | 674 | }// End if(). |
| 675 | 675 | |
| 676 | - give_set_upgrade_complete( 'v18_upgrades_core_setting' ); |
|
| 676 | + give_set_upgrade_complete('v18_upgrades_core_setting'); |
|
| 677 | 677 | } |
| 678 | 678 | |
| 679 | 679 | /** |
@@ -683,22 +683,22 @@ discard block |
||
| 683 | 683 | * @return void |
| 684 | 684 | */ |
| 685 | 685 | function give_v18_upgrades_form_metadata() { |
| 686 | - if ( ! current_user_can( 'manage_give_settings' ) ) { |
|
| 687 | - wp_die( esc_html__( 'You do not have permission to do Give upgrades.', 'give' ), esc_html__( 'Error', 'give' ), array( |
|
| 686 | + if ( ! current_user_can('manage_give_settings')) { |
|
| 687 | + wp_die(esc_html__('You do not have permission to do Give upgrades.', 'give'), esc_html__('Error', 'give'), array( |
|
| 688 | 688 | 'response' => 403, |
| 689 | - ) ); |
|
| 689 | + )); |
|
| 690 | 690 | } |
| 691 | 691 | |
| 692 | - ignore_user_abort( true ); |
|
| 692 | + ignore_user_abort(true); |
|
| 693 | 693 | |
| 694 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
| 695 | - @set_time_limit( 0 ); |
|
| 694 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
| 695 | + @set_time_limit(0); |
|
| 696 | 696 | } |
| 697 | 697 | |
| 698 | - $step = isset( $_GET['step'] ) ? absint( $_GET['step'] ) : 1; |
|
| 698 | + $step = isset($_GET['step']) ? absint($_GET['step']) : 1; |
|
| 699 | 699 | |
| 700 | 700 | // form query |
| 701 | - $forms = new WP_Query( array( |
|
| 701 | + $forms = new WP_Query(array( |
|
| 702 | 702 | 'paged' => $step, |
| 703 | 703 | 'status' => 'any', |
| 704 | 704 | 'order' => 'ASC', |
@@ -707,39 +707,39 @@ discard block |
||
| 707 | 707 | ) |
| 708 | 708 | ); |
| 709 | 709 | |
| 710 | - if ( $forms->have_posts() ) { |
|
| 711 | - while ( $forms->have_posts() ) { |
|
| 710 | + if ($forms->have_posts()) { |
|
| 711 | + while ($forms->have_posts()) { |
|
| 712 | 712 | $forms->the_post(); |
| 713 | 713 | |
| 714 | 714 | // Form content. |
| 715 | 715 | // Note in version 1.8 display content setting split into display content and content placement setting. |
| 716 | 716 | // You can delete _give_content_option in future |
| 717 | - $show_content = get_post_meta( get_the_ID(), '_give_content_option', true ); |
|
| 718 | - if ( $show_content && ! get_post_meta( get_the_ID(), '_give_display_content', true ) ) { |
|
| 719 | - $field_value = ( 'none' !== $show_content ? 'enabled' : 'disabled' ); |
|
| 720 | - update_post_meta( get_the_ID(), '_give_display_content', $field_value ); |
|
| 717 | + $show_content = get_post_meta(get_the_ID(), '_give_content_option', true); |
|
| 718 | + if ($show_content && ! get_post_meta(get_the_ID(), '_give_display_content', true)) { |
|
| 719 | + $field_value = ('none' !== $show_content ? 'enabled' : 'disabled'); |
|
| 720 | + update_post_meta(get_the_ID(), '_give_display_content', $field_value); |
|
| 721 | 721 | |
| 722 | - $field_value = ( 'none' !== $show_content ? $show_content : 'give_pre_form' ); |
|
| 723 | - update_post_meta( get_the_ID(), '_give_content_placement', $field_value ); |
|
| 722 | + $field_value = ('none' !== $show_content ? $show_content : 'give_pre_form'); |
|
| 723 | + update_post_meta(get_the_ID(), '_give_content_placement', $field_value); |
|
| 724 | 724 | } |
| 725 | 725 | |
| 726 | 726 | // "Disable" Guest Donation. Checkbox |
| 727 | 727 | // See: https://github.com/WordImpress/Give/issues/1470 |
| 728 | - $guest_donation = get_post_meta( get_the_ID(), '_give_logged_in_only', true ); |
|
| 729 | - $guest_donation_newval = ( in_array( $guest_donation, array( 'yes', 'on' ) ) ? 'disabled' : 'enabled' ); |
|
| 730 | - update_post_meta( get_the_ID(), '_give_logged_in_only', $guest_donation_newval ); |
|
| 728 | + $guest_donation = get_post_meta(get_the_ID(), '_give_logged_in_only', true); |
|
| 729 | + $guest_donation_newval = (in_array($guest_donation, array('yes', 'on')) ? 'disabled' : 'enabled'); |
|
| 730 | + update_post_meta(get_the_ID(), '_give_logged_in_only', $guest_donation_newval); |
|
| 731 | 731 | |
| 732 | 732 | // Offline Donations |
| 733 | 733 | // See: https://github.com/WordImpress/Give/issues/1579 |
| 734 | - $offline_donation = get_post_meta( get_the_ID(), '_give_customize_offline_donations', true ); |
|
| 735 | - if ( 'no' === $offline_donation ) { |
|
| 734 | + $offline_donation = get_post_meta(get_the_ID(), '_give_customize_offline_donations', true); |
|
| 735 | + if ('no' === $offline_donation) { |
|
| 736 | 736 | $offline_donation_newval = 'global'; |
| 737 | - } elseif ( 'yes' === $offline_donation ) { |
|
| 737 | + } elseif ('yes' === $offline_donation) { |
|
| 738 | 738 | $offline_donation_newval = 'enabled'; |
| 739 | 739 | } else { |
| 740 | 740 | $offline_donation_newval = 'disabled'; |
| 741 | 741 | } |
| 742 | - update_post_meta( get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval ); |
|
| 742 | + update_post_meta(get_the_ID(), '_give_customize_offline_donations', $offline_donation_newval); |
|
| 743 | 743 | |
| 744 | 744 | // Convert yes/no setting field to enabled/disabled. |
| 745 | 745 | $form_radio_settings = array( |
@@ -759,15 +759,15 @@ discard block |
||
| 759 | 759 | '_give_offline_donation_enable_billing_fields_single', |
| 760 | 760 | ); |
| 761 | 761 | |
| 762 | - foreach ( $form_radio_settings as $meta_key ) { |
|
| 762 | + foreach ($form_radio_settings as $meta_key) { |
|
| 763 | 763 | // Get value. |
| 764 | - $field_value = get_post_meta( get_the_ID(), $meta_key, true ); |
|
| 764 | + $field_value = get_post_meta(get_the_ID(), $meta_key, true); |
|
| 765 | 765 | |
| 766 | 766 | // Convert meta value only if it is in yes/no/none. |
| 767 | - if ( in_array( $field_value, array( 'yes', 'on', 'no', 'none' ) ) ) { |
|
| 767 | + if (in_array($field_value, array('yes', 'on', 'no', 'none'))) { |
|
| 768 | 768 | |
| 769 | - $field_value = ( in_array( $field_value, array( 'yes', 'on' ) ) ? 'enabled' : 'disabled' ); |
|
| 770 | - update_post_meta( get_the_ID(), $meta_key, $field_value ); |
|
| 769 | + $field_value = (in_array($field_value, array('yes', 'on')) ? 'enabled' : 'disabled'); |
|
| 770 | + update_post_meta(get_the_ID(), $meta_key, $field_value); |
|
| 771 | 771 | } |
| 772 | 772 | } |
| 773 | 773 | }// End while(). |
@@ -775,27 +775,27 @@ discard block |
||
| 775 | 775 | wp_reset_postdata(); |
| 776 | 776 | |
| 777 | 777 | // Forms found so upgrade them |
| 778 | - $step ++; |
|
| 779 | - $redirect = add_query_arg( array( |
|
| 778 | + $step++; |
|
| 779 | + $redirect = add_query_arg(array( |
|
| 780 | 780 | 'page' => 'give-upgrades', |
| 781 | 781 | 'give-upgrade' => 'give_v18_upgrades_form_metadata', |
| 782 | 782 | 'step' => $step, |
| 783 | - ), admin_url( 'index.php' ) ); |
|
| 784 | - wp_redirect( $redirect ); |
|
| 783 | + ), admin_url('index.php')); |
|
| 784 | + wp_redirect($redirect); |
|
| 785 | 785 | exit(); |
| 786 | 786 | |
| 787 | 787 | } else { |
| 788 | 788 | // No more forms found, finish up. |
| 789 | - update_option( 'give_version', preg_replace( '/[^0-9.].*/', '', GIVE_VERSION ) ); |
|
| 790 | - delete_option( 'give_doing_upgrade' ); |
|
| 791 | - give_set_upgrade_complete( 'v18_upgrades_form_metadata' ); |
|
| 789 | + update_option('give_version', preg_replace('/[^0-9.].*/', '', GIVE_VERSION)); |
|
| 790 | + delete_option('give_doing_upgrade'); |
|
| 791 | + give_set_upgrade_complete('v18_upgrades_form_metadata'); |
|
| 792 | 792 | |
| 793 | - wp_redirect( admin_url() ); |
|
| 793 | + wp_redirect(admin_url()); |
|
| 794 | 794 | exit; |
| 795 | 795 | } |
| 796 | 796 | } |
| 797 | 797 | |
| 798 | -add_action( 'give_give_v18_upgrades_form_metadata', 'give_v18_upgrades_form_metadata' ); |
|
| 798 | +add_action('give_give_v18_upgrades_form_metadata', 'give_v18_upgrades_form_metadata'); |
|
| 799 | 799 | |
| 800 | 800 | /** |
| 801 | 801 | * Get list of core setting renamed in version 1.8. |
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if ( ! class_exists( 'Give_Admin_Settings' ) ) : |
|
| 16 | +if ( ! class_exists('Give_Admin_Settings')) : |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Give_Admin_Settings Class. |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @param array $settings Array of settings class object. |
| 74 | 74 | */ |
| 75 | - self::$settings = apply_filters( self::$setting_filter_prefix . '_get_settings_pages', array() ); |
|
| 75 | + self::$settings = apply_filters(self::$setting_filter_prefix.'_get_settings_pages', array()); |
|
| 76 | 76 | |
| 77 | 77 | return self::$settings; |
| 78 | 78 | } |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | public static function save() { |
| 87 | 87 | $current_tab = give_get_current_setting_tab(); |
| 88 | 88 | |
| 89 | - if ( empty( $_REQUEST['_give-save-settings'] ) || ! wp_verify_nonce( $_REQUEST['_give-save-settings'], 'give-save-settings' ) ) { |
|
| 90 | - die( __( 'Action failed. Please refresh the page and retry.', 'give' ) ); |
|
| 89 | + if (empty($_REQUEST['_give-save-settings']) || ! wp_verify_nonce($_REQUEST['_give-save-settings'], 'give-save-settings')) { |
|
| 90 | + die(__('Action failed. Please refresh the page and retry.', 'give')); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | * |
| 100 | 100 | * @since 1.8 |
| 101 | 101 | */ |
| 102 | - do_action( self::$setting_filter_prefix . '_save_' . $current_tab ); |
|
| 102 | + do_action(self::$setting_filter_prefix.'_save_'.$current_tab); |
|
| 103 | 103 | |
| 104 | - self::add_message( 'give-setting-updated', __( 'Your settings have been saved.', 'give' ) ); |
|
| 104 | + self::add_message('give-setting-updated', __('Your settings have been saved.', 'give')); |
|
| 105 | 105 | |
| 106 | 106 | /** |
| 107 | 107 | * Trigger Action. |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * |
| 113 | 113 | * @since 1.8 |
| 114 | 114 | */ |
| 115 | - do_action( self::$setting_filter_prefix . '_saved' ); |
|
| 115 | + do_action(self::$setting_filter_prefix.'_saved'); |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | /** |
@@ -125,8 +125,8 @@ discard block |
||
| 125 | 125 | * |
| 126 | 126 | * @return void |
| 127 | 127 | */ |
| 128 | - public static function add_message( $code, $message ) { |
|
| 129 | - self::$messages[ $code ] = $message; |
|
| 128 | + public static function add_message($code, $message) { |
|
| 129 | + self::$messages[$code] = $message; |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | /** |
@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | * |
| 140 | 140 | * @return void |
| 141 | 141 | */ |
| 142 | - public static function add_error( $code, $message ) { |
|
| 143 | - self::$errors[ $code ] = $message; |
|
| 142 | + public static function add_error($code, $message) { |
|
| 143 | + self::$errors[$code] = $message; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -153,18 +153,18 @@ discard block |
||
| 153 | 153 | $notice_html = ''; |
| 154 | 154 | $classes = 'give-notice settings-error notice is-dismissible'; |
| 155 | 155 | |
| 156 | - self::$errors = apply_filters( self::$setting_filter_prefix . '_error_notices', self::$errors ); |
|
| 157 | - self::$messages = apply_filters( self::$setting_filter_prefix . '_update_notices', self::$messages ); |
|
| 156 | + self::$errors = apply_filters(self::$setting_filter_prefix.'_error_notices', self::$errors); |
|
| 157 | + self::$messages = apply_filters(self::$setting_filter_prefix.'_update_notices', self::$messages); |
|
| 158 | 158 | |
| 159 | - if ( 0 < count( self::$errors ) ) { |
|
| 160 | - foreach ( self::$errors as $code => $message ) { |
|
| 161 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' error"><p><strong>' . $message . '</strong></p></div>'; |
|
| 159 | + if (0 < count(self::$errors)) { |
|
| 160 | + foreach (self::$errors as $code => $message) { |
|
| 161 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' error"><p><strong>'.$message.'</strong></p></div>'; |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - if ( 0 < count( self::$messages ) ) { |
|
| 166 | - foreach ( self::$messages as $code => $message ) { |
|
| 167 | - $notice_html .= '<div id="setting-error-' . $code . '" class="' . $classes . ' updated"><p><strong>' . $message . '</strong></p></div>'; |
|
| 165 | + if (0 < count(self::$messages)) { |
|
| 166 | + foreach (self::$messages as $code => $message) { |
|
| 167 | + $notice_html .= '<div id="setting-error-'.$code.'" class="'.$classes.' updated"><p><strong>'.$message.'</strong></p></div>'; |
|
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | self::$setting_filter_prefix = give_get_current_setting_page(); |
| 185 | 185 | |
| 186 | 186 | // Bailout: Exit if setting page is not defined. |
| 187 | - if ( empty( self::$setting_filter_prefix ) ) { |
|
| 187 | + if (empty(self::$setting_filter_prefix)) { |
|
| 188 | 188 | return false; |
| 189 | 189 | } |
| 190 | 190 | |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * |
| 198 | 198 | * @since 1.8 |
| 199 | 199 | */ |
| 200 | - do_action( self::$setting_filter_prefix . '_start' ); |
|
| 200 | + do_action(self::$setting_filter_prefix.'_start'); |
|
| 201 | 201 | |
| 202 | 202 | $current_tab = give_get_current_setting_tab(); |
| 203 | 203 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | self::get_settings_pages(); |
| 206 | 206 | |
| 207 | 207 | // Save settings if data has been posted. |
| 208 | - if ( ! empty( $_POST ) ) { |
|
| 208 | + if ( ! empty($_POST)) { |
|
| 209 | 209 | self::save(); |
| 210 | 210 | } |
| 211 | 211 | |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * |
| 219 | 219 | * @since 1.8 |
| 220 | 220 | */ |
| 221 | - $tabs = apply_filters( self::$setting_filter_prefix . '_tabs_array', array() ); |
|
| 221 | + $tabs = apply_filters(self::$setting_filter_prefix.'_tabs_array', array()); |
|
| 222 | 222 | |
| 223 | 223 | include 'views/html-admin-settings.php'; |
| 224 | 224 | |
@@ -236,25 +236,25 @@ discard block |
||
| 236 | 236 | * |
| 237 | 237 | * @return string|bool |
| 238 | 238 | */ |
| 239 | - public static function get_option( $option_name = '', $field_id = '', $default = false ) { |
|
| 239 | + public static function get_option($option_name = '', $field_id = '', $default = false) { |
|
| 240 | 240 | // Bailout. |
| 241 | - if ( empty( $option_name ) && empty( $field_id ) ) { |
|
| 241 | + if (empty($option_name) && empty($field_id)) { |
|
| 242 | 242 | return false; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - if ( ! empty( $field_id ) && ! empty( $option_name ) ) { |
|
| 245 | + if ( ! empty($field_id) && ! empty($option_name)) { |
|
| 246 | 246 | // Get field value if any. |
| 247 | - $option_value = get_option( $option_name ); |
|
| 247 | + $option_value = get_option($option_name); |
|
| 248 | 248 | |
| 249 | - $option_value = ( is_array( $option_value ) && array_key_exists( $field_id, $option_value ) ) |
|
| 250 | - ? $option_value[ $field_id ] |
|
| 249 | + $option_value = (is_array($option_value) && array_key_exists($field_id, $option_value)) |
|
| 250 | + ? $option_value[$field_id] |
|
| 251 | 251 | : $default; |
| 252 | 252 | } else { |
| 253 | 253 | // If option name is empty but not field name then this means, setting is direct store to option table under there field name. |
| 254 | 254 | $option_name = ! $option_name ? $field_id : $option_name; |
| 255 | 255 | |
| 256 | 256 | // Get option value if any. |
| 257 | - $option_value = get_option( $option_name, $default ); |
|
| 257 | + $option_value = get_option($option_name, $default); |
|
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | return $option_value; |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | * |
| 273 | 273 | * @return void |
| 274 | 274 | */ |
| 275 | - public static function output_fields( $options, $option_name = '' ) { |
|
| 275 | + public static function output_fields($options, $option_name = '') { |
|
| 276 | 276 | $current_tab = give_get_current_setting_tab(); |
| 277 | 277 | |
| 278 | 278 | // Field Default values. |
@@ -285,52 +285,52 @@ discard block |
||
| 285 | 285 | 'table_html' => true, |
| 286 | 286 | ); |
| 287 | 287 | |
| 288 | - foreach ( $options as $value ) { |
|
| 289 | - if ( ! isset( $value['type'] ) ) { |
|
| 288 | + foreach ($options as $value) { |
|
| 289 | + if ( ! isset($value['type'])) { |
|
| 290 | 290 | continue; |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | // Set title. |
| 294 | - $defaults['title'] = isset( $value['name'] ) ? $value['name'] : ''; |
|
| 294 | + $defaults['title'] = isset($value['name']) ? $value['name'] : ''; |
|
| 295 | 295 | |
| 296 | 296 | // Set default setting. |
| 297 | - $value = wp_parse_args( $value, $defaults ); |
|
| 297 | + $value = wp_parse_args($value, $defaults); |
|
| 298 | 298 | |
| 299 | 299 | // Colorpicker field. |
| 300 | - $value['class'] = ( 'colorpicker' === $value['type'] ? trim( $value['class'] ) . ' give-colorpicker' : $value['class'] ); |
|
| 301 | - $value['type'] = ( 'colorpicker' === $value['type'] ? 'text' : $value['type'] ); |
|
| 300 | + $value['class'] = ('colorpicker' === $value['type'] ? trim($value['class']).' give-colorpicker' : $value['class']); |
|
| 301 | + $value['type'] = ('colorpicker' === $value['type'] ? 'text' : $value['type']); |
|
| 302 | 302 | |
| 303 | 303 | |
| 304 | 304 | // Custom attribute handling. |
| 305 | 305 | $custom_attributes = array(); |
| 306 | 306 | |
| 307 | - if ( ! empty( $value['attributes'] ) && is_array( $value['attributes'] ) ) { |
|
| 308 | - foreach ( $value['attributes'] as $attribute => $attribute_value ) { |
|
| 309 | - $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; |
|
| 307 | + if ( ! empty($value['attributes']) && is_array($value['attributes'])) { |
|
| 308 | + foreach ($value['attributes'] as $attribute => $attribute_value) { |
|
| 309 | + $custom_attributes[] = esc_attr($attribute).'="'.esc_attr($attribute_value).'"'; |
|
| 310 | 310 | } |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | // Description handling. |
| 314 | - $description = self::get_field_description( $value ); |
|
| 314 | + $description = self::get_field_description($value); |
|
| 315 | 315 | |
| 316 | 316 | // Switch based on type. |
| 317 | - switch ( $value['type'] ) { |
|
| 317 | + switch ($value['type']) { |
|
| 318 | 318 | |
| 319 | 319 | // Section Titles |
| 320 | 320 | case 'title': |
| 321 | - if ( ! empty( $value['title'] ) ) { |
|
| 322 | - echo '<div class="give-setting-tab-header give-setting-tab-header-' . $current_tab . '"><h2>' . self::get_field_title( $value ) . '</h2><hr></div>'; |
|
| 321 | + if ( ! empty($value['title'])) { |
|
| 322 | + echo '<div class="give-setting-tab-header give-setting-tab-header-'.$current_tab.'"><h2>'.self::get_field_title($value).'</h2><hr></div>'; |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - if ( ! empty( $value['desc'] ) ) { |
|
| 326 | - echo wpautop( wptexturize( wp_kses_post( $value['desc'] ) ) ); |
|
| 325 | + if ( ! empty($value['desc'])) { |
|
| 326 | + echo wpautop(wptexturize(wp_kses_post($value['desc']))); |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - if ( $value['table_html'] ) { |
|
| 330 | - echo '<table class="form-table give-setting-tab-body give-setting-tab-body-' . $current_tab . '">' . "\n\n"; |
|
| 329 | + if ($value['table_html']) { |
|
| 330 | + echo '<table class="form-table give-setting-tab-body give-setting-tab-body-'.$current_tab.'">'."\n\n"; |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | - if ( ! empty( $value['id'] ) ) { |
|
| 333 | + if ( ! empty($value['id'])) { |
|
| 334 | 334 | |
| 335 | 335 | /** |
| 336 | 336 | * Trigger Action. |
@@ -339,14 +339,14 @@ discard block |
||
| 339 | 339 | * |
| 340 | 340 | * @since 1.8 |
| 341 | 341 | */ |
| 342 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) ); |
|
| 342 | + do_action('give_settings_'.sanitize_title($value['id'])); |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | break; |
| 346 | 346 | |
| 347 | 347 | // Section Ends. |
| 348 | 348 | case 'sectionend': |
| 349 | - if ( ! empty( $value['id'] ) ) { |
|
| 349 | + if ( ! empty($value['id'])) { |
|
| 350 | 350 | |
| 351 | 351 | /** |
| 352 | 352 | * Trigger Action. |
@@ -355,14 +355,14 @@ discard block |
||
| 355 | 355 | * |
| 356 | 356 | * @since 1.8 |
| 357 | 357 | */ |
| 358 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_end' ); |
|
| 358 | + do_action('give_settings_'.sanitize_title($value['id']).'_end'); |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | - if ( $value['table_html'] ) { |
|
| 361 | + if ($value['table_html']) { |
|
| 362 | 362 | echo '</table>'; |
| 363 | 363 | } |
| 364 | 364 | |
| 365 | - if ( ! empty( $value['id'] ) ) { |
|
| 365 | + if ( ! empty($value['id'])) { |
|
| 366 | 366 | |
| 367 | 367 | /** |
| 368 | 368 | * Trigger Action. |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | * |
| 372 | 372 | * @since 1.8 |
| 373 | 373 | */ |
| 374 | - do_action( 'give_settings_' . sanitize_title( $value['id'] ) . '_after' ); |
|
| 374 | + do_action('give_settings_'.sanitize_title($value['id']).'_after'); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | break; |
@@ -384,22 +384,22 @@ discard block |
||
| 384 | 384 | case 'password' : |
| 385 | 385 | |
| 386 | 386 | $type = $value['type']; |
| 387 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 387 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 388 | 388 | |
| 389 | 389 | ?> |
| 390 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 390 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 391 | 391 | <th scope="row" class="titledesc"> |
| 392 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 392 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 393 | 393 | </th> |
| 394 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
| 394 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
| 395 | 395 | <input |
| 396 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 397 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 398 | - type="<?php echo esc_attr( $type ); ?>" |
|
| 399 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 400 | - value="<?php echo esc_attr( $option_value ); ?>" |
|
| 401 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
| 402 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 396 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 397 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 398 | + type="<?php echo esc_attr($type); ?>" |
|
| 399 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 400 | + value="<?php echo esc_attr($option_value); ?>" |
|
| 401 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
| 402 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 403 | 403 | /> <?php echo $description; ?> |
| 404 | 404 | </td> |
| 405 | 405 | </tr><?php |
@@ -408,23 +408,23 @@ discard block |
||
| 408 | 408 | // Textarea. |
| 409 | 409 | case 'textarea': |
| 410 | 410 | |
| 411 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 411 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 412 | 412 | |
| 413 | 413 | ?> |
| 414 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 414 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 415 | 415 | <th scope="row" class="titledesc"> |
| 416 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 416 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 417 | 417 | </th> |
| 418 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
| 418 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
| 419 | 419 | <textarea |
| 420 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 421 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 422 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 423 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
| 420 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 421 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 422 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 423 | + class="<?php echo esc_attr($value['class']); ?>" |
|
| 424 | 424 | rows="10" |
| 425 | 425 | cols="60" |
| 426 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 427 | - ><?php echo esc_textarea( $option_value ); ?></textarea> |
|
| 426 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 427 | + ><?php echo esc_textarea($option_value); ?></textarea> |
|
| 428 | 428 | <?php echo $description; ?> |
| 429 | 429 | </td> |
| 430 | 430 | </tr><?php |
@@ -434,35 +434,35 @@ discard block |
||
| 434 | 434 | case 'select' : |
| 435 | 435 | case 'multiselect' : |
| 436 | 436 | |
| 437 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 437 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 438 | 438 | |
| 439 | 439 | ?> |
| 440 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 440 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 441 | 441 | <th scope="row" class="titledesc"> |
| 442 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 442 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 443 | 443 | </th> |
| 444 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
| 444 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
| 445 | 445 | <select |
| 446 | - name="<?php echo esc_attr( $value['id'] ); ?><?php if ( $value['type'] == 'multiselect' ) { |
|
| 446 | + name="<?php echo esc_attr($value['id']); ?><?php if ($value['type'] == 'multiselect') { |
|
| 447 | 447 | echo '[]'; |
| 448 | 448 | } ?>" |
| 449 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 450 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 451 | - class="<?php echo esc_attr( $value['class'] ); ?>" |
|
| 452 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 453 | - <?php echo ( 'multiselect' == $value['type'] ) ? 'multiple="multiple"' : ''; ?> |
|
| 449 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 450 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 451 | + class="<?php echo esc_attr($value['class']); ?>" |
|
| 452 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 453 | + <?php echo ('multiselect' == $value['type']) ? 'multiple="multiple"' : ''; ?> |
|
| 454 | 454 | > |
| 455 | 455 | |
| 456 | 456 | <?php |
| 457 | - if ( ! empty( $value['options'] ) ) { |
|
| 458 | - foreach ( $value['options'] as $key => $val ) { |
|
| 457 | + if ( ! empty($value['options'])) { |
|
| 458 | + foreach ($value['options'] as $key => $val) { |
|
| 459 | 459 | ?> |
| 460 | - <option value="<?php echo esc_attr( $key ); ?>" <?php |
|
| 460 | + <option value="<?php echo esc_attr($key); ?>" <?php |
|
| 461 | 461 | |
| 462 | - if ( is_array( $option_value ) ) { |
|
| 463 | - selected( in_array( $key, $option_value ), true ); |
|
| 462 | + if (is_array($option_value)) { |
|
| 463 | + selected(in_array($key, $option_value), true); |
|
| 464 | 464 | } else { |
| 465 | - selected( $option_value, $key ); |
|
| 465 | + selected($option_value, $key); |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | ?>><?php echo $val ?></option> |
@@ -478,28 +478,28 @@ discard block |
||
| 478 | 478 | |
| 479 | 479 | // Radio inputs. |
| 480 | 480 | case 'radio_inline' : |
| 481 | - $value['class'] = empty( $value['class'] ) ? 'give-radio-inline' : $value['class'] . ' give-radio-inline'; |
|
| 481 | + $value['class'] = empty($value['class']) ? 'give-radio-inline' : $value['class'].' give-radio-inline'; |
|
| 482 | 482 | case 'radio' : |
| 483 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 483 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 484 | 484 | ?> |
| 485 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 485 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 486 | 486 | <th scope="row" class="titledesc"> |
| 487 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 487 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 488 | 488 | </th> |
| 489 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
| 489 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
| 490 | 490 | <fieldset> |
| 491 | 491 | <ul> |
| 492 | 492 | <?php |
| 493 | - foreach ( $value['options'] as $key => $val ) { |
|
| 493 | + foreach ($value['options'] as $key => $val) { |
|
| 494 | 494 | ?> |
| 495 | 495 | <li> |
| 496 | 496 | <label><input |
| 497 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 497 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 498 | 498 | value="<?php echo $key; ?>" |
| 499 | 499 | type="radio" |
| 500 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 501 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 502 | - <?php checked( $key, $option_value ); ?> |
|
| 500 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 501 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 502 | + <?php checked($key, $option_value); ?> |
|
| 503 | 503 | /> <?php echo $val ?></label> |
| 504 | 504 | </li> |
| 505 | 505 | <?php |
@@ -513,21 +513,21 @@ discard block |
||
| 513 | 513 | |
| 514 | 514 | // Checkbox input. |
| 515 | 515 | case 'checkbox' : |
| 516 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 516 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 517 | 517 | ?> |
| 518 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 518 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 519 | 519 | <th scope="row" class="titledesc"> |
| 520 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 520 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 521 | 521 | </th> |
| 522 | 522 | <td class="give-forminp"> |
| 523 | 523 | <input |
| 524 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 525 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 524 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 525 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 526 | 526 | type="checkbox" |
| 527 | - class="<?php echo esc_attr( isset( $value['class'] ) ? $value['class'] : '' ); ?>" |
|
| 527 | + class="<?php echo esc_attr(isset($value['class']) ? $value['class'] : ''); ?>" |
|
| 528 | 528 | value="1" |
| 529 | - <?php checked( $option_value, 'on' ); ?> |
|
| 530 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 529 | + <?php checked($option_value, 'on'); ?> |
|
| 530 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 531 | 531 | /> |
| 532 | 532 | <?php echo $description; ?> |
| 533 | 533 | </td> |
@@ -537,28 +537,28 @@ discard block |
||
| 537 | 537 | |
| 538 | 538 | // Multi Checkbox input. |
| 539 | 539 | case 'multicheck' : |
| 540 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 541 | - $option_value = is_array( $option_value ) ? $option_value : array(); |
|
| 540 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 541 | + $option_value = is_array($option_value) ? $option_value : array(); |
|
| 542 | 542 | ?> |
| 543 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 543 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 544 | 544 | <th scope="row" class="titledesc"> |
| 545 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 545 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 546 | 546 | </th> |
| 547 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?> <?php echo( ! empty( $value['class'] ) ? $value['class'] : '' ); ?>"> |
|
| 547 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?> <?php echo( ! empty($value['class']) ? $value['class'] : ''); ?>"> |
|
| 548 | 548 | <fieldset> |
| 549 | 549 | <ul> |
| 550 | 550 | <?php |
| 551 | - foreach ( $value['options'] as $key => $val ) { |
|
| 551 | + foreach ($value['options'] as $key => $val) { |
|
| 552 | 552 | ?> |
| 553 | 553 | <li> |
| 554 | 554 | <label> |
| 555 | 555 | <input |
| 556 | - name="<?php echo esc_attr( $value['id'] ); ?>[]" |
|
| 556 | + name="<?php echo esc_attr($value['id']); ?>[]" |
|
| 557 | 557 | value="<?php echo $key; ?>" |
| 558 | 558 | type="checkbox" |
| 559 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 560 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 561 | - <?php if ( in_array( $key, $option_value ) ) { |
|
| 559 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 560 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 561 | + <?php if (in_array($key, $option_value)) { |
|
| 562 | 562 | echo 'checked="checked"'; |
| 563 | 563 | } ?> |
| 564 | 564 | /> <?php echo $val ?> |
@@ -576,25 +576,25 @@ discard block |
||
| 576 | 576 | |
| 577 | 577 | // File input field. |
| 578 | 578 | case 'file' : |
| 579 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 579 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 580 | 580 | ?> |
| 581 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 581 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 582 | 582 | <th scope="row" class="titledesc"> |
| 583 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 583 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 584 | 584 | </th> |
| 585 | 585 | <td class="give-forminp"> |
| 586 | 586 | <div class="give-field-wrap"> |
| 587 | 587 | <label for="<?php echo $value['id'] ?>"> |
| 588 | 588 | <input |
| 589 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 590 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 589 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 590 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 591 | 591 | type="text" |
| 592 | - class="give-input-field<?php echo esc_attr( isset( $value['class'] ) ? ' ' . $value['class'] : '' ); ?>" |
|
| 592 | + class="give-input-field<?php echo esc_attr(isset($value['class']) ? ' '.$value['class'] : ''); ?>" |
|
| 593 | 593 | value="<?php echo $option_value; ?>" |
| 594 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 595 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 594 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 595 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 596 | 596 | /> <input class="give-upload-button button" type="button" |
| 597 | - value="<?php echo esc_html__( 'Add or Upload File', 'give' ); ?>"> |
|
| 597 | + value="<?php echo esc_html__('Add or Upload File', 'give'); ?>"> |
|
| 598 | 598 | <?php echo $description ?> |
| 599 | 599 | <div class="give-image-thumb<?php echo ! $option_value ? ' give-hidden' : ''; ?>"> |
| 600 | 600 | <span class="give-delete-image-thumb dashicons dashicons-no-alt"></span> |
@@ -609,17 +609,17 @@ discard block |
||
| 609 | 609 | // WordPress Editor. |
| 610 | 610 | case 'wysiwyg' : |
| 611 | 611 | // Get option value. |
| 612 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 612 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 613 | 613 | |
| 614 | 614 | // Get editor settings. |
| 615 | - $editor_settings = ! empty( $value['options'] ) ? $value['options'] : array(); |
|
| 615 | + $editor_settings = ! empty($value['options']) ? $value['options'] : array(); |
|
| 616 | 616 | ?> |
| 617 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 617 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 618 | 618 | <th scope="row" class="titledesc"> |
| 619 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 619 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 620 | 620 | </th> |
| 621 | 621 | <td class="give-forminp"> |
| 622 | - <?php wp_editor( $option_value, $value['id'], $editor_settings ); ?> |
|
| 622 | + <?php wp_editor($option_value, $value['id'], $editor_settings); ?> |
|
| 623 | 623 | <?php echo $description; ?> |
| 624 | 624 | </td> |
| 625 | 625 | </tr><?php |
@@ -628,9 +628,9 @@ discard block |
||
| 628 | 628 | // Custom: System setting field. |
| 629 | 629 | case 'system_info' : |
| 630 | 630 | ?> |
| 631 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 631 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 632 | 632 | <th scope="row" class="titledesc"> |
| 633 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 633 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 634 | 634 | </th> |
| 635 | 635 | <td class="give-forminp"> |
| 636 | 636 | <?php give_system_info_callback(); ?> |
@@ -641,14 +641,14 @@ discard block |
||
| 641 | 641 | |
| 642 | 642 | // Custom: Default gateways setting field. |
| 643 | 643 | case 'default_gateway' : |
| 644 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 644 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 645 | 645 | ?> |
| 646 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 646 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 647 | 647 | <th scope="row" class="titledesc"> |
| 648 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 648 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 649 | 649 | </th> |
| 650 | 650 | <td class="give-forminp"> |
| 651 | - <?php give_default_gateway_callback( $value, $option_value ); ?> |
|
| 651 | + <?php give_default_gateway_callback($value, $option_value); ?> |
|
| 652 | 652 | <?php echo $description; ?> |
| 653 | 653 | </td> |
| 654 | 654 | </tr><?php |
@@ -656,14 +656,14 @@ discard block |
||
| 656 | 656 | |
| 657 | 657 | // Custom: Enable gateways setting field. |
| 658 | 658 | case 'enabled_gateways' : |
| 659 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 659 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 660 | 660 | ?> |
| 661 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 661 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 662 | 662 | <th scope="row" class="titledesc"> |
| 663 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 663 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 664 | 664 | </th> |
| 665 | 665 | <td class="give-forminp"> |
| 666 | - <?php give_enabled_gateways_callback( $value, $option_value ); ?> |
|
| 666 | + <?php give_enabled_gateways_callback($value, $option_value); ?> |
|
| 667 | 667 | <?php echo $description; ?> |
| 668 | 668 | </td> |
| 669 | 669 | </tr><?php |
@@ -672,9 +672,9 @@ discard block |
||
| 672 | 672 | // Custom: Email preview buttons field. |
| 673 | 673 | case 'email_preview_buttons' : |
| 674 | 674 | ?> |
| 675 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 675 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 676 | 676 | <th scope="row" class="titledesc"> |
| 677 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 677 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 678 | 678 | </th> |
| 679 | 679 | <td class="give-forminp"> |
| 680 | 680 | <?php give_email_preview_buttons_callback(); ?> |
@@ -691,22 +691,22 @@ discard block |
||
| 691 | 691 | |
| 692 | 692 | // Custom: Gateway API key. |
| 693 | 693 | case 'api_key' : |
| 694 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 695 | - $type = ! empty( $option_value ) ? 'password' : 'text'; |
|
| 694 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 695 | + $type = ! empty($option_value) ? 'password' : 'text'; |
|
| 696 | 696 | ?> |
| 697 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 697 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 698 | 698 | <th scope="row" class="titledesc"> |
| 699 | - <label for="<?php echo esc_attr( $value['id'] ); ?>"><?php echo self::get_field_title( $value ); ?></label> |
|
| 699 | + <label for="<?php echo esc_attr($value['id']); ?>"><?php echo self::get_field_title($value); ?></label> |
|
| 700 | 700 | </th> |
| 701 | - <td class="give-forminp give-forminp-<?php echo sanitize_title( $value['type'] ) ?>"> |
|
| 701 | + <td class="give-forminp give-forminp-<?php echo sanitize_title($value['type']) ?>"> |
|
| 702 | 702 | <input |
| 703 | - name="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 704 | - id="<?php echo esc_attr( $value['id'] ); ?>" |
|
| 705 | - type="<?php echo esc_attr( $type ); ?>" |
|
| 706 | - style="<?php echo esc_attr( $value['css'] ); ?>" |
|
| 707 | - value="<?php echo esc_attr( trim( $option_value ) ); ?>" |
|
| 708 | - class="give-input-field<?php echo( empty( $value['class'] ) ? '' : ' ' . esc_attr( $value['class'] ) ); ?>" |
|
| 709 | - <?php echo implode( ' ', $custom_attributes ); ?> |
|
| 703 | + name="<?php echo esc_attr($value['id']); ?>" |
|
| 704 | + id="<?php echo esc_attr($value['id']); ?>" |
|
| 705 | + type="<?php echo esc_attr($type); ?>" |
|
| 706 | + style="<?php echo esc_attr($value['css']); ?>" |
|
| 707 | + value="<?php echo esc_attr(trim($option_value)); ?>" |
|
| 708 | + class="give-input-field<?php echo(empty($value['class']) ? '' : ' '.esc_attr($value['class'])); ?>" |
|
| 709 | + <?php echo implode(' ', $custom_attributes); ?> |
|
| 710 | 710 | /> <?php echo $description; ?> |
| 711 | 711 | </td> |
| 712 | 712 | </tr><?php |
@@ -728,12 +728,12 @@ discard block |
||
| 728 | 728 | // Custom: Give Docs Link field type. |
| 729 | 729 | case 'give_docs_link' : |
| 730 | 730 | ?> |
| 731 | - <tr valign="top" <?php echo ! empty( $value['wrapper_class'] ) ? 'class="' . $value['wrapper_class'] . '"' : '' ?>> |
|
| 731 | + <tr valign="top" <?php echo ! empty($value['wrapper_class']) ? 'class="'.$value['wrapper_class'].'"' : '' ?>> |
|
| 732 | 732 | <td class="give-docs-link" colspan="2"> |
| 733 | 733 | <?php |
| 734 | - echo '<p class="give-docs-link"><a href="' . esc_url( $value['url'] ) |
|
| 734 | + echo '<p class="give-docs-link"><a href="'.esc_url($value['url']) |
|
| 735 | 735 | . '" target="_blank">' |
| 736 | - . sprintf( esc_html__( 'Need Help? See docs on "%s"' ), $value['title'] ) |
|
| 736 | + . sprintf(esc_html__('Need Help? See docs on "%s"'), $value['title']) |
|
| 737 | 737 | . '<span class="dashicons dashicons-editor-help"></span></a></p>'; |
| 738 | 738 | ?> |
| 739 | 739 | </td> |
@@ -744,8 +744,8 @@ discard block |
||
| 744 | 744 | // You can add or handle your custom field action. |
| 745 | 745 | default: |
| 746 | 746 | // Get option value. |
| 747 | - $option_value = self::get_option( $option_name, $value['id'], $value['default'] ); |
|
| 748 | - do_action( 'give_admin_field_' . $value['type'], $value, $option_value ); |
|
| 747 | + $option_value = self::get_option($option_name, $value['id'], $value['default']); |
|
| 748 | + do_action('give_admin_field_'.$value['type'], $value, $option_value); |
|
| 749 | 749 | break; |
| 750 | 750 | } |
| 751 | 751 | } |
@@ -761,15 +761,15 @@ discard block |
||
| 761 | 761 | * |
| 762 | 762 | * @return string The HTML description of the field. |
| 763 | 763 | */ |
| 764 | - public static function get_field_description( $value ) { |
|
| 764 | + public static function get_field_description($value) { |
|
| 765 | 765 | $description = ''; |
| 766 | 766 | |
| 767 | 767 | // Support for both 'description' and 'desc' args. |
| 768 | - $description_key = isset( $value['description'] ) ? 'description' : 'desc'; |
|
| 769 | - $value = ( isset( $value[ $description_key ] ) && ! empty( $value[ $description_key ] ) ) ? $value[ $description_key ] : ''; |
|
| 768 | + $description_key = isset($value['description']) ? 'description' : 'desc'; |
|
| 769 | + $value = (isset($value[$description_key]) && ! empty($value[$description_key])) ? $value[$description_key] : ''; |
|
| 770 | 770 | |
| 771 | - if ( ! empty( $value ) ) { |
|
| 772 | - $description = '<p class="give-field-description">' . wp_kses_post( $value ) . '</p>'; |
|
| 771 | + if ( ! empty($value)) { |
|
| 772 | + $description = '<p class="give-field-description">'.wp_kses_post($value).'</p>'; |
|
| 773 | 773 | } |
| 774 | 774 | |
| 775 | 775 | return $description; |
@@ -786,11 +786,11 @@ discard block |
||
| 786 | 786 | * |
| 787 | 787 | * @return array The description and tip as a 2 element array |
| 788 | 788 | */ |
| 789 | - public static function get_field_title( $value ) { |
|
| 790 | - $title = esc_html( $value['title'] ); |
|
| 789 | + public static function get_field_title($value) { |
|
| 790 | + $title = esc_html($value['title']); |
|
| 791 | 791 | |
| 792 | 792 | // If html tag detected then allow them to print. |
| 793 | - if ( strip_tags( $title ) ) { |
|
| 793 | + if (strip_tags($title)) { |
|
| 794 | 794 | $title = $value['title']; |
| 795 | 795 | } |
| 796 | 796 | |
@@ -809,8 +809,8 @@ discard block |
||
| 809 | 809 | * |
| 810 | 810 | * @return bool |
| 811 | 811 | */ |
| 812 | - public static function save_fields( $options, $option_name = '' ) { |
|
| 813 | - if ( empty( $_POST ) ) { |
|
| 812 | + public static function save_fields($options, $option_name = '') { |
|
| 813 | + if (empty($_POST)) { |
|
| 814 | 814 | return false; |
| 815 | 815 | } |
| 816 | 816 | |
@@ -818,37 +818,37 @@ discard block |
||
| 818 | 818 | $update_options = array(); |
| 819 | 819 | |
| 820 | 820 | // Loop options and get values to save. |
| 821 | - foreach ( $options as $option ) { |
|
| 822 | - if ( ! isset( $option['id'] ) || ! isset( $option['type'] ) ) { |
|
| 821 | + foreach ($options as $option) { |
|
| 822 | + if ( ! isset($option['id']) || ! isset($option['type'])) { |
|
| 823 | 823 | continue; |
| 824 | 824 | } |
| 825 | 825 | |
| 826 | 826 | // Get posted value. |
| 827 | - if ( strstr( $option['id'], '[' ) ) { |
|
| 828 | - parse_str( $option['id'], $option_name_array ); |
|
| 829 | - $field_option_name = current( array_keys( $option_name_array ) ); |
|
| 830 | - $setting_name = key( $option_name_array[ $field_option_name ] ); |
|
| 831 | - $raw_value = isset( $_POST[ $field_option_name ][ $setting_name ] ) ? wp_unslash( $_POST[ $field_option_name ][ $setting_name ] ) : null; |
|
| 827 | + if (strstr($option['id'], '[')) { |
|
| 828 | + parse_str($option['id'], $option_name_array); |
|
| 829 | + $field_option_name = current(array_keys($option_name_array)); |
|
| 830 | + $setting_name = key($option_name_array[$field_option_name]); |
|
| 831 | + $raw_value = isset($_POST[$field_option_name][$setting_name]) ? wp_unslash($_POST[$field_option_name][$setting_name]) : null; |
|
| 832 | 832 | } else { |
| 833 | 833 | $field_option_name = $option['id']; |
| 834 | 834 | $setting_name = ''; |
| 835 | - $raw_value = isset( $_POST[ $option['id'] ] ) ? wp_unslash( $_POST[ $option['id'] ] ) : null; |
|
| 835 | + $raw_value = isset($_POST[$option['id']]) ? wp_unslash($_POST[$option['id']]) : null; |
|
| 836 | 836 | } |
| 837 | 837 | |
| 838 | 838 | // Format the value based on option type. |
| 839 | - switch ( $option['type'] ) { |
|
| 839 | + switch ($option['type']) { |
|
| 840 | 840 | case 'checkbox' : |
| 841 | - $value = is_null( $raw_value ) ? '' : 'on'; |
|
| 841 | + $value = is_null($raw_value) ? '' : 'on'; |
|
| 842 | 842 | break; |
| 843 | 843 | case 'wysiwyg' : |
| 844 | 844 | case 'textarea' : |
| 845 | - $value = wp_kses_post( trim( $raw_value ) ); |
|
| 845 | + $value = wp_kses_post(trim($raw_value)); |
|
| 846 | 846 | break; |
| 847 | 847 | case 'multiselect' : |
| 848 | - $value = array_filter( array_map( 'give_clean', (array) $raw_value ) ); |
|
| 848 | + $value = array_filter(array_map('give_clean', (array) $raw_value)); |
|
| 849 | 849 | break; |
| 850 | 850 | default : |
| 851 | - $value = give_clean( $raw_value ); |
|
| 851 | + $value = give_clean($raw_value); |
|
| 852 | 852 | break; |
| 853 | 853 | } |
| 854 | 854 | |
@@ -857,37 +857,37 @@ discard block |
||
| 857 | 857 | * |
| 858 | 858 | * @since 1.8 |
| 859 | 859 | */ |
| 860 | - $value = apply_filters( 'give_admin_settings_sanitize_option', $value, $option, $raw_value ); |
|
| 860 | + $value = apply_filters('give_admin_settings_sanitize_option', $value, $option, $raw_value); |
|
| 861 | 861 | |
| 862 | 862 | /** |
| 863 | 863 | * Sanitize the value of an option by option name. |
| 864 | 864 | * |
| 865 | 865 | * @since 1.8 |
| 866 | 866 | */ |
| 867 | - $value = apply_filters( "give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value ); |
|
| 867 | + $value = apply_filters("give_admin_settings_sanitize_option_{$field_option_name}", $value, $option, $raw_value); |
|
| 868 | 868 | |
| 869 | - if ( is_null( $value ) ) { |
|
| 869 | + if (is_null($value)) { |
|
| 870 | 870 | continue; |
| 871 | 871 | } |
| 872 | 872 | |
| 873 | 873 | // Check if option is an array and handle that differently to single values. |
| 874 | - if ( $field_option_name && $setting_name ) { |
|
| 875 | - if ( ! isset( $update_options[ $field_option_name ] ) ) { |
|
| 876 | - $update_options[ $field_option_name ] = get_option( $field_option_name, array() ); |
|
| 874 | + if ($field_option_name && $setting_name) { |
|
| 875 | + if ( ! isset($update_options[$field_option_name])) { |
|
| 876 | + $update_options[$field_option_name] = get_option($field_option_name, array()); |
|
| 877 | 877 | } |
| 878 | - if ( ! is_array( $update_options[ $field_option_name ] ) ) { |
|
| 879 | - $update_options[ $field_option_name ] = array(); |
|
| 878 | + if ( ! is_array($update_options[$field_option_name])) { |
|
| 879 | + $update_options[$field_option_name] = array(); |
|
| 880 | 880 | } |
| 881 | - $update_options[ $field_option_name ][ $setting_name ] = $value; |
|
| 881 | + $update_options[$field_option_name][$setting_name] = $value; |
|
| 882 | 882 | } else { |
| 883 | - $update_options[ $field_option_name ] = $value; |
|
| 883 | + $update_options[$field_option_name] = $value; |
|
| 884 | 884 | } |
| 885 | 885 | } |
| 886 | 886 | |
| 887 | 887 | // Save all options in our array or there own option name i.e. option id. |
| 888 | - if ( empty( $option_name ) ) { |
|
| 889 | - foreach ( $update_options as $name => $value ) { |
|
| 890 | - update_option( $name, $value ); |
|
| 888 | + if (empty($option_name)) { |
|
| 889 | + foreach ($update_options as $name => $value) { |
|
| 890 | + update_option($name, $value); |
|
| 891 | 891 | |
| 892 | 892 | /** |
| 893 | 893 | * Trigger action. |
@@ -896,13 +896,13 @@ discard block |
||
| 896 | 896 | * |
| 897 | 897 | * @since 1.8 |
| 898 | 898 | */ |
| 899 | - do_action( "give_save_option_{$name}", $value, $name ); |
|
| 899 | + do_action("give_save_option_{$name}", $value, $name); |
|
| 900 | 900 | } |
| 901 | 901 | } else { |
| 902 | - $old_options = ( $old_options = get_option( $option_name ) ) ? $old_options : array(); |
|
| 903 | - $update_options = array_merge( $old_options, $update_options ); |
|
| 902 | + $old_options = ($old_options = get_option($option_name)) ? $old_options : array(); |
|
| 903 | + $update_options = array_merge($old_options, $update_options); |
|
| 904 | 904 | |
| 905 | - update_option( $option_name, $update_options ); |
|
| 905 | + update_option($option_name, $update_options); |
|
| 906 | 906 | |
| 907 | 907 | /** |
| 908 | 908 | * Trigger action. |
@@ -911,7 +911,7 @@ discard block |
||
| 911 | 911 | * |
| 912 | 912 | * @since 1.8 |
| 913 | 913 | */ |
| 914 | - do_action( "give_save_settings_{$option_name}", $update_options, $option_name ); |
|
| 914 | + do_action("give_save_settings_{$option_name}", $update_options, $option_name); |
|
| 915 | 915 | } |
| 916 | 916 | |
| 917 | 917 | return true; |
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | * @since 1.8 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 12 | +if ( ! defined('ABSPATH')) { |
|
| 13 | 13 | exit; // Exit if accessed directly |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if ( ! class_exists( 'Give_Settings_Gateways' ) ) : |
|
| 16 | +if ( ! class_exists('Give_Settings_Gateways')) : |
|
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * Give_Settings_Gateways. |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | */ |
| 28 | 28 | public function __construct() { |
| 29 | 29 | $this->id = 'gateways'; |
| 30 | - $this->label = esc_html__( 'Payment Gateways', 'give' ); |
|
| 30 | + $this->label = esc_html__('Payment Gateways', 'give'); |
|
| 31 | 31 | |
| 32 | 32 | $this->default_tab = 'gateways-settings'; |
| 33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | $settings = array(); |
| 45 | 45 | $current_section = give_get_current_setting_section(); |
| 46 | 46 | |
| 47 | - switch ( $current_section ) { |
|
| 47 | + switch ($current_section) { |
|
| 48 | 48 | case 'paypal-standard': |
| 49 | 49 | $settings = array( |
| 50 | 50 | // Section 2: PayPal Standard. |
@@ -53,55 +53,55 @@ discard block |
||
| 53 | 53 | 'id' => 'give_title_gateway_settings_2', |
| 54 | 54 | ), |
| 55 | 55 | array( |
| 56 | - 'name' => __( 'PayPal Email', 'give' ), |
|
| 57 | - 'desc' => __( 'Enter your PayPal account\'s email.', 'give' ), |
|
| 56 | + 'name' => __('PayPal Email', 'give'), |
|
| 57 | + 'desc' => __('Enter your PayPal account\'s email.', 'give'), |
|
| 58 | 58 | 'id' => 'paypal_email', |
| 59 | 59 | 'type' => 'email', |
| 60 | 60 | ), |
| 61 | 61 | array( |
| 62 | - 'name' => __( 'PayPal Page Style', 'give' ), |
|
| 63 | - 'desc' => __( 'Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give' ), |
|
| 62 | + 'name' => __('PayPal Page Style', 'give'), |
|
| 63 | + 'desc' => __('Enter the name of the PayPal page style to use, or leave blank to use the default.', 'give'), |
|
| 64 | 64 | 'id' => 'paypal_page_style', |
| 65 | 65 | 'type' => 'text', |
| 66 | 66 | ), |
| 67 | 67 | array( |
| 68 | - 'name' => __( 'PayPal Transaction Type', 'give' ), |
|
| 69 | - 'desc' => __( 'Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give' ), |
|
| 68 | + 'name' => __('PayPal Transaction Type', 'give'), |
|
| 69 | + 'desc' => __('Nonprofits must verify their status to withdraw donations they receive via PayPal. PayPal users that are not verified nonprofits must demonstrate how their donations will be used, once they raise more than $10,000. By default, Give transactions are sent to PayPal as donations. You may change the transaction type using this option if you feel you may not meet PayPal\'s donation requirements.', 'give'), |
|
| 70 | 70 | 'id' => 'paypal_button_type', |
| 71 | 71 | 'type' => 'radio_inline', |
| 72 | 72 | 'options' => array( |
| 73 | - 'donation' => __( 'Donation', 'give' ), |
|
| 74 | - 'standard' => __( 'Standard Transaction', 'give' ) |
|
| 73 | + 'donation' => __('Donation', 'give'), |
|
| 74 | + 'standard' => __('Standard Transaction', 'give') |
|
| 75 | 75 | ), |
| 76 | 76 | 'default' => 'donation', |
| 77 | 77 | ), |
| 78 | 78 | array( |
| 79 | - 'name' => __( 'Billing Details', 'give' ), |
|
| 80 | - 'desc' => __( 'This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give' ), |
|
| 79 | + 'name' => __('Billing Details', 'give'), |
|
| 80 | + 'desc' => __('This option will enable the billing details section for PayPal Standard which requires the donor\'s address to complete the donation. These fields are not required by PayPal to process the transaction, but you may have a need to collect the data.', 'give'), |
|
| 81 | 81 | 'id' => 'paypal_standard_billing_details', |
| 82 | 82 | 'type' => 'radio_inline', |
| 83 | 83 | 'default' => 'disabled', |
| 84 | 84 | 'options' => array( |
| 85 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 86 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 85 | + 'enabled' => __('Enabled', 'give'), |
|
| 86 | + 'disabled' => __('Disabled', 'give'), |
|
| 87 | 87 | ) |
| 88 | 88 | ), |
| 89 | 89 | array( |
| 90 | - 'name' => __( 'PayPal IPN Verification', 'give' ), |
|
| 91 | - 'desc' => __( 'If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give' ), |
|
| 90 | + 'name' => __('PayPal IPN Verification', 'give'), |
|
| 91 | + 'desc' => __('If donations are not getting marked as complete, use a slightly less secure method of verifying donations.', 'give'), |
|
| 92 | 92 | 'id' => 'paypal_verification', |
| 93 | 93 | 'type' => 'radio_inline', |
| 94 | 94 | 'default' => 'enabled', |
| 95 | 95 | 'options' => array( |
| 96 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 97 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 96 | + 'enabled' => __('Enabled', 'give'), |
|
| 97 | + 'disabled' => __('Disabled', 'give'), |
|
| 98 | 98 | ) |
| 99 | 99 | ), |
| 100 | 100 | array( |
| 101 | - 'name' => __( 'PayPal Standard Gateway Settings Docs Link', 'give' ), |
|
| 101 | + 'name' => __('PayPal Standard Gateway Settings Docs Link', 'give'), |
|
| 102 | 102 | 'id' => 'paypal_standard_gateway_settings_docs_link', |
| 103 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-paypal-standard' ), |
|
| 104 | - 'title' => __( 'PayPal Standard Gateway Settings', 'give' ), |
|
| 103 | + 'url' => esc_url('http://docs.givewp.com/settings-gateway-paypal-standard'), |
|
| 104 | + 'title' => __('PayPal Standard Gateway Settings', 'give'), |
|
| 105 | 105 | 'type' => 'give_docs_link', |
| 106 | 106 | ), |
| 107 | 107 | array( |
@@ -119,19 +119,19 @@ discard block |
||
| 119 | 119 | 'id' => 'give_title_gateway_settings_3', |
| 120 | 120 | ), |
| 121 | 121 | array( |
| 122 | - 'name' => __( 'Collect Billing Details', 'give' ), |
|
| 123 | - 'desc' => __( 'Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give' ), |
|
| 122 | + 'name' => __('Collect Billing Details', 'give'), |
|
| 123 | + 'desc' => __('Enable to request billing details for offline donations. Will appear above offline donation instructions. Can be enabled/disabled per form.', 'give'), |
|
| 124 | 124 | 'id' => 'give_offline_donation_enable_billing_fields', |
| 125 | 125 | 'type' => 'radio_inline', |
| 126 | 126 | 'default' => 'disabled', |
| 127 | 127 | 'options' => array( |
| 128 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 129 | - 'disabled' => __( 'Disabled', 'give' ) |
|
| 128 | + 'enabled' => __('Enabled', 'give'), |
|
| 129 | + 'disabled' => __('Disabled', 'give') |
|
| 130 | 130 | ) |
| 131 | 131 | ), |
| 132 | 132 | array( |
| 133 | - 'name' => __( 'Offline Donation Instructions', 'give' ), |
|
| 134 | - 'desc' => __( 'The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give' ), |
|
| 133 | + 'name' => __('Offline Donation Instructions', 'give'), |
|
| 134 | + 'desc' => __('The following content will appear for all forms when the user selects the offline donation payment option. Note: You may customize the content per form as needed.', 'give'), |
|
| 135 | 135 | 'id' => 'global_offline_donation_content', |
| 136 | 136 | 'default' => give_get_default_offline_donation_content(), |
| 137 | 137 | 'type' => 'wysiwyg', |
@@ -140,15 +140,15 @@ discard block |
||
| 140 | 140 | ) |
| 141 | 141 | ), |
| 142 | 142 | array( |
| 143 | - 'name' => __( 'Offline Donation Email Instructions Subject', 'give' ), |
|
| 144 | - 'desc' => __( 'Enter the subject line for the donation receipt email.', 'give' ), |
|
| 143 | + 'name' => __('Offline Donation Email Instructions Subject', 'give'), |
|
| 144 | + 'desc' => __('Enter the subject line for the donation receipt email.', 'give'), |
|
| 145 | 145 | 'id' => 'offline_donation_subject', |
| 146 | - 'default' => esc_attr__( '{donation} - Offline Donation Instructions', 'give' ), |
|
| 146 | + 'default' => esc_attr__('{donation} - Offline Donation Instructions', 'give'), |
|
| 147 | 147 | 'type' => 'text' |
| 148 | 148 | ), |
| 149 | 149 | array( |
| 150 | - 'name' => __( 'Offline Donation Email Instructions', 'give' ), |
|
| 151 | - '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(), |
|
| 150 | + 'name' => __('Offline Donation Email Instructions', 'give'), |
|
| 151 | + '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(), |
|
| 152 | 152 | 'id' => 'global_offline_donation_email', |
| 153 | 153 | 'default' => give_get_default_offline_donation_email_content(), |
| 154 | 154 | 'type' => 'wysiwyg', |
@@ -157,10 +157,10 @@ discard block |
||
| 157 | 157 | ) |
| 158 | 158 | ), |
| 159 | 159 | array( |
| 160 | - 'name' => __( 'Offline Donations Settings Docs Link', 'give' ), |
|
| 160 | + 'name' => __('Offline Donations Settings Docs Link', 'give'), |
|
| 161 | 161 | 'id' => 'offline_gateway_settings_docs_link', |
| 162 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateway-offline-donations' ), |
|
| 163 | - 'title' => __( 'Offline Gateway Settings', 'give' ), |
|
| 162 | + 'url' => esc_url('http://docs.givewp.com/settings-gateway-offline-donations'), |
|
| 163 | + 'title' => __('Offline Gateway Settings', 'give'), |
|
| 164 | 164 | 'type' => 'give_docs_link', |
| 165 | 165 | ), |
| 166 | 166 | array( |
@@ -178,33 +178,33 @@ discard block |
||
| 178 | 178 | 'type' => 'title' |
| 179 | 179 | ), |
| 180 | 180 | array( |
| 181 | - 'name' => __( 'Test Mode', 'give' ), |
|
| 182 | - 'desc' => __( 'While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give' ), |
|
| 181 | + 'name' => __('Test Mode', 'give'), |
|
| 182 | + 'desc' => __('While in test mode no live donations are processed. To fully use test mode, you must have a sandbox (test) account for the payment gateway you are testing.', 'give'), |
|
| 183 | 183 | 'id' => 'test_mode', |
| 184 | 184 | 'type' => 'radio_inline', |
| 185 | 185 | 'default' => 'disabled', |
| 186 | 186 | 'options' => array( |
| 187 | - 'enabled' => __( 'Enabled', 'give' ), |
|
| 188 | - 'disabled' => __( 'Disabled', 'give' ), |
|
| 187 | + 'enabled' => __('Enabled', 'give'), |
|
| 188 | + 'disabled' => __('Disabled', 'give'), |
|
| 189 | 189 | ) |
| 190 | 190 | ), |
| 191 | 191 | array( |
| 192 | - 'name' => __( 'Enabled Gateways', 'give' ), |
|
| 193 | - 'desc' => __( 'Enable your payment gateway. Can be ordered by dragging.', 'give' ), |
|
| 192 | + 'name' => __('Enabled Gateways', 'give'), |
|
| 193 | + 'desc' => __('Enable your payment gateway. Can be ordered by dragging.', 'give'), |
|
| 194 | 194 | 'id' => 'gateways', |
| 195 | 195 | 'type' => 'enabled_gateways' |
| 196 | 196 | ), |
| 197 | 197 | array( |
| 198 | - 'name' => __( 'Default Gateway', 'give' ), |
|
| 199 | - 'desc' => __( 'The gateway that will be selected by default.', 'give' ), |
|
| 198 | + 'name' => __('Default Gateway', 'give'), |
|
| 199 | + 'desc' => __('The gateway that will be selected by default.', 'give'), |
|
| 200 | 200 | 'id' => 'default_gateway', |
| 201 | 201 | 'type' => 'default_gateway' |
| 202 | 202 | ), |
| 203 | 203 | array( |
| 204 | - 'name' => __( 'Gateways Docs Link', 'give' ), |
|
| 204 | + 'name' => __('Gateways Docs Link', 'give'), |
|
| 205 | 205 | 'id' => 'gateway_settings_docs_link', |
| 206 | - 'url' => esc_url( 'http://docs.givewp.com/settings-gateways' ), |
|
| 207 | - 'title' => __( 'Gateway Settings', 'give' ), |
|
| 206 | + 'url' => esc_url('http://docs.givewp.com/settings-gateways'), |
|
| 207 | + 'title' => __('Gateway Settings', 'give'), |
|
| 208 | 208 | 'type' => 'give_docs_link', |
| 209 | 209 | ), |
| 210 | 210 | array( |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | * Filter the payment gateways settings. |
| 220 | 220 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
| 221 | 221 | */ |
| 222 | - $settings = apply_filters( 'give_settings_gateways', $settings ); |
|
| 222 | + $settings = apply_filters('give_settings_gateways', $settings); |
|
| 223 | 223 | |
| 224 | 224 | /** |
| 225 | 225 | * Filter the settings. |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | * |
| 229 | 229 | * @param array $settings |
| 230 | 230 | */ |
| 231 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
| 231 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
| 232 | 232 | |
| 233 | 233 | // Output. |
| 234 | 234 | return $settings; |
@@ -242,12 +242,12 @@ discard block |
||
| 242 | 242 | */ |
| 243 | 243 | public function get_sections() { |
| 244 | 244 | $sections = array( |
| 245 | - 'gateways-settings' => __( 'Gateways', 'give' ), |
|
| 246 | - 'paypal-standard' => __( 'PayPal Standard', 'give' ), |
|
| 247 | - 'offline-donations' => __( 'Offline Donations', 'give' ) |
|
| 245 | + 'gateways-settings' => __('Gateways', 'give'), |
|
| 246 | + 'paypal-standard' => __('PayPal Standard', 'give'), |
|
| 247 | + 'offline-donations' => __('Offline Donations', 'give') |
|
| 248 | 248 | ); |
| 249 | 249 | |
| 250 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
| 250 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | |