Skip to content

Commit 53c476b

Browse files
committed
Merge S3 options page from wp2static-addon-s3 repo
2 parents dd86d07 + c185c2f commit 53c476b

1 file changed

Lines changed: 291 additions & 0 deletions

File tree

views/s3-page.php

Lines changed: 291 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,291 @@
1+
<?php
2+
// phpcs:disable Generic.Files.LineLength.MaxExceeded
3+
// phpcs:disable Generic.Files.LineLength.TooLong
4+
5+
/**
6+
* @var mixed[] $view
7+
*/
8+
?>
9+
10+
<h2>S3 Deployment Options</h2>
11+
12+
<h3>S3</h3>
13+
14+
<form
15+
name="wp2static-s3-save-options"
16+
method="POST"
17+
action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
18+
19+
<?php wp_nonce_field( $view['nonce_action'] ); ?>
20+
<input name="action" type="hidden" value="wp2static_s3_save_options" />
21+
22+
<table class="widefat striped">
23+
<tbody>
24+
25+
<tr>
26+
<td style="width:50%;">
27+
<label
28+
for="<?php echo $view['options']['s3Bucket']->name; ?>"
29+
><?php echo $view['options']['s3Bucket']->label; ?></label>
30+
</td>
31+
<td>
32+
<input
33+
id="<?php echo $view['options']['s3Bucket']->name; ?>"
34+
name="<?php echo $view['options']['s3Bucket']->name; ?>"
35+
type="text"
36+
value="<?php echo $view['options']['s3Bucket']->value !== '' ? $view['options']['s3Bucket']->value : ''; ?>"
37+
/>
38+
</td>
39+
</tr>
40+
41+
<tr>
42+
<td style="width:50%;">
43+
<label
44+
for="<?php echo $view['options']['s3Region']->name; ?>"
45+
><?php echo $view['options']['s3Region']->label; ?></label>
46+
</td>
47+
<td>
48+
<input
49+
id="<?php echo $view['options']['s3Region']->name; ?>"
50+
name="<?php echo $view['options']['s3Region']->name; ?>"
51+
type="text"
52+
value="<?php echo $view['options']['s3Region']->value !== '' ? $view['options']['s3Region']->value : ''; ?>"
53+
/>
54+
</td>
55+
</tr>
56+
57+
<tr>
58+
<td style="width:50%;">
59+
<label
60+
for="<?php echo $view['options']['s3AccessKeyID']->name; ?>"
61+
><?php echo $view['options']['s3AccessKeyID']->label; ?></label>
62+
</td>
63+
<td>
64+
<input
65+
id="<?php echo $view['options']['s3AccessKeyID']->name; ?>"
66+
name="<?php echo $view['options']['s3AccessKeyID']->name; ?>"
67+
value="<?php echo $view['options']['s3AccessKeyID']->value !== '' ? $view['options']['s3AccessKeyID']->value : ''; ?>"
68+
/>
69+
</td>
70+
</tr>
71+
72+
<tr>
73+
<td style="width:50%;">
74+
<label
75+
for="<?php echo $view['options']['s3SecretAccessKey']->name; ?>"
76+
><?php echo $view['options']['s3SecretAccessKey']->label; ?></label>
77+
</td>
78+
<td>
79+
<input
80+
id="<?php echo $view['options']['s3SecretAccessKey']->name; ?>"
81+
name="<?php echo $view['options']['s3SecretAccessKey']->name; ?>"
82+
type="password"
83+
value="<?php echo $view['options']['s3SecretAccessKey']->value !== '' ?
84+
\WP2Static\CoreOptions::encrypt_decrypt( 'decrypt', $view['options']['s3SecretAccessKey']->value ) :
85+
''; ?>"
86+
/>
87+
</td>
88+
</tr>
89+
90+
<tr>
91+
<td style="width:50%;">
92+
<label
93+
for="<?php echo $view['options']['s3Profile']->name; ?>"
94+
><?php echo $view['options']['s3Profile']->label; ?></label>
95+
</td>
96+
<td>
97+
<input
98+
id="<?php echo $view['options']['s3Profile']->name; ?>"
99+
name="<?php echo $view['options']['s3Profile']->name; ?>"
100+
type="text"
101+
value="<?php echo $view['options']['s3Profile']->value !== '' ? $view['options']['s3Profile']->value : ''; ?>"
102+
/>
103+
</td>
104+
</tr>
105+
106+
107+
<tr>
108+
<td style="width:50%;">
109+
<label
110+
for="<?php echo $view['options']['s3RemotePath']->name; ?>"
111+
><?php echo $view['options']['s3RemotePath']->label; ?></label>
112+
</td>
113+
<td>
114+
<input
115+
id="<?php echo $view['options']['s3RemotePath']->name; ?>"
116+
name="<?php echo $view['options']['s3RemotePath']->name; ?>"
117+
type="text"
118+
value="<?php echo $view['options']['s3RemotePath']->value !== '' ? $view['options']['s3RemotePath']->value : ''; ?>"
119+
/>
120+
</td>
121+
</tr>
122+
123+
<tr>
124+
<td style="width:50%;">
125+
<label
126+
for="<?php echo $view['options']['s3CacheControl']->name; ?>"
127+
><?php echo $view['options']['s3CacheControl']->label; ?></label>
128+
</td>
129+
<td>
130+
<input
131+
id="<?php echo $view['options']['s3CacheControl']->name; ?>"
132+
name="<?php echo $view['options']['s3CacheControl']->name; ?>"
133+
type="text"
134+
value="<?php echo $view['options']['s3CacheControl']->value !== '' ? $view['options']['s3CacheControl']->value : ''; ?>"
135+
/>
136+
</td>
137+
</tr>
138+
139+
<tr>
140+
<td style="width:50%;">
141+
<label
142+
for="<?php echo $view['options']['s3ObjectACL']->name; ?>"
143+
><?php echo $view['options']['s3ObjectACL']->label; ?></label>
144+
</td>
145+
<td>
146+
<select
147+
id="<?php echo $view['options']['s3ObjectACL']->name; ?>"
148+
name="<?php echo $view['options']['s3ObjectACL']->name; ?>"
149+
>
150+
<option
151+
<?php if ( $view['options']['s3ObjectACL']->value === 'public-read' ) {
152+
echo 'selected'; } ?>
153+
value="public-read">public-read</option>
154+
<option
155+
<?php if ( $view['options']['s3ObjectACL']->value === 'private' ) {
156+
echo 'selected'; } ?>
157+
value="private">private</option>
158+
</select>
159+
</td>
160+
</tr>
161+
162+
<tr>
163+
<td style="width:50%;">
164+
<label
165+
for="<?php echo $view['options']['s3Concurrency']->name; ?>"
166+
><?php echo $view['options']['s3Concurrency']->label; ?></label>
167+
</td>
168+
<td>
169+
<input
170+
id="<?php echo $view['options']['s3Concurrency']->name; ?>"
171+
name="<?php echo $view['options']['s3Concurrency']->name; ?>"
172+
type="text"
173+
value="<?php echo $view['options']['s3Concurrency']->value !== '' ? $view['options']['s3Concurrency']->value : ''; ?>"
174+
/>
175+
</td>
176+
</tr>
177+
178+
</tbody>
179+
</table>
180+
181+
182+
<h3>CloudFront</h3>
183+
184+
<table class="widefat striped">
185+
<tbody>
186+
187+
<tr>
188+
<td style="width:50%;">
189+
<label
190+
for="<?php echo $view['options']['cfRegion']->name; ?>"
191+
><?php echo $view['options']['cfRegion']->label; ?></label>
192+
</td>
193+
<td>
194+
<input
195+
id="<?php echo $view['options']['cfRegion']->name; ?>"
196+
name="<?php echo $view['options']['cfRegion']->name; ?>"
197+
type="text"
198+
value="<?php echo $view['options']['cfRegion']->value !== '' ? $view['options']['cfRegion']->value : ''; ?>"
199+
/>
200+
</td>
201+
</tr>
202+
203+
<tr>
204+
<td style="width:50%;">
205+
<label
206+
for="<?php echo $view['options']['cfAccessKeyID']->name; ?>"
207+
><?php echo $view['options']['cfAccessKeyID']->label; ?></label>
208+
</td>
209+
<td>
210+
<input
211+
id="<?php echo $view['options']['cfAccessKeyID']->name; ?>"
212+
name="<?php echo $view['options']['cfAccessKeyID']->name; ?>"
213+
value="<?php echo $view['options']['cfAccessKeyID']->value !== '' ? $view['options']['cfAccessKeyID']->value : ''; ?>"
214+
/>
215+
</td>
216+
</tr>
217+
218+
<tr>
219+
<td style="width:50%;">
220+
<label
221+
for="<?php echo $view['options']['cfSecretAccessKey']->name; ?>"
222+
><?php echo $view['options']['cfSecretAccessKey']->label; ?></label>
223+
</td>
224+
<td>
225+
<input
226+
id="<?php echo $view['options']['cfSecretAccessKey']->name; ?>"
227+
name="<?php echo $view['options']['cfSecretAccessKey']->name; ?>"
228+
type="password"
229+
value="<?php echo $view['options']['cfSecretAccessKey']->value !== '' ?
230+
\WP2Static\CoreOptions::encrypt_decrypt( 'decrypt', $view['options']['cfSecretAccessKey']->value ) :
231+
''; ?>"
232+
/>
233+
</td>
234+
</tr>
235+
236+
<tr>
237+
<td style="width:50%;">
238+
<label
239+
for="<?php echo $view['options']['cfProfile']->name; ?>"
240+
><?php echo $view['options']['cfProfile']->label; ?></label>
241+
</td>
242+
<td>
243+
<input
244+
id="<?php echo $view['options']['cfProfile']->name; ?>"
245+
name="<?php echo $view['options']['cfProfile']->name; ?>"
246+
type="text"
247+
value="<?php echo $view['options']['cfProfile']->value !== '' ? $view['options']['cfProfile']->value : ''; ?>"
248+
/>
249+
</td>
250+
</tr>
251+
252+
<tr>
253+
<td style="width:50%;">
254+
<label
255+
for="<?php echo $view['options']['cfDistributionID']->name; ?>"
256+
><?php echo $view['options']['cfDistributionID']->label; ?></label>
257+
</td>
258+
<td>
259+
<input
260+
id="<?php echo $view['options']['cfDistributionID']->name; ?>"
261+
name="<?php echo $view['options']['cfDistributionID']->name; ?>"
262+
type="text"
263+
value="<?php echo $view['options']['cfDistributionID']->value !== '' ? $view['options']['cfDistributionID']->value : ''; ?>"
264+
/>
265+
</td>
266+
</tr>
267+
268+
<tr>
269+
<td style="width:50%;">
270+
<label
271+
for="<?php echo $view['options']['cfMaxPathsToInvalidate']->name; ?>"
272+
><?php echo $view['options']['cfMaxPathsToInvalidate']->label; ?></label>
273+
</td>
274+
<td>
275+
<input
276+
id="<?php echo $view['options']['cfMaxPathsToInvalidate']->name; ?>"
277+
name="<?php echo $view['options']['cfMaxPathsToInvalidate']->name; ?>"
278+
type="text"
279+
value="<?php echo $view['options']['cfMaxPathsToInvalidate']->value !== '' ? $view['options']['cfMaxPathsToInvalidate']->value : ''; ?>"
280+
/>
281+
</td>
282+
</tr>
283+
284+
</tbody>
285+
</table>
286+
287+
<br>
288+
289+
<button class="button btn-primary">Save S3 Options</button>
290+
</form>
291+

0 commit comments

Comments
 (0)