@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -53,21 +53,21 @@ discard block |
||
| 53 | 53 | * @since 1.8.9 |
| 54 | 54 | */ |
| 55 | 55 | public function __construct() { |
| 56 | - add_action( 'admin_notices', array( $this, 'render_admin_notices' ), 999 ); |
|
| 57 | - add_action( 'give_dismiss_notices', array( $this, 'dismiss_notices' ) ); |
|
| 56 | + add_action('admin_notices', array($this, 'render_admin_notices'), 999); |
|
| 57 | + add_action('give_dismiss_notices', array($this, 'dismiss_notices')); |
|
| 58 | 58 | |
| 59 | - add_action( 'give_frontend_notices', array( $this, 'render_frontend_notices' ), 999 ); |
|
| 60 | - add_action( 'give_pre_form', array( $this, 'render_frontend_notices' ), 11 ); |
|
| 61 | - add_action( 'give_ajax_donation_errors', array( $this, 'render_frontend_notices' ) ); |
|
| 59 | + add_action('give_frontend_notices', array($this, 'render_frontend_notices'), 999); |
|
| 60 | + add_action('give_pre_form', array($this, 'render_frontend_notices'), 11); |
|
| 61 | + add_action('give_ajax_donation_errors', array($this, 'render_frontend_notices')); |
|
| 62 | 62 | |
| 63 | 63 | /** |
| 64 | 64 | * Backward compatibility for deprecated params. |
| 65 | 65 | * |
| 66 | 66 | * @since 1.8.14 |
| 67 | 67 | */ |
| 68 | - add_filter( 'give_register_notice_args', array( $this, 'bc_deprecated_params' ) ); |
|
| 69 | - add_filter( 'give_frontend_errors_args', array( $this, 'bc_deprecated_params' ) ); |
|
| 70 | - add_filter( 'give_frontend_notice_args', array( $this, 'bc_deprecated_params' ) ); |
|
| 68 | + add_filter('give_register_notice_args', array($this, 'bc_deprecated_params')); |
|
| 69 | + add_filter('give_frontend_errors_args', array($this, 'bc_deprecated_params')); |
|
| 70 | + add_filter('give_frontend_notice_args', array($this, 'bc_deprecated_params')); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -80,19 +80,19 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @return array |
| 82 | 82 | */ |
| 83 | - public function bc_deprecated_params( $args ) { |
|
| 83 | + public function bc_deprecated_params($args) { |
|
| 84 | 84 | /** |
| 85 | 85 | * Param: auto_dismissible |
| 86 | 86 | * deprecated in 1.8.14 |
| 87 | 87 | * |
| 88 | 88 | * Check if auto_dismissible is set and it true then unset and change dismissible parameter value to auto |
| 89 | 89 | */ |
| 90 | - if ( isset( $args['auto_dismissible'] ) ) { |
|
| 91 | - if ( ! empty( $args['auto_dismissible'] ) ) { |
|
| 90 | + if (isset($args['auto_dismissible'])) { |
|
| 91 | + if ( ! empty($args['auto_dismissible'])) { |
|
| 92 | 92 | $args['dismissible'] = 'auto'; |
| 93 | 93 | } |
| 94 | 94 | // unset auto_dismissible as it has been deprecated. |
| 95 | - unset( $args['auto_dismissible'] ); |
|
| 95 | + unset($args['auto_dismissible']); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | return $args; |
@@ -108,9 +108,9 @@ discard block |
||
| 108 | 108 | * |
| 109 | 109 | * @return bool |
| 110 | 110 | */ |
| 111 | - public function register_notice( $notice_args ) { |
|
| 111 | + public function register_notice($notice_args) { |
|
| 112 | 112 | // Bailout. |
| 113 | - if ( empty( $notice_args['id'] ) || array_key_exists( $notice_args['id'], self::$notices ) ) { |
|
| 113 | + if (empty($notice_args['id']) || array_key_exists($notice_args['id'], self::$notices)) { |
|
| 114 | 114 | return false; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -159,39 +159,39 @@ discard block |
||
| 159 | 159 | * |
| 160 | 160 | * @since 1.8.14 |
| 161 | 161 | */ |
| 162 | - $notice_args = apply_filters( 'give_register_notice_args', $notice_args ); |
|
| 162 | + $notice_args = apply_filters('give_register_notice_args', $notice_args); |
|
| 163 | 163 | |
| 164 | 164 | // Set extra dismiss links if any. |
| 165 | - if ( false !== strpos( $notice_args['description'], 'data-dismiss-interval' ) ) { |
|
| 165 | + if (false !== strpos($notice_args['description'], 'data-dismiss-interval')) { |
|
| 166 | 166 | |
| 167 | - preg_match_all( "/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link ); |
|
| 167 | + preg_match_all("/data-([^\"]*)=\"([^\"]*)\"/", $notice_args['description'], $extra_notice_dismiss_link); |
|
| 168 | 168 | |
| 169 | - if ( ! empty( $extra_notice_dismiss_link ) ) { |
|
| 170 | - $extra_notice_dismiss_links = array_chunk( current( $extra_notice_dismiss_link ), 3 ); |
|
| 171 | - foreach ( $extra_notice_dismiss_links as $extra_notice_dismiss_link ) { |
|
| 169 | + if ( ! empty($extra_notice_dismiss_link)) { |
|
| 170 | + $extra_notice_dismiss_links = array_chunk(current($extra_notice_dismiss_link), 3); |
|
| 171 | + foreach ($extra_notice_dismiss_links as $extra_notice_dismiss_link) { |
|
| 172 | 172 | // Create array og key ==> value by parsing query string created after renaming data attributes. |
| 173 | - $data_attribute_query_str = str_replace( array( 'data-', '-', '"' ), array( |
|
| 173 | + $data_attribute_query_str = str_replace(array('data-', '-', '"'), array( |
|
| 174 | 174 | '', |
| 175 | 175 | '_', |
| 176 | 176 | '', |
| 177 | - ), implode( '&', $extra_notice_dismiss_link ) ); |
|
| 177 | + ), implode('&', $extra_notice_dismiss_link)); |
|
| 178 | 178 | |
| 179 | - $notice_args['extra_links'][] = wp_parse_args( $data_attribute_query_str ); |
|
| 179 | + $notice_args['extra_links'][] = wp_parse_args($data_attribute_query_str); |
|
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | |
| 185 | - self::$notices[ $notice_args['id'] ] = $notice_args; |
|
| 185 | + self::$notices[$notice_args['id']] = $notice_args; |
|
| 186 | 186 | |
| 187 | 187 | // Auto set show param if not already set. |
| 188 | - if ( ! isset( self::$notices[ $notice_args['id'] ]['show'] ) ) { |
|
| 189 | - self::$notices[ $notice_args['id'] ]['show'] = $this->is_notice_dismissed( $notice_args ) ? false : true; |
|
| 188 | + if ( ! isset(self::$notices[$notice_args['id']]['show'])) { |
|
| 189 | + self::$notices[$notice_args['id']]['show'] = $this->is_notice_dismissed($notice_args) ? false : true; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | // Auto set time interval for shortly. |
| 193 | - if ( 'shortly' === self::$notices[ $notice_args['id'] ]['dismiss_interval'] ) { |
|
| 194 | - self::$notices[ $notice_args['id'] ]['dismiss_interval_time'] = DAY_IN_SECONDS; |
|
| 193 | + if ('shortly' === self::$notices[$notice_args['id']]['dismiss_interval']) { |
|
| 194 | + self::$notices[$notice_args['id']]['dismiss_interval_time'] = DAY_IN_SECONDS; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | return true; |
@@ -205,51 +205,51 @@ discard block |
||
| 205 | 205 | */ |
| 206 | 206 | public function render_admin_notices() { |
| 207 | 207 | // Bailout. |
| 208 | - if ( empty( self::$notices ) ) { |
|
| 208 | + if (empty(self::$notices)) { |
|
| 209 | 209 | return; |
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | $output = ''; |
| 213 | 213 | |
| 214 | - foreach ( self::$notices as $notice_id => $notice ) { |
|
| 214 | + foreach (self::$notices as $notice_id => $notice) { |
|
| 215 | 215 | // Check flag set to true to show notice. |
| 216 | - if ( ! $notice['show'] ) { |
|
| 216 | + if ( ! $notice['show']) { |
|
| 217 | 217 | continue; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | |
| 221 | 221 | // Render custom html. |
| 222 | - if( ! empty( $notice['description_html'] ) ) { |
|
| 222 | + if ( ! empty($notice['description_html'])) { |
|
| 223 | 223 | $output .= "{$notice['description_html']} \n"; |
| 224 | 224 | continue; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | // Check if notice dismissible or not. |
| 228 | - if ( ! self::$has_auto_dismissible_notice ) { |
|
| 229 | - self::$has_auto_dismissible_notice = ( 'auto' === $notice['dismissible'] ); |
|
| 228 | + if ( ! self::$has_auto_dismissible_notice) { |
|
| 229 | + self::$has_auto_dismissible_notice = ('auto' === $notice['dismissible']); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | // Check if notice dismissible or not. |
| 233 | - if ( ! self::$has_dismiss_interval_notice ) { |
|
| 233 | + if ( ! self::$has_dismiss_interval_notice) { |
|
| 234 | 234 | self::$has_dismiss_interval_notice = $notice['dismiss_interval']; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - $css_id = ( false === strpos( $notice['id'], 'give' ) ? "give-{$notice['id']}" : $notice['id'] ); |
|
| 237 | + $css_id = (false === strpos($notice['id'], 'give') ? "give-{$notice['id']}" : $notice['id']); |
|
| 238 | 238 | |
| 239 | - $css_class = 'give-notice notice ' . ( empty( $notice['dismissible'] ) ? 'non' : 'is' ) . "-dismissible {$notice['type']} notice-{$notice['type']}"; |
|
| 240 | - $output .= sprintf( |
|
| 241 | - '<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s" style="display: none">' . " \n", |
|
| 239 | + $css_class = 'give-notice notice '.(empty($notice['dismissible']) ? 'non' : 'is')."-dismissible {$notice['type']} notice-{$notice['type']}"; |
|
| 240 | + $output .= sprintf( |
|
| 241 | + '<div id="%1$s" class="%2$s" data-dismissible="%3$s" data-dismissible-type="%4$s" data-dismiss-interval="%5$s" data-notice-id="%6$s" data-security="%7$s" data-dismiss-interval-time="%8$s" style="display: none">'." \n", |
|
| 242 | 242 | $css_id, |
| 243 | 243 | $css_class, |
| 244 | - give_clean( $notice['dismissible'] ), |
|
| 244 | + give_clean($notice['dismissible']), |
|
| 245 | 245 | $notice['dismissible_type'], |
| 246 | 246 | $notice['dismiss_interval'], |
| 247 | 247 | $notice['id'], |
| 248 | - empty( $notice['dismissible_type'] ) ? '' : wp_create_nonce( "give_edit_{$notice_id}_notice" ), |
|
| 248 | + empty($notice['dismissible_type']) ? '' : wp_create_nonce("give_edit_{$notice_id}_notice"), |
|
| 249 | 249 | $notice['dismiss_interval_time'] |
| 250 | 250 | ); |
| 251 | 251 | |
| 252 | - $output .= ( 0 === strpos( $notice['description'], '<div' ) || 0 === strpos( $notice['description'], '<p' ) ? $notice['description'] : "<p>{$notice['description']}</p>" ); |
|
| 252 | + $output .= (0 === strpos($notice['description'], '<div') || 0 === strpos($notice['description'], '<p') ? $notice['description'] : "<p>{$notice['description']}</p>"); |
|
| 253 | 253 | $output .= "</div> \n"; |
| 254 | 254 | } |
| 255 | 255 | |
@@ -267,18 +267,18 @@ discard block |
||
| 267 | 267 | * |
| 268 | 268 | * @param int $form_id |
| 269 | 269 | */ |
| 270 | - public function render_frontend_notices( $form_id = 0 ) { |
|
| 270 | + public function render_frontend_notices($form_id = 0) { |
|
| 271 | 271 | $errors = give_get_errors(); |
| 272 | 272 | |
| 273 | - $request_form_id = isset( $_REQUEST['form-id'] ) ? absint( $_REQUEST['form-id'] ) : 0; |
|
| 273 | + $request_form_id = isset($_REQUEST['form-id']) ? absint($_REQUEST['form-id']) : 0; |
|
| 274 | 274 | |
| 275 | 275 | // Sanity checks first: Ensure that gateway returned errors display on the appropriate form. |
| 276 | - if ( ! isset( $_POST['give_ajax'] ) && $request_form_id !== $form_id ) { |
|
| 276 | + if ( ! isset($_POST['give_ajax']) && $request_form_id !== $form_id) { |
|
| 277 | 277 | return; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - if ( $errors ) { |
|
| 281 | - self::print_frontend_errors( $errors ); |
|
| 280 | + if ($errors) { |
|
| 281 | + self::print_frontend_errors($errors); |
|
| 282 | 282 | |
| 283 | 283 | give_clear_errors(); |
| 284 | 284 | } |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | * @access private |
| 292 | 292 | */ |
| 293 | 293 | private function print_js() { |
| 294 | - if ( self::$has_auto_dismissible_notice ) : |
|
| 294 | + if (self::$has_auto_dismissible_notice) : |
|
| 295 | 295 | ?> |
| 296 | 296 | <script> |
| 297 | 297 | jQuery(document).ready(function () { |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | <?php |
| 308 | 308 | endif; |
| 309 | 309 | |
| 310 | - if ( self::$has_dismiss_interval_notice ) : |
|
| 310 | + if (self::$has_dismiss_interval_notice) : |
|
| 311 | 311 | ?> |
| 312 | 312 | <script> |
| 313 | 313 | jQuery(document).ready(function () { |
@@ -386,36 +386,36 @@ discard block |
||
| 386 | 386 | * @access public |
| 387 | 387 | */ |
| 388 | 388 | public function dismiss_notices() { |
| 389 | - $_post = give_clean( $_POST ); |
|
| 390 | - $notice_id = esc_attr( $_post['notice_id'] ); |
|
| 389 | + $_post = give_clean($_POST); |
|
| 390 | + $notice_id = esc_attr($_post['notice_id']); |
|
| 391 | 391 | |
| 392 | 392 | // Bailout. |
| 393 | 393 | if ( |
| 394 | - empty( $notice_id ) || |
|
| 395 | - empty( $_post['dismissible_type'] ) || |
|
| 396 | - empty( $_post['dismiss_interval'] ) || |
|
| 397 | - ! check_ajax_referer( "give_edit_{$notice_id}_notice", '_wpnonce' ) |
|
| 394 | + empty($notice_id) || |
|
| 395 | + empty($_post['dismissible_type']) || |
|
| 396 | + empty($_post['dismiss_interval']) || |
|
| 397 | + ! check_ajax_referer("give_edit_{$notice_id}_notice", '_wpnonce') |
|
| 398 | 398 | ) { |
| 399 | 399 | wp_send_json_error(); |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | - $notice_key = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'] ); |
|
| 403 | - if ( 'user' === $_post['dismissible_type'] ) { |
|
| 402 | + $notice_key = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval']); |
|
| 403 | + if ('user' === $_post['dismissible_type']) { |
|
| 404 | 404 | $current_user = wp_get_current_user(); |
| 405 | - $notice_key = Give()->notices->get_notice_key( $notice_id, $_post['dismiss_interval'], $current_user->ID ); |
|
| 405 | + $notice_key = Give()->notices->get_notice_key($notice_id, $_post['dismiss_interval'], $current_user->ID); |
|
| 406 | 406 | } |
| 407 | 407 | |
| 408 | - $notice_dismiss_time = ! empty( $_post['dismiss_interval_time'] ) ? $_post['dismiss_interval_time'] : null; |
|
| 408 | + $notice_dismiss_time = ! empty($_post['dismiss_interval_time']) ? $_post['dismiss_interval_time'] : null; |
|
| 409 | 409 | |
| 410 | 410 | // Save option to hide notice. |
| 411 | - Give_Cache::set( $notice_key, true, $notice_dismiss_time, true ); |
|
| 411 | + Give_Cache::set($notice_key, true, $notice_dismiss_time, true); |
|
| 412 | 412 | |
| 413 | 413 | /** |
| 414 | 414 | * Fire the action when notice dismissed |
| 415 | 415 | * |
| 416 | 416 | * @since 2.0 |
| 417 | 417 | */ |
| 418 | - do_action( 'give_dismiss_notices', $_post ); |
|
| 418 | + do_action('give_dismiss_notices', $_post); |
|
| 419 | 419 | |
| 420 | 420 | wp_send_json_success(); |
| 421 | 421 | } |
@@ -433,18 +433,18 @@ discard block |
||
| 433 | 433 | * |
| 434 | 434 | * @return string |
| 435 | 435 | */ |
| 436 | - public function get_notice_key( $notice_id, $dismiss_interval = null, $user_id = 0 ) { |
|
| 436 | + public function get_notice_key($notice_id, $dismiss_interval = null, $user_id = 0) { |
|
| 437 | 437 | $notice_key = "_give_notice_{$notice_id}"; |
| 438 | 438 | |
| 439 | - if ( ! empty( $dismiss_interval ) ) { |
|
| 439 | + if ( ! empty($dismiss_interval)) { |
|
| 440 | 440 | $notice_key .= "_{$dismiss_interval}"; |
| 441 | 441 | } |
| 442 | 442 | |
| 443 | - if ( $user_id ) { |
|
| 443 | + if ($user_id) { |
|
| 444 | 444 | $notice_key .= "_{$user_id}"; |
| 445 | 445 | } |
| 446 | 446 | |
| 447 | - $notice_key = sanitize_key( $notice_key ); |
|
| 447 | + $notice_key = sanitize_key($notice_key); |
|
| 448 | 448 | |
| 449 | 449 | return $notice_key; |
| 450 | 450 | } |
@@ -457,11 +457,11 @@ discard block |
||
| 457 | 457 | * |
| 458 | 458 | * @return string |
| 459 | 459 | */ |
| 460 | - public function get_dismiss_link( $notice_args ) { |
|
| 460 | + public function get_dismiss_link($notice_args) { |
|
| 461 | 461 | $notice_args = wp_parse_args( |
| 462 | 462 | $notice_args, |
| 463 | 463 | array( |
| 464 | - 'title' => __( 'Click here', 'give' ), |
|
| 464 | + 'title' => __('Click here', 'give'), |
|
| 465 | 465 | 'dismissible_type' => '', |
| 466 | 466 | 'dismiss_interval' => '', |
| 467 | 467 | 'dismiss_interval_time' => null, |
@@ -488,31 +488,31 @@ discard block |
||
| 488 | 488 | * |
| 489 | 489 | * @return bool|null |
| 490 | 490 | */ |
| 491 | - public function is_notice_dismissed( $notice ) { |
|
| 492 | - $notice_key = $this->get_notice_key( $notice['id'], $notice['dismiss_interval'] ); |
|
| 491 | + public function is_notice_dismissed($notice) { |
|
| 492 | + $notice_key = $this->get_notice_key($notice['id'], $notice['dismiss_interval']); |
|
| 493 | 493 | $is_notice_dismissed = false; |
| 494 | 494 | |
| 495 | - if ( 'user' === $notice['dismissible_type'] ) { |
|
| 495 | + if ('user' === $notice['dismissible_type']) { |
|
| 496 | 496 | $current_user = wp_get_current_user(); |
| 497 | - $notice_key = Give()->notices->get_notice_key( $notice['id'], $notice['dismiss_interval'], $current_user->ID ); |
|
| 497 | + $notice_key = Give()->notices->get_notice_key($notice['id'], $notice['dismiss_interval'], $current_user->ID); |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | - $notice_data = Give_Cache::get( $notice_key, true ); |
|
| 500 | + $notice_data = Give_Cache::get($notice_key, true); |
|
| 501 | 501 | |
| 502 | 502 | // Find notice dismiss link status if notice has extra dismissible links. |
| 503 | - if ( ( empty( $notice_data ) || is_wp_error( $notice_data ) ) && ! empty( $notice['extra_links'] ) ) { |
|
| 503 | + if ((empty($notice_data) || is_wp_error($notice_data)) && ! empty($notice['extra_links'])) { |
|
| 504 | 504 | |
| 505 | - foreach ( $notice['extra_links'] as $extra_link ) { |
|
| 506 | - $new_notice_data = wp_parse_args( $extra_link, $notice ); |
|
| 507 | - unset( $new_notice_data['extra_links'] ); |
|
| 505 | + foreach ($notice['extra_links'] as $extra_link) { |
|
| 506 | + $new_notice_data = wp_parse_args($extra_link, $notice); |
|
| 507 | + unset($new_notice_data['extra_links']); |
|
| 508 | 508 | |
| 509 | - if ( $is_notice_dismissed = $this->is_notice_dismissed( $new_notice_data ) ) { |
|
| 509 | + if ($is_notice_dismissed = $this->is_notice_dismissed($new_notice_data)) { |
|
| 510 | 510 | return $is_notice_dismissed; |
| 511 | 511 | } |
| 512 | 512 | } |
| 513 | 513 | } |
| 514 | 514 | |
| 515 | - $is_notice_dismissed = ! empty( $notice_data ) && ! is_wp_error( $notice_data ); |
|
| 515 | + $is_notice_dismissed = ! empty($notice_data) && ! is_wp_error($notice_data); |
|
| 516 | 516 | |
| 517 | 517 | return $is_notice_dismissed; |
| 518 | 518 | } |
@@ -526,9 +526,9 @@ discard block |
||
| 526 | 526 | * |
| 527 | 527 | * @param array $errors |
| 528 | 528 | */ |
| 529 | - public static function print_frontend_errors( $errors ) { |
|
| 529 | + public static function print_frontend_errors($errors) { |
|
| 530 | 530 | // Bailout. |
| 531 | - if ( ! $errors ) { |
|
| 531 | + if ( ! $errors) { |
|
| 532 | 532 | return; |
| 533 | 533 | } |
| 534 | 534 | |
@@ -543,37 +543,37 @@ discard block |
||
| 543 | 543 | ); |
| 544 | 544 | |
| 545 | 545 | // Note: we will remove give_errors class in future. |
| 546 | - $classes = apply_filters( 'give_error_class', array( 'give_notices', 'give_errors' ) ); |
|
| 546 | + $classes = apply_filters('give_error_class', array('give_notices', 'give_errors')); |
|
| 547 | 547 | |
| 548 | - echo sprintf( '<div class="%s">', implode( ' ', $classes ) ); |
|
| 548 | + echo sprintf('<div class="%s">', implode(' ', $classes)); |
|
| 549 | 549 | |
| 550 | 550 | // Loop error codes and display errors. |
| 551 | - foreach ( $errors as $error_id => $error ) { |
|
| 551 | + foreach ($errors as $error_id => $error) { |
|
| 552 | 552 | // Backward compatibility v<1.8.11 |
| 553 | - if ( is_string( $error ) ) { |
|
| 553 | + if (is_string($error)) { |
|
| 554 | 554 | $error = array( |
| 555 | 555 | 'message' => $error, |
| 556 | 556 | 'notice_args' => array(), |
| 557 | 557 | ); |
| 558 | 558 | } |
| 559 | 559 | |
| 560 | - $notice_args = wp_parse_args( $error['notice_args'], $default_notice_args ); |
|
| 560 | + $notice_args = wp_parse_args($error['notice_args'], $default_notice_args); |
|
| 561 | 561 | |
| 562 | 562 | /** |
| 563 | 563 | * Filter to modify Frontend Errors args before errors is display. |
| 564 | 564 | * |
| 565 | 565 | * @since 1.8.14 |
| 566 | 566 | */ |
| 567 | - $notice_args = apply_filters( 'give_frontend_errors_args', $notice_args ); |
|
| 567 | + $notice_args = apply_filters('give_frontend_errors_args', $notice_args); |
|
| 568 | 568 | |
| 569 | 569 | echo sprintf( |
| 570 | 570 | '<div class="give_error give_notice" id="give_error_%1$s" data-dismissible="%2$s" data-dismiss-interval="%3$d"> |
| 571 | 571 | <p><strong>%4$s</strong>: %5$s</p> |
| 572 | 572 | </div>', |
| 573 | 573 | $error_id, |
| 574 | - give_clean( $notice_args['dismissible'] ), |
|
| 575 | - absint( $notice_args['dismiss_interval'] ), |
|
| 576 | - esc_html__( 'Error', 'give' ), |
|
| 574 | + give_clean($notice_args['dismissible']), |
|
| 575 | + absint($notice_args['dismiss_interval']), |
|
| 576 | + esc_html__('Error', 'give'), |
|
| 577 | 577 | $error['message'] |
| 578 | 578 | ); |
| 579 | 579 | } |
@@ -595,8 +595,8 @@ discard block |
||
| 595 | 595 | * |
| 596 | 596 | * @return string |
| 597 | 597 | */ |
| 598 | - public static function print_frontend_notice( $message, $echo = true, $notice_type = 'warning', $notice_args = array() ) { |
|
| 599 | - if ( empty( $message ) ) { |
|
| 598 | + public static function print_frontend_notice($message, $echo = true, $notice_type = 'warning', $notice_args = array()) { |
|
| 599 | + if (empty($message)) { |
|
| 600 | 600 | return ''; |
| 601 | 601 | } |
| 602 | 602 | |
@@ -611,7 +611,7 @@ discard block |
||
| 611 | 611 | 'dismiss_interval' => 5000, |
| 612 | 612 | ); |
| 613 | 613 | |
| 614 | - $notice_args = wp_parse_args( $notice_args, $default_notice_args ); |
|
| 614 | + $notice_args = wp_parse_args($notice_args, $default_notice_args); |
|
| 615 | 615 | |
| 616 | 616 | // Notice dismissible must be true for dismiss type. |
| 617 | 617 | $notice_args['dismiss_type'] = ! $notice_args['dismissible'] ? '' : $notice_args['dismiss_type']; |
@@ -621,15 +621,14 @@ discard block |
||
| 621 | 621 | * |
| 622 | 622 | * @since 1.8.14 |
| 623 | 623 | */ |
| 624 | - $notice_args = apply_filters( 'give_frontend_notice_args', $notice_args ); |
|
| 624 | + $notice_args = apply_filters('give_frontend_notice_args', $notice_args); |
|
| 625 | 625 | |
| 626 | 626 | $close_icon = 'manual' === $notice_args['dismiss_type'] ? |
| 627 | 627 | sprintf( |
| 628 | 628 | '<img class="notice-dismiss give-notice-close" src="%s" />', |
| 629 | - esc_url( GIVE_PLUGIN_URL . 'assets/dist/images/close.svg' ) |
|
| 629 | + esc_url(GIVE_PLUGIN_URL.'assets/dist/images/close.svg') |
|
| 630 | 630 | |
| 631 | - ) : |
|
| 632 | - ''; |
|
| 631 | + ) : ''; |
|
| 633 | 632 | |
| 634 | 633 | // Note: we will remove give_errors class in future. |
| 635 | 634 | $error = sprintf( |
@@ -640,15 +639,15 @@ discard block |
||
| 640 | 639 | %6$s |
| 641 | 640 | </div>', |
| 642 | 641 | $notice_type, |
| 643 | - give_clean( $notice_args['dismissible'] ), |
|
| 644 | - absint( $notice_args['dismiss_interval'] ), |
|
| 645 | - give_clean( $notice_args['dismiss_type'] ), |
|
| 642 | + give_clean($notice_args['dismissible']), |
|
| 643 | + absint($notice_args['dismiss_interval']), |
|
| 644 | + give_clean($notice_args['dismiss_type']), |
|
| 646 | 645 | $message, |
| 647 | 646 | $close_icon |
| 648 | 647 | |
| 649 | 648 | ); |
| 650 | 649 | |
| 651 | - if ( ! $echo ) { |
|
| 650 | + if ( ! $echo) { |
|
| 652 | 651 | return $error; |
| 653 | 652 | } |
| 654 | 653 | |
@@ -668,24 +667,24 @@ discard block |
||
| 668 | 667 | * |
| 669 | 668 | * @return string |
| 670 | 669 | */ |
| 671 | - public function print_admin_notices( $notice_args = array() ) { |
|
| 670 | + public function print_admin_notices($notice_args = array()) { |
|
| 672 | 671 | // Bailout. |
| 673 | - if ( empty( $notice_args['description'] ) ) { |
|
| 672 | + if (empty($notice_args['description'])) { |
|
| 674 | 673 | return ''; |
| 675 | 674 | } |
| 676 | 675 | |
| 677 | - $defaults = array( |
|
| 676 | + $defaults = array( |
|
| 678 | 677 | 'id' => '', |
| 679 | 678 | 'echo' => true, |
| 680 | 679 | 'notice_type' => 'warning', |
| 681 | 680 | 'dismissible' => true, |
| 682 | 681 | ); |
| 683 | - $notice_args = wp_parse_args( $notice_args, $defaults ); |
|
| 682 | + $notice_args = wp_parse_args($notice_args, $defaults); |
|
| 684 | 683 | |
| 685 | 684 | $output = ''; |
| 686 | - $css_id = ! empty( $notice_args['id'] ) ? $notice_args['id'] : uniqid( 'give-inline-notice-' ); |
|
| 685 | + $css_id = ! empty($notice_args['id']) ? $notice_args['id'] : uniqid('give-inline-notice-'); |
|
| 687 | 686 | $css_class = "notice-{$notice_args['notice_type']} give-notice notice inline"; |
| 688 | - $css_class .= ( $notice_args['dismissible'] ) ? ' is-dismissible' : ''; |
|
| 687 | + $css_class .= ($notice_args['dismissible']) ? ' is-dismissible' : ''; |
|
| 689 | 688 | $output .= sprintf( |
| 690 | 689 | '<div id="%1$s" class="%2$s"><p>%3$s</p></div>', |
| 691 | 690 | $css_id, |
@@ -693,7 +692,7 @@ discard block |
||
| 693 | 692 | $notice_args['description'] |
| 694 | 693 | ); |
| 695 | 694 | |
| 696 | - if ( ! $notice_args['echo'] ) { |
|
| 695 | + if ( ! $notice_args['echo']) { |
|
| 697 | 696 | return $output; |
| 698 | 697 | } |
| 699 | 698 | |
@@ -20,17 +20,17 @@ discard block |
||
| 20 | 20 | * |
| 21 | 21 | * @return string The currency code |
| 22 | 22 | */ |
| 23 | -function give_get_currency( $donation_or_form_id = null, $args = array() ) { |
|
| 23 | +function give_get_currency($donation_or_form_id = null, $args = array()) { |
|
| 24 | 24 | |
| 25 | 25 | // Get currency from donation |
| 26 | - if ( is_numeric( $donation_or_form_id ) && 'give_payment' === get_post_type( $donation_or_form_id ) ) { |
|
| 27 | - $currency = give_get_meta( $donation_or_form_id, '_give_payment_currency', true ); |
|
| 26 | + if (is_numeric($donation_or_form_id) && 'give_payment' === get_post_type($donation_or_form_id)) { |
|
| 27 | + $currency = give_get_meta($donation_or_form_id, '_give_payment_currency', true); |
|
| 28 | 28 | |
| 29 | - if ( empty( $currency ) ) { |
|
| 30 | - $currency = give_get_option( 'currency', 'USD' ); |
|
| 29 | + if (empty($currency)) { |
|
| 30 | + $currency = give_get_option('currency', 'USD'); |
|
| 31 | 31 | } |
| 32 | 32 | } else { |
| 33 | - $currency = give_get_option( 'currency', 'USD' ); |
|
| 33 | + $currency = give_get_option('currency', 'USD'); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @since 1.0 |
| 40 | 40 | */ |
| 41 | - return apply_filters( 'give_currency', $currency, $donation_or_form_id, $args ); |
|
| 41 | + return apply_filters('give_currency', $currency, $donation_or_form_id, $args); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | function give_get_currency_position() { |
| 52 | 52 | |
| 53 | - $currency_pos = give_get_option( 'currency_position', 'before' ); |
|
| 53 | + $currency_pos = give_get_option('currency_position', 'before'); |
|
| 54 | 54 | |
| 55 | - return apply_filters( 'give_currency_position', $currency_pos ); |
|
| 55 | + return apply_filters('give_currency_position', $currency_pos); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | function give_get_currencies_list() { |
| 66 | 66 | $currencies = array( |
| 67 | 67 | 'USD' => array( |
| 68 | - 'admin_label' => sprintf( __('US Dollars (%1$s)', 'give'), '$'), |
|
| 68 | + 'admin_label' => sprintf(__('US Dollars (%1$s)', 'give'), '$'), |
|
| 69 | 69 | 'symbol' => '$', |
| 70 | 70 | 'setting' => array( |
| 71 | 71 | 'currency_position' => 'before', |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | ), |
| 76 | 76 | ), |
| 77 | 77 | 'EUR' => array( |
| 78 | - 'admin_label' => sprintf( __('Euros (%1$s)', 'give'), '€'), |
|
| 78 | + 'admin_label' => sprintf(__('Euros (%1$s)', 'give'), '€'), |
|
| 79 | 79 | 'symbol' => '€', |
| 80 | 80 | 'setting' => array( |
| 81 | 81 | 'currency_position' => 'before', |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | ), |
| 86 | 86 | ), |
| 87 | 87 | 'GBP' => array( |
| 88 | - 'admin_label' => sprintf( __('Pounds Sterling (%1$s)', 'give'), '£'), |
|
| 88 | + 'admin_label' => sprintf(__('Pounds Sterling (%1$s)', 'give'), '£'), |
|
| 89 | 89 | 'symbol' => '£', |
| 90 | 90 | 'setting' => array( |
| 91 | 91 | 'currency_position' => 'before', |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | ), |
| 96 | 96 | ), |
| 97 | 97 | 'AUD' => array( |
| 98 | - 'admin_label' => sprintf( __('Australian Dollars (%1$s)', 'give'), '$'), |
|
| 98 | + 'admin_label' => sprintf(__('Australian Dollars (%1$s)', 'give'), '$'), |
|
| 99 | 99 | 'symbol' => '$', |
| 100 | 100 | 'setting' => array( |
| 101 | 101 | 'currency_position' => 'before', |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | ), |
| 106 | 106 | ), |
| 107 | 107 | 'BRL' => array( |
| 108 | - 'admin_label' => sprintf( __('Brazilian Real (%1$s)', 'give'), 'R$'), |
|
| 108 | + 'admin_label' => sprintf(__('Brazilian Real (%1$s)', 'give'), 'R$'), |
|
| 109 | 109 | 'symbol' => 'R$', |
| 110 | 110 | 'setting' => array( |
| 111 | 111 | 'currency_position' => 'before', |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | ), |
| 116 | 116 | ), |
| 117 | 117 | 'CAD' => array( |
| 118 | - 'admin_label' => sprintf( __('Canadian Dollars (%1$s)', 'give'), '$'), |
|
| 118 | + 'admin_label' => sprintf(__('Canadian Dollars (%1$s)', 'give'), '$'), |
|
| 119 | 119 | 'symbol' => '$', |
| 120 | 120 | 'setting' => array( |
| 121 | 121 | 'currency_position' => 'before', |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | ), |
| 126 | 126 | ), |
| 127 | 127 | 'CZK' => array( |
| 128 | - 'admin_label' => sprintf( __('Czech Koruna (%1$s)', 'give'), 'Kč'), |
|
| 128 | + 'admin_label' => sprintf(__('Czech Koruna (%1$s)', 'give'), 'Kč'), |
|
| 129 | 129 | 'symbol' => 'Kč', |
| 130 | 130 | 'setting' => array( |
| 131 | 131 | 'currency_position' => 'after', |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | ), |
| 136 | 136 | ), |
| 137 | 137 | 'DKK' => array( |
| 138 | - 'admin_label' => sprintf( __('Danish Krone (%1$s)', 'give'), ' kr. '), |
|
| 138 | + 'admin_label' => sprintf(__('Danish Krone (%1$s)', 'give'), ' kr. '), |
|
| 139 | 139 | 'symbol' => ' kr. ', |
| 140 | 140 | 'setting' => array( |
| 141 | 141 | 'currency_position' => 'before', |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | ), |
| 146 | 146 | ), |
| 147 | 147 | 'HKD' => array( |
| 148 | - 'admin_label' => sprintf( __('Hong Kong Dollar (%1$s)', 'give'), '$'), |
|
| 148 | + 'admin_label' => sprintf(__('Hong Kong Dollar (%1$s)', 'give'), '$'), |
|
| 149 | 149 | 'symbol' => '$', |
| 150 | 150 | 'setting' => array( |
| 151 | 151 | 'currency_position' => 'before', |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | ), |
| 156 | 156 | ), |
| 157 | 157 | 'HUF' => array( |
| 158 | - 'admin_label' => sprintf( __('Hungarian Forint (%1$s)', 'give'), 'Ft'), |
|
| 158 | + 'admin_label' => sprintf(__('Hungarian Forint (%1$s)', 'give'), 'Ft'), |
|
| 159 | 159 | 'symbol' => 'Ft', |
| 160 | 160 | 'setting' => array( |
| 161 | 161 | 'currency_position' => 'after', |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | ), |
| 166 | 166 | ), |
| 167 | 167 | 'ILS' => array( |
| 168 | - 'admin_label' => sprintf( __('Israeli Shekel (%1$s)', 'give'), '₪'), |
|
| 168 | + 'admin_label' => sprintf(__('Israeli Shekel (%1$s)', 'give'), '₪'), |
|
| 169 | 169 | 'symbol' => '₪', |
| 170 | 170 | 'setting' => array( |
| 171 | 171 | 'currency_position' => 'after', |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | ), |
| 176 | 176 | ), |
| 177 | 177 | 'JPY' => array( |
| 178 | - 'admin_label' => sprintf( __('Japanese Yen (%1$s)', 'give'), '¥'), |
|
| 178 | + 'admin_label' => sprintf(__('Japanese Yen (%1$s)', 'give'), '¥'), |
|
| 179 | 179 | 'symbol' => '¥', |
| 180 | 180 | 'setting' => array( |
| 181 | 181 | 'currency_position' => 'before', |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | ), |
| 186 | 186 | ), |
| 187 | 187 | 'MYR' => array( |
| 188 | - 'admin_label' => sprintf( __('Malaysian Ringgits (%1$s)', 'give'), 'RM'), |
|
| 188 | + 'admin_label' => sprintf(__('Malaysian Ringgits (%1$s)', 'give'), 'RM'), |
|
| 189 | 189 | 'symbol' => 'RM', |
| 190 | 190 | 'setting' => array( |
| 191 | 191 | 'currency_position' => 'before', |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | ), |
| 196 | 196 | ), |
| 197 | 197 | 'MXN' => array( |
| 198 | - 'admin_label' => sprintf( __('Mexican Peso (%1$s)', 'give'), '$'), |
|
| 198 | + 'admin_label' => sprintf(__('Mexican Peso (%1$s)', 'give'), '$'), |
|
| 199 | 199 | 'symbol' => '$', |
| 200 | 200 | 'setting' => array( |
| 201 | 201 | 'currency_position' => 'before', |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | ), |
| 206 | 206 | ), |
| 207 | 207 | 'MAD' => array( |
| 208 | - 'admin_label' => sprintf( __('Moroccan Dirham (%1$s)', 'give'), '.د.م'), |
|
| 208 | + 'admin_label' => sprintf(__('Moroccan Dirham (%1$s)', 'give'), '.د.م'), |
|
| 209 | 209 | 'symbol' => '.د.م', |
| 210 | 210 | 'setting' => array( |
| 211 | 211 | 'currency_position' => 'before', |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | ), |
| 216 | 216 | ), |
| 217 | 217 | 'NZD' => array( |
| 218 | - 'admin_label' => sprintf( __('New Zealand Dollar (%1$s)', 'give'), '$'), |
|
| 218 | + 'admin_label' => sprintf(__('New Zealand Dollar (%1$s)', 'give'), '$'), |
|
| 219 | 219 | 'symbol' => '$', |
| 220 | 220 | 'setting' => array( |
| 221 | 221 | 'currency_position' => 'before', |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | ), |
| 226 | 226 | ), |
| 227 | 227 | 'NOK' => array( |
| 228 | - 'admin_label' => sprintf( __('Norwegian Krone (%1$s)', 'give'), 'kr.'), |
|
| 228 | + 'admin_label' => sprintf(__('Norwegian Krone (%1$s)', 'give'), 'kr.'), |
|
| 229 | 229 | 'symbol' => 'kr.', |
| 230 | 230 | 'setting' => array( |
| 231 | 231 | 'currency_position' => 'before', |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | ), |
| 236 | 236 | ), |
| 237 | 237 | 'PHP' => array( |
| 238 | - 'admin_label' => sprintf( __('Philippine Pesos (%1$s)', 'give'), '₱'), |
|
| 238 | + 'admin_label' => sprintf(__('Philippine Pesos (%1$s)', 'give'), '₱'), |
|
| 239 | 239 | 'symbol' => '₱', |
| 240 | 240 | 'setting' => array( |
| 241 | 241 | 'currency_position' => 'before', |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | ), |
| 246 | 246 | ), |
| 247 | 247 | 'PLN' => array( |
| 248 | - 'admin_label' => sprintf( __('Polish Zloty (%1$s)', 'give'), 'zł'), |
|
| 248 | + 'admin_label' => sprintf(__('Polish Zloty (%1$s)', 'give'), 'zł'), |
|
| 249 | 249 | 'symbol' => 'zł', |
| 250 | 250 | 'setting' => array( |
| 251 | 251 | 'currency_position' => 'after', |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | ), |
| 256 | 256 | ), |
| 257 | 257 | 'SGD' => array( |
| 258 | - 'admin_label' => sprintf( __('Singapore Dollar (%1$s)', 'give'), '$'), |
|
| 258 | + 'admin_label' => sprintf(__('Singapore Dollar (%1$s)', 'give'), '$'), |
|
| 259 | 259 | 'symbol' => '$', |
| 260 | 260 | 'setting' => array( |
| 261 | 261 | 'currency_position' => 'before', |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | ), |
| 266 | 266 | ), |
| 267 | 267 | 'KRW' => array( |
| 268 | - 'admin_label' => sprintf( __('South Korean Won (%1$s)', 'give'), '₩'), |
|
| 268 | + 'admin_label' => sprintf(__('South Korean Won (%1$s)', 'give'), '₩'), |
|
| 269 | 269 | 'symbol' => '₩', |
| 270 | 270 | 'setting' => array( |
| 271 | 271 | 'currency_position' => 'before', |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | ), |
| 276 | 276 | ), |
| 277 | 277 | 'ZAR' => array( |
| 278 | - 'admin_label' => sprintf( __('South African Rand (%1$s)', 'give'), 'R'), |
|
| 278 | + 'admin_label' => sprintf(__('South African Rand (%1$s)', 'give'), 'R'), |
|
| 279 | 279 | 'symbol' => 'R', |
| 280 | 280 | 'setting' => array( |
| 281 | 281 | 'currency_position' => 'before', |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | ), |
| 286 | 286 | ), |
| 287 | 287 | 'SEK' => array( |
| 288 | - 'admin_label' => sprintf( __('Swedish Krona (%1$s)', 'give'), ' kr. '), |
|
| 288 | + 'admin_label' => sprintf(__('Swedish Krona (%1$s)', 'give'), ' kr. '), |
|
| 289 | 289 | 'symbol' => ' kr. ', |
| 290 | 290 | 'setting' => array( |
| 291 | 291 | 'currency_position' => 'before', |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | ), |
| 296 | 296 | ), |
| 297 | 297 | 'CHF' => array( |
| 298 | - 'admin_label' => sprintf( __('Swiss Franc (%1$s)', 'give'), 'Fr'), |
|
| 298 | + 'admin_label' => sprintf(__('Swiss Franc (%1$s)', 'give'), 'Fr'), |
|
| 299 | 299 | 'symbol' => 'Fr', |
| 300 | 300 | 'setting' => array( |
| 301 | 301 | 'currency_position' => 'before', |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | ), |
| 306 | 306 | ), |
| 307 | 307 | 'TWD' => array( |
| 308 | - 'admin_label' => sprintf( __('Taiwan New Dollars (%1$s)', 'give'), 'NT$'), |
|
| 308 | + 'admin_label' => sprintf(__('Taiwan New Dollars (%1$s)', 'give'), 'NT$'), |
|
| 309 | 309 | 'symbol' => 'NT$', |
| 310 | 310 | 'setting' => array( |
| 311 | 311 | 'currency_position' => 'before', |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | ), |
| 316 | 316 | ), |
| 317 | 317 | 'THB' => array( |
| 318 | - 'admin_label' => sprintf( __('Thai Baht (%1$s)', 'give'), '฿'), |
|
| 318 | + 'admin_label' => sprintf(__('Thai Baht (%1$s)', 'give'), '฿'), |
|
| 319 | 319 | 'symbol' => '฿', |
| 320 | 320 | 'setting' => array( |
| 321 | 321 | 'currency_position' => 'before', |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | ), |
| 326 | 326 | ), |
| 327 | 327 | 'INR' => array( |
| 328 | - 'admin_label' => sprintf( __('Indian Rupee (%1$s)', 'give'), '₹'), |
|
| 328 | + 'admin_label' => sprintf(__('Indian Rupee (%1$s)', 'give'), '₹'), |
|
| 329 | 329 | 'symbol' => '₹', |
| 330 | 330 | 'setting' => array( |
| 331 | 331 | 'currency_position' => 'before', |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | ), |
| 336 | 336 | ), |
| 337 | 337 | 'TRY' => array( |
| 338 | - 'admin_label' => sprintf( __('Turkish Lira (%1$s)', 'give'), '₺'), |
|
| 338 | + 'admin_label' => sprintf(__('Turkish Lira (%1$s)', 'give'), '₺'), |
|
| 339 | 339 | 'symbol' => '₺', |
| 340 | 340 | 'setting' => array( |
| 341 | 341 | 'currency_position' => 'after', |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | ), |
| 346 | 346 | ), |
| 347 | 347 | 'IRR' => array( |
| 348 | - 'admin_label' => sprintf( __('Iranian Rial (%1$s)', 'give'), '﷼'), |
|
| 348 | + 'admin_label' => sprintf(__('Iranian Rial (%1$s)', 'give'), '﷼'), |
|
| 349 | 349 | 'symbol' => '﷼', |
| 350 | 350 | 'setting' => array( |
| 351 | 351 | 'currency_position' => 'after', |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | ), |
| 356 | 356 | ), |
| 357 | 357 | 'RUB' => array( |
| 358 | - 'admin_label' => sprintf( __('Russian Rubles (%1$s)', 'give'), '₽'), |
|
| 358 | + 'admin_label' => sprintf(__('Russian Rubles (%1$s)', 'give'), '₽'), |
|
| 359 | 359 | 'symbol' => '₽', |
| 360 | 360 | 'setting' => array( |
| 361 | 361 | 'currency_position' => 'before', |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | ), |
| 366 | 366 | ), |
| 367 | 367 | 'AED' => array( |
| 368 | - 'admin_label' => sprintf( __('United Arab Emirates dirham (%1$s)', 'give'), 'د.إ'), |
|
| 368 | + 'admin_label' => sprintf(__('United Arab Emirates dirham (%1$s)', 'give'), 'د.إ'), |
|
| 369 | 369 | 'symbol' => 'د.إ', |
| 370 | 370 | 'setting' => array( |
| 371 | 371 | 'currency_position' => 'before', |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | ), |
| 376 | 376 | ), |
| 377 | 377 | 'AMD' => array( |
| 378 | - 'admin_label' => sprintf( __('Armenian dram (%1$s)', 'give'), 'AMD'), |
|
| 378 | + 'admin_label' => sprintf(__('Armenian dram (%1$s)', 'give'), 'AMD'), |
|
| 379 | 379 | 'symbol' => 'AMD', // Add backward compatibility. Using AMD in place of ֏ |
| 380 | 380 | 'setting' => array( |
| 381 | 381 | 'currency_position' => 'before', |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | ), |
| 386 | 386 | ), |
| 387 | 387 | 'ANG' => array( |
| 388 | - 'admin_label' => sprintf( __('Netherlands Antillean guilder (%1$s)', 'give'), 'ƒ'), |
|
| 388 | + 'admin_label' => sprintf(__('Netherlands Antillean guilder (%1$s)', 'give'), 'ƒ'), |
|
| 389 | 389 | 'symbol' => 'ƒ', |
| 390 | 390 | 'setting' => array( |
| 391 | 391 | 'currency_position' => 'before', |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | ), |
| 396 | 396 | ), |
| 397 | 397 | 'ARS' => array( |
| 398 | - 'admin_label' => sprintf( __('Argentine peso (%1$s)', 'give'), '$'), |
|
| 398 | + 'admin_label' => sprintf(__('Argentine peso (%1$s)', 'give'), '$'), |
|
| 399 | 399 | 'symbol' => '$', |
| 400 | 400 | 'setting' => array( |
| 401 | 401 | 'currency_position' => 'before', |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | ), |
| 406 | 406 | ), |
| 407 | 407 | 'AWG' => array( |
| 408 | - 'admin_label' => sprintf( __( 'Aruban florin (%1$s)', 'give' ), 'ƒ' ), |
|
| 408 | + 'admin_label' => sprintf(__('Aruban florin (%1$s)', 'give'), 'ƒ'), |
|
| 409 | 409 | 'symbol' => 'ƒ', |
| 410 | 410 | 'setting' => array( |
| 411 | 411 | 'currency_position' => 'before', |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | ), |
| 416 | 416 | ), |
| 417 | 417 | 'BAM' => array( |
| 418 | - 'admin_label' => sprintf( __( 'Bosnia and Herzegovina convertible mark (%1$s)', 'give' ), 'KM' ), |
|
| 418 | + 'admin_label' => sprintf(__('Bosnia and Herzegovina convertible mark (%1$s)', 'give'), 'KM'), |
|
| 419 | 419 | 'symbol' => 'KM', |
| 420 | 420 | 'setting' => array( |
| 421 | 421 | 'currency_position' => 'before', |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | ), |
| 426 | 426 | ), |
| 427 | 427 | 'BDT' => array( |
| 428 | - 'admin_label' => sprintf( __( 'Bangladeshi taka (%1$s)', 'give' ), '৳' ), |
|
| 428 | + 'admin_label' => sprintf(__('Bangladeshi taka (%1$s)', 'give'), '৳'), |
|
| 429 | 429 | 'symbol' => '৳', |
| 430 | 430 | 'setting' => array( |
| 431 | 431 | 'currency_position' => 'before', |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | ), |
| 436 | 436 | ), |
| 437 | 437 | 'BHD' => array( |
| 438 | - 'admin_label' => sprintf( __( 'Bahraini dinar (%1$s)', 'give' ), '.د.ب' ), |
|
| 438 | + 'admin_label' => sprintf(__('Bahraini dinar (%1$s)', 'give'), '.د.ب'), |
|
| 439 | 439 | 'symbol' => '.د.ب', |
| 440 | 440 | 'setting' => array( |
| 441 | 441 | 'currency_position' => 'before', |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | ), |
| 446 | 446 | ), |
| 447 | 447 | 'BMD' => array( |
| 448 | - 'admin_label' => sprintf( __( 'Bermudian dollar (%1$s)', 'give' ), 'BD$' ), |
|
| 448 | + 'admin_label' => sprintf(__('Bermudian dollar (%1$s)', 'give'), 'BD$'), |
|
| 449 | 449 | 'symbol' => 'BD$', |
| 450 | 450 | 'setting' => array( |
| 451 | 451 | 'currency_position' => 'before', |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | ), |
| 456 | 456 | ), |
| 457 | 457 | 'BND' => array( |
| 458 | - 'admin_label' => sprintf( __( 'Brunei dollar (%1$s)', 'give' ), 'B$' ), |
|
| 458 | + 'admin_label' => sprintf(__('Brunei dollar (%1$s)', 'give'), 'B$'), |
|
| 459 | 459 | 'symbol' => 'B$', |
| 460 | 460 | 'setting' => array( |
| 461 | 461 | 'currency_position' => 'before', |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | ), |
| 466 | 466 | ), |
| 467 | 467 | 'BOB' => array( |
| 468 | - 'admin_label' => sprintf( __( 'Bolivian boliviano (%1$s)', 'give' ), 'Bs.' ), |
|
| 468 | + 'admin_label' => sprintf(__('Bolivian boliviano (%1$s)', 'give'), 'Bs.'), |
|
| 469 | 469 | 'symbol' => 'Bs.', |
| 470 | 470 | 'setting' => array( |
| 471 | 471 | 'currency_position' => 'before', |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | ), |
| 476 | 476 | ), |
| 477 | 477 | 'BSD' => array( |
| 478 | - 'admin_label' => sprintf( __( 'Bahamian dollar (%1$s)', 'give' ), 'B$' ), |
|
| 478 | + 'admin_label' => sprintf(__('Bahamian dollar (%1$s)', 'give'), 'B$'), |
|
| 479 | 479 | 'symbol' => 'B$', |
| 480 | 480 | 'setting' => array( |
| 481 | 481 | 'currency_position' => 'before', |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | ), |
| 486 | 486 | ), |
| 487 | 487 | 'BWP' => array( |
| 488 | - 'admin_label' => sprintf( __( 'Botswana pula (%1$s)', 'give' ), 'P' ), |
|
| 488 | + 'admin_label' => sprintf(__('Botswana pula (%1$s)', 'give'), 'P'), |
|
| 489 | 489 | 'symbol' => 'P', |
| 490 | 490 | 'setting' => array( |
| 491 | 491 | 'currency_position' => 'before', |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | ), |
| 496 | 496 | ), |
| 497 | 497 | 'BZD' => array( |
| 498 | - 'admin_label' => sprintf( __( 'Belizean dollar (%1$s)', 'give' ), 'BZ$' ), |
|
| 498 | + 'admin_label' => sprintf(__('Belizean dollar (%1$s)', 'give'), 'BZ$'), |
|
| 499 | 499 | 'symbol' => 'BZ$', |
| 500 | 500 | 'setting' => array( |
| 501 | 501 | 'currency_position' => 'before', |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | ), |
| 506 | 506 | ), |
| 507 | 507 | 'CLP' => array( |
| 508 | - 'admin_label' => sprintf( __( 'Chilean peso (%1$s)', 'give' ), '$' ), |
|
| 508 | + 'admin_label' => sprintf(__('Chilean peso (%1$s)', 'give'), '$'), |
|
| 509 | 509 | 'symbol' => '$', |
| 510 | 510 | 'setting' => array( |
| 511 | 511 | 'currency_position' => 'before', |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | ), |
| 516 | 516 | ), |
| 517 | 517 | 'CNY' => array( |
| 518 | - 'admin_label' => sprintf( __( 'Chinese yuan (%1$s)', 'give' ), '¥' ), |
|
| 518 | + 'admin_label' => sprintf(__('Chinese yuan (%1$s)', 'give'), '¥'), |
|
| 519 | 519 | 'symbol' => '¥', |
| 520 | 520 | 'setting' => array( |
| 521 | 521 | 'currency_position' => 'before', |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | ), |
| 526 | 526 | ), |
| 527 | 527 | 'COP' => array( |
| 528 | - 'admin_label' => sprintf( __( 'Colombian peso (%1$s)', 'give' ), '$' ), |
|
| 528 | + 'admin_label' => sprintf(__('Colombian peso (%1$s)', 'give'), '$'), |
|
| 529 | 529 | 'symbol' => '$', |
| 530 | 530 | 'setting' => array( |
| 531 | 531 | 'currency_position' => 'before', |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | ), |
| 536 | 536 | ), |
| 537 | 537 | 'CRC' => array( |
| 538 | - 'admin_label' => sprintf( __( 'Costa Rican colón (%1$s)', 'give' ), '₡' ), |
|
| 538 | + 'admin_label' => sprintf(__('Costa Rican colón (%1$s)', 'give'), '₡'), |
|
| 539 | 539 | 'symbol' => '₡', |
| 540 | 540 | 'setting' => array( |
| 541 | 541 | 'currency_position' => 'before', |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | ), |
| 546 | 546 | ), |
| 547 | 547 | 'CUC' => array( |
| 548 | - 'admin_label' => sprintf( __( 'Cuban convertible peso (%1$s)', 'give' ), '₱' ), |
|
| 548 | + 'admin_label' => sprintf(__('Cuban convertible peso (%1$s)', 'give'), '₱'), |
|
| 549 | 549 | 'symbol' => '₱', |
| 550 | 550 | 'setting' => array( |
| 551 | 551 | 'currency_position' => 'before', |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | ), |
| 556 | 556 | ), |
| 557 | 557 | 'CUP' => array( |
| 558 | - 'admin_label' => sprintf( __( 'Cuban convertible peso (%1$s)', 'give' ), '₱' ), |
|
| 558 | + 'admin_label' => sprintf(__('Cuban convertible peso (%1$s)', 'give'), '₱'), |
|
| 559 | 559 | 'symbol' => '₱', |
| 560 | 560 | 'setting' => array( |
| 561 | 561 | 'currency_position' => 'before', |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | ), |
| 566 | 566 | ), |
| 567 | 567 | 'DOP' => array( |
| 568 | - 'admin_label' => sprintf( __( 'Dominican peso (%1$s)', 'give' ), 'RD$' ), |
|
| 568 | + 'admin_label' => sprintf(__('Dominican peso (%1$s)', 'give'), 'RD$'), |
|
| 569 | 569 | 'symbol' => 'RD$', |
| 570 | 570 | 'setting' => array( |
| 571 | 571 | 'currency_position' => 'before', |
@@ -575,7 +575,7 @@ discard block |
||
| 575 | 575 | ), |
| 576 | 576 | ), |
| 577 | 577 | 'EGP' => array( |
| 578 | - 'admin_label' => sprintf( __( 'Egyptian pound (%1$s)', 'give' ), 'E£' ), |
|
| 578 | + 'admin_label' => sprintf(__('Egyptian pound (%1$s)', 'give'), 'E£'), |
|
| 579 | 579 | 'symbol' => 'E£', |
| 580 | 580 | 'setting' => array( |
| 581 | 581 | 'currency_position' => 'before', |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | ), |
| 586 | 586 | ), |
| 587 | 587 | 'GIP' => array( |
| 588 | - 'admin_label' => sprintf( __( 'Gibraltar pound (%1$s)', 'give' ), '£' ), |
|
| 588 | + 'admin_label' => sprintf(__('Gibraltar pound (%1$s)', 'give'), '£'), |
|
| 589 | 589 | 'symbol' => '£', |
| 590 | 590 | 'setting' => array( |
| 591 | 591 | 'currency_position' => 'before', |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | ), |
| 596 | 596 | ), |
| 597 | 597 | 'GTQ' => array( |
| 598 | - 'admin_label' => sprintf( __( 'Guatemalan quetzal (%1$s)', 'give' ), 'Q' ), |
|
| 598 | + 'admin_label' => sprintf(__('Guatemalan quetzal (%1$s)', 'give'), 'Q'), |
|
| 599 | 599 | 'symbol' => 'Q', |
| 600 | 600 | 'setting' => array( |
| 601 | 601 | 'currency_position' => 'before', |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | ), |
| 606 | 606 | ), |
| 607 | 607 | 'HNL' => array( |
| 608 | - 'admin_label' => sprintf( __( 'Honduran lempira (%1$s)', 'give' ), 'L' ), |
|
| 608 | + 'admin_label' => sprintf(__('Honduran lempira (%1$s)', 'give'), 'L'), |
|
| 609 | 609 | 'symbol' => 'L', |
| 610 | 610 | 'setting' => array( |
| 611 | 611 | 'currency_position' => 'before', |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | ), |
| 616 | 616 | ), |
| 617 | 617 | 'HRK' => array( |
| 618 | - 'admin_label' => sprintf( __( 'Croatian kuna (%1$s)', 'give' ), 'kn' ), |
|
| 618 | + 'admin_label' => sprintf(__('Croatian kuna (%1$s)', 'give'), 'kn'), |
|
| 619 | 619 | 'symbol' => 'kn', |
| 620 | 620 | 'setting' => array( |
| 621 | 621 | 'currency_position' => 'after', |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | ), |
| 626 | 626 | ), |
| 627 | 627 | 'IDR' => array( |
| 628 | - 'admin_label' => sprintf( __( 'Indonesian rupiah (%1$s)', 'give' ), 'Rp' ), |
|
| 628 | + 'admin_label' => sprintf(__('Indonesian rupiah (%1$s)', 'give'), 'Rp'), |
|
| 629 | 629 | 'symbol' => 'Rp', |
| 630 | 630 | 'setting' => array( |
| 631 | 631 | 'currency_position' => 'before', |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | ), |
| 636 | 636 | ), |
| 637 | 637 | 'ISK' => array( |
| 638 | - 'admin_label' => sprintf( __( 'Icelandic króna (%1$s)', 'give' ), 'kr' ), |
|
| 638 | + 'admin_label' => sprintf(__('Icelandic króna (%1$s)', 'give'), 'kr'), |
|
| 639 | 639 | 'symbol' => 'kr', |
| 640 | 640 | 'setting' => array( |
| 641 | 641 | 'currency_position' => 'after', |
@@ -645,7 +645,7 @@ discard block |
||
| 645 | 645 | ), |
| 646 | 646 | ), |
| 647 | 647 | 'JMD' => array( |
| 648 | - 'admin_label' => sprintf( __( 'Jamaican dollar (%1$s)', 'give' ), 'j$' ), |
|
| 648 | + 'admin_label' => sprintf(__('Jamaican dollar (%1$s)', 'give'), 'j$'), |
|
| 649 | 649 | 'symbol' => 'j$', |
| 650 | 650 | 'setting' => array( |
| 651 | 651 | 'currency_position' => 'before', |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | ), |
| 656 | 656 | ), |
| 657 | 657 | 'JOD' => array( |
| 658 | - 'admin_label' => sprintf( __( 'Jordanian dinar (%1$s)', 'give' ), 'د.ا' ), |
|
| 658 | + 'admin_label' => sprintf(__('Jordanian dinar (%1$s)', 'give'), 'د.ا'), |
|
| 659 | 659 | 'symbol' => 'د.ا', |
| 660 | 660 | 'setting' => array( |
| 661 | 661 | 'currency_position' => 'before', |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | ), |
| 666 | 666 | ), |
| 667 | 667 | 'KES' => array( |
| 668 | - 'admin_label' => sprintf( __( 'Kenyan shilling (%1$s)', 'give' ), 'KSh' ), |
|
| 668 | + 'admin_label' => sprintf(__('Kenyan shilling (%1$s)', 'give'), 'KSh'), |
|
| 669 | 669 | 'symbol' => 'KSh', |
| 670 | 670 | 'setting' => array( |
| 671 | 671 | 'currency_position' => 'before', |
@@ -675,7 +675,7 @@ discard block |
||
| 675 | 675 | ), |
| 676 | 676 | ), |
| 677 | 677 | 'KWD' => array( |
| 678 | - 'admin_label' => sprintf( __( 'Kuwaiti dinar (%1$s)', 'give' ), 'د.ك' ), |
|
| 678 | + 'admin_label' => sprintf(__('Kuwaiti dinar (%1$s)', 'give'), 'د.ك'), |
|
| 679 | 679 | 'symbol' => 'د.ك', |
| 680 | 680 | 'setting' => array( |
| 681 | 681 | 'currency_position' => 'before', |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | ), |
| 686 | 686 | ), |
| 687 | 687 | 'KYD' => array( |
| 688 | - 'admin_label' => sprintf( __( 'Cayman Islands dollar (%1$s)', 'give' ), 'KY$' ), |
|
| 688 | + 'admin_label' => sprintf(__('Cayman Islands dollar (%1$s)', 'give'), 'KY$'), |
|
| 689 | 689 | 'symbol' => 'KY$', |
| 690 | 690 | 'setting' => array( |
| 691 | 691 | 'currency_position' => 'before', |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | ), |
| 696 | 696 | ), |
| 697 | 697 | 'MKD' => array( |
| 698 | - 'admin_label' => sprintf( __( 'Macedonian denar (%1$s)', 'give' ), 'ден' ), |
|
| 698 | + 'admin_label' => sprintf(__('Macedonian denar (%1$s)', 'give'), 'ден'), |
|
| 699 | 699 | 'symbol' => 'ден', |
| 700 | 700 | 'setting' => array( |
| 701 | 701 | 'currency_position' => 'before', |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | ), |
| 706 | 706 | ), |
| 707 | 707 | 'NPR' => array( |
| 708 | - 'admin_label' => sprintf( __( 'Nepalese rupee (%1$s)', 'give' ), '₨' ), |
|
| 708 | + 'admin_label' => sprintf(__('Nepalese rupee (%1$s)', 'give'), '₨'), |
|
| 709 | 709 | 'symbol' => '₨', |
| 710 | 710 | 'setting' => array( |
| 711 | 711 | 'currency_position' => 'before', |
@@ -715,7 +715,7 @@ discard block |
||
| 715 | 715 | ), |
| 716 | 716 | ), |
| 717 | 717 | 'OMR' => array( |
| 718 | - 'admin_label' => sprintf( __( 'Omani rial (%1$s)', 'give' ), 'ر.ع.' ), |
|
| 718 | + 'admin_label' => sprintf(__('Omani rial (%1$s)', 'give'), 'ر.ع.'), |
|
| 719 | 719 | 'symbol' => 'ر.ع.', |
| 720 | 720 | 'setting' => array( |
| 721 | 721 | 'currency_position' => 'before', |
@@ -725,7 +725,7 @@ discard block |
||
| 725 | 725 | ), |
| 726 | 726 | ), |
| 727 | 727 | 'PEN' => array( |
| 728 | - 'admin_label' => sprintf( __( 'Peruvian nuevo sol (%1$s)', 'give' ), 'S/.' ), |
|
| 728 | + 'admin_label' => sprintf(__('Peruvian nuevo sol (%1$s)', 'give'), 'S/.'), |
|
| 729 | 729 | 'symbol' => 'S/.', |
| 730 | 730 | 'setting' => array( |
| 731 | 731 | 'currency_position' => 'before', |
@@ -735,7 +735,7 @@ discard block |
||
| 735 | 735 | ), |
| 736 | 736 | ), |
| 737 | 737 | 'PKR' => array( |
| 738 | - 'admin_label' => sprintf( __( 'Pakistani rupee (%1$s)', 'give' ), '₨' ), |
|
| 738 | + 'admin_label' => sprintf(__('Pakistani rupee (%1$s)', 'give'), '₨'), |
|
| 739 | 739 | 'symbol' => '₨', |
| 740 | 740 | 'setting' => array( |
| 741 | 741 | 'currency_position' => 'before', |
@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | ), |
| 746 | 746 | ), |
| 747 | 747 | 'RON' => array( |
| 748 | - 'admin_label' => sprintf( __( 'Romanian leu (%1$s)', 'give' ), 'L' ), |
|
| 748 | + 'admin_label' => sprintf(__('Romanian leu (%1$s)', 'give'), 'L'), |
|
| 749 | 749 | 'symbol' => 'L', |
| 750 | 750 | 'setting' => array( |
| 751 | 751 | 'currency_position' => 'after', |
@@ -755,7 +755,7 @@ discard block |
||
| 755 | 755 | ), |
| 756 | 756 | ), |
| 757 | 757 | 'SAR' => array( |
| 758 | - 'admin_label' => sprintf( __( 'Saudi riyal (%1$s)', 'give' ), 'ر.س' ), |
|
| 758 | + 'admin_label' => sprintf(__('Saudi riyal (%1$s)', 'give'), 'ر.س'), |
|
| 759 | 759 | 'symbol' => 'ر.س', |
| 760 | 760 | 'setting' => array( |
| 761 | 761 | 'currency_position' => 'before', |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | ), |
| 766 | 766 | ), |
| 767 | 767 | 'SZL' => array( |
| 768 | - 'admin_label' => sprintf( __( 'Swazi lilangeni (%1$s)', 'give' ), 'L'), |
|
| 768 | + 'admin_label' => sprintf(__('Swazi lilangeni (%1$s)', 'give'), 'L'), |
|
| 769 | 769 | 'symbol' => 'L', |
| 770 | 770 | 'setting' => array( |
| 771 | 771 | 'currency_position' => 'before', |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | ), |
| 776 | 776 | ), |
| 777 | 777 | 'TOP' => array( |
| 778 | - 'admin_label' => sprintf( __( 'Tongan paʻanga (%1$s)', 'give' ), 'T$'), |
|
| 778 | + 'admin_label' => sprintf(__('Tongan paʻanga (%1$s)', 'give'), 'T$'), |
|
| 779 | 779 | 'symbol' => 'T$', |
| 780 | 780 | 'setting' => array( |
| 781 | 781 | 'currency_position' => 'before', |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | ), |
| 786 | 786 | ), |
| 787 | 787 | 'TZS' => array( |
| 788 | - 'admin_label' => sprintf( __( 'Tanzanian shilling (%1$s)', 'give' ), 'TSh'), |
|
| 788 | + 'admin_label' => sprintf(__('Tanzanian shilling (%1$s)', 'give'), 'TSh'), |
|
| 789 | 789 | 'symbol' => 'TSh', |
| 790 | 790 | 'setting' => array( |
| 791 | 791 | 'currency_position' => 'before', |
@@ -795,7 +795,7 @@ discard block |
||
| 795 | 795 | ), |
| 796 | 796 | ), |
| 797 | 797 | 'UAH' => array( |
| 798 | - 'admin_label' => sprintf( __( 'Ukrainian hryvnia (%1$s)', 'give' ), '₴'), |
|
| 798 | + 'admin_label' => sprintf(__('Ukrainian hryvnia (%1$s)', 'give'), '₴'), |
|
| 799 | 799 | 'symbol' => '₴', |
| 800 | 800 | 'setting' => array( |
| 801 | 801 | 'currency_position' => 'before', |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | ), |
| 806 | 806 | ), |
| 807 | 807 | 'UYU' => array( |
| 808 | - 'admin_label' => sprintf( __( 'Uruguayan peso (%1$s)', 'give' ), '$U'), |
|
| 808 | + 'admin_label' => sprintf(__('Uruguayan peso (%1$s)', 'give'), '$U'), |
|
| 809 | 809 | 'symbol' => '$U', |
| 810 | 810 | 'setting' => array( |
| 811 | 811 | 'currency_position' => 'before', |
@@ -815,7 +815,7 @@ discard block |
||
| 815 | 815 | ), |
| 816 | 816 | ), |
| 817 | 817 | 'VEF' => array( |
| 818 | - 'admin_label' => sprintf( __( 'Venezuelan bolívar (%1$s)', 'give' ), 'Bs'), |
|
| 818 | + 'admin_label' => sprintf(__('Venezuelan bolívar (%1$s)', 'give'), 'Bs'), |
|
| 819 | 819 | 'symbol' => 'Bs', |
| 820 | 820 | 'setting' => array( |
| 821 | 821 | 'currency_position' => 'before', |
@@ -825,7 +825,7 @@ discard block |
||
| 825 | 825 | ), |
| 826 | 826 | ), |
| 827 | 827 | 'XCD' => array( |
| 828 | - 'admin_label' => sprintf( __( 'East Caribbean dollar (%1$s)', 'give' ), 'EC$'), |
|
| 828 | + 'admin_label' => sprintf(__('East Caribbean dollar (%1$s)', 'give'), 'EC$'), |
|
| 829 | 829 | 'symbol' => 'EC$', |
| 830 | 830 | 'setting' => array( |
| 831 | 831 | 'currency_position' => 'before', |
@@ -850,7 +850,7 @@ discard block |
||
| 850 | 850 | * |
| 851 | 851 | * @param array $currencies |
| 852 | 852 | */ |
| 853 | - return (array) apply_filters( 'give_currencies', $currencies ); |
|
| 853 | + return (array) apply_filters('give_currencies', $currencies); |
|
| 854 | 854 | } |
| 855 | 855 | |
| 856 | 856 | /** |
@@ -862,22 +862,22 @@ discard block |
||
| 862 | 862 | * |
| 863 | 863 | * @return array $currencies A list of the available currencies |
| 864 | 864 | */ |
| 865 | -function give_get_currencies( $info = 'admin_label' ) { |
|
| 865 | +function give_get_currencies($info = 'admin_label') { |
|
| 866 | 866 | |
| 867 | 867 | $currencies = give_get_currencies_list(); |
| 868 | 868 | |
| 869 | 869 | // Backward compatibility: handle old way of currency registration. |
| 870 | 870 | // Backward compatibility: Return desired result. |
| 871 | - if ( ! empty( $currencies ) ) { |
|
| 872 | - foreach ( $currencies as $currency_code => $currency_setting ) { |
|
| 873 | - if ( is_string( $currency_setting ) ) { |
|
| 874 | - $currencies[ $currency_code ] = array( |
|
| 871 | + if ( ! empty($currencies)) { |
|
| 872 | + foreach ($currencies as $currency_code => $currency_setting) { |
|
| 873 | + if (is_string($currency_setting)) { |
|
| 874 | + $currencies[$currency_code] = array( |
|
| 875 | 875 | 'admin_label' => $currency_setting, |
| 876 | 876 | ); |
| 877 | 877 | } |
| 878 | 878 | |
| 879 | - $currencies[ $currency_code ] = wp_parse_args( |
|
| 880 | - $currencies[ $currency_code ], |
|
| 879 | + $currencies[$currency_code] = wp_parse_args( |
|
| 880 | + $currencies[$currency_code], |
|
| 881 | 881 | array( |
| 882 | 882 | 'admin_label' => '', |
| 883 | 883 | 'symbol' => $currency_code, |
@@ -886,8 +886,8 @@ discard block |
||
| 886 | 886 | ); |
| 887 | 887 | } |
| 888 | 888 | |
| 889 | - if ( ! empty( $info ) && is_string( $info ) && 'all' !== $info ) { |
|
| 890 | - $currencies = wp_list_pluck( $currencies, $info ); |
|
| 889 | + if ( ! empty($info) && is_string($info) && 'all' !== $info) { |
|
| 890 | + $currencies = wp_list_pluck($currencies, $info); |
|
| 891 | 891 | } |
| 892 | 892 | } |
| 893 | 893 | |
@@ -904,12 +904,12 @@ discard block |
||
| 904 | 904 | * |
| 905 | 905 | * @return array |
| 906 | 906 | */ |
| 907 | -function give_currency_symbols( $decode_currencies = false ) { |
|
| 908 | - $currencies = give_get_currencies( 'symbol' ); |
|
| 907 | +function give_currency_symbols($decode_currencies = false) { |
|
| 908 | + $currencies = give_get_currencies('symbol'); |
|
| 909 | 909 | |
| 910 | - if ( $decode_currencies ) { |
|
| 911 | - array_walk( $currencies, function ( &$currency_symbol ) { |
|
| 912 | - $currency_symbol = html_entity_decode( $currency_symbol, ENT_COMPAT, 'UTF-8' ); |
|
| 910 | + if ($decode_currencies) { |
|
| 911 | + array_walk($currencies, function(&$currency_symbol) { |
|
| 912 | + $currency_symbol = html_entity_decode($currency_symbol, ENT_COMPAT, 'UTF-8'); |
|
| 913 | 913 | } ); |
| 914 | 914 | } |
| 915 | 915 | |
@@ -920,7 +920,7 @@ discard block |
||
| 920 | 920 | * |
| 921 | 921 | * @param array $currencies |
| 922 | 922 | */ |
| 923 | - return apply_filters( 'give_currency_symbols', $currencies ); |
|
| 923 | + return apply_filters('give_currency_symbols', $currencies); |
|
| 924 | 924 | } |
| 925 | 925 | |
| 926 | 926 | |
@@ -937,14 +937,14 @@ discard block |
||
| 937 | 937 | * |
| 938 | 938 | * @return string The symbol to use for the currency |
| 939 | 939 | */ |
| 940 | -function give_currency_symbol( $currency = '', $decode_currency = false ) { |
|
| 940 | +function give_currency_symbol($currency = '', $decode_currency = false) { |
|
| 941 | 941 | |
| 942 | - if ( empty( $currency ) ) { |
|
| 942 | + if (empty($currency)) { |
|
| 943 | 943 | $currency = give_get_currency(); |
| 944 | 944 | } |
| 945 | 945 | |
| 946 | - $currencies = give_currency_symbols( $decode_currency ); |
|
| 947 | - $symbol = array_key_exists( $currency, $currencies ) ? $currencies[ $currency ] : $currency; |
|
| 946 | + $currencies = give_currency_symbols($decode_currency); |
|
| 947 | + $symbol = array_key_exists($currency, $currencies) ? $currencies[$currency] : $currency; |
|
| 948 | 948 | |
| 949 | 949 | /** |
| 950 | 950 | * Filter the currency symbol |
@@ -954,7 +954,7 @@ discard block |
||
| 954 | 954 | * @param string $symbol |
| 955 | 955 | * @param string $currency |
| 956 | 956 | */ |
| 957 | - return apply_filters( 'give_currency_symbol', $symbol, $currency ); |
|
| 957 | + return apply_filters('give_currency_symbol', $symbol, $currency); |
|
| 958 | 958 | } |
| 959 | 959 | |
| 960 | 960 | |
@@ -967,13 +967,13 @@ discard block |
||
| 967 | 967 | * |
| 968 | 968 | * @return string |
| 969 | 969 | */ |
| 970 | -function give_get_currency_name( $currency_code ) { |
|
| 970 | +function give_get_currency_name($currency_code) { |
|
| 971 | 971 | $currency_name = ''; |
| 972 | 972 | $currency_names = give_get_currencies(); |
| 973 | 973 | |
| 974 | - if ( $currency_code && array_key_exists( $currency_code, $currency_names ) ) { |
|
| 975 | - $currency_name = explode( '(', $currency_names[ $currency_code ] ); |
|
| 976 | - $currency_name = trim( current( $currency_name ) ); |
|
| 974 | + if ($currency_code && array_key_exists($currency_code, $currency_names)) { |
|
| 975 | + $currency_name = explode('(', $currency_names[$currency_code]); |
|
| 976 | + $currency_name = trim(current($currency_name)); |
|
| 977 | 977 | } |
| 978 | 978 | |
| 979 | 979 | /** |
@@ -984,7 +984,7 @@ discard block |
||
| 984 | 984 | * @param string $currency_name |
| 985 | 985 | * @param string $currency_code |
| 986 | 986 | */ |
| 987 | - return apply_filters( 'give_currency_name', $currency_name, $currency_code ); |
|
| 987 | + return apply_filters('give_currency_name', $currency_name, $currency_code); |
|
| 988 | 988 | } |
| 989 | 989 | |
| 990 | 990 | /** |
@@ -997,20 +997,20 @@ discard block |
||
| 997 | 997 | * |
| 998 | 998 | * @return mixed|string |
| 999 | 999 | */ |
| 1000 | -function give_currency_filter( $price = '', $args = array() ) { |
|
| 1000 | +function give_currency_filter($price = '', $args = array()) { |
|
| 1001 | 1001 | |
| 1002 | 1002 | // Get functions arguments. |
| 1003 | 1003 | $func_args = func_get_args(); |
| 1004 | 1004 | |
| 1005 | 1005 | // Backward compatibility: modify second param to array |
| 1006 | - if ( isset( $func_args[1] ) && is_string( $func_args[1] ) ) { |
|
| 1006 | + if (isset($func_args[1]) && is_string($func_args[1])) { |
|
| 1007 | 1007 | $args = array( |
| 1008 | - 'currency_code' => isset( $func_args[1] ) ? $func_args[1] : '', |
|
| 1009 | - 'decode_currency' => isset( $func_args[2] ) ? $func_args[2] : false, |
|
| 1010 | - 'form_id' => isset( $func_args[3] ) ? $func_args[3] : '', |
|
| 1008 | + 'currency_code' => isset($func_args[1]) ? $func_args[1] : '', |
|
| 1009 | + 'decode_currency' => isset($func_args[2]) ? $func_args[2] : false, |
|
| 1010 | + 'form_id' => isset($func_args[3]) ? $func_args[3] : '', |
|
| 1011 | 1011 | ); |
| 1012 | 1012 | |
| 1013 | - give_doing_it_wrong( __FUNCTION__, 'Pass second argument as Array.', GIVE_VERSION ); |
|
| 1013 | + give_doing_it_wrong(__FUNCTION__, 'Pass second argument as Array.', GIVE_VERSION); |
|
| 1014 | 1014 | } |
| 1015 | 1015 | |
| 1016 | 1016 | // Set default values. |
@@ -1023,22 +1023,22 @@ discard block |
||
| 1023 | 1023 | ) |
| 1024 | 1024 | ); |
| 1025 | 1025 | |
| 1026 | - if ( empty( $args['currency_code'] ) || ! array_key_exists( (string) $args['currency_code'], give_get_currencies() ) ) { |
|
| 1027 | - $args['currency_code'] = give_get_currency( $args['form_id'] ); |
|
| 1026 | + if (empty($args['currency_code']) || ! array_key_exists((string) $args['currency_code'], give_get_currencies())) { |
|
| 1027 | + $args['currency_code'] = give_get_currency($args['form_id']); |
|
| 1028 | 1028 | } |
| 1029 | 1029 | |
| 1030 | - $args['position'] = give_get_option( 'currency_position', 'before' ); |
|
| 1030 | + $args['position'] = give_get_option('currency_position', 'before'); |
|
| 1031 | 1031 | |
| 1032 | 1032 | $negative = $price < 0; |
| 1033 | 1033 | |
| 1034 | - if ( $negative ) { |
|
| 1034 | + if ($negative) { |
|
| 1035 | 1035 | // Remove proceeding "-". |
| 1036 | - $price = substr( $price, 1 ); |
|
| 1036 | + $price = substr($price, 1); |
|
| 1037 | 1037 | } |
| 1038 | 1038 | |
| 1039 | - $args['symbol'] = give_currency_symbol( $args['currency_code'], $args['decode_currency'] ); |
|
| 1039 | + $args['symbol'] = give_currency_symbol($args['currency_code'], $args['decode_currency']); |
|
| 1040 | 1040 | |
| 1041 | - switch ( $args['currency_code'] ) : |
|
| 1041 | + switch ($args['currency_code']) : |
|
| 1042 | 1042 | case 'GBP' : |
| 1043 | 1043 | case 'BRL' : |
| 1044 | 1044 | case 'EUR' : |
@@ -1068,13 +1068,13 @@ discard block |
||
| 1068 | 1068 | case 'MAD' : |
| 1069 | 1069 | case 'KRW' : |
| 1070 | 1070 | case 'ZAR' : |
| 1071 | - $formatted = ( 'before' === $args['position'] ? $args['symbol'] . $price : $price . $args['symbol'] ); |
|
| 1071 | + $formatted = ('before' === $args['position'] ? $args['symbol'].$price : $price.$args['symbol']); |
|
| 1072 | 1072 | break; |
| 1073 | 1073 | case 'NOK': |
| 1074 | - $formatted = ( 'before' === $args['position'] ? $args['symbol'] . ' ' . $price : $price . ' ' . $args['symbol'] ); |
|
| 1074 | + $formatted = ('before' === $args['position'] ? $args['symbol'].' '.$price : $price.' '.$args['symbol']); |
|
| 1075 | 1075 | break; |
| 1076 | 1076 | default: |
| 1077 | - $formatted = ( 'before' === $args['position'] ? $args['symbol'] . ' ' . $price : $price . ' ' . $args['symbol'] ); |
|
| 1077 | + $formatted = ('before' === $args['position'] ? $args['symbol'].' '.$price : $price.' '.$args['symbol']); |
|
| 1078 | 1078 | break; |
| 1079 | 1079 | endswitch; |
| 1080 | 1080 | |
@@ -1083,7 +1083,7 @@ discard block |
||
| 1083 | 1083 | * |
| 1084 | 1084 | * @since 1.8.17 |
| 1085 | 1085 | */ |
| 1086 | - $formatted = apply_filters( 'give_currency_filter', $formatted, $args, $price ); |
|
| 1086 | + $formatted = apply_filters('give_currency_filter', $formatted, $args, $price); |
|
| 1087 | 1087 | |
| 1088 | 1088 | /** |
| 1089 | 1089 | * Filter formatted amount with currency |
@@ -1097,16 +1097,16 @@ discard block |
||
| 1097 | 1097 | * filter name will be give_usd_currency_filter_after |
| 1098 | 1098 | */ |
| 1099 | 1099 | $formatted = apply_filters( |
| 1100 | - 'give_' . strtolower( $args['currency_code'] ) . "_currency_filter_{$args['position']}", |
|
| 1100 | + 'give_'.strtolower($args['currency_code'])."_currency_filter_{$args['position']}", |
|
| 1101 | 1101 | $formatted, |
| 1102 | 1102 | $args['currency_code'], |
| 1103 | 1103 | $price, |
| 1104 | 1104 | $args |
| 1105 | 1105 | ); |
| 1106 | 1106 | |
| 1107 | - if ( $negative ) { |
|
| 1107 | + if ($negative) { |
|
| 1108 | 1108 | // Prepend the minus sign before the currency sign. |
| 1109 | - $formatted = '-' . $formatted; |
|
| 1109 | + $formatted = '-'.$formatted; |
|
| 1110 | 1110 | } |
| 1111 | 1111 | |
| 1112 | 1112 | return $formatted; |
@@ -1123,7 +1123,7 @@ discard block |
||
| 1123 | 1123 | * |
| 1124 | 1124 | * @return bool |
| 1125 | 1125 | */ |
| 1126 | -function give_is_zero_based_currency( $currency = '' ) { |
|
| 1126 | +function give_is_zero_based_currency($currency = '') { |
|
| 1127 | 1127 | $zero_based_currency = array( |
| 1128 | 1128 | 'PYG', // Paraguayan Guarani. |
| 1129 | 1129 | 'GNF', // Guinean Franc. |
@@ -1143,12 +1143,12 @@ discard block |
||
| 1143 | 1143 | ); |
| 1144 | 1144 | |
| 1145 | 1145 | // Set default currency. |
| 1146 | - if ( empty( $currency ) ) { |
|
| 1146 | + if (empty($currency)) { |
|
| 1147 | 1147 | $currency = give_get_currency(); |
| 1148 | 1148 | } |
| 1149 | 1149 | |
| 1150 | 1150 | // Check for Zero Based Currency. |
| 1151 | - if ( in_array( $currency, $zero_based_currency ) ) { |
|
| 1151 | + if (in_array($currency, $zero_based_currency)) { |
|
| 1152 | 1152 | return true; |
| 1153 | 1153 | } |
| 1154 | 1154 | |
@@ -1163,7 +1163,7 @@ discard block |
||
| 1163 | 1163 | * |
| 1164 | 1164 | * @return bool |
| 1165 | 1165 | */ |
| 1166 | -function give_is_right_to_left_supported_currency( $currency = '' ) { |
|
| 1166 | +function give_is_right_to_left_supported_currency($currency = '') { |
|
| 1167 | 1167 | $zero_based_currency = apply_filters( |
| 1168 | 1168 | 'give_right_to_left_supported_currency', |
| 1169 | 1169 | array( |
@@ -1179,12 +1179,12 @@ discard block |
||
| 1179 | 1179 | ); |
| 1180 | 1180 | |
| 1181 | 1181 | // Set default currency. |
| 1182 | - if ( empty( $currency ) ) { |
|
| 1182 | + if (empty($currency)) { |
|
| 1183 | 1183 | $currency = give_get_currency(); |
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | 1186 | // Check for Zero Based Currency. |
| 1187 | - if ( in_array( $currency, $zero_based_currency ) ) { |
|
| 1187 | + if (in_array($currency, $zero_based_currency)) { |
|
| 1188 | 1188 | return true; |
| 1189 | 1189 | } |
| 1190 | 1190 | |
@@ -1,14 +1,14 @@ discard block |
||
| 1 | 1 | <div id="give-db-updates" data-resume-update="0"> |
| 2 | 2 | <div class="postbox-container"> |
| 3 | 3 | <div class="postbox"> |
| 4 | - <h2 class="hndle"><?php esc_html_e( 'Database Updates', 'give' ); ?></h2> |
|
| 4 | + <h2 class="hndle"><?php esc_html_e('Database Updates', 'give'); ?></h2> |
|
| 5 | 5 | <div class="inside"> |
| 6 | 6 | <div class="progress-container"> |
| 7 | - <p class="update-message"><strong><?php esc_html_e( 'Updates Completed.', 'give' ) ?></strong></p> |
|
| 7 | + <p class="update-message"><strong><?php esc_html_e('Updates Completed.', 'give') ?></strong></p> |
|
| 8 | 8 | <div class="progress-content"> |
| 9 | 9 | <div class="notice-wrap give-clearfix"> |
| 10 | 10 | <div class="notice notice-success is-dismissible inline"> |
| 11 | - <p><?php esc_html_e( 'Give database updates completed successfully. Thank you for updating to the latest version!', 'give' ) ?> |
|
| 11 | + <p><?php esc_html_e('Give database updates completed successfully. Thank you for updating to the latest version!', 'give') ?> |
|
| 12 | 12 | </p> |
| 13 | 13 | <button type="button" class="notice-dismiss"></button> |
| 14 | 14 | </div> |
@@ -20,4 +20,4 @@ discard block |
||
| 20 | 20 | </div><!-- .postbox --> |
| 21 | 21 | </div> |
| 22 | 22 | </div> |
| 23 | -<?php delete_option( 'give_show_db_upgrade_complete_notice' ); ?> |
|
| 24 | 23 | \ No newline at end of file |
| 24 | +<?php delete_option('give_show_db_upgrade_complete_notice'); ?> |
|
| 25 | 25 | \ No newline at end of file |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -93,19 +93,19 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | public function get_predefined_dates() { |
| 95 | 95 | $predefined = array( |
| 96 | - 'today' => esc_html__( 'Today', 'give' ), |
|
| 97 | - 'yesterday' => esc_html__( 'Yesterday', 'give' ), |
|
| 98 | - 'this_week' => esc_html__( 'This Week', 'give' ), |
|
| 99 | - 'last_week' => esc_html__( 'Last Week', 'give' ), |
|
| 100 | - 'this_month' => esc_html__( 'This Month', 'give' ), |
|
| 101 | - 'last_month' => esc_html__( 'Last Month', 'give' ), |
|
| 102 | - 'this_quarter' => esc_html__( 'This Quarter', 'give' ), |
|
| 103 | - 'last_quarter' => esc_html__( 'Last Quarter', 'give' ), |
|
| 104 | - 'this_year' => esc_html__( 'This Year', 'give' ), |
|
| 105 | - 'last_year' => esc_html__( 'Last Year', 'give' ), |
|
| 96 | + 'today' => esc_html__('Today', 'give'), |
|
| 97 | + 'yesterday' => esc_html__('Yesterday', 'give'), |
|
| 98 | + 'this_week' => esc_html__('This Week', 'give'), |
|
| 99 | + 'last_week' => esc_html__('Last Week', 'give'), |
|
| 100 | + 'this_month' => esc_html__('This Month', 'give'), |
|
| 101 | + 'last_month' => esc_html__('Last Month', 'give'), |
|
| 102 | + 'this_quarter' => esc_html__('This Quarter', 'give'), |
|
| 103 | + 'last_quarter' => esc_html__('Last Quarter', 'give'), |
|
| 104 | + 'this_year' => esc_html__('This Year', 'give'), |
|
| 105 | + 'last_year' => esc_html__('Last Year', 'give'), |
|
| 106 | 106 | ); |
| 107 | 107 | |
| 108 | - return apply_filters( 'give_stats_predefined_dates', $predefined ); |
|
| 108 | + return apply_filters('give_stats_predefined_dates', $predefined); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | /** |
@@ -121,18 +121,18 @@ discard block |
||
| 121 | 121 | * |
| 122 | 122 | * @return void |
| 123 | 123 | */ |
| 124 | - public function setup_dates( $_start_date = 'this_month', $_end_date = false ) { |
|
| 124 | + public function setup_dates($_start_date = 'this_month', $_end_date = false) { |
|
| 125 | 125 | |
| 126 | - if ( empty( $_start_date ) ) { |
|
| 126 | + if (empty($_start_date)) { |
|
| 127 | 127 | $_start_date = 'this_month'; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - if ( empty( $_end_date ) ) { |
|
| 130 | + if (empty($_end_date)) { |
|
| 131 | 131 | $_end_date = $_start_date; |
| 132 | 132 | } |
| 133 | 133 | |
| 134 | - $this->start_date = $this->convert_date( $_start_date ); |
|
| 135 | - $this->end_date = $this->convert_date( $_end_date, true ); |
|
| 134 | + $this->start_date = $this->convert_date($_start_date); |
|
| 135 | + $this->end_date = $this->convert_date($_end_date, true); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
@@ -148,26 +148,26 @@ discard block |
||
| 148 | 148 | * |
| 149 | 149 | * @return array|WP_Error If the date is invalid, a WP_Error object will be returned. |
| 150 | 150 | */ |
| 151 | - public function convert_date( $date, $end_date = false ) { |
|
| 151 | + public function convert_date($date, $end_date = false) { |
|
| 152 | 152 | |
| 153 | 153 | $this->timestamp = false; |
| 154 | 154 | $second = $end_date ? 59 : 0; |
| 155 | 155 | $minute = $end_date ? 59 : 0; |
| 156 | 156 | $hour = $end_date ? 23 : 0; |
| 157 | 157 | $day = 1; |
| 158 | - $month = date( 'n', current_time( 'timestamp' ) ); |
|
| 159 | - $year = date( 'Y', current_time( 'timestamp' ) ); |
|
| 158 | + $month = date('n', current_time('timestamp')); |
|
| 159 | + $year = date('Y', current_time('timestamp')); |
|
| 160 | 160 | |
| 161 | - if ( array_key_exists( (string) $date, $this->get_predefined_dates() ) ) { |
|
| 161 | + if (array_key_exists((string) $date, $this->get_predefined_dates())) { |
|
| 162 | 162 | |
| 163 | 163 | // This is a predefined date rate, such as last_week |
| 164 | - switch ( $date ) { |
|
| 164 | + switch ($date) { |
|
| 165 | 165 | |
| 166 | 166 | case 'this_month' : |
| 167 | 167 | |
| 168 | - if ( $end_date ) { |
|
| 168 | + if ($end_date) { |
|
| 169 | 169 | |
| 170 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 170 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 171 | 171 | $hour = 23; |
| 172 | 172 | $minute = 59; |
| 173 | 173 | $second = 59; |
@@ -177,28 +177,28 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | case 'last_month' : |
| 179 | 179 | |
| 180 | - if ( $month == 1 ) { |
|
| 180 | + if ($month == 1) { |
|
| 181 | 181 | |
| 182 | 182 | $month = 12; |
| 183 | - $year --; |
|
| 183 | + $year--; |
|
| 184 | 184 | |
| 185 | 185 | } else { |
| 186 | 186 | |
| 187 | - $month --; |
|
| 187 | + $month--; |
|
| 188 | 188 | |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - if ( $end_date ) { |
|
| 192 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 191 | + if ($end_date) { |
|
| 192 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | break; |
| 196 | 196 | |
| 197 | 197 | case 'today' : |
| 198 | 198 | |
| 199 | - $day = date( 'd', current_time( 'timestamp' ) ); |
|
| 199 | + $day = date('d', current_time('timestamp')); |
|
| 200 | 200 | |
| 201 | - if ( $end_date ) { |
|
| 201 | + if ($end_date) { |
|
| 202 | 202 | $hour = 23; |
| 203 | 203 | $minute = 59; |
| 204 | 204 | $second = 59; |
@@ -208,23 +208,23 @@ discard block |
||
| 208 | 208 | |
| 209 | 209 | case 'yesterday' : |
| 210 | 210 | |
| 211 | - $day = date( 'd', current_time( 'timestamp' ) ) - 1; |
|
| 211 | + $day = date('d', current_time('timestamp')) - 1; |
|
| 212 | 212 | |
| 213 | 213 | // Check if Today is the first day of the month (meaning subtracting one will get us 0) |
| 214 | - if ( $day < 1 ) { |
|
| 214 | + if ($day < 1) { |
|
| 215 | 215 | |
| 216 | 216 | // If current month is 1 |
| 217 | - if ( 1 == $month ) { |
|
| 217 | + if (1 == $month) { |
|
| 218 | 218 | |
| 219 | 219 | $year -= 1; // Today is January 1, so skip back to last day of December |
| 220 | 220 | $month = 12; |
| 221 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 221 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 222 | 222 | |
| 223 | 223 | } else { |
| 224 | 224 | |
| 225 | 225 | // Go back one month and get the last day of the month |
| 226 | 226 | $month -= 1; |
| 227 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 227 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 228 | 228 | |
| 229 | 229 | } |
| 230 | 230 | } |
@@ -233,12 +233,12 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | case 'this_week' : |
| 235 | 235 | |
| 236 | - $days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24; |
|
| 237 | - $today = date( 'j', current_time( 'timestamp' ) ) * 60 * 60 * 24; |
|
| 236 | + $days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24; |
|
| 237 | + $today = date('j', current_time('timestamp')) * 60 * 60 * 24; |
|
| 238 | 238 | |
| 239 | - if ( $today <= $days_to_week_start ) { |
|
| 239 | + if ($today <= $days_to_week_start) { |
|
| 240 | 240 | |
| 241 | - if ( $month > 1 ) { |
|
| 241 | + if ($month > 1) { |
|
| 242 | 242 | $month -= 1; |
| 243 | 243 | } else { |
| 244 | 244 | $month = 12; |
@@ -246,19 +246,19 @@ discard block |
||
| 246 | 246 | |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - if ( ! $end_date ) { |
|
| 249 | + if ( ! $end_date) { |
|
| 250 | 250 | |
| 251 | 251 | // Getting the start day |
| 252 | 252 | |
| 253 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1; |
|
| 254 | - $day += get_option( 'start_of_week' ); |
|
| 253 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 1; |
|
| 254 | + $day += get_option('start_of_week'); |
|
| 255 | 255 | |
| 256 | 256 | } else { |
| 257 | 257 | |
| 258 | 258 | // Getting the end day |
| 259 | 259 | |
| 260 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1; |
|
| 261 | - $day += get_option( 'start_of_week' ) + 6; |
|
| 260 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 1; |
|
| 261 | + $day += get_option('start_of_week') + 6; |
|
| 262 | 262 | |
| 263 | 263 | } |
| 264 | 264 | |
@@ -266,12 +266,12 @@ discard block |
||
| 266 | 266 | |
| 267 | 267 | case 'last_week' : |
| 268 | 268 | |
| 269 | - $days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24; |
|
| 270 | - $today = date( 'j', current_time( 'timestamp' ) ) * 60 * 60 * 24; |
|
| 269 | + $days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24; |
|
| 270 | + $today = date('j', current_time('timestamp')) * 60 * 60 * 24; |
|
| 271 | 271 | |
| 272 | - if ( $today <= $days_to_week_start ) { |
|
| 272 | + if ($today <= $days_to_week_start) { |
|
| 273 | 273 | |
| 274 | - if ( $month > 1 ) { |
|
| 274 | + if ($month > 1) { |
|
| 275 | 275 | $month -= 1; |
| 276 | 276 | } else { |
| 277 | 277 | $month = 12; |
@@ -279,19 +279,19 @@ discard block |
||
| 279 | 279 | |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | - if ( ! $end_date ) { |
|
| 282 | + if ( ! $end_date) { |
|
| 283 | 283 | |
| 284 | 284 | // Getting the start day |
| 285 | 285 | |
| 286 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8; |
|
| 287 | - $day += get_option( 'start_of_week' ); |
|
| 286 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 8; |
|
| 287 | + $day += get_option('start_of_week'); |
|
| 288 | 288 | |
| 289 | 289 | } else { |
| 290 | 290 | |
| 291 | 291 | // Getting the end day |
| 292 | 292 | |
| 293 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8; |
|
| 294 | - $day += get_option( 'start_of_week' ) + 6; |
|
| 293 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 8; |
|
| 294 | + $day += get_option('start_of_week') + 6; |
|
| 295 | 295 | |
| 296 | 296 | } |
| 297 | 297 | |
@@ -299,39 +299,39 @@ discard block |
||
| 299 | 299 | |
| 300 | 300 | case 'this_quarter' : |
| 301 | 301 | |
| 302 | - $month_now = date( 'n', current_time( 'timestamp' ) ); |
|
| 302 | + $month_now = date('n', current_time('timestamp')); |
|
| 303 | 303 | |
| 304 | - if ( $month_now <= 3 ) { |
|
| 304 | + if ($month_now <= 3) { |
|
| 305 | 305 | |
| 306 | - if ( ! $end_date ) { |
|
| 306 | + if ( ! $end_date) { |
|
| 307 | 307 | $month = 1; |
| 308 | 308 | } else { |
| 309 | 309 | $month = 3; |
| 310 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 310 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 311 | 311 | $hour = 23; |
| 312 | 312 | $minute = 59; |
| 313 | 313 | $second = 59; |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | - } else if ( $month_now <= 6 ) { |
|
| 316 | + } else if ($month_now <= 6) { |
|
| 317 | 317 | |
| 318 | - if ( ! $end_date ) { |
|
| 318 | + if ( ! $end_date) { |
|
| 319 | 319 | $month = 4; |
| 320 | 320 | } else { |
| 321 | 321 | $month = 6; |
| 322 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 322 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 323 | 323 | $hour = 23; |
| 324 | 324 | $minute = 59; |
| 325 | 325 | $second = 59; |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - } else if ( $month_now <= 9 ) { |
|
| 328 | + } else if ($month_now <= 9) { |
|
| 329 | 329 | |
| 330 | - if ( ! $end_date ) { |
|
| 330 | + if ( ! $end_date) { |
|
| 331 | 331 | $month = 7; |
| 332 | 332 | } else { |
| 333 | 333 | $month = 9; |
| 334 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 334 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 335 | 335 | $hour = 23; |
| 336 | 336 | $minute = 59; |
| 337 | 337 | $second = 59; |
@@ -339,11 +339,11 @@ discard block |
||
| 339 | 339 | |
| 340 | 340 | } else { |
| 341 | 341 | |
| 342 | - if ( ! $end_date ) { |
|
| 342 | + if ( ! $end_date) { |
|
| 343 | 343 | $month = 10; |
| 344 | 344 | } else { |
| 345 | 345 | $month = 12; |
| 346 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 346 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 347 | 347 | $hour = 23; |
| 348 | 348 | $minute = 59; |
| 349 | 349 | $second = 59; |
@@ -355,40 +355,40 @@ discard block |
||
| 355 | 355 | |
| 356 | 356 | case 'last_quarter' : |
| 357 | 357 | |
| 358 | - $month_now = date( 'n', current_time( 'timestamp' ) ); |
|
| 358 | + $month_now = date('n', current_time('timestamp')); |
|
| 359 | 359 | |
| 360 | - if ( $month_now <= 3 ) { |
|
| 360 | + if ($month_now <= 3) { |
|
| 361 | 361 | |
| 362 | - if ( ! $end_date ) { |
|
| 362 | + if ( ! $end_date) { |
|
| 363 | 363 | $month = 10; |
| 364 | 364 | } else { |
| 365 | 365 | $year -= 1; |
| 366 | 366 | $month = 12; |
| 367 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 367 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 368 | 368 | $hour = 23; |
| 369 | 369 | $minute = 59; |
| 370 | 370 | $second = 59; |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - } else if ( $month_now <= 6 ) { |
|
| 373 | + } else if ($month_now <= 6) { |
|
| 374 | 374 | |
| 375 | - if ( ! $end_date ) { |
|
| 375 | + if ( ! $end_date) { |
|
| 376 | 376 | $month = 1; |
| 377 | 377 | } else { |
| 378 | 378 | $month = 3; |
| 379 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 379 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 380 | 380 | $hour = 23; |
| 381 | 381 | $minute = 59; |
| 382 | 382 | $second = 59; |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | - } else if ( $month_now <= 9 ) { |
|
| 385 | + } else if ($month_now <= 9) { |
|
| 386 | 386 | |
| 387 | - if ( ! $end_date ) { |
|
| 387 | + if ( ! $end_date) { |
|
| 388 | 388 | $month = 4; |
| 389 | 389 | } else { |
| 390 | 390 | $month = 6; |
| 391 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 391 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 392 | 392 | $hour = 23; |
| 393 | 393 | $minute = 59; |
| 394 | 394 | $second = 59; |
@@ -396,11 +396,11 @@ discard block |
||
| 396 | 396 | |
| 397 | 397 | } else { |
| 398 | 398 | |
| 399 | - if ( ! $end_date ) { |
|
| 399 | + if ( ! $end_date) { |
|
| 400 | 400 | $month = 7; |
| 401 | 401 | } else { |
| 402 | 402 | $month = 9; |
| 403 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 403 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 404 | 404 | $hour = 23; |
| 405 | 405 | $minute = 59; |
| 406 | 406 | $second = 59; |
@@ -412,11 +412,11 @@ discard block |
||
| 412 | 412 | |
| 413 | 413 | case 'this_year' : |
| 414 | 414 | |
| 415 | - if ( ! $end_date ) { |
|
| 415 | + if ( ! $end_date) { |
|
| 416 | 416 | $month = 1; |
| 417 | 417 | } else { |
| 418 | 418 | $month = 12; |
| 419 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 419 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 420 | 420 | $hour = 23; |
| 421 | 421 | $minute = 59; |
| 422 | 422 | $second = 59; |
@@ -427,11 +427,11 @@ discard block |
||
| 427 | 427 | case 'last_year' : |
| 428 | 428 | |
| 429 | 429 | $year -= 1; |
| 430 | - if ( ! $end_date ) { |
|
| 430 | + if ( ! $end_date) { |
|
| 431 | 431 | $month = 1; |
| 432 | 432 | } else { |
| 433 | 433 | $month = 12; |
| 434 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
| 434 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
| 435 | 435 | $hour = 23; |
| 436 | 436 | $minute = 59; |
| 437 | 437 | $second = 59; |
@@ -442,30 +442,30 @@ discard block |
||
| 442 | 442 | } |
| 443 | 443 | |
| 444 | 444 | |
| 445 | - } else if ( is_numeric( $date ) ) { |
|
| 445 | + } else if (is_numeric($date)) { |
|
| 446 | 446 | |
| 447 | 447 | // return $date unchanged since it is a timestamp |
| 448 | 448 | $this->timestamp = true; |
| 449 | 449 | |
| 450 | - } else if ( false !== strtotime( $date ) ) { |
|
| 450 | + } else if (false !== strtotime($date)) { |
|
| 451 | 451 | |
| 452 | - $date = strtotime( $date, current_time( 'timestamp' ) ); |
|
| 453 | - $year = date( 'Y', $date ); |
|
| 454 | - $month = date( 'm', $date ); |
|
| 455 | - $day = date( 'd', $date ); |
|
| 452 | + $date = strtotime($date, current_time('timestamp')); |
|
| 453 | + $year = date('Y', $date); |
|
| 454 | + $month = date('m', $date); |
|
| 455 | + $day = date('d', $date); |
|
| 456 | 456 | |
| 457 | 457 | } else { |
| 458 | 458 | |
| 459 | - return new WP_Error( 'invalid_date', esc_html__( 'Improper date provided.', 'give' ) ); |
|
| 459 | + return new WP_Error('invalid_date', esc_html__('Improper date provided.', 'give')); |
|
| 460 | 460 | |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | - if ( false === $this->timestamp ) { |
|
| 463 | + if (false === $this->timestamp) { |
|
| 464 | 464 | // Create an exact timestamp |
| 465 | - $date = mktime( $hour, $minute, $second, $month, $day, $year ); |
|
| 465 | + $date = mktime($hour, $minute, $second, $month, $day, $year); |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | - return apply_filters( 'give_stats_date', $date, $end_date, $this ); |
|
| 468 | + return apply_filters('give_stats_date', $date, $end_date, $this); |
|
| 469 | 469 | |
| 470 | 470 | } |
| 471 | 471 | |
@@ -481,33 +481,33 @@ discard block |
||
| 481 | 481 | * |
| 482 | 482 | * @return string |
| 483 | 483 | */ |
| 484 | - public function count_where( $where = '' ) { |
|
| 484 | + public function count_where($where = '') { |
|
| 485 | 485 | // Only get payments in our date range |
| 486 | 486 | |
| 487 | 487 | $start_where = ''; |
| 488 | 488 | $end_where = ''; |
| 489 | 489 | |
| 490 | - if ( $this->start_date ) { |
|
| 490 | + if ($this->start_date) { |
|
| 491 | 491 | |
| 492 | - if ( $this->timestamp ) { |
|
| 492 | + if ($this->timestamp) { |
|
| 493 | 493 | $format = 'Y-m-d H:i:s'; |
| 494 | 494 | } else { |
| 495 | 495 | $format = 'Y-m-d 00:00:00'; |
| 496 | 496 | } |
| 497 | 497 | |
| 498 | - $start_date = date( $format, $this->start_date ); |
|
| 498 | + $start_date = date($format, $this->start_date); |
|
| 499 | 499 | $start_where = " AND p.post_date >= '{$start_date}'"; |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - if ( $this->end_date ) { |
|
| 502 | + if ($this->end_date) { |
|
| 503 | 503 | |
| 504 | - if ( $this->timestamp ) { |
|
| 504 | + if ($this->timestamp) { |
|
| 505 | 505 | $format = 'Y-m-d H:i:s'; |
| 506 | 506 | } else { |
| 507 | 507 | $format = 'Y-m-d 23:59:59'; |
| 508 | 508 | } |
| 509 | 509 | |
| 510 | - $end_date = date( $format, $this->end_date ); |
|
| 510 | + $end_date = date($format, $this->end_date); |
|
| 511 | 511 | |
| 512 | 512 | $end_where = " AND p.post_date <= '{$end_date}'"; |
| 513 | 513 | } |
@@ -529,34 +529,34 @@ discard block |
||
| 529 | 529 | * |
| 530 | 530 | * @return string |
| 531 | 531 | */ |
| 532 | - public function payments_where( $where = '' ) { |
|
| 532 | + public function payments_where($where = '') { |
|
| 533 | 533 | |
| 534 | 534 | global $wpdb; |
| 535 | 535 | |
| 536 | 536 | $start_where = ''; |
| 537 | 537 | $end_where = ''; |
| 538 | 538 | |
| 539 | - if ( ! is_wp_error( $this->start_date ) ) { |
|
| 539 | + if ( ! is_wp_error($this->start_date)) { |
|
| 540 | 540 | |
| 541 | - if ( $this->timestamp ) { |
|
| 541 | + if ($this->timestamp) { |
|
| 542 | 542 | $format = 'Y-m-d H:i:s'; |
| 543 | 543 | } else { |
| 544 | 544 | $format = 'Y-m-d 00:00:00'; |
| 545 | 545 | } |
| 546 | 546 | |
| 547 | - $start_date = date( $format, $this->start_date ); |
|
| 547 | + $start_date = date($format, $this->start_date); |
|
| 548 | 548 | $start_where = " AND $wpdb->posts.post_date >= '{$start_date}'"; |
| 549 | 549 | } |
| 550 | 550 | |
| 551 | - if ( ! is_wp_error( $this->end_date ) ) { |
|
| 551 | + if ( ! is_wp_error($this->end_date)) { |
|
| 552 | 552 | |
| 553 | - if ( $this->timestamp ) { |
|
| 553 | + if ($this->timestamp) { |
|
| 554 | 554 | $format = 'Y-m-d H:i:s'; |
| 555 | 555 | } else { |
| 556 | 556 | $format = 'Y-m-d 23:59:59'; |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | - $end_date = date( $format, $this->end_date ); |
|
| 559 | + $end_date = date($format, $this->end_date); |
|
| 560 | 560 | |
| 561 | 561 | $end_where = " AND $wpdb->posts.post_date <= '{$end_date}'"; |
| 562 | 562 | } |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -348,11 +348,11 @@ discard block |
||
| 348 | 348 | * @param int|bool $_id Post id. Default is false. |
| 349 | 349 | * @param array $_args Arguments passed. |
| 350 | 350 | */ |
| 351 | - public function __construct( $_id = false, $_args = array() ) { |
|
| 351 | + public function __construct($_id = false, $_args = array()) { |
|
| 352 | 352 | |
| 353 | - $donation_form = WP_Post::get_instance( $_id ); |
|
| 353 | + $donation_form = WP_Post::get_instance($_id); |
|
| 354 | 354 | |
| 355 | - return $this->setup_donation_form( $donation_form ); |
|
| 355 | + return $this->setup_donation_form($donation_form); |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | /** |
@@ -365,23 +365,23 @@ discard block |
||
| 365 | 365 | * |
| 366 | 366 | * @return bool If the setup was successful or not. |
| 367 | 367 | */ |
| 368 | - private function setup_donation_form( $donation_form ) { |
|
| 368 | + private function setup_donation_form($donation_form) { |
|
| 369 | 369 | |
| 370 | - if ( ! is_object( $donation_form ) ) { |
|
| 370 | + if ( ! is_object($donation_form)) { |
|
| 371 | 371 | return false; |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - if ( ! is_a( $donation_form, 'WP_Post' ) ) { |
|
| 374 | + if ( ! is_a($donation_form, 'WP_Post')) { |
|
| 375 | 375 | return false; |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | - if ( 'give_forms' !== $donation_form->post_type ) { |
|
| 378 | + if ('give_forms' !== $donation_form->post_type) { |
|
| 379 | 379 | return false; |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | - foreach ( $donation_form as $key => $value ) { |
|
| 382 | + foreach ($donation_form as $key => $value) { |
|
| 383 | 383 | |
| 384 | - switch ( $key ) { |
|
| 384 | + switch ($key) { |
|
| 385 | 385 | |
| 386 | 386 | default: |
| 387 | 387 | $this->$key = $value; |
@@ -405,16 +405,16 @@ discard block |
||
| 405 | 405 | * |
| 406 | 406 | * @return mixed |
| 407 | 407 | */ |
| 408 | - public function __get( $key ) { |
|
| 408 | + public function __get($key) { |
|
| 409 | 409 | |
| 410 | - if ( method_exists( $this, 'get_' . $key ) ) { |
|
| 410 | + if (method_exists($this, 'get_'.$key)) { |
|
| 411 | 411 | |
| 412 | - return call_user_func( array( $this, 'get_' . $key ) ); |
|
| 412 | + return call_user_func(array($this, 'get_'.$key)); |
|
| 413 | 413 | |
| 414 | 414 | } else { |
| 415 | 415 | |
| 416 | 416 | /* translators: %s: property key */ |
| 417 | - return new WP_Error( 'give-form-invalid-property', sprintf( esc_html__( 'Can\'t get property %s.', 'give' ), $key ) ); |
|
| 417 | + return new WP_Error('give-form-invalid-property', sprintf(esc_html__('Can\'t get property %s.', 'give'), $key)); |
|
| 418 | 418 | |
| 419 | 419 | } |
| 420 | 420 | |
@@ -430,30 +430,30 @@ discard block |
||
| 430 | 430 | * |
| 431 | 431 | * @return bool|int False if data isn't passed and class not instantiated for creation, or New Form ID. |
| 432 | 432 | */ |
| 433 | - public function create( $data = array() ) { |
|
| 433 | + public function create($data = array()) { |
|
| 434 | 434 | |
| 435 | - if ( $this->id != 0 ) { |
|
| 435 | + if ($this->id != 0) { |
|
| 436 | 436 | return false; |
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | $defaults = array( |
| 440 | 440 | 'post_type' => 'give_forms', |
| 441 | 441 | 'post_status' => 'draft', |
| 442 | - 'post_title' => __( 'New Donation Form', 'give' ), |
|
| 442 | + 'post_title' => __('New Donation Form', 'give'), |
|
| 443 | 443 | ); |
| 444 | 444 | |
| 445 | - $args = wp_parse_args( $data, $defaults ); |
|
| 445 | + $args = wp_parse_args($data, $defaults); |
|
| 446 | 446 | |
| 447 | 447 | /** |
| 448 | 448 | * Fired before a donation form is created |
| 449 | 449 | * |
| 450 | 450 | * @param array $args The post object arguments used for creation. |
| 451 | 451 | */ |
| 452 | - do_action( 'give_form_pre_create', $args ); |
|
| 452 | + do_action('give_form_pre_create', $args); |
|
| 453 | 453 | |
| 454 | - $id = wp_insert_post( $args, true ); |
|
| 454 | + $id = wp_insert_post($args, true); |
|
| 455 | 455 | |
| 456 | - $donation_form = WP_Post::get_instance( $id ); |
|
| 456 | + $donation_form = WP_Post::get_instance($id); |
|
| 457 | 457 | |
| 458 | 458 | /** |
| 459 | 459 | * Fired after a donation form is created |
@@ -461,9 +461,9 @@ discard block |
||
| 461 | 461 | * @param int $id The post ID of the created item. |
| 462 | 462 | * @param array $args The post object arguments used for creation. |
| 463 | 463 | */ |
| 464 | - do_action( 'give_form_post_create', $id, $args ); |
|
| 464 | + do_action('give_form_post_create', $id, $args); |
|
| 465 | 465 | |
| 466 | - return $this->setup_donation_form( $donation_form ); |
|
| 466 | + return $this->setup_donation_form($donation_form); |
|
| 467 | 467 | |
| 468 | 468 | } |
| 469 | 469 | |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | * @return string Donation form name. |
| 489 | 489 | */ |
| 490 | 490 | public function get_name() { |
| 491 | - return get_the_title( $this->ID ); |
|
| 491 | + return get_the_title($this->ID); |
|
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | /** |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | */ |
| 502 | 502 | public function get_price() { |
| 503 | 503 | |
| 504 | - if ( ! isset( $this->price ) ) { |
|
| 504 | + if ( ! isset($this->price)) { |
|
| 505 | 505 | |
| 506 | 506 | $this->price = give_maybe_sanitize_amount( |
| 507 | 507 | give_get_meta( |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | ) |
| 512 | 512 | ); |
| 513 | 513 | |
| 514 | - if ( ! $this->price ) { |
|
| 514 | + if ( ! $this->price) { |
|
| 515 | 515 | $this->price = 0; |
| 516 | 516 | } |
| 517 | 517 | |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | * @param string $price The donation form price. |
| 526 | 526 | * @param string|int $id The form ID. |
| 527 | 527 | */ |
| 528 | - return apply_filters( 'give_get_set_price', $this->price, $this->ID ); |
|
| 528 | + return apply_filters('give_get_set_price', $this->price, $this->ID); |
|
| 529 | 529 | } |
| 530 | 530 | |
| 531 | 531 | /** |
@@ -538,22 +538,22 @@ discard block |
||
| 538 | 538 | */ |
| 539 | 539 | public function get_minimum_price() { |
| 540 | 540 | |
| 541 | - if ( ! isset( $this->minimum_price ) ) { |
|
| 541 | + if ( ! isset($this->minimum_price)) { |
|
| 542 | 542 | |
| 543 | - $this->minimum_price = give_get_meta( $this->ID, '_give_custom_amount_range_minimum', true ); |
|
| 543 | + $this->minimum_price = give_get_meta($this->ID, '_give_custom_amount_range_minimum', true); |
|
| 544 | 544 | |
| 545 | 545 | // Give backward < 2.1 |
| 546 | - if ( empty( $this->minimum_price ) ) { |
|
| 547 | - $this->minimum_price = give_get_meta( $this->ID, '_give_custom_amount_minimum', true ); |
|
| 546 | + if (empty($this->minimum_price)) { |
|
| 547 | + $this->minimum_price = give_get_meta($this->ID, '_give_custom_amount_minimum', true); |
|
| 548 | 548 | } |
| 549 | 549 | |
| 550 | - if ( ! $this->is_custom_price_mode() ) { |
|
| 551 | - $this->minimum_price = give_get_lowest_price_option( $this->ID ); |
|
| 550 | + if ( ! $this->is_custom_price_mode()) { |
|
| 551 | + $this->minimum_price = give_get_lowest_price_option($this->ID); |
|
| 552 | 552 | } |
| 553 | 553 | |
| 554 | 554 | } |
| 555 | 555 | |
| 556 | - return apply_filters( 'give_get_set_minimum_price', $this->minimum_price, $this->ID ); |
|
| 556 | + return apply_filters('give_get_set_minimum_price', $this->minimum_price, $this->ID); |
|
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | /** |
@@ -566,15 +566,15 @@ discard block |
||
| 566 | 566 | */ |
| 567 | 567 | public function get_maximum_price() { |
| 568 | 568 | |
| 569 | - if ( ! isset( $this->maximum_price ) ) { |
|
| 570 | - $this->maximum_price = give_get_meta( $this->ID, '_give_custom_amount_range_maximum', true, 999999.99 ); |
|
| 569 | + if ( ! isset($this->maximum_price)) { |
|
| 570 | + $this->maximum_price = give_get_meta($this->ID, '_give_custom_amount_range_maximum', true, 999999.99); |
|
| 571 | 571 | |
| 572 | - if ( ! $this->is_custom_price_mode() ) { |
|
| 573 | - $this->maximum_price = give_get_highest_price_option( $this->ID ); |
|
| 572 | + if ( ! $this->is_custom_price_mode()) { |
|
| 573 | + $this->maximum_price = give_get_highest_price_option($this->ID); |
|
| 574 | 574 | } |
| 575 | 575 | } |
| 576 | 576 | |
| 577 | - return apply_filters( 'give_get_set_maximum_price', $this->maximum_price, $this->ID ); |
|
| 577 | + return apply_filters('give_get_set_maximum_price', $this->maximum_price, $this->ID); |
|
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | /** |
@@ -587,9 +587,9 @@ discard block |
||
| 587 | 587 | */ |
| 588 | 588 | public function get_prices() { |
| 589 | 589 | |
| 590 | - if ( ! isset( $this->prices ) ) { |
|
| 590 | + if ( ! isset($this->prices)) { |
|
| 591 | 591 | |
| 592 | - $this->prices = give_get_meta( $this->ID, '_give_donation_levels', true ); |
|
| 592 | + $this->prices = give_get_meta($this->ID, '_give_donation_levels', true); |
|
| 593 | 593 | |
| 594 | 594 | } |
| 595 | 595 | |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | * @param array $prices The array of mulit-level prices. |
| 602 | 602 | * @param int|string $ID The ID of the form. |
| 603 | 603 | */ |
| 604 | - return apply_filters( 'give_get_donation_levels', $this->prices, $this->ID ); |
|
| 604 | + return apply_filters('give_get_donation_levels', $this->prices, $this->ID); |
|
| 605 | 605 | |
| 606 | 606 | } |
| 607 | 607 | |
@@ -615,18 +615,18 @@ discard block |
||
| 615 | 615 | * |
| 616 | 616 | * @return array|null |
| 617 | 617 | */ |
| 618 | - public function get_level_info( $price_id ) { |
|
| 618 | + public function get_level_info($price_id) { |
|
| 619 | 619 | $level_info = array(); |
| 620 | 620 | |
| 621 | 621 | // Bailout. |
| 622 | - if ( 'multi' !== $this->get_type() ) { |
|
| 622 | + if ('multi' !== $this->get_type()) { |
|
| 623 | 623 | return null; |
| 624 | - } elseif ( ! ( $levels = $this->get_prices() ) ) { |
|
| 624 | + } elseif ( ! ($levels = $this->get_prices())) { |
|
| 625 | 625 | return $level_info; |
| 626 | 626 | } |
| 627 | 627 | |
| 628 | - foreach ( $levels as $level ) { |
|
| 629 | - if ( $price_id === $level['_give_id']['level_id'] ) { |
|
| 628 | + foreach ($levels as $level) { |
|
| 629 | + if ($price_id === $level['_give_id']['level_id']) { |
|
| 630 | 630 | $level_info = $level; |
| 631 | 631 | break; |
| 632 | 632 | } |
@@ -646,25 +646,25 @@ discard block |
||
| 646 | 646 | */ |
| 647 | 647 | public function get_goal() { |
| 648 | 648 | |
| 649 | - if ( ! isset( $this->goal ) ) { |
|
| 649 | + if ( ! isset($this->goal)) { |
|
| 650 | 650 | |
| 651 | - $goal_format = give_get_form_goal_format( $this->ID ); |
|
| 651 | + $goal_format = give_get_form_goal_format($this->ID); |
|
| 652 | 652 | |
| 653 | - if ( 'donation' === $goal_format ) { |
|
| 654 | - $this->goal = give_get_meta( $this->ID, '_give_number_of_donation_goal', true ); |
|
| 655 | - } elseif ( 'donors' === $goal_format ) { |
|
| 656 | - $this->goal = give_get_meta( $this->ID, '_give_number_of_donor_goal', true ); |
|
| 653 | + if ('donation' === $goal_format) { |
|
| 654 | + $this->goal = give_get_meta($this->ID, '_give_number_of_donation_goal', true); |
|
| 655 | + } elseif ('donors' === $goal_format) { |
|
| 656 | + $this->goal = give_get_meta($this->ID, '_give_number_of_donor_goal', true); |
|
| 657 | 657 | } else { |
| 658 | - $this->goal = give_get_meta( $this->ID, '_give_set_goal', true ); |
|
| 658 | + $this->goal = give_get_meta($this->ID, '_give_set_goal', true); |
|
| 659 | 659 | } |
| 660 | 660 | |
| 661 | - if ( ! $this->goal ) { |
|
| 661 | + if ( ! $this->goal) { |
|
| 662 | 662 | $this->goal = 0; |
| 663 | 663 | } |
| 664 | 664 | |
| 665 | 665 | } |
| 666 | 666 | |
| 667 | - return apply_filters( 'give_get_set_goal', $this->goal, $this->ID ); |
|
| 667 | + return apply_filters('give_get_set_goal', $this->goal, $this->ID); |
|
| 668 | 668 | |
| 669 | 669 | } |
| 670 | 670 | |
@@ -678,10 +678,10 @@ discard block |
||
| 678 | 678 | */ |
| 679 | 679 | public function is_single_price_mode() { |
| 680 | 680 | |
| 681 | - $option = give_get_meta( $this->ID, '_give_price_option', true ); |
|
| 681 | + $option = give_get_meta($this->ID, '_give_price_option', true); |
|
| 682 | 682 | $ret = 0; |
| 683 | 683 | |
| 684 | - if ( empty( $option ) || $option === 'set' ) { |
|
| 684 | + if (empty($option) || $option === 'set') { |
|
| 685 | 685 | $ret = 1; |
| 686 | 686 | } |
| 687 | 687 | |
@@ -693,7 +693,7 @@ discard block |
||
| 693 | 693 | * @param bool $ret Is donation form in single price mode? |
| 694 | 694 | * @param int|string $ID The ID of the donation form. |
| 695 | 695 | */ |
| 696 | - return (bool) apply_filters( 'give_single_price_option_mode', $ret, $this->ID ); |
|
| 696 | + return (bool) apply_filters('give_single_price_option_mode', $ret, $this->ID); |
|
| 697 | 697 | |
| 698 | 698 | } |
| 699 | 699 | |
@@ -707,10 +707,10 @@ discard block |
||
| 707 | 707 | */ |
| 708 | 708 | public function is_custom_price_mode() { |
| 709 | 709 | |
| 710 | - $option = give_get_meta( $this->ID, '_give_custom_amount', true ); |
|
| 710 | + $option = give_get_meta($this->ID, '_give_custom_amount', true); |
|
| 711 | 711 | $ret = 0; |
| 712 | 712 | |
| 713 | - if ( give_is_setting_enabled( $option ) ) { |
|
| 713 | + if (give_is_setting_enabled($option)) { |
|
| 714 | 714 | $ret = 1; |
| 715 | 715 | } |
| 716 | 716 | |
@@ -722,7 +722,7 @@ discard block |
||
| 722 | 722 | * @param bool $ret Is donation form in custom price mode? |
| 723 | 723 | * @param int|string $ID The ID of the donation form. |
| 724 | 724 | */ |
| 725 | - return (bool) apply_filters( 'give_custom_price_option_mode', $ret, $this->ID ); |
|
| 725 | + return (bool) apply_filters('give_custom_price_option_mode', $ret, $this->ID); |
|
| 726 | 726 | |
| 727 | 727 | } |
| 728 | 728 | |
@@ -736,20 +736,20 @@ discard block |
||
| 736 | 736 | * |
| 737 | 737 | * @return bool |
| 738 | 738 | */ |
| 739 | - public function is_custom_price( $amount ) { |
|
| 739 | + public function is_custom_price($amount) { |
|
| 740 | 740 | $result = false; |
| 741 | - $amount = give_maybe_sanitize_amount( $amount ); |
|
| 741 | + $amount = give_maybe_sanitize_amount($amount); |
|
| 742 | 742 | |
| 743 | - if ( $this->is_custom_price_mode() ) { |
|
| 743 | + if ($this->is_custom_price_mode()) { |
|
| 744 | 744 | |
| 745 | - if ( 'set' === $this->get_type() ) { |
|
| 746 | - if ( $amount !== $this->get_price() ) { |
|
| 745 | + if ('set' === $this->get_type()) { |
|
| 746 | + if ($amount !== $this->get_price()) { |
|
| 747 | 747 | $result = true; |
| 748 | 748 | } |
| 749 | 749 | |
| 750 | - } elseif ( 'multi' === $this->get_type() ) { |
|
| 751 | - $level_amounts = array_map( 'give_maybe_sanitize_amount', wp_list_pluck( $this->get_prices(), '_give_amount' ) ); |
|
| 752 | - $result = ! in_array( $amount, $level_amounts ); |
|
| 750 | + } elseif ('multi' === $this->get_type()) { |
|
| 751 | + $level_amounts = array_map('give_maybe_sanitize_amount', wp_list_pluck($this->get_prices(), '_give_amount')); |
|
| 752 | + $result = ! in_array($amount, $level_amounts); |
|
| 753 | 753 | } |
| 754 | 754 | } |
| 755 | 755 | |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | * |
| 763 | 763 | * @since 1.8.18 |
| 764 | 764 | */ |
| 765 | - return (bool) apply_filters( 'give_is_custom_price', $result, $amount, $this->ID ); |
|
| 765 | + return (bool) apply_filters('give_is_custom_price', $result, $amount, $this->ID); |
|
| 766 | 766 | } |
| 767 | 767 | |
| 768 | 768 | /** |
@@ -777,10 +777,10 @@ discard block |
||
| 777 | 777 | */ |
| 778 | 778 | public function has_variable_prices() { |
| 779 | 779 | |
| 780 | - $option = give_get_meta( $this->ID, '_give_price_option', true ); |
|
| 780 | + $option = give_get_meta($this->ID, '_give_price_option', true); |
|
| 781 | 781 | $ret = 0; |
| 782 | 782 | |
| 783 | - if ( $option === 'multi' ) { |
|
| 783 | + if ($option === 'multi') { |
|
| 784 | 784 | $ret = 1; |
| 785 | 785 | } |
| 786 | 786 | |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | * @param bool $ret Does donation form have variable prices? |
| 791 | 791 | * @param int|string $ID The ID of the donation form. |
| 792 | 792 | */ |
| 793 | - return (bool) apply_filters( 'give_has_variable_prices', $ret, $this->ID ); |
|
| 793 | + return (bool) apply_filters('give_has_variable_prices', $ret, $this->ID); |
|
| 794 | 794 | |
| 795 | 795 | } |
| 796 | 796 | |
@@ -804,17 +804,17 @@ discard block |
||
| 804 | 804 | */ |
| 805 | 805 | public function get_type() { |
| 806 | 806 | |
| 807 | - if ( ! isset( $this->type ) ) { |
|
| 807 | + if ( ! isset($this->type)) { |
|
| 808 | 808 | |
| 809 | - $this->type = give_get_meta( $this->ID, '_give_price_option', true ); |
|
| 809 | + $this->type = give_get_meta($this->ID, '_give_price_option', true); |
|
| 810 | 810 | |
| 811 | - if ( empty( $this->type ) ) { |
|
| 811 | + if (empty($this->type)) { |
|
| 812 | 812 | $this->type = 'set'; |
| 813 | 813 | } |
| 814 | 814 | |
| 815 | 815 | } |
| 816 | 816 | |
| 817 | - return apply_filters( 'give_get_form_type', $this->type, $this->ID ); |
|
| 817 | + return apply_filters('give_get_form_type', $this->type, $this->ID); |
|
| 818 | 818 | |
| 819 | 819 | } |
| 820 | 820 | |
@@ -830,23 +830,23 @@ discard block |
||
| 830 | 830 | * |
| 831 | 831 | * @return string |
| 832 | 832 | */ |
| 833 | - public function get_form_classes( $args ) { |
|
| 833 | + public function get_form_classes($args) { |
|
| 834 | 834 | |
| 835 | - $float_labels_option = give_is_float_labels_enabled( $args ) |
|
| 835 | + $float_labels_option = give_is_float_labels_enabled($args) |
|
| 836 | 836 | ? 'float-labels-enabled' |
| 837 | 837 | : ''; |
| 838 | 838 | |
| 839 | - $form_classes_array = apply_filters( 'give_form_classes', array( |
|
| 839 | + $form_classes_array = apply_filters('give_form_classes', array( |
|
| 840 | 840 | 'give-form', |
| 841 | - 'give-form-' . $this->ID, |
|
| 842 | - 'give-form-type-' . $this->get_type(), |
|
| 841 | + 'give-form-'.$this->ID, |
|
| 842 | + 'give-form-type-'.$this->get_type(), |
|
| 843 | 843 | $float_labels_option, |
| 844 | - ), $this->ID, $args ); |
|
| 844 | + ), $this->ID, $args); |
|
| 845 | 845 | |
| 846 | 846 | // Remove empty class names. |
| 847 | - $form_classes_array = array_filter( $form_classes_array ); |
|
| 847 | + $form_classes_array = array_filter($form_classes_array); |
|
| 848 | 848 | |
| 849 | - return implode( ' ', $form_classes_array ); |
|
| 849 | + return implode(' ', $form_classes_array); |
|
| 850 | 850 | |
| 851 | 851 | } |
| 852 | 852 | |
@@ -861,22 +861,22 @@ discard block |
||
| 861 | 861 | * |
| 862 | 862 | * @return string |
| 863 | 863 | */ |
| 864 | - public function get_form_wrap_classes( $args ) { |
|
| 864 | + public function get_form_wrap_classes($args) { |
|
| 865 | 865 | $custom_class = array( |
| 866 | 866 | 'give-form-wrap', |
| 867 | 867 | ); |
| 868 | 868 | |
| 869 | - if ( $this->is_close_donation_form() ) { |
|
| 869 | + if ($this->is_close_donation_form()) { |
|
| 870 | 870 | $custom_class[] = 'give-form-closed'; |
| 871 | 871 | } else { |
| 872 | - $display_option = ( isset( $args['display_style'] ) && ! empty( $args['display_style'] ) ) |
|
| 872 | + $display_option = (isset($args['display_style']) && ! empty($args['display_style'])) |
|
| 873 | 873 | ? $args['display_style'] |
| 874 | - : give_get_meta( $this->ID, '_give_payment_display', true ); |
|
| 874 | + : give_get_meta($this->ID, '_give_payment_display', true); |
|
| 875 | 875 | |
| 876 | 876 | $custom_class[] = "give-display-{$display_option}"; |
| 877 | 877 | |
| 878 | 878 | // If admin want to show only button for form then user inbuilt modal functionality. |
| 879 | - if ( 'button' === $display_option ) { |
|
| 879 | + if ('button' === $display_option) { |
|
| 880 | 880 | $custom_class[] = 'give-display-button-only'; |
| 881 | 881 | } |
| 882 | 882 | } |
@@ -887,10 +887,10 @@ discard block |
||
| 887 | 887 | * |
| 888 | 888 | * @since 1.0 |
| 889 | 889 | */ |
| 890 | - $form_wrap_classes_array = (array) apply_filters( 'give_form_wrap_classes', $custom_class, $this->ID, $args ); |
|
| 890 | + $form_wrap_classes_array = (array) apply_filters('give_form_wrap_classes', $custom_class, $this->ID, $args); |
|
| 891 | 891 | |
| 892 | 892 | |
| 893 | - return implode( ' ', $form_wrap_classes_array ); |
|
| 893 | + return implode(' ', $form_wrap_classes_array); |
|
| 894 | 894 | |
| 895 | 895 | } |
| 896 | 896 | |
@@ -905,7 +905,7 @@ discard block |
||
| 905 | 905 | public function is_set_type_donation_form() { |
| 906 | 906 | $form_type = $this->get_type(); |
| 907 | 907 | |
| 908 | - return ( 'set' === $form_type ? true : false ); |
|
| 908 | + return ('set' === $form_type ? true : false); |
|
| 909 | 909 | } |
| 910 | 910 | |
| 911 | 911 | /** |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | public function is_multi_type_donation_form() { |
| 920 | 920 | $form_type = $this->get_type(); |
| 921 | 921 | |
| 922 | - return ( 'multi' === $form_type ? true : false ); |
|
| 922 | + return ('multi' === $form_type ? true : false); |
|
| 923 | 923 | |
| 924 | 924 | } |
| 925 | 925 | |
@@ -933,15 +933,15 @@ discard block |
||
| 933 | 933 | */ |
| 934 | 934 | public function get_sales() { |
| 935 | 935 | |
| 936 | - if ( ! isset( $this->sales ) ) { |
|
| 936 | + if ( ! isset($this->sales)) { |
|
| 937 | 937 | |
| 938 | - if ( '' == give_get_meta( $this->ID, '_give_form_sales', true ) ) { |
|
| 939 | - add_post_meta( $this->ID, '_give_form_sales', 0 ); |
|
| 938 | + if ('' == give_get_meta($this->ID, '_give_form_sales', true)) { |
|
| 939 | + add_post_meta($this->ID, '_give_form_sales', 0); |
|
| 940 | 940 | } // End if |
| 941 | 941 | |
| 942 | - $this->sales = give_get_meta( $this->ID, '_give_form_sales', true ); |
|
| 942 | + $this->sales = give_get_meta($this->ID, '_give_form_sales', true); |
|
| 943 | 943 | |
| 944 | - if ( $this->sales < 0 ) { |
|
| 944 | + if ($this->sales < 0) { |
|
| 945 | 945 | // Never let sales be less than zero. |
| 946 | 946 | $this->sales = 0; |
| 947 | 947 | } |
@@ -962,13 +962,13 @@ discard block |
||
| 962 | 962 | * |
| 963 | 963 | * @return int|false New number of total sales. |
| 964 | 964 | */ |
| 965 | - public function increase_sales( $quantity = 1 ) { |
|
| 965 | + public function increase_sales($quantity = 1) { |
|
| 966 | 966 | |
| 967 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
| 968 | - $quantity = absint( $quantity ); |
|
| 967 | + $sales = give_get_form_sales_stats($this->ID); |
|
| 968 | + $quantity = absint($quantity); |
|
| 969 | 969 | $total_sales = $sales + $quantity; |
| 970 | 970 | |
| 971 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
| 971 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
| 972 | 972 | |
| 973 | 973 | $this->sales = $total_sales; |
| 974 | 974 | |
@@ -989,17 +989,17 @@ discard block |
||
| 989 | 989 | * |
| 990 | 990 | * @return int|false New number of total sales. |
| 991 | 991 | */ |
| 992 | - public function decrease_sales( $quantity = 1 ) { |
|
| 992 | + public function decrease_sales($quantity = 1) { |
|
| 993 | 993 | |
| 994 | - $sales = give_get_form_sales_stats( $this->ID ); |
|
| 994 | + $sales = give_get_form_sales_stats($this->ID); |
|
| 995 | 995 | |
| 996 | 996 | // Only decrease if not already zero |
| 997 | - if ( $sales > 0 ) { |
|
| 997 | + if ($sales > 0) { |
|
| 998 | 998 | |
| 999 | - $quantity = absint( $quantity ); |
|
| 999 | + $quantity = absint($quantity); |
|
| 1000 | 1000 | $total_sales = $sales - $quantity; |
| 1001 | 1001 | |
| 1002 | - if ( $this->update_meta( '_give_form_sales', $total_sales ) ) { |
|
| 1002 | + if ($this->update_meta('_give_form_sales', $total_sales)) { |
|
| 1003 | 1003 | |
| 1004 | 1004 | $this->sales = $sales; |
| 1005 | 1005 | |
@@ -1023,15 +1023,15 @@ discard block |
||
| 1023 | 1023 | */ |
| 1024 | 1024 | public function get_earnings() { |
| 1025 | 1025 | |
| 1026 | - if ( ! isset( $this->earnings ) ) { |
|
| 1026 | + if ( ! isset($this->earnings)) { |
|
| 1027 | 1027 | |
| 1028 | - if ( '' == give_get_meta( $this->ID, '_give_form_earnings', true ) ) { |
|
| 1029 | - add_post_meta( $this->ID, '_give_form_earnings', 0 ); |
|
| 1028 | + if ('' == give_get_meta($this->ID, '_give_form_earnings', true)) { |
|
| 1029 | + add_post_meta($this->ID, '_give_form_earnings', 0); |
|
| 1030 | 1030 | } |
| 1031 | 1031 | |
| 1032 | - $this->earnings = give_get_meta( $this->ID, '_give_form_earnings', true ); |
|
| 1032 | + $this->earnings = give_get_meta($this->ID, '_give_form_earnings', true); |
|
| 1033 | 1033 | |
| 1034 | - if ( $this->earnings < 0 ) { |
|
| 1034 | + if ($this->earnings < 0) { |
|
| 1035 | 1035 | // Never let earnings be less than zero |
| 1036 | 1036 | $this->earnings = 0; |
| 1037 | 1037 | } |
@@ -1055,9 +1055,9 @@ discard block |
||
| 1055 | 1055 | * |
| 1056 | 1056 | * @return float|false |
| 1057 | 1057 | */ |
| 1058 | - public function increase_earnings( $amount = 0, $payment_id = 0 ) { |
|
| 1058 | + public function increase_earnings($amount = 0, $payment_id = 0) { |
|
| 1059 | 1059 | |
| 1060 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
| 1060 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
| 1061 | 1061 | |
| 1062 | 1062 | /** |
| 1063 | 1063 | * Modify the earning amount when increasing. |
@@ -1068,11 +1068,11 @@ discard block |
||
| 1068 | 1068 | * @param int $form_id Donation form ID. |
| 1069 | 1069 | * @param int $payment_id Donation ID. |
| 1070 | 1070 | */ |
| 1071 | - $amount = apply_filters( 'give_increase_form_earnings_amount', $amount, $this->ID, $payment_id ); |
|
| 1071 | + $amount = apply_filters('give_increase_form_earnings_amount', $amount, $this->ID, $payment_id); |
|
| 1072 | 1072 | |
| 1073 | 1073 | $new_amount = $earnings + (float) $amount; |
| 1074 | 1074 | |
| 1075 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
| 1075 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
| 1076 | 1076 | |
| 1077 | 1077 | $this->earnings = $new_amount; |
| 1078 | 1078 | |
@@ -1095,11 +1095,11 @@ discard block |
||
| 1095 | 1095 | * |
| 1096 | 1096 | * @return float|false |
| 1097 | 1097 | */ |
| 1098 | - public function decrease_earnings( $amount, $payment_id = 0 ) { |
|
| 1098 | + public function decrease_earnings($amount, $payment_id = 0) { |
|
| 1099 | 1099 | |
| 1100 | - $earnings = give_get_form_earnings_stats( $this->ID ); |
|
| 1100 | + $earnings = give_get_form_earnings_stats($this->ID); |
|
| 1101 | 1101 | |
| 1102 | - if ( $earnings > 0 ) { |
|
| 1102 | + if ($earnings > 0) { |
|
| 1103 | 1103 | |
| 1104 | 1104 | /** |
| 1105 | 1105 | * Modify the earning value when decreasing it. |
@@ -1110,12 +1110,12 @@ discard block |
||
| 1110 | 1110 | * @param int $form_id Donation Form ID. |
| 1111 | 1111 | * @param int $payment_id Donation ID. |
| 1112 | 1112 | */ |
| 1113 | - $amount = apply_filters( 'give_decrease_form_earnings_amount', $amount, $this->ID, $payment_id ); |
|
| 1113 | + $amount = apply_filters('give_decrease_form_earnings_amount', $amount, $this->ID, $payment_id); |
|
| 1114 | 1114 | |
| 1115 | 1115 | // Only decrease if greater than zero |
| 1116 | 1116 | $new_amount = $earnings - (float) $amount; |
| 1117 | 1117 | |
| 1118 | - if ( $this->update_meta( '_give_form_earnings', $new_amount ) ) { |
|
| 1118 | + if ($this->update_meta('_give_form_earnings', $new_amount)) { |
|
| 1119 | 1119 | $this->earnings = $new_amount; |
| 1120 | 1120 | |
| 1121 | 1121 | return $this->earnings; |
@@ -1141,10 +1141,10 @@ discard block |
||
| 1141 | 1141 | * @return bool |
| 1142 | 1142 | */ |
| 1143 | 1143 | public function is_close_donation_form() { |
| 1144 | - $is_closed = ( 'closed' === give_get_meta( $this->ID, '_give_form_status', true, 'open' ) ); |
|
| 1144 | + $is_closed = ('closed' === give_get_meta($this->ID, '_give_form_status', true, 'open')); |
|
| 1145 | 1145 | |
| 1146 | 1146 | // If manual upgrade not completed, proceed with backward compatible code. |
| 1147 | - if ( ! give_has_upgrade_completed( 'v210_verify_form_status_upgrades' ) ) { |
|
| 1147 | + if ( ! give_has_upgrade_completed('v210_verify_form_status_upgrades')) { |
|
| 1148 | 1148 | |
| 1149 | 1149 | // Check for backward compatibility. |
| 1150 | 1150 | $is_closed = $this->bc_210_is_close_donation_form(); |
@@ -1174,17 +1174,17 @@ discard block |
||
| 1174 | 1174 | * |
| 1175 | 1175 | * @return bool The result of the update query. |
| 1176 | 1176 | */ |
| 1177 | - private function update_meta( $meta_key = '', $meta_value = '' ) { |
|
| 1177 | + private function update_meta($meta_key = '', $meta_value = '') { |
|
| 1178 | 1178 | |
| 1179 | 1179 | /* @var WPDB $wpdb */ |
| 1180 | 1180 | global $wpdb; |
| 1181 | 1181 | |
| 1182 | 1182 | // Bailout. |
| 1183 | - if ( empty( $meta_key ) ) { |
|
| 1183 | + if (empty($meta_key)) { |
|
| 1184 | 1184 | return false; |
| 1185 | 1185 | } |
| 1186 | 1186 | |
| 1187 | - if ( give_update_meta( $this->ID, $meta_key, $meta_value ) ) { |
|
| 1187 | + if (give_update_meta($this->ID, $meta_key, $meta_value)) { |
|
| 1188 | 1188 | return true; |
| 1189 | 1189 | } |
| 1190 | 1190 | |
@@ -1201,33 +1201,33 @@ discard block |
||
| 1201 | 1201 | private function bc_210_is_close_donation_form() { |
| 1202 | 1202 | |
| 1203 | 1203 | $close_form = false; |
| 1204 | - $is_goal_enabled = give_is_setting_enabled( give_get_meta( $this->ID, '_give_goal_option', true, 'disabled' ) ); |
|
| 1204 | + $is_goal_enabled = give_is_setting_enabled(give_get_meta($this->ID, '_give_goal_option', true, 'disabled')); |
|
| 1205 | 1205 | |
| 1206 | 1206 | // Proceed, if the form goal is enabled. |
| 1207 | - if ( $is_goal_enabled ) { |
|
| 1207 | + if ($is_goal_enabled) { |
|
| 1208 | 1208 | |
| 1209 | - $close_form_when_goal_achieved = give_is_setting_enabled( give_get_meta( $this->ID, '_give_close_form_when_goal_achieved', true, 'disabled' ) ); |
|
| 1209 | + $close_form_when_goal_achieved = give_is_setting_enabled(give_get_meta($this->ID, '_give_close_form_when_goal_achieved', true, 'disabled')); |
|
| 1210 | 1210 | |
| 1211 | 1211 | // Proceed, if close form when goal achieved option is enabled. |
| 1212 | - if ( $close_form_when_goal_achieved ) { |
|
| 1212 | + if ($close_form_when_goal_achieved) { |
|
| 1213 | 1213 | |
| 1214 | - $form = new Give_Donate_Form( $this->ID ); |
|
| 1215 | - $goal_format = give_get_form_goal_format( $this->ID ); |
|
| 1214 | + $form = new Give_Donate_Form($this->ID); |
|
| 1215 | + $goal_format = give_get_form_goal_format($this->ID); |
|
| 1216 | 1216 | |
| 1217 | 1217 | // Verify whether the form is closed or not after processing data based on goal format. |
| 1218 | - switch ( $goal_format ) { |
|
| 1218 | + switch ($goal_format) { |
|
| 1219 | 1219 | case 'donation': |
| 1220 | 1220 | $closed = $form->get_goal() <= $form->get_sales(); |
| 1221 | 1221 | break; |
| 1222 | 1222 | case 'donors': |
| 1223 | - $closed = $form->get_goal() <= give_get_form_donor_count( $this->ID ); |
|
| 1223 | + $closed = $form->get_goal() <= give_get_form_donor_count($this->ID); |
|
| 1224 | 1224 | break; |
| 1225 | 1225 | default : |
| 1226 | 1226 | $closed = $form->get_goal() <= $form->get_earnings(); |
| 1227 | 1227 | break; |
| 1228 | 1228 | } |
| 1229 | 1229 | |
| 1230 | - if ( $closed ) { |
|
| 1230 | + if ($closed) { |
|
| 1231 | 1231 | $close_form = true; |
| 1232 | 1232 | } |
| 1233 | 1233 | |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | * |
| 156 | 156 | * Used to redirect a user back to the donation form if there are errors present. |
| 157 | 157 | * |
| 158 | - * @param array|string $args |
|
| 158 | + * @param string $args |
|
| 159 | 159 | * |
| 160 | 160 | * @access public |
| 161 | 161 | * @since 1.0 |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | * @since 1.0 |
| 302 | 302 | * @since 1.8.16 Add security check |
| 303 | 303 | * |
| 304 | - * @return bool |
|
| 304 | + * @return false|null |
|
| 305 | 305 | */ |
| 306 | 306 | function give_listen_for_failed_payments() { |
| 307 | 307 | |
@@ -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 = give_get_meta( $args['form_id'], '_give_form_floating_labels', true ); |
|
| 70 | + if (empty($float_labels)) { |
|
| 71 | + $float_labels = give_get_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,32 +254,31 @@ discard block |
||
| 254 | 254 | * |
| 255 | 255 | * @return mixed 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 | 260 | // Remove question mark. |
| 261 | - if ( 0 === strpos( $extras, '?' ) ) { |
|
| 262 | - $extras = substr( $extras, 1 ); |
|
| 261 | + if (0 === strpos($extras, '?')) { |
|
| 262 | + $extras = substr($extras, 1); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | - $extras_args = wp_parse_args( $extras ); |
|
| 265 | + $extras_args = wp_parse_args($extras); |
|
| 266 | 266 | |
| 267 | 267 | // Set nonce if payment id exist in extra params. |
| 268 | - if ( array_key_exists( 'payment-id', $extras_args ) ) { |
|
| 269 | - $extras_args['_wpnonce'] = wp_create_nonce( "give-failed-donation-{$extras_args['payment-id']}" ); |
|
| 270 | - $extras = http_build_query( $extras_args ); |
|
| 268 | + if (array_key_exists('payment-id', $extras_args)) { |
|
| 269 | + $extras_args['_wpnonce'] = wp_create_nonce("give-failed-donation-{$extras_args['payment-id']}"); |
|
| 270 | + $extras = http_build_query($extras_args); |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | - $uri = ! empty( $give_options['failure_page'] ) ? |
|
| 274 | - trailingslashit( get_permalink( $give_options['failure_page'] ) ) : |
|
| 275 | - home_url(); |
|
| 273 | + $uri = ! empty($give_options['failure_page']) ? |
|
| 274 | + trailingslashit(get_permalink($give_options['failure_page'])) : home_url(); |
|
| 276 | 275 | |
| 277 | 276 | |
| 278 | - if ( $extras ) { |
|
| 277 | + if ($extras) { |
|
| 279 | 278 | $uri .= "?{$extras}"; |
| 280 | 279 | } |
| 281 | 280 | |
| 282 | - return apply_filters( 'give_get_failed_transaction_uri', $uri ); |
|
| 281 | + return apply_filters('give_get_failed_transaction_uri', $uri); |
|
| 283 | 282 | } |
| 284 | 283 | |
| 285 | 284 | /** |
@@ -290,9 +289,9 @@ discard block |
||
| 290 | 289 | */ |
| 291 | 290 | function give_is_failed_transaction_page() { |
| 292 | 291 | $give_options = give_get_settings(); |
| 293 | - $ret = isset( $give_options['failure_page'] ) ? is_page( $give_options['failure_page'] ) : false; |
|
| 292 | + $ret = isset($give_options['failure_page']) ? is_page($give_options['failure_page']) : false; |
|
| 294 | 293 | |
| 295 | - return apply_filters( 'give_is_failure_page', $ret ); |
|
| 294 | + return apply_filters('give_is_failure_page', $ret); |
|
| 296 | 295 | } |
| 297 | 296 | |
| 298 | 297 | /** |
@@ -305,25 +304,25 @@ discard block |
||
| 305 | 304 | */ |
| 306 | 305 | function give_listen_for_failed_payments() { |
| 307 | 306 | |
| 308 | - $failed_page = give_get_option( 'failure_page', 0 ); |
|
| 309 | - $payment_id = ! empty( $_GET['payment-id'] ) ? absint( $_GET['payment-id'] ) : 0; |
|
| 310 | - $nonce = ! empty( $_GET['_wpnonce'] ) ? give_clean( $_GET['_wpnonce'] ) : false; |
|
| 307 | + $failed_page = give_get_option('failure_page', 0); |
|
| 308 | + $payment_id = ! empty($_GET['payment-id']) ? absint($_GET['payment-id']) : 0; |
|
| 309 | + $nonce = ! empty($_GET['_wpnonce']) ? give_clean($_GET['_wpnonce']) : false; |
|
| 311 | 310 | |
| 312 | 311 | // Bailout. |
| 313 | - if ( ! $failed_page || ! is_page( $failed_page ) || ! $payment_id || ! $nonce ) { |
|
| 312 | + if ( ! $failed_page || ! is_page($failed_page) || ! $payment_id || ! $nonce) { |
|
| 314 | 313 | return false; |
| 315 | 314 | } |
| 316 | 315 | |
| 317 | 316 | // Security check. |
| 318 | - if ( ! wp_verify_nonce( $nonce, "give-failed-donation-{$payment_id}" ) ) { |
|
| 319 | - wp_die( __( 'Nonce verification failed.', 'give' ), __( 'Error', 'give' ) ); |
|
| 317 | + if ( ! wp_verify_nonce($nonce, "give-failed-donation-{$payment_id}")) { |
|
| 318 | + wp_die(__('Nonce verification failed.', 'give'), __('Error', 'give')); |
|
| 320 | 319 | } |
| 321 | 320 | |
| 322 | 321 | // Set payment status to failure |
| 323 | - give_update_payment_status( $payment_id, 'failed' ); |
|
| 322 | + give_update_payment_status($payment_id, 'failed'); |
|
| 324 | 323 | } |
| 325 | 324 | |
| 326 | -add_action( 'template_redirect', 'give_listen_for_failed_payments' ); |
|
| 325 | +add_action('template_redirect', 'give_listen_for_failed_payments'); |
|
| 327 | 326 | |
| 328 | 327 | /** |
| 329 | 328 | * Retrieve the Donation History page URI |
@@ -336,9 +335,9 @@ discard block |
||
| 336 | 335 | function give_get_history_page_uri() { |
| 337 | 336 | $give_options = give_get_settings(); |
| 338 | 337 | |
| 339 | - $history_page = isset( $give_options['history_page'] ) ? get_permalink( absint( $give_options['history_page'] ) ) : get_bloginfo( 'url' ); |
|
| 338 | + $history_page = isset($give_options['history_page']) ? get_permalink(absint($give_options['history_page'])) : get_bloginfo('url'); |
|
| 340 | 339 | |
| 341 | - return apply_filters( 'give_get_history_page_uri', $history_page ); |
|
| 340 | + return apply_filters('give_get_history_page_uri', $history_page); |
|
| 342 | 341 | } |
| 343 | 342 | |
| 344 | 343 | /** |
@@ -351,11 +350,11 @@ discard block |
||
| 351 | 350 | * @since 1.0 |
| 352 | 351 | * @return bool |
| 353 | 352 | */ |
| 354 | -function give_field_is_required( $field = '', $form_id ) { |
|
| 353 | +function give_field_is_required($field = '', $form_id) { |
|
| 355 | 354 | |
| 356 | - $required_fields = give_get_required_fields( $form_id ); |
|
| 355 | + $required_fields = give_get_required_fields($form_id); |
|
| 357 | 356 | |
| 358 | - return array_key_exists( $field, $required_fields ); |
|
| 357 | + return array_key_exists($field, $required_fields); |
|
| 359 | 358 | } |
| 360 | 359 | |
| 361 | 360 | /** |
@@ -372,12 +371,12 @@ discard block |
||
| 372 | 371 | * |
| 373 | 372 | * @return void |
| 374 | 373 | */ |
| 375 | -function give_record_donation_in_log( $give_form_id = 0, $payment_id, $price_id = false, $donation_date = null ) { |
|
| 374 | +function give_record_donation_in_log($give_form_id = 0, $payment_id, $price_id = false, $donation_date = null) { |
|
| 376 | 375 | $log_data = array( |
| 377 | 376 | 'log_parent' => $payment_id, |
| 378 | 377 | 'log_type' => 'sale', |
| 379 | - 'log_date' => isset( $donation_date ) ? $donation_date : null, |
|
| 380 | - 'log_date_gmt' => isset( $donation_date ) ? $donation_date : null, |
|
| 378 | + 'log_date' => isset($donation_date) ? $donation_date : null, |
|
| 379 | + 'log_date_gmt' => isset($donation_date) ? $donation_date : null, |
|
| 381 | 380 | ); |
| 382 | 381 | |
| 383 | 382 | $log_meta = array( |
@@ -385,7 +384,7 @@ discard block |
||
| 385 | 384 | 'price_id' => (int) $price_id, |
| 386 | 385 | ); |
| 387 | 386 | |
| 388 | - Give()->logs->insert_log( $log_data, $log_meta ); |
|
| 387 | + Give()->logs->insert_log($log_data, $log_meta); |
|
| 389 | 388 | } |
| 390 | 389 | |
| 391 | 390 | |
@@ -399,13 +398,13 @@ discard block |
||
| 399 | 398 | * |
| 400 | 399 | * @return bool|int |
| 401 | 400 | */ |
| 402 | -function give_increase_donation_count( $form_id = 0, $quantity = 1 ) { |
|
| 401 | +function give_increase_donation_count($form_id = 0, $quantity = 1) { |
|
| 403 | 402 | $quantity = (int) $quantity; |
| 404 | 403 | |
| 405 | 404 | /** @var \Give_Donate_Form $form */ |
| 406 | - $form = new Give_Donate_Form( $form_id ); |
|
| 405 | + $form = new Give_Donate_Form($form_id); |
|
| 407 | 406 | |
| 408 | - return $form->increase_sales( $quantity ); |
|
| 407 | + return $form->increase_sales($quantity); |
|
| 409 | 408 | } |
| 410 | 409 | |
| 411 | 410 | /** |
@@ -418,13 +417,13 @@ discard block |
||
| 418 | 417 | * |
| 419 | 418 | * @return bool|int |
| 420 | 419 | */ |
| 421 | -function give_decrease_donation_count( $form_id = 0, $quantity = 1 ) { |
|
| 420 | +function give_decrease_donation_count($form_id = 0, $quantity = 1) { |
|
| 422 | 421 | $quantity = (int) $quantity; |
| 423 | 422 | |
| 424 | 423 | /** @var \Give_Donate_Form $form */ |
| 425 | - $form = new Give_Donate_Form( $form_id ); |
|
| 424 | + $form = new Give_Donate_Form($form_id); |
|
| 426 | 425 | |
| 427 | - return $form->decrease_sales( $quantity ); |
|
| 426 | + return $form->decrease_sales($quantity); |
|
| 428 | 427 | } |
| 429 | 428 | |
| 430 | 429 | /** |
@@ -440,11 +439,11 @@ discard block |
||
| 440 | 439 | * |
| 441 | 440 | * @return bool|int |
| 442 | 441 | */ |
| 443 | -function give_increase_earnings( $give_form_id = 0, $amount, $payment_id = 0 ) { |
|
| 442 | +function give_increase_earnings($give_form_id = 0, $amount, $payment_id = 0) { |
|
| 444 | 443 | /** @var \Give_Donate_Form $form */ |
| 445 | - $form = new Give_Donate_Form( $give_form_id ); |
|
| 444 | + $form = new Give_Donate_Form($give_form_id); |
|
| 446 | 445 | |
| 447 | - return $form->increase_earnings( $amount, $payment_id ); |
|
| 446 | + return $form->increase_earnings($amount, $payment_id); |
|
| 448 | 447 | } |
| 449 | 448 | |
| 450 | 449 | /** |
@@ -462,11 +461,11 @@ discard block |
||
| 462 | 461 | * |
| 463 | 462 | * @return bool|int |
| 464 | 463 | */ |
| 465 | -function give_decrease_form_earnings( $form_id = 0, $amount, $payment_id = 0 ) { |
|
| 464 | +function give_decrease_form_earnings($form_id = 0, $amount, $payment_id = 0) { |
|
| 466 | 465 | /** @var \Give_Donate_Form $form */ |
| 467 | - $form = new Give_Donate_Form( $form_id ); |
|
| 466 | + $form = new Give_Donate_Form($form_id); |
|
| 468 | 467 | |
| 469 | - return $form->decrease_earnings( $amount, $payment_id ); |
|
| 468 | + return $form->decrease_earnings($amount, $payment_id); |
|
| 470 | 469 | } |
| 471 | 470 | |
| 472 | 471 | |
@@ -479,15 +478,15 @@ discard block |
||
| 479 | 478 | * |
| 480 | 479 | * @return int $earnings Earnings for a certain form |
| 481 | 480 | */ |
| 482 | -function give_get_form_earnings_stats( $form_id = 0 ) { |
|
| 483 | - $give_form = new Give_Donate_Form( $form_id ); |
|
| 481 | +function give_get_form_earnings_stats($form_id = 0) { |
|
| 482 | + $give_form = new Give_Donate_Form($form_id); |
|
| 484 | 483 | |
| 485 | 484 | /** |
| 486 | 485 | * Filter the form earnings |
| 487 | 486 | * |
| 488 | 487 | * @since 1.8.17 |
| 489 | 488 | */ |
| 490 | - return apply_filters( 'give_get_form_earnings_stats', $give_form->earnings, $form_id, $give_form ); |
|
| 489 | + return apply_filters('give_get_form_earnings_stats', $give_form->earnings, $form_id, $give_form); |
|
| 491 | 490 | } |
| 492 | 491 | |
| 493 | 492 | |
@@ -500,8 +499,8 @@ discard block |
||
| 500 | 499 | * |
| 501 | 500 | * @return int $sales Amount of sales for a certain form |
| 502 | 501 | */ |
| 503 | -function give_get_form_sales_stats( $give_form_id = 0 ) { |
|
| 504 | - $give_form = new Give_Donate_Form( $give_form_id ); |
|
| 502 | +function give_get_form_sales_stats($give_form_id = 0) { |
|
| 503 | + $give_form = new Give_Donate_Form($give_form_id); |
|
| 505 | 504 | |
| 506 | 505 | return $give_form->sales; |
| 507 | 506 | } |
@@ -516,16 +515,16 @@ discard block |
||
| 516 | 515 | * |
| 517 | 516 | * @return float $sales Average monthly sales |
| 518 | 517 | */ |
| 519 | -function give_get_average_monthly_form_sales( $form_id = 0 ) { |
|
| 520 | - $sales = give_get_form_sales_stats( $form_id ); |
|
| 521 | - $release_date = get_post_field( 'post_date', $form_id ); |
|
| 518 | +function give_get_average_monthly_form_sales($form_id = 0) { |
|
| 519 | + $sales = give_get_form_sales_stats($form_id); |
|
| 520 | + $release_date = get_post_field('post_date', $form_id); |
|
| 522 | 521 | |
| 523 | - $diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) ); |
|
| 522 | + $diff = abs(current_time('timestamp') - strtotime($release_date)); |
|
| 524 | 523 | |
| 525 | - $months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication |
|
| 524 | + $months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication |
|
| 526 | 525 | |
| 527 | - if ( $months > 0 ) { |
|
| 528 | - $sales = ( $sales / $months ); |
|
| 526 | + if ($months > 0) { |
|
| 527 | + $sales = ($sales / $months); |
|
| 529 | 528 | } |
| 530 | 529 | |
| 531 | 530 | return $sales; |
@@ -541,16 +540,16 @@ discard block |
||
| 541 | 540 | * |
| 542 | 541 | * @return float $earnings Average monthly earnings |
| 543 | 542 | */ |
| 544 | -function give_get_average_monthly_form_earnings( $form_id = 0 ) { |
|
| 545 | - $earnings = give_get_form_earnings_stats( $form_id ); |
|
| 546 | - $release_date = get_post_field( 'post_date', $form_id ); |
|
| 543 | +function give_get_average_monthly_form_earnings($form_id = 0) { |
|
| 544 | + $earnings = give_get_form_earnings_stats($form_id); |
|
| 545 | + $release_date = get_post_field('post_date', $form_id); |
|
| 547 | 546 | |
| 548 | - $diff = abs( current_time( 'timestamp' ) - strtotime( $release_date ) ); |
|
| 547 | + $diff = abs(current_time('timestamp') - strtotime($release_date)); |
|
| 549 | 548 | |
| 550 | - $months = floor( $diff / ( 30 * 60 * 60 * 24 ) ); // Number of months since publication |
|
| 549 | + $months = floor($diff / (30 * 60 * 60 * 24)); // Number of months since publication |
|
| 551 | 550 | |
| 552 | - if ( $months > 0 ) { |
|
| 553 | - $earnings = ( $earnings / $months ); |
|
| 551 | + if ($months > 0) { |
|
| 552 | + $earnings = ($earnings / $months); |
|
| 554 | 553 | } |
| 555 | 554 | |
| 556 | 555 | return $earnings < 0 ? 0 : $earnings; |
@@ -571,34 +570,34 @@ discard block |
||
| 571 | 570 | * |
| 572 | 571 | * @return string $price_name Name of the price option |
| 573 | 572 | */ |
| 574 | -function give_get_price_option_name( $form_id = 0, $price_id = 0, $payment_id = 0, $use_fallback = true ) { |
|
| 573 | +function give_get_price_option_name($form_id = 0, $price_id = 0, $payment_id = 0, $use_fallback = true) { |
|
| 575 | 574 | |
| 576 | - $prices = give_get_variable_prices( $form_id ); |
|
| 575 | + $prices = give_get_variable_prices($form_id); |
|
| 577 | 576 | $price_name = ''; |
| 578 | 577 | |
| 579 | - if ( false === $prices ) { |
|
| 578 | + if (false === $prices) { |
|
| 580 | 579 | return $price_name; |
| 581 | 580 | } |
| 582 | 581 | |
| 583 | - foreach ( $prices as $price ) { |
|
| 582 | + foreach ($prices as $price) { |
|
| 584 | 583 | |
| 585 | - if ( intval( $price['_give_id']['level_id'] ) === intval( $price_id ) ) { |
|
| 584 | + if (intval($price['_give_id']['level_id']) === intval($price_id)) { |
|
| 586 | 585 | |
| 587 | - $price_text = isset( $price['_give_text'] ) ? $price['_give_text'] : ''; |
|
| 586 | + $price_text = isset($price['_give_text']) ? $price['_give_text'] : ''; |
|
| 588 | 587 | $price_fallback = $use_fallback ? |
| 589 | 588 | give_currency_filter( |
| 590 | 589 | give_format_amount( |
| 591 | 590 | $price['_give_amount'], |
| 592 | - array( 'sanitize' => false ) |
|
| 591 | + array('sanitize' => false) |
|
| 593 | 592 | ), |
| 594 | - array( 'decode_currency' => true ) |
|
| 593 | + array('decode_currency' => true) |
|
| 595 | 594 | ) : ''; |
| 596 | - $price_name = ! empty( $price_text ) ? $price_text : $price_fallback; |
|
| 595 | + $price_name = ! empty($price_text) ? $price_text : $price_fallback; |
|
| 597 | 596 | |
| 598 | 597 | } |
| 599 | 598 | } |
| 600 | 599 | |
| 601 | - return apply_filters( 'give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id ); |
|
| 600 | + return apply_filters('give_get_price_option_name', $price_name, $form_id, $payment_id, $price_id); |
|
| 602 | 601 | } |
| 603 | 602 | |
| 604 | 603 | |
@@ -612,25 +611,25 @@ discard block |
||
| 612 | 611 | * |
| 613 | 612 | * @return string $range A fully formatted price range |
| 614 | 613 | */ |
| 615 | -function give_price_range( $form_id = 0, $formatted = true ) { |
|
| 616 | - $low = give_get_lowest_price_option( $form_id ); |
|
| 617 | - $high = give_get_highest_price_option( $form_id ); |
|
| 618 | - $order_type = ! empty( $_REQUEST['order'] ) ? $_REQUEST['order'] : 'asc'; |
|
| 614 | +function give_price_range($form_id = 0, $formatted = true) { |
|
| 615 | + $low = give_get_lowest_price_option($form_id); |
|
| 616 | + $high = give_get_highest_price_option($form_id); |
|
| 617 | + $order_type = ! empty($_REQUEST['order']) ? $_REQUEST['order'] : 'asc'; |
|
| 619 | 618 | |
| 620 | 619 | $range = sprintf( |
| 621 | 620 | '<span class="give_price_range_%1$s">%2$s</span><span class="give_price_range_sep"> – </span><span class="give_price_range_%3$s">%4$s</span>', |
| 622 | 621 | 'asc' === $order_type ? 'low' : 'high', |
| 623 | - 'asc' === $order_type ? give_currency_filter( give_format_amount( $low, array( 'sanitize' => false ) ) ) : give_currency_filter( give_format_amount( $high, array( 'sanitize' => false ) ) ), |
|
| 622 | + 'asc' === $order_type ? give_currency_filter(give_format_amount($low, array('sanitize' => false))) : give_currency_filter(give_format_amount($high, array('sanitize' => false))), |
|
| 624 | 623 | 'asc' === $order_type ? 'high' : 'low', |
| 625 | - 'asc' === $order_type ? give_currency_filter( give_format_amount( $high, array( 'sanitize' => false ) ) ) : give_currency_filter( give_format_amount( $low, array( 'sanitize' => false ) ) ) |
|
| 624 | + 'asc' === $order_type ? give_currency_filter(give_format_amount($high, array('sanitize' => false))) : give_currency_filter(give_format_amount($low, array('sanitize' => false))) |
|
| 626 | 625 | |
| 627 | 626 | ); |
| 628 | 627 | |
| 629 | - if ( ! $formatted ) { |
|
| 630 | - $range = wp_strip_all_tags( $range ); |
|
| 628 | + if ( ! $formatted) { |
|
| 629 | + $range = wp_strip_all_tags($range); |
|
| 631 | 630 | } |
| 632 | 631 | |
| 633 | - return apply_filters( 'give_price_range', $range, $form_id, $low, $high ); |
|
| 632 | + return apply_filters('give_price_range', $range, $form_id, $low, $high); |
|
| 634 | 633 | } |
| 635 | 634 | |
| 636 | 635 | |
@@ -645,35 +644,35 @@ discard block |
||
| 645 | 644 | * |
| 646 | 645 | * @return int ID of the lowest price |
| 647 | 646 | */ |
| 648 | -function give_get_lowest_price_id( $form_id = 0 ) { |
|
| 647 | +function give_get_lowest_price_id($form_id = 0) { |
|
| 649 | 648 | |
| 650 | - if ( empty( $form_id ) ) { |
|
| 649 | + if (empty($form_id)) { |
|
| 651 | 650 | $form_id = get_the_ID(); |
| 652 | 651 | } |
| 653 | 652 | |
| 654 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
| 655 | - return give_get_form_price( $form_id ); |
|
| 653 | + if ( ! give_has_variable_prices($form_id)) { |
|
| 654 | + return give_get_form_price($form_id); |
|
| 656 | 655 | } |
| 657 | 656 | |
| 658 | - $prices = give_get_variable_prices( $form_id ); |
|
| 657 | + $prices = give_get_variable_prices($form_id); |
|
| 659 | 658 | |
| 660 | 659 | $min = $min_id = 0; |
| 661 | 660 | |
| 662 | - if ( ! empty( $prices ) ) { |
|
| 661 | + if ( ! empty($prices)) { |
|
| 663 | 662 | |
| 664 | - foreach ( $prices as $key => $price ) { |
|
| 663 | + foreach ($prices as $key => $price) { |
|
| 665 | 664 | |
| 666 | - if ( empty( $price['_give_amount'] ) ) { |
|
| 665 | + if (empty($price['_give_amount'])) { |
|
| 667 | 666 | continue; |
| 668 | 667 | } |
| 669 | 668 | |
| 670 | - if ( ! isset( $min ) ) { |
|
| 669 | + if ( ! isset($min)) { |
|
| 671 | 670 | $min = $price['_give_amount']; |
| 672 | 671 | } else { |
| 673 | - $min = min( $min, $price['_give_amount'] ); |
|
| 672 | + $min = min($min, $price['_give_amount']); |
|
| 674 | 673 | } |
| 675 | 674 | |
| 676 | - if ( $price['_give_amount'] == $min ) { |
|
| 675 | + if ($price['_give_amount'] == $min) { |
|
| 677 | 676 | $min_id = $price['_give_id']['level_id']; |
| 678 | 677 | } |
| 679 | 678 | } |
@@ -691,22 +690,22 @@ discard block |
||
| 691 | 690 | * |
| 692 | 691 | * @return float Amount of the lowest price |
| 693 | 692 | */ |
| 694 | -function give_get_lowest_price_option( $form_id = 0 ) { |
|
| 695 | - if ( empty( $form_id ) ) { |
|
| 693 | +function give_get_lowest_price_option($form_id = 0) { |
|
| 694 | + if (empty($form_id)) { |
|
| 696 | 695 | $form_id = get_the_ID(); |
| 697 | 696 | } |
| 698 | 697 | |
| 699 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
| 700 | - return give_get_form_price( $form_id ); |
|
| 698 | + if ( ! give_has_variable_prices($form_id)) { |
|
| 699 | + return give_get_form_price($form_id); |
|
| 701 | 700 | } |
| 702 | 701 | |
| 703 | - if ( ! ( $low = get_post_meta( $form_id, '_give_levels_minimum_amount', true ) ) ) { |
|
| 702 | + if ( ! ($low = get_post_meta($form_id, '_give_levels_minimum_amount', true))) { |
|
| 704 | 703 | // Backward compatibility. |
| 705 | - $prices = wp_list_pluck( give_get_variable_prices( $form_id ), '_give_amount' ); |
|
| 706 | - $low = ! empty( $prices ) ? min( $prices ) : 0; |
|
| 704 | + $prices = wp_list_pluck(give_get_variable_prices($form_id), '_give_amount'); |
|
| 705 | + $low = ! empty($prices) ? min($prices) : 0; |
|
| 707 | 706 | } |
| 708 | 707 | |
| 709 | - return give_maybe_sanitize_amount( $low ); |
|
| 708 | + return give_maybe_sanitize_amount($low); |
|
| 710 | 709 | } |
| 711 | 710 | |
| 712 | 711 | /** |
@@ -718,23 +717,23 @@ discard block |
||
| 718 | 717 | * |
| 719 | 718 | * @return float Amount of the highest price |
| 720 | 719 | */ |
| 721 | -function give_get_highest_price_option( $form_id = 0 ) { |
|
| 720 | +function give_get_highest_price_option($form_id = 0) { |
|
| 722 | 721 | |
| 723 | - if ( empty( $form_id ) ) { |
|
| 722 | + if (empty($form_id)) { |
|
| 724 | 723 | $form_id = get_the_ID(); |
| 725 | 724 | } |
| 726 | 725 | |
| 727 | - if ( ! give_has_variable_prices( $form_id ) ) { |
|
| 728 | - return give_get_form_price( $form_id ); |
|
| 726 | + if ( ! give_has_variable_prices($form_id)) { |
|
| 727 | + return give_get_form_price($form_id); |
|
| 729 | 728 | } |
| 730 | 729 | |
| 731 | - if ( ! ( $high = get_post_meta( $form_id, '_give_levels_maximum_amount', true ) ) ) { |
|
| 730 | + if ( ! ($high = get_post_meta($form_id, '_give_levels_maximum_amount', true))) { |
|
| 732 | 731 | // Backward compatibility. |
| 733 | - $prices = wp_list_pluck( give_get_variable_prices( $form_id ), '_give_amount' ); |
|
| 734 | - $high = ! empty( $prices ) ? max( $prices ) : 0; |
|
| 732 | + $prices = wp_list_pluck(give_get_variable_prices($form_id), '_give_amount'); |
|
| 733 | + $high = ! empty($prices) ? max($prices) : 0; |
|
| 735 | 734 | } |
| 736 | 735 | |
| 737 | - return give_maybe_sanitize_amount( $high ); |
|
| 736 | + return give_maybe_sanitize_amount($high); |
|
| 738 | 737 | } |
| 739 | 738 | |
| 740 | 739 | /** |
@@ -746,15 +745,15 @@ discard block |
||
| 746 | 745 | * |
| 747 | 746 | * @return mixed string|int Price of the form |
| 748 | 747 | */ |
| 749 | -function give_get_form_price( $form_id = 0 ) { |
|
| 748 | +function give_get_form_price($form_id = 0) { |
|
| 750 | 749 | |
| 751 | - if ( empty( $form_id ) ) { |
|
| 750 | + if (empty($form_id)) { |
|
| 752 | 751 | return false; |
| 753 | 752 | } |
| 754 | 753 | |
| 755 | - $form = new Give_Donate_Form( $form_id ); |
|
| 754 | + $form = new Give_Donate_Form($form_id); |
|
| 756 | 755 | |
| 757 | - return $form->__get( 'price' ); |
|
| 756 | + return $form->__get('price'); |
|
| 758 | 757 | } |
| 759 | 758 | |
| 760 | 759 | /** |
@@ -766,13 +765,13 @@ discard block |
||
| 766 | 765 | * |
| 767 | 766 | * @return mixed string|int Minimum price of the form |
| 768 | 767 | */ |
| 769 | -function give_get_form_minimum_price( $form_id = 0 ) { |
|
| 768 | +function give_get_form_minimum_price($form_id = 0) { |
|
| 770 | 769 | |
| 771 | - if ( empty( $form_id ) ) { |
|
| 770 | + if (empty($form_id)) { |
|
| 772 | 771 | return false; |
| 773 | 772 | } |
| 774 | 773 | |
| 775 | - $form = new Give_Donate_Form( $form_id ); |
|
| 774 | + $form = new Give_Donate_Form($form_id); |
|
| 776 | 775 | |
| 777 | 776 | return $form->get_minimum_price(); |
| 778 | 777 | |
@@ -787,13 +786,13 @@ discard block |
||
| 787 | 786 | * |
| 788 | 787 | * @return bool|float |
| 789 | 788 | */ |
| 790 | -function give_get_form_maximum_price( $form_id = 0 ) { |
|
| 789 | +function give_get_form_maximum_price($form_id = 0) { |
|
| 791 | 790 | |
| 792 | - if ( empty( $form_id ) ) { |
|
| 791 | + if (empty($form_id)) { |
|
| 793 | 792 | return false; |
| 794 | 793 | } |
| 795 | 794 | |
| 796 | - $form = new Give_Donate_Form( $form_id ); |
|
| 795 | + $form = new Give_Donate_Form($form_id); |
|
| 797 | 796 | |
| 798 | 797 | return $form->get_maximum_price(); |
| 799 | 798 | } |
@@ -809,48 +808,48 @@ discard block |
||
| 809 | 808 | * |
| 810 | 809 | * @return int $formatted_price |
| 811 | 810 | */ |
| 812 | -function give_price( $form_id = 0, $echo = true, $price_id = false ) { |
|
| 811 | +function give_price($form_id = 0, $echo = true, $price_id = false) { |
|
| 813 | 812 | $price = 0; |
| 814 | 813 | |
| 815 | - if ( empty( $form_id ) ) { |
|
| 814 | + if (empty($form_id)) { |
|
| 816 | 815 | $form_id = get_the_ID(); |
| 817 | 816 | } |
| 818 | 817 | |
| 819 | - if ( give_has_variable_prices( $form_id ) ) { |
|
| 818 | + if (give_has_variable_prices($form_id)) { |
|
| 820 | 819 | |
| 821 | - $prices = give_get_variable_prices( $form_id ); |
|
| 820 | + $prices = give_get_variable_prices($form_id); |
|
| 822 | 821 | |
| 823 | - if ( false !== $price_id ) { |
|
| 822 | + if (false !== $price_id) { |
|
| 824 | 823 | |
| 825 | 824 | // loop through multi-prices to see which is default |
| 826 | - foreach ( $prices as $price ) { |
|
| 825 | + foreach ($prices as $price) { |
|
| 827 | 826 | // this is the default price |
| 828 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
| 827 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
| 829 | 828 | $price = (float) $price['_give_amount']; |
| 830 | 829 | }; |
| 831 | 830 | } |
| 832 | 831 | } else { |
| 833 | 832 | |
| 834 | - $price = give_get_lowest_price_option( $form_id ); |
|
| 833 | + $price = give_get_lowest_price_option($form_id); |
|
| 835 | 834 | } |
| 836 | 835 | } else { |
| 837 | 836 | |
| 838 | - $price = give_get_form_price( $form_id ); |
|
| 837 | + $price = give_get_form_price($form_id); |
|
| 839 | 838 | } |
| 840 | 839 | |
| 841 | - $price = apply_filters( 'give_form_price', give_maybe_sanitize_amount( $price ), $form_id ); |
|
| 842 | - $formatted_price = '<span class="give_price" id="give_price_' . $form_id . '">' . $price . '</span>'; |
|
| 843 | - $formatted_price = apply_filters( 'give_form_price_after_html', $formatted_price, $form_id, $price ); |
|
| 840 | + $price = apply_filters('give_form_price', give_maybe_sanitize_amount($price), $form_id); |
|
| 841 | + $formatted_price = '<span class="give_price" id="give_price_'.$form_id.'">'.$price.'</span>'; |
|
| 842 | + $formatted_price = apply_filters('give_form_price_after_html', $formatted_price, $form_id, $price); |
|
| 844 | 843 | |
| 845 | - if ( $echo ) { |
|
| 844 | + if ($echo) { |
|
| 846 | 845 | echo $formatted_price; |
| 847 | 846 | } else { |
| 848 | 847 | return $formatted_price; |
| 849 | 848 | } |
| 850 | 849 | } |
| 851 | 850 | |
| 852 | -add_filter( 'give_form_price', 'give_format_amount', 10 ); |
|
| 853 | -add_filter( 'give_form_price', 'give_currency_filter', 20 ); |
|
| 851 | +add_filter('give_form_price', 'give_format_amount', 10); |
|
| 852 | +add_filter('give_form_price', 'give_currency_filter', 20); |
|
| 854 | 853 | |
| 855 | 854 | |
| 856 | 855 | /** |
@@ -863,19 +862,19 @@ discard block |
||
| 863 | 862 | * |
| 864 | 863 | * @return float $amount Amount of the price option |
| 865 | 864 | */ |
| 866 | -function give_get_price_option_amount( $form_id = 0, $price_id = 0 ) { |
|
| 867 | - $prices = give_get_variable_prices( $form_id ); |
|
| 865 | +function give_get_price_option_amount($form_id = 0, $price_id = 0) { |
|
| 866 | + $prices = give_get_variable_prices($form_id); |
|
| 868 | 867 | |
| 869 | 868 | $amount = 0.00; |
| 870 | 869 | |
| 871 | - foreach ( $prices as $price ) { |
|
| 872 | - if ( isset( $price['_give_id']['level_id'] ) && $price['_give_id']['level_id'] == $price_id ) { |
|
| 873 | - $amount = isset( $price['_give_amount'] ) ? $price['_give_amount'] : 0.00; |
|
| 870 | + foreach ($prices as $price) { |
|
| 871 | + if (isset($price['_give_id']['level_id']) && $price['_give_id']['level_id'] == $price_id) { |
|
| 872 | + $amount = isset($price['_give_amount']) ? $price['_give_amount'] : 0.00; |
|
| 874 | 873 | break; |
| 875 | 874 | }; |
| 876 | 875 | } |
| 877 | 876 | |
| 878 | - return apply_filters( 'give_get_price_option_amount', give_maybe_sanitize_amount( $amount ), $form_id, $price_id ); |
|
| 877 | + return apply_filters('give_get_price_option_amount', give_maybe_sanitize_amount($amount), $form_id, $price_id); |
|
| 879 | 878 | } |
| 880 | 879 | |
| 881 | 880 | /** |
@@ -887,13 +886,13 @@ discard block |
||
| 887 | 886 | * |
| 888 | 887 | * @return mixed string|int Goal of the form |
| 889 | 888 | */ |
| 890 | -function give_get_form_goal( $form_id = 0 ) { |
|
| 889 | +function give_get_form_goal($form_id = 0) { |
|
| 891 | 890 | |
| 892 | - if ( empty( $form_id ) ) { |
|
| 891 | + if (empty($form_id)) { |
|
| 893 | 892 | return false; |
| 894 | 893 | } |
| 895 | 894 | |
| 896 | - $form = new Give_Donate_Form( $form_id ); |
|
| 895 | + $form = new Give_Donate_Form($form_id); |
|
| 897 | 896 | |
| 898 | 897 | return $form->goal; |
| 899 | 898 | |
@@ -908,13 +907,13 @@ discard block |
||
| 908 | 907 | * |
| 909 | 908 | * @return mixed string|int Goal of the form |
| 910 | 909 | */ |
| 911 | -function give_get_form_goal_format( $form_id = 0 ) { |
|
| 910 | +function give_get_form_goal_format($form_id = 0) { |
|
| 912 | 911 | |
| 913 | - if ( empty( $form_id ) ) { |
|
| 912 | + if (empty($form_id)) { |
|
| 914 | 913 | return false; |
| 915 | 914 | } |
| 916 | 915 | |
| 917 | - return give_get_meta( $form_id, '_give_goal_format', true ); |
|
| 916 | + return give_get_meta($form_id, '_give_goal_format', true); |
|
| 918 | 917 | |
| 919 | 918 | } |
| 920 | 919 | |
@@ -928,19 +927,19 @@ discard block |
||
| 928 | 927 | * |
| 929 | 928 | * @return string $formatted_goal |
| 930 | 929 | */ |
| 931 | -function give_goal( $form_id = 0, $echo = true ) { |
|
| 930 | +function give_goal($form_id = 0, $echo = true) { |
|
| 932 | 931 | |
| 933 | - if ( empty( $form_id ) ) { |
|
| 932 | + if (empty($form_id)) { |
|
| 934 | 933 | $form_id = get_the_ID(); |
| 935 | 934 | } |
| 936 | 935 | |
| 937 | - $goal = give_get_form_goal( $form_id ); |
|
| 938 | - $goal_format = give_get_form_goal_format( $form_id ); |
|
| 936 | + $goal = give_get_form_goal($form_id); |
|
| 937 | + $goal_format = give_get_form_goal_format($form_id); |
|
| 939 | 938 | |
| 940 | - if ( 'donation' === $goal_format ) { |
|
| 939 | + if ('donation' === $goal_format) { |
|
| 941 | 940 | $goal = "{$goal} donations"; |
| 942 | 941 | } else { |
| 943 | - $goal = apply_filters( 'give_form_goal', give_maybe_sanitize_amount( $goal ), $form_id ); |
|
| 942 | + $goal = apply_filters('give_form_goal', give_maybe_sanitize_amount($goal), $form_id); |
|
| 944 | 943 | } |
| 945 | 944 | |
| 946 | 945 | $formatted_goal = sprintf( |
@@ -948,17 +947,17 @@ discard block |
||
| 948 | 947 | $form_id, |
| 949 | 948 | $goal |
| 950 | 949 | ); |
| 951 | - $formatted_goal = apply_filters( 'give_form_price_after_html', $formatted_goal, $form_id, $goal ); |
|
| 950 | + $formatted_goal = apply_filters('give_form_price_after_html', $formatted_goal, $form_id, $goal); |
|
| 952 | 951 | |
| 953 | - if ( $echo ) { |
|
| 952 | + if ($echo) { |
|
| 954 | 953 | echo $formatted_goal; |
| 955 | 954 | } else { |
| 956 | 955 | return $formatted_goal; |
| 957 | 956 | } |
| 958 | 957 | } |
| 959 | 958 | |
| 960 | -add_filter( 'give_form_goal', 'give_format_amount', 10 ); |
|
| 961 | -add_filter( 'give_form_goal', 'give_currency_filter', 20 ); |
|
| 959 | +add_filter('give_form_goal', 'give_format_amount', 10); |
|
| 960 | +add_filter('give_form_goal', 'give_currency_filter', 20); |
|
| 962 | 961 | |
| 963 | 962 | |
| 964 | 963 | /** |
@@ -970,15 +969,15 @@ discard block |
||
| 970 | 969 | * |
| 971 | 970 | * @return bool $ret Whether or not the logged_in_only setting is set |
| 972 | 971 | */ |
| 973 | -function give_logged_in_only( $form_id ) { |
|
| 972 | +function give_logged_in_only($form_id) { |
|
| 974 | 973 | // If _give_logged_in_only is set to enable then guest can donate from that specific form. |
| 975 | 974 | // Otherwise it is member only donation form. |
| 976 | - $val = give_get_meta( $form_id, '_give_logged_in_only', true ); |
|
| 977 | - $val = ! empty( $val ) ? $val : 'enabled'; |
|
| 975 | + $val = give_get_meta($form_id, '_give_logged_in_only', true); |
|
| 976 | + $val = ! empty($val) ? $val : 'enabled'; |
|
| 978 | 977 | |
| 979 | - $ret = ! give_is_setting_enabled( $val ); |
|
| 978 | + $ret = ! give_is_setting_enabled($val); |
|
| 980 | 979 | |
| 981 | - return (bool) apply_filters( 'give_logged_in_only', $ret, $form_id ); |
|
| 980 | + return (bool) apply_filters('give_logged_in_only', $ret, $form_id); |
|
| 982 | 981 | } |
| 983 | 982 | |
| 984 | 983 | |
@@ -991,11 +990,11 @@ discard block |
||
| 991 | 990 | * |
| 992 | 991 | * @return string |
| 993 | 992 | */ |
| 994 | -function give_show_login_register_option( $form_id ) { |
|
| 993 | +function give_show_login_register_option($form_id) { |
|
| 995 | 994 | |
| 996 | - $show_register_form = give_get_meta( $form_id, '_give_show_register_form', true ); |
|
| 995 | + $show_register_form = give_get_meta($form_id, '_give_show_register_form', true); |
|
| 997 | 996 | |
| 998 | - return apply_filters( 'give_show_register_form', $show_register_form, $form_id ); |
|
| 997 | + return apply_filters('give_show_register_form', $show_register_form, $form_id); |
|
| 999 | 998 | |
| 1000 | 999 | } |
| 1001 | 1000 | |
@@ -1011,12 +1010,12 @@ discard block |
||
| 1011 | 1010 | * |
| 1012 | 1011 | * @return array |
| 1013 | 1012 | */ |
| 1014 | -function _give_get_prefill_form_field_values( $form_id ) { |
|
| 1013 | +function _give_get_prefill_form_field_values($form_id) { |
|
| 1015 | 1014 | $logged_in_donor_info = array(); |
| 1016 | 1015 | |
| 1017 | - if ( is_user_logged_in() ) : |
|
| 1018 | - $donor_data = get_userdata( get_current_user_id() ); |
|
| 1019 | - $donor = new Give_Donor( get_current_user_id(), true ); |
|
| 1016 | + if (is_user_logged_in()) : |
|
| 1017 | + $donor_data = get_userdata(get_current_user_id()); |
|
| 1018 | + $donor = new Give_Donor(get_current_user_id(), true); |
|
| 1020 | 1019 | $donor_address = $donor->get_donor_address(); |
| 1021 | 1020 | $company_name = $donor->get_company_name(); |
| 1022 | 1021 | |
@@ -1055,23 +1054,23 @@ discard block |
||
| 1055 | 1054 | |
| 1056 | 1055 | // Bailout: Auto fill form field values only form form which donor is donating. |
| 1057 | 1056 | if ( |
| 1058 | - empty( $_GET['form-id'] ) |
|
| 1057 | + empty($_GET['form-id']) |
|
| 1059 | 1058 | || ! $form_id |
| 1060 | - || ( $form_id !== absint( $_GET['form-id'] ) ) |
|
| 1059 | + || ($form_id !== absint($_GET['form-id'])) |
|
| 1061 | 1060 | ) { |
| 1062 | 1061 | return $logged_in_donor_info; |
| 1063 | 1062 | } |
| 1064 | 1063 | |
| 1065 | 1064 | // Get purchase data. |
| 1066 | - $give_purchase_data = Give()->session->get( 'give_purchase' ); |
|
| 1065 | + $give_purchase_data = Give()->session->get('give_purchase'); |
|
| 1067 | 1066 | |
| 1068 | 1067 | // Get donor info from form data. |
| 1069 | - $give_donor_info_in_session = empty( $give_purchase_data['post_data'] ) |
|
| 1068 | + $give_donor_info_in_session = empty($give_purchase_data['post_data']) |
|
| 1070 | 1069 | ? array() |
| 1071 | 1070 | : $give_purchase_data['post_data']; |
| 1072 | 1071 | |
| 1073 | 1072 | // Output. |
| 1074 | - return wp_parse_args( $give_donor_info_in_session, $logged_in_donor_info ); |
|
| 1073 | + return wp_parse_args($give_donor_info_in_session, $logged_in_donor_info); |
|
| 1075 | 1074 | } |
| 1076 | 1075 | |
| 1077 | 1076 | /** |
@@ -1084,13 +1083,13 @@ discard block |
||
| 1084 | 1083 | * |
| 1085 | 1084 | * @return int |
| 1086 | 1085 | */ |
| 1087 | -function give_get_form_donor_count( $form_id, $args = array() ) { |
|
| 1086 | +function give_get_form_donor_count($form_id, $args = array()) { |
|
| 1088 | 1087 | global $wpdb; |
| 1089 | 1088 | |
| 1090 | - $cache_key = Give_Cache::get_key( "form_donor_count_{$form_id}", $args, false ); |
|
| 1091 | - $donor_count = absint( Give_Cache::get_db_query( $cache_key ) ); |
|
| 1089 | + $cache_key = Give_Cache::get_key("form_donor_count_{$form_id}", $args, false); |
|
| 1090 | + $donor_count = absint(Give_Cache::get_db_query($cache_key)); |
|
| 1092 | 1091 | |
| 1093 | - if ( $form_id && ! $donor_count ) { |
|
| 1092 | + if ($form_id && ! $donor_count) { |
|
| 1094 | 1093 | // Set arguments. |
| 1095 | 1094 | $args = wp_parse_args( |
| 1096 | 1095 | $args, |
@@ -1124,7 +1123,7 @@ discard block |
||
| 1124 | 1123 | 'publish' |
| 1125 | 1124 | ); |
| 1126 | 1125 | |
| 1127 | - $donor_count = absint( $wpdb->get_var( $query ) ); |
|
| 1126 | + $donor_count = absint($wpdb->get_var($query)); |
|
| 1128 | 1127 | } |
| 1129 | 1128 | |
| 1130 | 1129 | |
@@ -1133,9 +1132,9 @@ discard block |
||
| 1133 | 1132 | * |
| 1134 | 1133 | * @since 2.1.0 |
| 1135 | 1134 | */ |
| 1136 | - $donor_count = apply_filters( 'give_get_form_donor_count', $donor_count, $form_id, $args ); |
|
| 1135 | + $donor_count = apply_filters('give_get_form_donor_count', $donor_count, $form_id, $args); |
|
| 1137 | 1136 | |
| 1138 | - Give_Cache::set_db_query( $cache_key, $donor_count ); |
|
| 1137 | + Give_Cache::set_db_query($cache_key, $donor_count); |
|
| 1139 | 1138 | |
| 1140 | 1139 | return $donor_count; |
| 1141 | 1140 | } |
@@ -1149,33 +1148,33 @@ discard block |
||
| 1149 | 1148 | * |
| 1150 | 1149 | * @return void |
| 1151 | 1150 | */ |
| 1152 | -function give_set_form_closed_status( $form_id ) { |
|
| 1151 | +function give_set_form_closed_status($form_id) { |
|
| 1153 | 1152 | |
| 1154 | 1153 | // Bailout. |
| 1155 | - if ( empty( $form_id ) ) { |
|
| 1154 | + if (empty($form_id)) { |
|
| 1156 | 1155 | return; |
| 1157 | 1156 | } |
| 1158 | 1157 | |
| 1159 | 1158 | $open_form = false; |
| 1160 | - $is_goal_enabled = give_is_setting_enabled( give_get_meta( $form_id, '_give_goal_option', true, 'disabled' ) ); |
|
| 1159 | + $is_goal_enabled = give_is_setting_enabled(give_get_meta($form_id, '_give_goal_option', true, 'disabled')); |
|
| 1161 | 1160 | |
| 1162 | 1161 | // Proceed, if the form goal is enabled. |
| 1163 | - if ( $is_goal_enabled ) { |
|
| 1162 | + if ($is_goal_enabled) { |
|
| 1164 | 1163 | |
| 1165 | - $close_form_when_goal_achieved = give_is_setting_enabled( give_get_meta( $form_id, '_give_close_form_when_goal_achieved', true, 'disabled' ) ); |
|
| 1164 | + $close_form_when_goal_achieved = give_is_setting_enabled(give_get_meta($form_id, '_give_close_form_when_goal_achieved', true, 'disabled')); |
|
| 1166 | 1165 | |
| 1167 | 1166 | // Proceed, if close form when goal achieved option is enabled. |
| 1168 | - if ( $close_form_when_goal_achieved ) { |
|
| 1167 | + if ($close_form_when_goal_achieved) { |
|
| 1169 | 1168 | |
| 1170 | - $form = new Give_Donate_Form( $form_id ); |
|
| 1171 | - $goal_progress_stats = give_goal_progress_stats( $form ); |
|
| 1169 | + $form = new Give_Donate_Form($form_id); |
|
| 1170 | + $goal_progress_stats = give_goal_progress_stats($form); |
|
| 1172 | 1171 | |
| 1173 | 1172 | // Verify whether the form is closed or not after processing data. |
| 1174 | 1173 | $closed = $goal_progress_stats['raw_goal'] <= $goal_progress_stats['raw_actual']; |
| 1175 | 1174 | |
| 1176 | 1175 | // Update form meta if verified that the form is closed. |
| 1177 | - if ( $closed ) { |
|
| 1178 | - give_update_meta( $form_id, '_give_form_status', 'closed' ); |
|
| 1176 | + if ($closed) { |
|
| 1177 | + give_update_meta($form_id, '_give_form_status', 'closed'); |
|
| 1179 | 1178 | } else { |
| 1180 | 1179 | $open_form = true; |
| 1181 | 1180 | } |
@@ -1187,8 +1186,8 @@ discard block |
||
| 1187 | 1186 | } |
| 1188 | 1187 | |
| 1189 | 1188 | // If $open_form is true, then update form status to open. |
| 1190 | - if ( $open_form ) { |
|
| 1191 | - give_update_meta( $form_id, '_give_form_status', 'open' ); |
|
| 1189 | + if ($open_form) { |
|
| 1190 | + give_update_meta($form_id, '_give_form_status', 'open'); |
|
| 1192 | 1191 | } |
| 1193 | 1192 | } |
| 1194 | 1193 | |
@@ -1201,32 +1200,31 @@ discard block |
||
| 1201 | 1200 | * |
| 1202 | 1201 | * @return string |
| 1203 | 1202 | */ |
| 1204 | -function give_admin_form_goal_stats( $form_id ) { |
|
| 1203 | +function give_admin_form_goal_stats($form_id) { |
|
| 1205 | 1204 | |
| 1206 | 1205 | $html = ''; |
| 1207 | - $goal_stats = give_goal_progress_stats( $form_id ); |
|
| 1208 | - $percent_complete = round( ( $goal_stats['raw_actual'] / $goal_stats['raw_goal'] ), 3 ) * 100; |
|
| 1206 | + $goal_stats = give_goal_progress_stats($form_id); |
|
| 1207 | + $percent_complete = round(($goal_stats['raw_actual'] / $goal_stats['raw_goal']), 3) * 100; |
|
| 1209 | 1208 | |
| 1210 | 1209 | $html .= sprintf( |
| 1211 | 1210 | '<div class="give-admin-progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="%1$s"> |
| 1212 | 1211 | <span style="width:%1$s%%;"></span> |
| 1213 | 1212 | </div>', |
| 1214 | - esc_attr( $goal_stats['progress'] ) |
|
| 1213 | + esc_attr($goal_stats['progress']) |
|
| 1215 | 1214 | ); |
| 1216 | 1215 | |
| 1217 | 1216 | $html .= sprintf( |
| 1218 | - ( 'percentage' !== $goal_stats['format'] ) ? |
|
| 1219 | - '<div class="give-goal-text"><span>%1$s</span> %2$s <a href="%3$s">%4$s</a> %5$s ' : |
|
| 1220 | - '<div class="give-goal-text"><a href="%3$s">%1$s </a>', |
|
| 1221 | - ( 'percentage' !== $goal_stats['format'] ) ? $goal_stats['actual'] : $percent_complete . '%', |
|
| 1222 | - ( 'percentage' !== $goal_stats['format'] ) ? __( 'of', 'give' ) : '', |
|
| 1223 | - esc_url( admin_url( "post.php?post={$form_id}&action=edit&give_tab=donation_goal_options" ) ), |
|
| 1217 | + ('percentage' !== $goal_stats['format']) ? |
|
| 1218 | + '<div class="give-goal-text"><span>%1$s</span> %2$s <a href="%3$s">%4$s</a> %5$s ' : '<div class="give-goal-text"><a href="%3$s">%1$s </a>', |
|
| 1219 | + ('percentage' !== $goal_stats['format']) ? $goal_stats['actual'] : $percent_complete.'%', |
|
| 1220 | + ('percentage' !== $goal_stats['format']) ? __('of', 'give') : '', |
|
| 1221 | + esc_url(admin_url("post.php?post={$form_id}&action=edit&give_tab=donation_goal_options")), |
|
| 1224 | 1222 | $goal_stats['goal'], |
| 1225 | - ( 'donors' === $goal_stats['format'] ? __( 'Donors', 'give' ) : ( 'donation' === $goal_stats['format'] ? __( 'Donations', 'give' ) : '' ) ) |
|
| 1223 | + ('donors' === $goal_stats['format'] ? __('Donors', 'give') : ('donation' === $goal_stats['format'] ? __('Donations', 'give') : '')) |
|
| 1226 | 1224 | ); |
| 1227 | 1225 | |
| 1228 | - if ( $goal_stats['raw_actual'] >= $goal_stats['raw_goal'] ) { |
|
| 1229 | - $html .= sprintf( '<span class="give-admin-goal-achieved"><span class="dashicons dashicons-star-filled"></span> %s</span>', __( 'Goal achieved', 'give' ) ); |
|
| 1226 | + if ($goal_stats['raw_actual'] >= $goal_stats['raw_goal']) { |
|
| 1227 | + $html .= sprintf('<span class="give-admin-goal-achieved"><span class="dashicons dashicons-star-filled"></span> %s</span>', __('Goal achieved', 'give')); |
|
| 1230 | 1228 | } |
| 1231 | 1229 | |
| 1232 | 1230 | $html .= '</div>'; |
@@ -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 | |
@@ -30,54 +30,54 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @return bool|array List of all user donations. |
| 32 | 32 | */ |
| 33 | -function give_get_users_donations( $user = 0, $number = 20, $pagination = false, $status = 'complete' ) { |
|
| 33 | +function give_get_users_donations($user = 0, $number = 20, $pagination = false, $status = 'complete') { |
|
| 34 | 34 | |
| 35 | - if ( empty( $user ) ) { |
|
| 35 | + if (empty($user)) { |
|
| 36 | 36 | $user = get_current_user_id(); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - if ( 0 === $user && ! Give()->email_access->token_exists ) { |
|
| 39 | + if (0 === $user && ! Give()->email_access->token_exists) { |
|
| 40 | 40 | return false; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - $status = ( 'complete' === $status ) ? 'publish' : $status; |
|
| 43 | + $status = ('complete' === $status) ? 'publish' : $status; |
|
| 44 | 44 | $paged = 1; |
| 45 | 45 | |
| 46 | - if ( $pagination ) { |
|
| 47 | - if ( get_query_var( 'paged' ) ) { |
|
| 48 | - $paged = get_query_var( 'paged' ); |
|
| 49 | - } elseif ( get_query_var( 'page' ) ) { |
|
| 50 | - $paged = get_query_var( 'page' ); |
|
| 46 | + if ($pagination) { |
|
| 47 | + if (get_query_var('paged')) { |
|
| 48 | + $paged = get_query_var('paged'); |
|
| 49 | + } elseif (get_query_var('page')) { |
|
| 50 | + $paged = get_query_var('page'); |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - $args = apply_filters( 'give_get_users_donations_args', array( |
|
| 54 | + $args = apply_filters('give_get_users_donations_args', array( |
|
| 55 | 55 | 'user' => $user, |
| 56 | 56 | 'number' => $number, |
| 57 | 57 | 'status' => $status, |
| 58 | 58 | 'orderby' => 'date', |
| 59 | - ) ); |
|
| 59 | + )); |
|
| 60 | 60 | |
| 61 | - if ( $pagination ) { |
|
| 61 | + if ($pagination) { |
|
| 62 | 62 | $args['page'] = $paged; |
| 63 | 63 | } else { |
| 64 | 64 | $args['nopaging'] = true; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $by_user_id = is_numeric( $user ) ? true : false; |
|
| 68 | - $donor = new Give_Donor( $user, $by_user_id ); |
|
| 67 | + $by_user_id = is_numeric($user) ? true : false; |
|
| 68 | + $donor = new Give_Donor($user, $by_user_id); |
|
| 69 | 69 | |
| 70 | - if ( ! empty( $donor->payment_ids ) ) { |
|
| 70 | + if ( ! empty($donor->payment_ids)) { |
|
| 71 | 71 | |
| 72 | - unset( $args['user'] ); |
|
| 73 | - $args['post__in'] = array_map( 'absint', explode( ',', $donor->payment_ids ) ); |
|
| 72 | + unset($args['user']); |
|
| 73 | + $args['post__in'] = array_map('absint', explode(',', $donor->payment_ids)); |
|
| 74 | 74 | |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - $donations = give_get_payments( apply_filters( 'give_get_users_donations_args', $args ) ); |
|
| 77 | + $donations = give_get_payments(apply_filters('give_get_users_donations_args', $args)); |
|
| 78 | 78 | |
| 79 | 79 | // No donations. |
| 80 | - if ( ! $donations ) { |
|
| 80 | + if ( ! $donations) { |
|
| 81 | 81 | return false; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -96,65 +96,65 @@ discard block |
||
| 96 | 96 | * |
| 97 | 97 | * @return bool|object List of unique forms donated by user |
| 98 | 98 | */ |
| 99 | -function give_get_users_completed_donations( $user = 0, $status = 'complete' ) { |
|
| 100 | - if ( empty( $user ) ) { |
|
| 99 | +function give_get_users_completed_donations($user = 0, $status = 'complete') { |
|
| 100 | + if (empty($user)) { |
|
| 101 | 101 | $user = get_current_user_id(); |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - if ( empty( $user ) ) { |
|
| 104 | + if (empty($user)) { |
|
| 105 | 105 | return false; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - $by_user_id = is_numeric( $user ) ? true : false; |
|
| 108 | + $by_user_id = is_numeric($user) ? true : false; |
|
| 109 | 109 | |
| 110 | - $donor = new Give_Donor( $user, $by_user_id ); |
|
| 110 | + $donor = new Give_Donor($user, $by_user_id); |
|
| 111 | 111 | |
| 112 | - if ( empty( $donor->payment_ids ) ) { |
|
| 112 | + if (empty($donor->payment_ids)) { |
|
| 113 | 113 | return false; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | // Get all the items donated. |
| 117 | - $payment_ids = array_reverse( explode( ',', $donor->payment_ids ) ); |
|
| 118 | - $limit_payments = apply_filters( 'give_users_completed_donations_payments', 50 ); |
|
| 119 | - if ( ! empty( $limit_payments ) ) { |
|
| 120 | - $payment_ids = array_slice( $payment_ids, 0, $limit_payments ); |
|
| 117 | + $payment_ids = array_reverse(explode(',', $donor->payment_ids)); |
|
| 118 | + $limit_payments = apply_filters('give_users_completed_donations_payments', 50); |
|
| 119 | + if ( ! empty($limit_payments)) { |
|
| 120 | + $payment_ids = array_slice($payment_ids, 0, $limit_payments); |
|
| 121 | 121 | } |
| 122 | 122 | $donation_data = array(); |
| 123 | - foreach ( $payment_ids as $payment_id ) { |
|
| 124 | - $donation_data[] = give_get_payment_meta( $payment_id ); |
|
| 123 | + foreach ($payment_ids as $payment_id) { |
|
| 124 | + $donation_data[] = give_get_payment_meta($payment_id); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - if ( empty( $donation_data ) ) { |
|
| 127 | + if (empty($donation_data)) { |
|
| 128 | 128 | return false; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | // Grab only the post ids "form_id" of the forms donated on this order. |
| 132 | 132 | $completed_donations_ids = array(); |
| 133 | - foreach ( $donation_data as $donation_meta ) { |
|
| 134 | - $completed_donations_ids[] = isset( $donation_meta['form_id'] ) ? $donation_meta['form_id'] : ''; |
|
| 133 | + foreach ($donation_data as $donation_meta) { |
|
| 134 | + $completed_donations_ids[] = isset($donation_meta['form_id']) ? $donation_meta['form_id'] : ''; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - if ( empty( $completed_donations_ids ) ) { |
|
| 137 | + if (empty($completed_donations_ids)) { |
|
| 138 | 138 | return false; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | // Only include each donation once. |
| 142 | - $form_ids = array_unique( $completed_donations_ids ); |
|
| 142 | + $form_ids = array_unique($completed_donations_ids); |
|
| 143 | 143 | |
| 144 | 144 | // Make sure we still have some products and a first item. |
| 145 | - if ( empty( $form_ids ) || ! isset( $form_ids[0] ) ) { |
|
| 145 | + if (empty($form_ids) || ! isset($form_ids[0])) { |
|
| 146 | 146 | return false; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - $post_type = get_post_type( $form_ids[0] ); |
|
| 149 | + $post_type = get_post_type($form_ids[0]); |
|
| 150 | 150 | |
| 151 | - $args = apply_filters( 'give_get_users_completed_donations_args', array( |
|
| 151 | + $args = apply_filters('give_get_users_completed_donations_args', array( |
|
| 152 | 152 | 'include' => $form_ids, |
| 153 | 153 | 'post_type' => $post_type, |
| 154 | - 'posts_per_page' => - 1, |
|
| 155 | - ) ); |
|
| 154 | + 'posts_per_page' => -1, |
|
| 155 | + )); |
|
| 156 | 156 | |
| 157 | - return apply_filters( 'give_users_completed_donations_list', get_posts( $args ) ); |
|
| 157 | + return apply_filters('give_users_completed_donations_list', get_posts($args)); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | |
@@ -170,12 +170,12 @@ discard block |
||
| 170 | 170 | * |
| 171 | 171 | * @return bool True if has donated, false other wise. |
| 172 | 172 | */ |
| 173 | -function give_has_donations( $user_id = null ) { |
|
| 174 | - if ( empty( $user_id ) ) { |
|
| 173 | +function give_has_donations($user_id = null) { |
|
| 174 | + if (empty($user_id)) { |
|
| 175 | 175 | $user_id = get_current_user_id(); |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - if ( give_get_users_donations( $user_id, 1 ) ) { |
|
| 178 | + if (give_get_users_donations($user_id, 1)) { |
|
| 179 | 179 | return true; // User has at least one donation. |
| 180 | 180 | } |
| 181 | 181 | |
@@ -196,23 +196,23 @@ discard block |
||
| 196 | 196 | * |
| 197 | 197 | * @return array |
| 198 | 198 | */ |
| 199 | -function give_get_donation_stats_by_user( $user = '' ) { |
|
| 199 | +function give_get_donation_stats_by_user($user = '') { |
|
| 200 | 200 | |
| 201 | 201 | $field = ''; |
| 202 | 202 | |
| 203 | - if ( is_email( $user ) ) { |
|
| 203 | + if (is_email($user)) { |
|
| 204 | 204 | $field = 'email'; |
| 205 | - } elseif ( is_numeric( $user ) ) { |
|
| 205 | + } elseif (is_numeric($user)) { |
|
| 206 | 206 | $field = 'user_id'; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - $stats = array(); |
|
| 210 | - $donor = Give()->donors->get_donor_by( $field, $user ); |
|
| 209 | + $stats = array(); |
|
| 210 | + $donor = Give()->donors->get_donor_by($field, $user); |
|
| 211 | 211 | |
| 212 | - if ( $donor ) { |
|
| 213 | - $donor = new Give_Donor( $donor->id ); |
|
| 214 | - $stats['purchases'] = absint( $donor->purchase_count ); |
|
| 215 | - $stats['total_spent'] = give_maybe_sanitize_amount( $donor->get_total_donation_amount() ); |
|
| 212 | + if ($donor) { |
|
| 213 | + $donor = new Give_Donor($donor->id); |
|
| 214 | + $stats['purchases'] = absint($donor->purchase_count); |
|
| 215 | + $stats['total_spent'] = give_maybe_sanitize_amount($donor->get_total_donation_amount()); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | /** |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | * |
| 221 | 221 | * @since 1.7 |
| 222 | 222 | */ |
| 223 | - $stats = (array) apply_filters( 'give_donation_stats_by_user', $stats, $user ); |
|
| 223 | + $stats = (array) apply_filters('give_donation_stats_by_user', $stats, $user); |
|
| 224 | 224 | |
| 225 | 225 | return $stats; |
| 226 | 226 | } |
@@ -238,21 +238,21 @@ discard block |
||
| 238 | 238 | * |
| 239 | 239 | * @return int The total number of donations. |
| 240 | 240 | */ |
| 241 | -function give_count_donations_of_donor( $user = null ) { |
|
| 241 | +function give_count_donations_of_donor($user = null) { |
|
| 242 | 242 | |
| 243 | 243 | // Logged in? |
| 244 | - if ( empty( $user ) ) { |
|
| 244 | + if (empty($user)) { |
|
| 245 | 245 | $user = get_current_user_id(); |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | // Email access? |
| 249 | - if ( empty( $user ) && Give()->email_access->token_email ) { |
|
| 249 | + if (empty($user) && Give()->email_access->token_email) { |
|
| 250 | 250 | $user = Give()->email_access->token_email; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - $stats = ! empty( $user ) ? give_get_donation_stats_by_user( $user ) : false; |
|
| 253 | + $stats = ! empty($user) ? give_get_donation_stats_by_user($user) : false; |
|
| 254 | 254 | |
| 255 | - return isset( $stats['purchases'] ) ? $stats['purchases'] : 0; |
|
| 255 | + return isset($stats['purchases']) ? $stats['purchases'] : 0; |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | /** |
@@ -265,9 +265,9 @@ discard block |
||
| 265 | 265 | * |
| 266 | 266 | * @return float The total amount the user has spent |
| 267 | 267 | */ |
| 268 | -function give_donation_total_of_user( $user = null ) { |
|
| 268 | +function give_donation_total_of_user($user = null) { |
|
| 269 | 269 | |
| 270 | - $stats = give_get_donation_stats_by_user( $user ); |
|
| 270 | + $stats = give_get_donation_stats_by_user($user); |
|
| 271 | 271 | |
| 272 | 272 | return $stats['total_spent']; |
| 273 | 273 | } |
@@ -283,40 +283,40 @@ discard block |
||
| 283 | 283 | * |
| 284 | 284 | * @return bool |
| 285 | 285 | */ |
| 286 | -function give_validate_username( $username, $form_id = 0 ) { |
|
| 286 | +function give_validate_username($username, $form_id = 0) { |
|
| 287 | 287 | $valid = true; |
| 288 | 288 | |
| 289 | 289 | // Validate username. |
| 290 | - if ( ! empty( $username ) ) { |
|
| 290 | + if ( ! empty($username)) { |
|
| 291 | 291 | |
| 292 | 292 | // Sanitize username. |
| 293 | - $sanitized_user_name = sanitize_user( $username, false ); |
|
| 293 | + $sanitized_user_name = sanitize_user($username, false); |
|
| 294 | 294 | |
| 295 | 295 | // We have an user name, check if it already exists. |
| 296 | - if ( username_exists( $username ) ) { |
|
| 296 | + if (username_exists($username)) { |
|
| 297 | 297 | // Username already registered. |
| 298 | - give_set_error( 'username_unavailable', __( 'Username already taken.', 'give' ) ); |
|
| 298 | + give_set_error('username_unavailable', __('Username already taken.', 'give')); |
|
| 299 | 299 | $valid = false; |
| 300 | 300 | |
| 301 | 301 | // Check if it's valid. |
| 302 | - } elseif ( $sanitized_user_name !== $username ) { |
|
| 302 | + } elseif ($sanitized_user_name !== $username) { |
|
| 303 | 303 | // Invalid username. |
| 304 | - if ( is_multisite() ) { |
|
| 305 | - give_set_error( 'username_invalid', __( 'Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give' ) ); |
|
| 304 | + if (is_multisite()) { |
|
| 305 | + give_set_error('username_invalid', __('Invalid username. Only lowercase letters (a-z) and numbers are allowed.', 'give')); |
|
| 306 | 306 | $valid = false; |
| 307 | 307 | } else { |
| 308 | - give_set_error( 'username_invalid', __( 'Invalid username.', 'give' ) ); |
|
| 308 | + give_set_error('username_invalid', __('Invalid username.', 'give')); |
|
| 309 | 309 | $valid = false; |
| 310 | 310 | } |
| 311 | 311 | } |
| 312 | 312 | } else { |
| 313 | 313 | // Username is empty. |
| 314 | - give_set_error( 'username_empty', __( 'Enter a username.', 'give' ) ); |
|
| 314 | + give_set_error('username_empty', __('Enter a username.', 'give')); |
|
| 315 | 315 | $valid = false; |
| 316 | 316 | |
| 317 | 317 | // Check if guest checkout is disable for form. |
| 318 | - if ( $form_id && give_logged_in_only( $form_id ) ) { |
|
| 319 | - give_set_error( 'registration_required', __( 'You must register or login to complete your donation.', 'give' ) ); |
|
| 318 | + if ($form_id && give_logged_in_only($form_id)) { |
|
| 319 | + give_set_error('registration_required', __('You must register or login to complete your donation.', 'give')); |
|
| 320 | 320 | $valid = false; |
| 321 | 321 | } |
| 322 | 322 | } |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | * |
| 331 | 331 | * @since 1.8 |
| 332 | 332 | */ |
| 333 | - $valid = (bool) apply_filters( 'give_validate_username', $valid, $username, $form_id ); |
|
| 333 | + $valid = (bool) apply_filters('give_validate_username', $valid, $username, $form_id); |
|
| 334 | 334 | |
| 335 | 335 | return $valid; |
| 336 | 336 | } |
@@ -346,30 +346,30 @@ discard block |
||
| 346 | 346 | * |
| 347 | 347 | * @return bool |
| 348 | 348 | */ |
| 349 | -function give_validate_user_email( $email, $registering_new_user = false ) { |
|
| 349 | +function give_validate_user_email($email, $registering_new_user = false) { |
|
| 350 | 350 | $valid = true; |
| 351 | 351 | |
| 352 | - if ( empty( $email ) ) { |
|
| 352 | + if (empty($email)) { |
|
| 353 | 353 | // No email. |
| 354 | - give_set_error( 'email_empty', __( 'Enter an email.', 'give' ) ); |
|
| 354 | + give_set_error('email_empty', __('Enter an email.', 'give')); |
|
| 355 | 355 | $valid = false; |
| 356 | 356 | |
| 357 | - } elseif ( email_exists( $email ) ) { |
|
| 357 | + } elseif (email_exists($email)) { |
|
| 358 | 358 | // Email already exists. |
| 359 | - give_set_error( 'email_exists', __( 'Email already exists.', 'give' ) ); |
|
| 359 | + give_set_error('email_exists', __('Email already exists.', 'give')); |
|
| 360 | 360 | $valid = false; |
| 361 | 361 | |
| 362 | - } elseif ( ! is_email( $email ) ) { |
|
| 362 | + } elseif ( ! is_email($email)) { |
|
| 363 | 363 | // Validate email. |
| 364 | - give_set_error( 'email_invalid', __( 'Invalid email.', 'give' ) ); |
|
| 364 | + give_set_error('email_invalid', __('Invalid email.', 'give')); |
|
| 365 | 365 | $valid = false; |
| 366 | 366 | |
| 367 | - } elseif ( $registering_new_user ) { |
|
| 367 | + } elseif ($registering_new_user) { |
|
| 368 | 368 | |
| 369 | 369 | // If donor email is not primary. |
| 370 | - if ( ! email_exists( $email ) && give_donor_email_exists( $email ) && give_is_additional_email( $email ) ) { |
|
| 370 | + if ( ! email_exists($email) && give_donor_email_exists($email) && give_is_additional_email($email)) { |
|
| 371 | 371 | // Check if email exists. |
| 372 | - give_set_error( 'email_used', __( 'The email address provided is already active for another user.', 'give' ) ); |
|
| 372 | + give_set_error('email_used', __('The email address provided is already active for another user.', 'give')); |
|
| 373 | 373 | $valid = false; |
| 374 | 374 | } |
| 375 | 375 | } |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | * |
| 384 | 384 | * @since 1.8 |
| 385 | 385 | */ |
| 386 | - $valid = (bool) apply_filters( 'give_validate_user_email', $valid, $email, $registering_new_user ); |
|
| 386 | + $valid = (bool) apply_filters('give_validate_user_email', $valid, $email, $registering_new_user); |
|
| 387 | 387 | |
| 388 | 388 | return $valid; |
| 389 | 389 | } |
@@ -399,34 +399,34 @@ discard block |
||
| 399 | 399 | * |
| 400 | 400 | * @return bool |
| 401 | 401 | */ |
| 402 | -function give_validate_user_password( $password = '', $confirm_password = '', $registering_new_user = false ) { |
|
| 402 | +function give_validate_user_password($password = '', $confirm_password = '', $registering_new_user = false) { |
|
| 403 | 403 | $valid = true; |
| 404 | 404 | |
| 405 | 405 | // Passwords Validation For New Donors Only. |
| 406 | - if ( $registering_new_user ) { |
|
| 406 | + if ($registering_new_user) { |
|
| 407 | 407 | // Password or confirmation missing. |
| 408 | - if ( ! $password ) { |
|
| 408 | + if ( ! $password) { |
|
| 409 | 409 | // The password is invalid. |
| 410 | - give_set_error( 'password_empty', __( 'Enter a password.', 'give' ) ); |
|
| 410 | + give_set_error('password_empty', __('Enter a password.', 'give')); |
|
| 411 | 411 | $valid = false; |
| 412 | - } elseif ( ! $confirm_password ) { |
|
| 412 | + } elseif ( ! $confirm_password) { |
|
| 413 | 413 | // Confirmation password is invalid. |
| 414 | - give_set_error( 'confirmation_empty', __( 'Enter the password confirmation.', 'give' ) ); |
|
| 414 | + give_set_error('confirmation_empty', __('Enter the password confirmation.', 'give')); |
|
| 415 | 415 | $valid = false; |
| 416 | 416 | } |
| 417 | 417 | } |
| 418 | 418 | // Passwords Validation For New Donors as well as Existing Donors. |
| 419 | - if ( $password || $confirm_password ) { |
|
| 420 | - if ( strlen( $password ) < 6 || strlen( $confirm_password ) < 6 ) { |
|
| 419 | + if ($password || $confirm_password) { |
|
| 420 | + if (strlen($password) < 6 || strlen($confirm_password) < 6) { |
|
| 421 | 421 | // Seems Weak Password. |
| 422 | - give_set_error( 'password_weak', __( 'Passwords should have at least 6 characters.', 'give' ) ); |
|
| 422 | + give_set_error('password_weak', __('Passwords should have at least 6 characters.', 'give')); |
|
| 423 | 423 | $valid = false; |
| 424 | 424 | } |
| 425 | - if ( $password && $confirm_password ) { |
|
| 425 | + if ($password && $confirm_password) { |
|
| 426 | 426 | // Verify confirmation matches. |
| 427 | - if ( $password !== $confirm_password ) { |
|
| 427 | + if ($password !== $confirm_password) { |
|
| 428 | 428 | // Passwords do not match. |
| 429 | - give_set_error( 'password_mismatch', __( 'Passwords you entered do not match. Please try again.', 'give' ) ); |
|
| 429 | + give_set_error('password_mismatch', __('Passwords you entered do not match. Please try again.', 'give')); |
|
| 430 | 430 | $valid = false; |
| 431 | 431 | } |
| 432 | 432 | } |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | * |
| 443 | 443 | * @since 1.8 |
| 444 | 444 | */ |
| 445 | - $valid = (bool) apply_filters( 'give_validate_user_email', $valid, $password, $confirm_password, $registering_new_user ); |
|
| 445 | + $valid = (bool) apply_filters('give_validate_user_email', $valid, $password, $confirm_password, $registering_new_user); |
|
| 446 | 446 | |
| 447 | 447 | return $valid; |
| 448 | 448 | } |
@@ -470,8 +470,8 @@ discard block |
||
| 470 | 470 | * |
| 471 | 471 | * @return array The donor's address, if any |
| 472 | 472 | */ |
| 473 | -function give_get_donor_address( $donor_id = null, $args = array() ) { |
|
| 474 | - if ( empty( $donor_id ) ) { |
|
| 473 | +function give_get_donor_address($donor_id = null, $args = array()) { |
|
| 474 | + if (empty($donor_id)) { |
|
| 475 | 475 | $donor_id = get_current_user_id(); |
| 476 | 476 | } |
| 477 | 477 | |
@@ -493,33 +493,33 @@ discard block |
||
| 493 | 493 | |
| 494 | 494 | |
| 495 | 495 | // Backward compatibility for user id param. |
| 496 | - $by_user_id = get_user_by( 'id', $donor_id ) ? true : false; |
|
| 496 | + $by_user_id = get_user_by('id', $donor_id) ? true : false; |
|
| 497 | 497 | |
| 498 | 498 | // Backward compatibility. |
| 499 | - if ( ! give_has_upgrade_completed( 'v20_upgrades_user_address' ) && $by_user_id ) { |
|
| 499 | + if ( ! give_has_upgrade_completed('v20_upgrades_user_address') && $by_user_id) { |
|
| 500 | 500 | return wp_parse_args( |
| 501 | - (array) get_user_meta( $donor_id, '_give_user_address', true ), |
|
| 501 | + (array) get_user_meta($donor_id, '_give_user_address', true), |
|
| 502 | 502 | $default_address |
| 503 | 503 | ); |
| 504 | 504 | } |
| 505 | 505 | |
| 506 | - $donor = new Give_Donor( $donor_id, $by_user_id ); |
|
| 506 | + $donor = new Give_Donor($donor_id, $by_user_id); |
|
| 507 | 507 | |
| 508 | 508 | if ( |
| 509 | 509 | ! $donor->id || |
| 510 | - empty( $donor->address ) || |
|
| 511 | - ! array_key_exists( $args['address_type'], $donor->address ) |
|
| 510 | + empty($donor->address) || |
|
| 511 | + ! array_key_exists($args['address_type'], $donor->address) |
|
| 512 | 512 | ) { |
| 513 | 513 | return $default_address; |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | - switch ( true ) { |
|
| 517 | - case is_string( end( $donor->address[ $args['address_type'] ] ) ): |
|
| 518 | - $address = wp_parse_args( $donor->address[ $args['address_type'] ], $default_address ); |
|
| 516 | + switch (true) { |
|
| 517 | + case is_string(end($donor->address[$args['address_type']])): |
|
| 518 | + $address = wp_parse_args($donor->address[$args['address_type']], $default_address); |
|
| 519 | 519 | break; |
| 520 | 520 | |
| 521 | - case is_array( end( $donor->address[ $args['address_type'] ] ) ): |
|
| 522 | - $address = wp_parse_args( array_shift( $donor->address[ $args['address_type'] ] ), $default_address ); |
|
| 521 | + case is_array(end($donor->address[$args['address_type']])): |
|
| 522 | + $address = wp_parse_args(array_shift($donor->address[$args['address_type']]), $default_address); |
|
| 523 | 523 | break; |
| 524 | 524 | } |
| 525 | 525 | |
@@ -539,17 +539,17 @@ discard block |
||
| 539 | 539 | * |
| 540 | 540 | * @return void |
| 541 | 541 | */ |
| 542 | -function give_new_user_notification( $user_id = 0, $user_data = array() ) { |
|
| 542 | +function give_new_user_notification($user_id = 0, $user_data = array()) { |
|
| 543 | 543 | // Bailout. |
| 544 | - if ( empty( $user_id ) || empty( $user_data ) ) { |
|
| 544 | + if (empty($user_id) || empty($user_data)) { |
|
| 545 | 545 | return; |
| 546 | 546 | } |
| 547 | 547 | |
| 548 | - do_action( 'give_new-donor-register_email_notification', $user_id, $user_data ); |
|
| 549 | - do_action( 'give_donor-register_email_notification', $user_id, $user_data ); |
|
| 548 | + do_action('give_new-donor-register_email_notification', $user_id, $user_data); |
|
| 549 | + do_action('give_donor-register_email_notification', $user_id, $user_data); |
|
| 550 | 550 | } |
| 551 | 551 | |
| 552 | -add_action( 'give_insert_user', 'give_new_user_notification', 10, 2 ); |
|
| 552 | +add_action('give_insert_user', 'give_new_user_notification', 10, 2); |
|
| 553 | 553 | |
| 554 | 554 | |
| 555 | 555 | /** |
@@ -565,33 +565,33 @@ discard block |
||
| 565 | 565 | * |
| 566 | 566 | * @return string |
| 567 | 567 | */ |
| 568 | -function give_get_donor_name_by( $id = 0, $from = 'donation' ) { |
|
| 568 | +function give_get_donor_name_by($id = 0, $from = 'donation') { |
|
| 569 | 569 | |
| 570 | 570 | // ID shouldn't be empty. |
| 571 | - if ( empty( $id ) ) { |
|
| 571 | + if (empty($id)) { |
|
| 572 | 572 | return ''; |
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | $name = ''; |
| 576 | 576 | |
| 577 | - switch ( $from ) { |
|
| 577 | + switch ($from) { |
|
| 578 | 578 | |
| 579 | 579 | case 'donation': |
| 580 | - $first_name = give_get_meta( $id, '_give_donor_billing_first_name', true ); |
|
| 581 | - $last_name = give_get_meta( $id, '_give_donor_billing_last_name', true ); |
|
| 580 | + $first_name = give_get_meta($id, '_give_donor_billing_first_name', true); |
|
| 581 | + $last_name = give_get_meta($id, '_give_donor_billing_last_name', true); |
|
| 582 | 582 | |
| 583 | - $name = trim( "{$first_name} {$last_name}" ); |
|
| 583 | + $name = trim("{$first_name} {$last_name}"); |
|
| 584 | 584 | |
| 585 | 585 | break; |
| 586 | 586 | |
| 587 | 587 | case 'donor': |
| 588 | - $name = Give()->donors->get_column( 'name', $id ); |
|
| 588 | + $name = Give()->donors->get_column('name', $id); |
|
| 589 | 589 | |
| 590 | 590 | break; |
| 591 | 591 | |
| 592 | 592 | } |
| 593 | 593 | |
| 594 | - return trim( $name ); |
|
| 594 | + return trim($name); |
|
| 595 | 595 | |
| 596 | 596 | } |
| 597 | 597 | |
@@ -604,8 +604,8 @@ discard block |
||
| 604 | 604 | * |
| 605 | 605 | * @return boolean The user's ID on success, and false on failure. |
| 606 | 606 | */ |
| 607 | -function give_donor_email_exists( $email ) { |
|
| 608 | - if ( Give()->donors->get_donor_by( 'email', $email ) ) { |
|
| 607 | +function give_donor_email_exists($email) { |
|
| 608 | + if (Give()->donors->get_donor_by('email', $email)) { |
|
| 609 | 609 | return true; |
| 610 | 610 | } |
| 611 | 611 | return false; |
@@ -620,14 +620,14 @@ discard block |
||
| 620 | 620 | * |
| 621 | 621 | * @return bool |
| 622 | 622 | */ |
| 623 | -function give_is_additional_email( $email ) { |
|
| 623 | +function give_is_additional_email($email) { |
|
| 624 | 624 | global $wpdb; |
| 625 | 625 | |
| 626 | 626 | $meta_table = Give()->donor_meta->table_name; |
| 627 | 627 | $meta_type = Give()->donor_meta->meta_type; |
| 628 | - $donor_id = $wpdb->get_var( $wpdb->prepare( "SELECT {$meta_type}_id FROM {$meta_table} WHERE meta_key = 'additional_email' AND meta_value = %s LIMIT 1", $email ) ); |
|
| 628 | + $donor_id = $wpdb->get_var($wpdb->prepare("SELECT {$meta_type}_id FROM {$meta_table} WHERE meta_key = 'additional_email' AND meta_value = %s LIMIT 1", $email)); |
|
| 629 | 629 | |
| 630 | - if ( empty( $donor_id ) ) { |
|
| 630 | + if (empty($donor_id)) { |
|
| 631 | 631 | return false; |
| 632 | 632 | } |
| 633 | 633 | |
@@ -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 | |
@@ -21,14 +21,14 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @param $data |
| 23 | 23 | */ |
| 24 | -function give_process_gateway_select( $data ) { |
|
| 25 | - if ( isset( $_POST['gateway_submit'] ) ) { |
|
| 26 | - wp_redirect( esc_url( add_query_arg( 'payment-mode', $_POST['payment-mode'] ) ) ); |
|
| 24 | +function give_process_gateway_select($data) { |
|
| 25 | + if (isset($_POST['gateway_submit'])) { |
|
| 26 | + wp_redirect(esc_url(add_query_arg('payment-mode', $_POST['payment-mode']))); |
|
| 27 | 27 | exit; |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | -add_action( 'give_gateway_select', 'give_process_gateway_select' ); |
|
| 31 | +add_action('give_gateway_select', 'give_process_gateway_select'); |
|
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Loads a payment gateway via AJAX. |
@@ -39,11 +39,11 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | function give_load_ajax_gateway() { |
| 41 | 41 | |
| 42 | - $post_data = give_clean( $_POST ); // WPCS: input var ok, CSRF ok. |
|
| 42 | + $post_data = give_clean($_POST); // WPCS: input var ok, CSRF ok. |
|
| 43 | 43 | |
| 44 | - if ( isset( $post_data['give_payment_mode'] ) ) { |
|
| 44 | + if (isset($post_data['give_payment_mode'])) { |
|
| 45 | 45 | |
| 46 | - $form_id_prefix = ! empty( $post_data['give_form_id_prefix'] ) ? $post_data['give_form_id_prefix'] : ''; |
|
| 46 | + $form_id_prefix = ! empty($post_data['give_form_id_prefix']) ? $post_data['give_form_id_prefix'] : ''; |
|
| 47 | 47 | |
| 48 | 48 | $args = array( |
| 49 | 49 | 'id_prefix' => $form_id_prefix, |
@@ -54,14 +54,14 @@ discard block |
||
| 54 | 54 | * |
| 55 | 55 | * @since 1.7 |
| 56 | 56 | */ |
| 57 | - do_action( 'give_donation_form', $post_data['give_form_id'], $args ); |
|
| 57 | + do_action('give_donation_form', $post_data['give_form_id'], $args); |
|
| 58 | 58 | |
| 59 | 59 | exit(); |
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | -add_action( 'wp_ajax_give_load_gateway', 'give_load_ajax_gateway' ); |
|
| 64 | -add_action( 'wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway' ); |
|
| 63 | +add_action('wp_ajax_give_load_gateway', 'give_load_ajax_gateway'); |
|
| 64 | +add_action('wp_ajax_nopriv_give_load_gateway', 'give_load_ajax_gateway'); |
|
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * Create wp nonce using Ajax call. |
@@ -73,18 +73,18 @@ discard block |
||
| 73 | 73 | * @return void |
| 74 | 74 | */ |
| 75 | 75 | function give_donation_form_nonce() { |
| 76 | - if ( isset( $_POST['give_form_id'] ) ) { |
|
| 76 | + if (isset($_POST['give_form_id'])) { |
|
| 77 | 77 | |
| 78 | 78 | // Get donation form id. |
| 79 | - $form_id = is_numeric( $_POST['give_form_id'] ) ? absint( $_POST['give_form_id'] ) : 0; |
|
| 79 | + $form_id = is_numeric($_POST['give_form_id']) ? absint($_POST['give_form_id']) : 0; |
|
| 80 | 80 | |
| 81 | 81 | // Send nonce json data. |
| 82 | - wp_send_json_success( wp_create_nonce( "give_donation_form_nonce_{$form_id}" ) ); |
|
| 82 | + wp_send_json_success(wp_create_nonce("give_donation_form_nonce_{$form_id}")); |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | -add_action( 'wp_ajax_give_donation_form_nonce', 'give_donation_form_nonce' ); |
|
| 87 | -add_action( 'wp_ajax_nopriv_give_donation_form_nonce', 'give_donation_form_nonce' ); |
|
| 86 | +add_action('wp_ajax_give_donation_form_nonce', 'give_donation_form_nonce'); |
|
| 87 | +add_action('wp_ajax_nopriv_give_donation_form_nonce', 'give_donation_form_nonce'); |
|
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | 90 | * Sets an error within the donation form if no gateways are enabled. |
@@ -97,11 +97,11 @@ discard block |
||
| 97 | 97 | function give_no_gateway_error() { |
| 98 | 98 | $gateways = give_get_enabled_payment_gateways(); |
| 99 | 99 | |
| 100 | - if ( empty( $gateways ) ) { |
|
| 101 | - give_set_error( 'no_gateways', esc_html__( 'You must enable a payment gateway to use Give.', 'give' ) ); |
|
| 100 | + if (empty($gateways)) { |
|
| 101 | + give_set_error('no_gateways', esc_html__('You must enable a payment gateway to use Give.', 'give')); |
|
| 102 | 102 | } else { |
| 103 | - give_unset_error( 'no_gateways' ); |
|
| 103 | + give_unset_error('no_gateways'); |
|
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | -add_action( 'init', 'give_no_gateway_error' ); |
|
| 107 | +add_action('init', 'give_no_gateway_error'); |
|
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | // Exit if accessed directly. |
| 13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 13 | +if ( ! defined('ABSPATH')) { |
|
| 14 | 14 | exit; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | /* @var WPDB $wpdb */ |
| 54 | 54 | global $wpdb; |
| 55 | 55 | |
| 56 | - $wpdb->donormeta = $this->table_name = $wpdb->prefix . 'give_donormeta'; |
|
| 56 | + $wpdb->donormeta = $this->table_name = $wpdb->prefix.'give_donormeta'; |
|
| 57 | 57 | $this->primary_key = 'meta_id'; |
| 58 | 58 | $this->version = '1.0'; |
| 59 | 59 | |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | global $wpdb; |
| 93 | 93 | |
| 94 | 94 | if ( |
| 95 | - ! give_has_upgrade_completed( 'v20_rename_donor_tables' ) && |
|
| 96 | - $wpdb->query( $wpdb->prepare( "SHOW TABLES LIKE %s","{$wpdb->prefix}give_customermeta" ) ) |
|
| 95 | + ! give_has_upgrade_completed('v20_rename_donor_tables') && |
|
| 96 | + $wpdb->query($wpdb->prepare("SHOW TABLES LIKE %s", "{$wpdb->prefix}give_customermeta")) |
|
| 97 | 97 | ) { |
| 98 | 98 | $wpdb->donormeta = $this->table_name = "{$wpdb->prefix}give_customermeta"; |
| 99 | 99 | $this->meta_type = 'customer'; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | * |
| 113 | 113 | * @return bool |
| 114 | 114 | */ |
| 115 | - protected function is_valid_post_type( $ID ) { |
|
| 115 | + protected function is_valid_post_type($ID) { |
|
| 116 | 116 | return $ID && true; |
| 117 | 117 | } |
| 118 | 118 | |