PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.3.4
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.3.4
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 1.7.0.9 1.8.0 All 210 releases
charitable / includes / shortcodes / class-charitable-login-shortcode.php

class-charitable-login-shortcode.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.3.4, at includes/shortcodes/class-charitable-login-shortcode.php

74 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Login shortcode class.
4 *
5 * @version 1.0.0
6 * @package Charitable/Shortcodes/Login
7 * @category Class
8 * @author Eric Daams
9 */
10
11 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
12
13 if ( ! class_exists( 'Charitable_Login_Shortcode' ) ) :
14
15 /**
16 * Charitable_Login_Shortcode class.
17 *
18 * @since 1.0.0
19 */
20 class Charitable_Login_Shortcode {
21
22 /**
23 * The callback method for the campaigns shortcode.
24 *
25 * This receives the user-defined attributes and passes the logic off to the class.
26 *
27 * @param array $atts User-defined shortcode attributes.
28 * @return string
29 * @access public
30 * @static
31 * @since 1.0.0
32 */
33 public static function display( $atts = array() ) {
34 global $wp;
35
36 $defaults = array(
37 'logged_in_message' => __( 'You are already logged in!', 'charitable' )
38 );
39
40 $args = shortcode_atts( $defaults, $atts, 'charitable_login' );
41
42 ob_start();
43
44 if ( is_user_logged_in() ) {
45
46 charitable_template( 'shortcodes/logged-in.php', $args );
47
48 return ob_get_clean();
49 }
50
51 $args[ 'login_form_args' ] = self::get_login_form_args( $args );
52
53 charitable_template( 'shortcodes/login.php', $args );
54
55 return apply_filters( 'charitable_login_shortcode', ob_get_clean() );
56 }
57
58 /**
59 * Return donations to display with the shortcode.
60 *
61 * @param array $args
62 * @return mixed[] $args
63 * @access protected
64 * @static
65 * @since 1.0.0
66 */
67 protected static function get_login_form_args( $args ) {
68 return apply_filters( 'charitable_login_form_args', array(
69 'redirect' => esc_url( charitable_get_login_redirect_url() )
70 ), $args );
71 }
72 }
73
74 endif;