Completed
Push — try/gutenberg-separate-jetpack... ( e8dd3e...f0efb9 )
by Bernhard
39:26 queued 23:22
created

modules/widgets/simple-payments/form.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<p>
2
	<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>">
3
		<?php esc_html_e( 'Widget Title', 'jetpack' ); ?>
4
	</label>
5
	<input
6
		type="text"
7
		class="widefat jetpack-simple-payments-widget-title"
8
		id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"
9
		name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>"
10
		value="<?php echo esc_attr( $instance['title'] ); ?>" />
11
</p>
12
<p class="jetpack-simple-payments-products-fieldset" <?php if ( empty( $product_posts ) ) { echo 'style="display:none;"'; } ?>>
13
	<label for="<?php echo $this->get_field_id('product_post_id'); ?>">
14
		<?php esc_html_e( 'Select a Simple Payment Button:', 'jetpack' ); ?>
15
	</label>
16
	<select
17
		class="widefat jetpack-simple-payments-products"
18
		id="<?php echo $this->get_field_id('product_post_id'); ?>"
19
		name="<?php echo $this->get_field_name('product_post_id'); ?>">
20
		<?php foreach ( $product_posts as $product_post ) { ?>
21
			<option value="<?php echo esc_attr( $product_post->ID ) ?>" <?php selected( (int) $instance['product_post_id'], $product_post->ID ); ?>>
22
				<?php echo esc_attr( get_the_title( $product_post ) ) ?>
23
			</option>
24
		<?php } ?>
25
	</select>
