PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3
Jetpack – WP Security, Backup, Speed, & Growth v16.3
16.3 16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 All 508 releases
jetpack / jetpack_vendor / automattic / jetpack-paypal-payments / src / widget / simple-payments / form.php

form.php in Jetpack – WP Security, Backup, Speed, & Growth 16.3, at jetpack_vendor/automattic/jetpack-paypal-payments/src/widget/simple-payments/form.php

239 lines 9.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Display the Pay with PayPal Form.
4 *
5 * @html-template Automattic\Jetpack\Paypal_Payments\Widgets\Simple_Payments_Widget::form
6 * @package automattic/jetpack
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit( 0 );
11 }
12
13 // phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable -- HTML template, let Phan handle it.
14
15 ?>
16 <p>
17 <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
18 <?php esc_html_e( 'Widget Title', 'jetpack-paypal-payments' ); ?>
19 </label>
20 <input
21 type="text"
22 class="widefat jetpack-simple-payments-widget-title"
23 id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
24 name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
25 value="<?php echo esc_attr( $instance['title'] ); ?>" />
26 </p>
27 <p class="jetpack-simple-payments-products-fieldset"
28 <?php
29 if ( empty( $product_posts ) ) {
30 echo 'style="display:none;"';
31 }
32 ?>
33 >
34 <label for="<?php echo esc_attr( $this->get_field_id( 'product_post_id' ) ); ?>">
35 <?php esc_html_e( 'Select a Pay with PayPal button:', 'jetpack-paypal-payments' ); ?>
36 </label>
37 <select
38 class="widefat jetpack-simple-payments-products"
39 id="<?php echo esc_attr( $this->get_field_id( 'product_post_id' ) ); ?>"
40 name="<?php echo esc_attr( $this->get_field_name( 'product_post_id' ) ); ?>">
41 <?php foreach ( $product_posts as $product_post ) { ?>
42 <option value="<?php echo (int) $product_post->ID; ?>" <?php selected( (int) $instance['product_post_id'], $product_post->ID ); ?>>
43 <?php echo esc_attr( get_the_title( $product_post ) ); ?>
44 </option>
45 <?php } ?>
46 </select>
47 </p>
48 <?php if ( is_customize_preview() ) { ?>
49 <p class="jetpack-simple-payments-products-warning"
50 <?php
51 if ( ! empty( $product_posts ) ) {
52 echo 'style="display:none;"';
53 }
54 ?>
55 >
56 <?php esc_html_e( "Looks like you don't have any products. You can create one using the Add New button below.", 'jetpack-paypal-payments' ); ?>
57 </p>
58 <p>
59 <div class="alignleft">
60 <button class="button jetpack-simple-payments-edit-product" <?php disabled( empty( $product_posts ), true ); ?>>
61 <?php esc_html_e( 'Edit Selected', 'jetpack-paypal-payments' ); ?>
62 </button>
63 </div>
64 <div class="alignright">
65 <button class="button jetpack-simple-payments-add-product"><?php esc_html_e( 'Add New', 'jetpack-paypal-payments' ); ?></button>
66 </div>
67 <br class="clear">
68 </p>
69 <hr />
70 <div class="jetpack-simple-payments-form" style="display: none;">
71 <input
72 type="hidden"
73 id="<?php echo esc_attr( $this->get_field_id( 'form_action' ) ); ?>"
74 name="<?php echo esc_attr( $this->get_field_name( 'form_action' ) ); ?>"
75 value="<?php echo esc_attr( $instance['form_action'] ); ?>"
76 class="jetpack-simple-payments-form-action" />
77 <input
78 type="hidden"
79 id="<?php echo esc_attr( $this->get_field_id( 'form_product_id' ) ); ?>"
80 name="<?php echo esc_attr( $this->get_field_name( 'form_product_id' ) ); ?>"
81 value="<?php echo esc_attr( $instance['form_product_id'] ); ?>"
82 class="jetpack-simple-payments-form-product-id" />
83 <input
84 type="hidden"
85 id="<?php echo esc_attr( $this->get_field_id( 'form_product_image_id' ) ); ?>"
86 name="<?php echo esc_attr( $this->get_field_name( 'form_product_image_id' ) ); ?>"
87 value="<?php echo esc_attr( $instance['form_product_image_id'] ); ?>"
88 class="jetpack-simple-payments-form-image-id" />
89 <input
90 type="hidden"
91 id="<?php echo esc_attr( $this->get_field_id( 'form_product_image_src' ) ); ?>"
92 name="<?php echo esc_attr( $this->get_field_name( 'form_product_image_src' ) ); ?>"
93 value="<?php echo esc_attr( $instance['form_product_image_src'] ); ?>"
94 class="jetpack-simple-payments-form-image-src" />
95 <p>
96 <label for="<?php echo esc_attr( $this->get_field_id( 'form_product_title' ) ); ?>">
97 <?php esc_html_e( 'What is this payment for?', 'jetpack-paypal-payments' ); ?>
98 </label>
99 <input
100 type="text"
101 class="widefat field-title jetpack-simple-payments-form-product-title"
102 id="<?php echo esc_attr( $this->get_field_id( 'form_product_title' ) ); ?>"
103 name="<?php echo esc_attr( $this->get_field_name( 'form_product_title' ) ); ?>"
104 value="<?php echo esc_attr( $instance['form_product_title'] ); ?>" />
105 <br />
106 <small>
107 <?php esc_html_e( 'For example: event tickets, charitable donations, training courses, coaching fees, etc.', 'jetpack-paypal-payments' ); ?>
108 </small>
109 </p>
110 <div class="jetpack-simple-payments-image-fieldset">
111 <label><?php esc_html_e( 'Product image', 'jetpack-paypal-payments' ); ?></label>
112 <div class="placeholder"
113 <?php
114 if ( ! empty( $instance['form_product_image_id'] ) ) {
115 echo 'style="display:none;"';
116 }
117 ?>
118 >
119 <?php esc_html_e( 'Select an image', 'jetpack-paypal-payments' ); ?>
120 </div>
121 <div class="jetpack-simple-payments-image"
122 <?php
123 if ( empty( $instance['form_product_image_id'] ) ) {
124 echo 'style="display:none;"';
125 }
126 ?>
127 >
128 <img src="<?php echo esc_url( $instance['form_product_image_src'] ); ?>" />
129 <button class="button jetpack-simple-payments-remove-image"><?php esc_html_e( 'Remove image', 'jetpack-paypal-payments' ); ?></button>
130 </div>
131 </div>
132 <p>
133 <label for="<?php echo esc_attr( $this->get_field_id( 'form_product_description' ) ); ?>">
134 <?php esc_html_e( 'Description', 'jetpack-paypal-payments' ); ?>
135 </label>
136 <textarea
137 class="field-description widefat jetpack-simple-payments-form-product-description"
138 rows=5
139 id="<?php echo esc_attr( $this->get_field_id( 'form_product_description' ) ); ?>"
140 name="<?php echo esc_attr( $this->get_field_name( 'form_product_description' ) ); ?>"><?php echo esc_textarea( $instance['form_product_description'] ); ?></textarea>
141 </p>
142 <p class="cost">
143 <label for="<?php echo esc_attr( $this->get_field_id( 'form_product_price' ) ); ?>">
144 <?php esc_html_e( 'Price', 'jetpack-paypal-payments' ); ?>
145 </label>
146 <select
147 class="field-currency widefat jetpack-simple-payments-form-product-currency"
148 id="<?php echo esc_attr( $this->get_field_id( 'form_product_currency' ) ); ?>"
149 name="<?php echo esc_attr( $this->get_field_name( 'form_product_currency' ) ); ?>">
150 <?php
151 foreach ( Automattic\Jetpack\Paypal_Payments\Widgets\Simple_Payments_Widget::$supported_currency_list as $code => $currency ) {
152 ?>
153 <option value="<?php echo esc_attr( $code ); ?>"<?php selected( $instance['form_product_currency'], $code ); ?>>
154 <?php echo esc_html( "$code $currency" ); ?>
155 </option>
156 <?php } ?>
157 </select>
158 <input
159 type="text"
160 class="field-price widefat jetpack-simple-payments-form-product-price"
161 id="<?php echo esc_attr( $this->get_field_id( 'form_product_price' ) ); ?>"
162 name="<?php echo esc_attr( $this->get_field_name( 'form_product_price' ) ); ?>"
163 value="<?php echo esc_attr( $instance['form_product_price'] ); ?>"
164 placeholder="1.00" />
165 </p>
166 <p>
167 <input
168 class="field-multiple jetpack-simple-payments-form-product-multiple"
169 id="<?php echo esc_attr( $this->get_field_id( 'form_product_multiple' ) ); ?>"
170 name="<?php echo esc_attr( $this->get_field_name( 'form_product_multiple' ) ); ?>"
171 type="checkbox"
172 value="1"
173 <?php checked( $instance['form_product_multiple'], '1' ); ?> />
174 <label for="<?php echo esc_attr( $this->get_field_id( 'form_product_multiple' ) ); ?>">
175 <?php esc_html_e( 'Allow people to buy more than one item at a time.', 'jetpack-paypal-payments' ); ?>
176 </label>
177 </p>
178 <p>
179 <label for="<?php echo esc_attr( $this->get_field_id( 'form_product_email' ) ); ?>">
180 <?php esc_html_e( 'Email', 'jetpack-paypal-payments' ); ?>
181 </label>
182 <input
183 class="field-email widefat jetpack-simple-payments-form-product-email"
184 id="<?php echo esc_attr( $this->get_field_id( 'form_product_email' ) ); ?>"
185 name="<?php echo esc_attr( $this->get_field_name( 'form_product_email' ) ); ?>"
186 type="email"
187 value="<?php echo esc_attr( $instance['form_product_email'] ); ?>" />
188 <small>
189 <?php
190 printf(
191 wp_kses(
192 /* Translators: placeholders are a link to Paypal website and a target attribute. */
193 __( 'This is where PayPal will send your money. To claim a payment, you\'ll need a <a href="%1$s" %2$s>PayPal account</a> connected to a bank account.', 'jetpack-paypal-payments' ),
194 array(
195 'a' => array(
196 'href' => array(),
197 'target' => array(),
198 ),
199 )
200 ),
201 'https://paypal.com',
202 'target="_blank"'
203 );
204 ?>
205 </small>
206 </p>
207 <p>
208 <div class="alignleft">
209 <button type="button" class="button-link button-link-delete jetpack-simple-payments-delete-product">
210 <?php esc_html_e( 'Delete Product', 'jetpack-paypal-payments' ); ?>
211 </button>
212 </div>
213 <div class="alignright">
214 <button name="<?php echo esc_attr( $this->get_field_name( 'save' ) ); ?>" class="button jetpack-simple-payments-save-product"><?php esc_html_e( 'Save', 'jetpack-paypal-payments' ); ?></button>
215 <span> | <button type="button" class="button-link jetpack-simple-payments-cancel-form"><?php esc_html_e( 'Cancel', 'jetpack-paypal-payments' ); ?></button></span>
216 </div>
217 <br class="clear">
218 </p>
219 <hr />
220 </div>
221 <?php } else { ?>
222 <p class="jetpack-simple-payments-products-warning">
223 <?php
224 printf(
225 wp_kses(
226 /* Translators: placeholder is a link to the customizer. */
227 __( 'This widget adds a payment button of your choice to your sidebar. To create or edit the payment buttons themselves, <a href="%s">use the Customizer</a>.', 'jetpack-paypal-payments' ),
228 array(
229 'a' => array(
230 'href' => array(),
231 ),
232 )
233 ),
234 esc_url( add_query_arg( array( 'autofocus[panel]' => 'widgets' ), admin_url( 'customize.php' ) ) )
235 );
236 ?>
237 </p>
238 <?php } ?>
239