| 1 |
<?php |
| 2 |
/** |
| 3 |
* The [give_register] Shortcode Generator class |
| 4 |
* |
| 5 |
* @package Give |
| 6 |
* @subpackage Admin |
| 7 |
* @copyright Copyright (c) 2016, GiveWP |
| 8 |
* @license https://opensource.org/licenses/gpl-license GNU Public License |
| 9 |
* @since 1.3.0 |
| 10 |
*/ |
| 11 |
|
| 12 |
// Exit if accessed directly. |
| 13 |
if ( ! defined( 'ABSPATH' ) ) { |
| 14 |
exit; |
| 15 |
} |
| 16 |
|
| 17 |
class Give_Shortcode_Register extends Give_Shortcode_Generator { |
| 18 |
|
| 19 |
/** |
| 20 |
* Class constructor |
| 21 |
*/ |
| 22 |
public function __construct() { |
| 23 |
|
| 24 |
$this->shortcode['title'] = esc_html__( 'Register', 'give' ); |
| 25 |
$this->shortcode['label'] = esc_html__( 'Register', 'give' ); |
| 26 |
|
| 27 |
parent::__construct( 'give_register' ); |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Define the shortcode attribute fields |
| 32 |
* |
| 33 |
* @return array |
| 34 |
*/ |
| 35 |
public function define_fields() { |
| 36 |
|
| 37 |
return array( |
| 38 |
array( |
| 39 |
'type' => 'container', |
| 40 |
'html' => sprintf( '<p class="no-margin">%s</p>', esc_html__( 'Redirect URL (optional):', 'give' ) ), |
| 41 |
), |
| 42 |
array( |
| 43 |
'type' => 'textbox', |
| 44 |
'name' => 'redirect', |
| 45 |
'minWidth' => 320, |
| 46 |
'tooltip' => esc_attr__( 'Enter an URL here to redirect to after registering.', 'give' ), |
| 47 |
), |
| 48 |
array( |
| 49 |
'type' => 'docs_link', |
| 50 |
'text' => esc_html__( 'Learn more about the Register Shortcode', 'give' ), |
| 51 |
'link' => 'http://docs.givewp.com/shortcode-give-register', |
| 52 |
), |
| 53 |
); |
| 54 |
} |
| 55 |
} |
| 56 |
|
| 57 |
/** |
| 58 |
* @since 4.3.0 use init action |
| 59 |
*/ |
| 60 |
add_action( 'init', static function () { |
| 61 |
new Give_Shortcode_Register(); |
| 62 |
}); |
| 63 |
|