PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13.1 1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 All 212 releases
← All changes | includes/shortcodes/class-charitable-login-shortcode.php +44 -17 1.6.7 → 1.8.13 View file →
@@ -2,17 +2,19 @@
2 2 /**
3 3 * Login shortcode class.
4 4 *
5 5 * @package Charitable/Shortcodes/Login
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.0.0
10 - * @version 1.5.7
10 + * @version 1.6.51
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_Login_Shortcode' ) ) :
17 19
18 20 /**
@@ -17,9 +19,9 @@
17 19
18 20 /**
19 21 * Charitable_Login_Shortcode class.
20 22 *
21 - * @since 1.0.0
23 + * @since 1.0.0
22 24 */
23 25 class Charitable_Login_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.0.0
32 + * @since 1.0.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 = array() ) {
36 38 $defaults = array(
37 39 'logged_in_message' => __( 'You are already logged in!', 'charitable' ),
@@ -55,9 +57,13 @@
55 57
56 58 if ( charitable_get_permalink( 'login_page' ) === $registration_link ) {
57 59 $args['registration_link'] = false;
58 60 } else {
59 - $args['registration_link'] = add_query_arg( 'redirect_to', $args['redirect'], $registration_link );
61 + $args['registration_link'] = add_query_arg(
62 + 'redirect_to',
63 + urlencode( urldecode( $args['redirect'] ) ),
64 + $registration_link
65 + );
60 66 }
61 67 }
62 68
63 69 ob_start();
@@ -63,19 +69,28 @@
63 69 ob_start();
64 70
65 71 charitable_template( 'shortcodes/login.php', $args );
66 72
73 + /**
74 + * Filter the default output of the login shortcode.
75 + *
76 + * @since 1.0.0
77 + *
78 + * @param string $content The default login shortcode output.
79 + */
67 80 return apply_filters( 'charitable_login_shortcode', ob_get_clean() );
68 -
69 81 }
70 82
71 83 /**
72 84 * Fingerprint the login form with our charitable=true hidden field.
73 85 *
74 - * @since 1.4.0
86 + * @see wp_login_form
75 87 *
76 - * @param string $content
77 - * @return string
88 + * @since 1.4.0
89 + *
90 + * @param string $content The default output.
91 + * @param array $args Arguments passed to wp_login_form.
92 + * @return string
78 93 */
79 94 public static function add_hidden_field_to_login_form( $content, $args ) {
80 95 if ( isset( $args['charitable'] ) && $args['charitable'] ) {
81 96 $content .= '<input type="hidden" name="charitable" value="1" />';
@@ -86,12 +101,14 @@
86 101
87 102 /**
88 103 * Return donations to display with the shortcode.
89 104 *
90 - * @since 1.0.0
105 + * @see wp_login_form
91 106 *
92 - * @param array $args
93 - * @return mixed[] $args
107 + * @since 1.0.0
108 + *
109 + * @param array $args Arguments to pass to wp_login_form.
110 + * @return mixed[] $args
94 111 */
95 112 protected static function get_login_form_args( $args ) {
96 113 $default = array(
97 114 'redirect' => $args['redirect'],
@@ -97,12 +114,22 @@
97 114 'redirect' => $args['redirect'],
98 115 'charitable' => true,
99 116 );
100 117
118 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Display only, no action
101 119 if ( isset( $_GET['username'] ) ) {
102 - $default['value_username'] = $_GET['username'];
120 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Display only, no action
121 + $default['value_username'] = str_replace( ' ', '+', sanitize_text_field( wp_unslash( $_GET['username'] ) ) );
103 122 }
104 123
124 + /**
125 + * Filter the arguments to pass to wp_login_form().
126 + *
127 + * @since 1.0.0
128 + *
129 + * @param array $default The default arguments.
130 + * @param array $args Passed in arguments.
131 + */
105 132 return apply_filters( 'charitable_login_form_args', $default, $args );
106 133 }
107 134 }
108 135