| 1 |
<?php |
| 2 |
/** |
| 3 |
* Registration shortcode class. |
| 4 |
* |
| 5 |
* @version 1.0.0 |
| 6 |
* @package Charitable/Shortcodes/Registration |
| 7 |
* @category Class |
| 8 |
* @author Eric Daams |
| 9 |
*/ |
| 10 |
|
| 11 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
| 12 |
|
| 13 |
if ( ! class_exists( 'Charitable_Registration_Shortcode' ) ) : |
| 14 |
|
| 15 |
/** |
| 16 |
* Charitable_Registration_Shortcode class. |
| 17 |
* |
| 18 |
* @since 1.0.0 |
| 19 |
*/ |
| 20 |
class Charitable_Registration_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 ) { |
| 34 |
$defaults = array( |
| 35 |
'logged_in_message' => __( 'You are already logged in!', 'charitable' ) |
| 36 |
); |
| 37 |
|
| 38 |
$args = shortcode_atts( $defaults, $atts, 'charitable_registration' ); |
| 39 |
|
| 40 |
ob_start(); |
| 41 |
|
| 42 |
if ( is_user_logged_in() ) { |
| 43 |
|
| 44 |
charitable_template( 'shortcodes/logged-in.php', $args ); |
| 45 |
|
| 46 |
return ob_get_clean(); |
| 47 |
} |
| 48 |
|
| 49 |
charitable_template( 'shortcodes/registration.php', array( |
| 50 |
'form' => new Charitable_Registration_Form( $args ) |
| 51 |
) ); |
| 52 |
|
| 53 |
return apply_filters( 'charitable_registration_shortcode', ob_get_clean() ); |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
endif; |