PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
give / includes / admin / shortcodes / shortcode-give-form.php

shortcode-give-form.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at includes/admin/shortcodes/shortcode-give-form.php

134 lines 4.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The [give_form] 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 /**
18 * Class Give_Shortcode_Donation_Form
19 */
20 class Give_Shortcode_Donation_Form extends Give_Shortcode_Generator {
21
22 /**
23 * Class constructor
24 */
25 public function __construct() {
26
27 $this->shortcode['title'] = esc_html__( 'Donation Form', 'give' );
28 $this->shortcode['label'] = esc_html__( 'Donation Form', 'give' );
29
30 parent::__construct( 'give_form' );
31 }
32
33 /**
34 * Define the shortcode attribute fields
35 *
36 * @since 4.0.0 Replace "new form" with "new campaign form" link
37 *
38 * @return array
39 */
40 public function define_fields() {
41
42 $create_form_link = sprintf(
43 /* translators: %s: create new form URL */
44 __('<a href="%s">Create</a> a new Campaign Form.', 'give'),
45 admin_url('edit.php?post_type=give_forms&page=give-campaigns&new=campaign')
46 );
47
48 return array(
49 array(
50 'type' => 'post',
51 'query_args' => array(
52 'post_type' => 'give_forms',
53 ),
54 'name' => 'id',
55 'tooltip' => esc_attr__( 'Select a Donation Form', 'give' ),
56 'placeholder' => '- ' . esc_attr__('Select a Campaign Form', 'give') . ' -',
57 'required' => array(
58 'alert' => esc_html__('You must first select a Campaign Form!', 'give'),
59 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>',
60 esc_html__('No campaign forms found.', 'give'), $create_form_link),
61 ),
62 ),
63 array(
64 'type' => 'container',
65 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html__( 'Optional settings', 'give' ) ),
66 ),
67 array(
68 'type' => 'listbox',
69 'name' => 'show_title',
70 'label' => esc_attr__( 'Show Title', 'give' ),
71 'tooltip' => esc_attr__( 'Do you want to display the form title?', 'give' ),
72 'options' => array(
73 'true' => esc_html__( 'Show', 'give' ),
74 'false' => esc_html__( 'Hide', 'give' ),
75 ),
76 ),
77 array(
78 'type' => 'listbox',
79 'name' => 'show_goal',
80 'label' => esc_attr__( 'Show Goal', 'give' ),
81 'tooltip' => esc_attr__( 'Do you want to display the donation goal?', 'give' ),
82 'options' => array(
83 'true' => esc_html__( 'Show', 'give' ),
84 'false' => esc_html__( 'Hide', 'give' ),
85 ),
86 ),
87 array(
88 'type' => 'listbox',
89 'name' => 'show_content',
90 'minWidth' => 240,
91 'label' => esc_attr__( 'Display Content', 'give' ),
92 'tooltip' => esc_attr__( 'Do you want to display the form content?', 'give' ),
93 'options' => array(
94 'none' => esc_html__( 'No Content', 'give' ),
95 'above' => esc_html__( 'Display content ABOVE the fields', 'give' ),
96 'below' => esc_html__( 'Display content BELOW the fields', 'give' ),
97 ),
98 ),
99 array(
100 'type' => 'listbox',
101 'name' => 'display_style',
102 'classes' => 'give-display-style',
103 'label' => esc_attr__( 'Display Options', 'give' ),
104 'tooltip' => esc_attr__( 'How would you like to display donation information?', 'give' ),
105 'options' => array(
106 'onpage' => esc_html__( 'All Fields', 'give' ),
107 'modal' => esc_html__( 'Modal', 'give' ),
108 'reveal' => esc_html__( 'Reveal', 'give' ),
109 'button' => esc_html__( 'Button', 'give' ),
110 ),
111 ),
112 array(
113 'type' => 'textbox',
114 'classes' => 'give-hidden give-continue-button-title',
115 'name' => 'continue_button_title',
116 'label' => esc_attr__( 'Button Text', 'give' ),
117 'tooltip' => esc_attr__( 'The button label for displaying the additional payment fields.', 'give' ),
118 ),
119 array(
120 'type' => 'docs_link',
121 'text' => esc_html__( 'Learn more about the Donation Form Shortcode', 'give' ),
122 'link' => 'http://docs.givewp.com/shortcode-give-forms',
123 ),
124 );
125 }
126 }
127
128 /**
129 * @since 4.3.0 use init action
130 */
131 add_action( 'init', static function () {
132 new Give_Shortcode_Donation_Form();
133 });
134