26
</p>
27
<?php if ( is_customize_preview() ) { ?>
28
<p class="jetpack-simple-payments-products-warning" <?php if ( ! empty( $product_posts ) ) { echo 'style="display:none;"'; } ?>>
29
	<?php esc_html_e( "Looks like you don't have any products. You can create one using the Add New button below.", 'jetpack' ) ?>
30
</p>
31
<p>
32
	<div class="alignleft">
33
		<button class="button jetpack-simple-payments-edit-product" <?php disabled( empty( $product_posts ), true ); ?>>
34
			<?php esc_html_e( 'Edit Selected', 'jetpack' ); ?>
35
		</button>
36
	</div>
37
	<div class="alignright">
38
		<button class="button jetpack-simple-payments-add-product"><?php esc_html_e( 'Add New', 'jetpack' ); ?></button>
39
	</div>
40
	<br class="clear">
41
</p>
42
<hr />
43
<div class="jetpack-simple-payments-form" style="display: none;">
44
	<input
45
		type="hidden"
46
		id="<?php echo $this->get_field_id('form_action'); ?>"
47
		name="<?php echo $this->get_field_name('form_action'); ?>"
48
		value="<?php echo esc_attr( $instance['form_action'] ); ?>"
49
		class="jetpack-simple-payments-form-action" />
50
	<input
51
		type="hidden"
52
		id="<?php echo $this->get_field_id('form_product_id'); ?>"
53
		name="<?php echo $this->get_field_name('form_product_id'); ?>"
54
		value="<?php echo esc_attr( $instance['form_product_id'] ); ?>"
55
		class="jetpack-simple-payments-form-product-id" />
56
	<input
57
		type="hidden"
58
		id="<?php echo esc_attr( $this->get_field_id( 'form_product_image_id' ) ); ?>"
59
		name="<?php echo esc_attr( $this->get_field_name( 'form_product_image_id' ) ); ?>"
60
		value="<?php echo esc_attr( $instance['form_product_image_id'] ); ?>"
61
		class="jetpack-simple-payments-form-image-id" />
62
	<input
63
		type="hidden"
64
		id="<?php echo esc_attr( $this->get_field_id( 'form_product_image_src' ) ); ?>"
65
		name="<?php echo esc_attr( $this->get_field_name( 'form_product_image_src' ) ); ?>"
66
		value="<?php echo esc_attr( $instance['form_product_image_src'] ); ?>"
67
		class="jetpack-simple-payments-form-image-src" />
68
	<p>
69
		<label for="<?php echo esc_attr( $this->get_field_id( 'form_product_title' ) ); ?>">
70
			<?php esc_html_e( 'What is this payment for?', 'jetpack' ); ?>
71
		</label>
72
		<input
73
			type="text"
74
			class="widefat field-title jetpack-simple-payments-form-product-title"
75
			id="<?php echo esc_attr( $this->get_field_id( 'form_product_title' ) ); ?>"
76
			name="<?php echo esc_attr( $this->get_field_name( 'form_product_title' ) ); ?>"
77
			value="<?php echo esc_attr( $instance['form_product_title'] ); ?>" />
78
		<br />
79
		<small>
80
			<?php esc_html_e( 'For example: event tickets, charitable donations, training courses, coaching fees, etc.', 'jetpack' ); ?>
81
		</small>
82
	</p>
83
	<div class="jetpack-simple-payments-image-fieldset">
84
		<label><?php esc_html_e( 'Product image', 'jetpack' ); ?></label>
85
		<div class="placeholder" <?php if ( ! empty( $instance['form_product_image_id'] ) ) echo 'style="display:none;"'; ?>>
86
			<?php esc_html_e( 'Select an image', 'jetpack' ); ?>
87
		</div>
88
		<div class="jetpack-simple-payments-image" <?php if ( empty( $instance['form_product_image_id'] ) ) echo 'style="display:none;"'; ?>>
89
			<img src="<?php echo esc_url( $instance['form_product_image_src'] ); ?>" />
90
			<button class="button jetpack-simple-payments-remove-image"><?php esc_html_e( 'Remove image', 'jetpack' ); ?></button>
91
		</div>
92
	</div>
93
	<p>
94
		<label for="<?php echo esc_attr( $this->get_field_id( 'form_product_description' ) ); ?>">
95
			<?php esc_html_e( 'Description', 'jetpack' ); ?>
96
		</label>
97
		<textarea
98
			class="field-description widefat jetpack-simple-payments-form-product-description"
99
			rows=5
100
			id="<?php echo esc_attr( $this->get_field_id( 'form_product_description' ) ); ?>"
101
			name="<?php echo esc_attr( $this->get_field_name( 'form_product_description' ) ); ?>"><?php  esc_html_e( $instance['form_product_description'] ); ?></textarea>
102
	</p>
103
	<p class="cost">
104
		<label for="<?php echo esc_attr( $this->get_field_id( 'form_product_price' ) ); ?>">
105
			<?php esc_html_e( 'Price', 'jetpack' ); ?>
106
		</label>
107
		<select
108
			class="field-currency widefat jetpack-simple-payments-form-product-currency"
109
			id="<?php echo esc_attr( $this->get_field_id( 'form_product_currency' ) ); ?>"
110
			name="<?php echo esc_attr( $this->get_field_name( 'form_product_currency' ) ); ?>">
111
			<?php foreach( Jetpack_Simple_Payments_Widget::$supported_currency_list as $code => $currency ) {?>
0 ignored issues
show
The property supported_currency_list cannot be accessed from this context as it is declared private in class Jetpack_Simple_Payments_Widget.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
112
				<option value="<?php echo esc_attr( $code ) ?>"<?php selected( $instance['form_product_currency'], $code ); ?>>
113
					<?php echo esc_html( "$code $currency" ); ?>
114
				</option>
115
			<?php } ?>
116
		</select>
117
		<input
118
			type="text"
119
			class="field-price widefat jetpack-simple-payments-form-product-price"
120
			id="<?php echo esc_attr( $this->get_field_id( 'form_product_price' ) ); ?>"
121
			name="<?php echo esc_attr( $this->get_field_name( 'form_product_price' ) ); ?>"
122
			value="<?php echo esc_attr( $instance['form_product_price'] ); ?>"
123
			placeholder="1.00" />
124
	</p>
125
	<p>
126
		<input
127
			class="field-multiple jetpack-simple-payments-form-product-multiple"
128
			id="<?php echo esc_attr( $this->get_field_id( 'form_product_multiple' ) ); ?>"
129
			name="<?php echo esc_attr( $this->get_field_name( 'form_product_multiple' ) ); ?>"
130
			type="checkbox"
131
			value="1"
132
			<?php checked( $instance['form_product_multiple'], '1' ); ?> />
133
		<label for="<?php echo esc_attr( $this->get_field_id( 'form_product_multiple' ) ); ?>">
134
			<?php esc_html_e( 'Allow people to buy more than one item at a time.', 'jetpack' ); ?>
135
		</label>
136
	</p>
137
	<p>
138
		<label for="<?php echo esc_attr( $this->get_field_id( 'form_product_email' ) ); ?>">
139
			<?php esc_html_e( 'Email', 'jetpack' ); ?>
140
		</label>
141
		<input
142
			class="field-email widefat jetpack-simple-payments-form-product-email"
143
			id="<?php echo esc_attr( $this->get_field_id( 'form_product_email' ) ); ?>"
144
			name="<?php echo esc_attr( $this->get_field_name( 'form_product_email' ) ); ?>"
145
			type="email"
146
			value="<?php  echo esc_attr( $instance['form_product_email'] ); ?>" />
147
		<small>
148
			<?php
149
			printf(
150
				wp_kses(
151
					__( 'This is where PayPal will send your money. To claim a payment, you\'ll need a <a href="%s" %s>PayPal account</a> connected to a bank account.' ),
152
					array( 'a' => array( 'href' => array(), 'target' => array() ) )
153
				),
154
				'https://paypal.com',
155
				'target="_blank"'
156
			);
157
			?>
158
		</small>
159
	</p>
160
	<p>
161
		<div class="alignleft">
162
			<button type="button" class="button-link button-link-delete jetpack-simple-payments-delete-product">
163
				<?php esc_html_e( 'Delete Product', 'jetpack' ); ?>
164
			</button>
165
		</div>
166
		<div class="alignright">
167
			<button name="<?php echo $this->get_field_name('save'); ?>" class="button jetpack-simple-payments-save-product"><?php esc_html_e( 'Save', 'jetpack' ); ?></button>
168
			<span> | <button type="button" class="button-link jetpack-simple-payments-cancel-form"><?php esc_html_e( 'Cancel', 'jetpack' ); ?></button></span>
169
		</div>
170
		<br class="clear">
171
	</p>
172
	<hr />
173
</div>
174
<?php } else { ?>
175
<p class="jetpack-simple-payments-products-warning">
176
	<?php
177
		printf(
178
			wp_kses(
179
				__( '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' ),
180
				array( 'a' => array( 'href' => array() ) )
181
			),
182
			esc_url( add_query_arg( array( 'autofocus[panel]' => 'widgets' ), admin_url( 'customize.php' ) ) )
183
		);
184
	?>
185
</p>
186
<?php } ?>
187