← All changes
|
includes/shortcodes/class-charitable-my-donations-shortcode.php
+23
-14
1.6.6
→
1.8.13
View file →
| @@ -2,17 +2,19 @@ | ||
| 2 | 2 | /** |
| 3 | 3 | * My Donations shortcode class. |
| 4 | 4 | * |
| 5 | 5 | * @package Charitable/Shortcodes/My Donations |
| 6 | - * @author Eric Daams | |
| 7 | - * @copyright Copyright (c) 2018, Studio 164a | |
| 6 | + * @author David Bisset | |
| 7 | + * @copyright Copyright (c) 2023, WP Charitable LLC | |
| 8 | 8 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 | 9 | * @since 1.4.0 |
| 10 | - * @version 1.5.7 | |
| 10 | + * @version 1.6.45 | |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | // Exit if accessed directly. |
| 14 | -if ( ! defined( 'ABSPATH' ) ) { exit; } | |
| 14 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 15 | + exit; | |
| 16 | +} | |
| 15 | 17 | |
| 16 | 18 | if ( ! class_exists( 'Charitable_My_Donations_Shortcode' ) ) : |
| 17 | 19 | |
| 18 | 20 | /** |
| @@ -17,9 +19,9 @@ | ||
| 17 | 19 | |
| 18 | 20 | /** |
| 19 | 21 | * Charitable_My_Donations_Shortcode class. |
| 20 | 22 | * |
| 21 | - * @since 1.4.0 | |
| 23 | + * @since 1.4.0 | |
| 22 | 24 | */ |
| 23 | 25 | class Charitable_My_Donations_Shortcode { |
| 24 | 26 | |
| 25 | 27 | /** |
| @@ -26,12 +28,12 @@ | ||
| 26 | 28 | * The callback method for the campaigns shortcode. |
| 27 | 29 | * |
| 28 | 30 | * This receives the user-defined attributes and passes the logic off to the class. |
| 29 | 31 | * |
| 30 | - * @since 1.4.0 | |
| 32 | + * @since 1.4.0 | |
| 31 | 33 | * |
| 32 | - * @param array $atts User-defined shortcode attributes. | |
| 33 | - * @return string | |
| 34 | + * @param array $atts User-defined shortcode attributes. | |
| 35 | + * @return string | |
| 34 | 36 | */ |
| 35 | 37 | public static function display( $atts ) { |
| 36 | 38 | $defaults = array( |
| 37 | 39 | 'hide_login' => false, |
| @@ -43,12 +45,12 @@ | ||
| 43 | 45 | |
| 44 | 46 | /* If the user is logged out, show the login form. */ |
| 45 | 47 | if ( ! is_user_logged_in() ) { |
| 46 | 48 | |
| 47 | - if ( false == $args['hide_login'] ) { | |
| 49 | + if ( false === $args['hide_login'] ) { | |
| 48 | 50 | $args['redirect'] = charitable_get_current_url(); |
| 49 | 51 | |
| 50 | - echo Charitable_Login_Shortcode::display( $args ); | |
| 52 | + echo Charitable_Login_Shortcode::display( $args ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 51 | 53 | } |
| 52 | 54 | |
| 53 | 55 | return ob_get_clean(); |
| 54 | 56 | } |
| @@ -53,9 +55,9 @@ | ||
| 53 | 55 | return ob_get_clean(); |
| 54 | 56 | } |
| 55 | 57 | |
| 56 | 58 | /* If the user is logged in, show the my donations template. */ |
| 57 | - $user = charitable_get_user( get_current_user_id() ); | |
| 59 | + $user = charitable_get_user( get_current_user_id(), true ); | |
| 58 | 60 | $donor_id = $user->get_donor_id(); |
| 59 | 61 | |
| 60 | 62 | if ( false === $donor_id ) { |
| 61 | 63 | $donations = array(); |
| @@ -71,14 +73,21 @@ | ||
| 71 | 73 | |
| 72 | 74 | if ( ! $user->is_verified() ) { |
| 73 | 75 | $query_args['user_id'] = $user->ID; |
| 74 | 76 | |
| 75 | - if ( array_key_exists( 'charitable_action', $_GET ) && 'verify_email' == $_GET['charitable_action'] ) { | |
| 76 | - $message = __( 'We have sent you an email to confirm your email address.', 'charitable' ); | |
| 77 | + if ( array_key_exists( 'charitable_action', $_GET ) && 'verify_email' === $_GET['charitable_action'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 78 | + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Display/routing parameter | |
| 79 | + $redirect = array_key_exists( 'redirect_url', $_GET ) ? esc_url_raw( wp_unslash( $_GET['redirect_url'] ) ) : false; | |
| 80 | + $message = sprintf( | |
| 81 | + /* translators: %s: email verification link */ | |
| 82 | + __( 'We have sent you an email to confirm your email address. Haven\'t received the email? <a href="%s">Click here to send it again.</a>', 'charitable' ), | |
| 83 | + esc_url_raw( charitable_get_email_verification_link( $user, $redirect, true ) ) | |
| 84 | + ); | |
| 77 | 85 | } else { |
| 78 | 86 | $message = sprintf( |
| 87 | + /* translators: %s: email verification link */ | |
| 79 | 88 | __( '<a href="%s">Confirm your email address</a> to access your full donation history.', 'charitable' ), |
| 80 | - esc_url( charitable_get_email_verification_link( $user, charitable_get_current_url() ) ) | |
| 89 | + esc_url( charitable_get_email_verification_link( $user, charitable_get_current_url(), true ) ) | |
| 81 | 90 | ); |
| 82 | 91 | } |
| 83 | 92 | |
| 84 | 93 | charitable_get_notices()->add_error( $message ); |