PluginProbe
WP-Stateless – Google Cloud Storage / 3.0
WP-Stateless – Google Cloud Storage v3.0
4.4.3 2.1.7 2.1.8 2.1.9 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.3.0 2.3.1 2.3.2 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.2.0 3.2.1 3.2.2 All 62 releases
wp-stateless / static / views / settings_interface.php

settings_interface.php in WP-Stateless – Google Cloud Storage 3.0, at static/views/settings_interface.php

296 lines 25.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <div class="wrap" ng-app="wpStatelessApp">
2 <div id="stateless-settings-page-title">
3 <h1><?php _e( 'WP-Stateless', ud_get_stateless_media()->domain ); ?></h1>
4 <div class="description"><?php _e( 'Upload and serve your WordPress media files from Google Cloud Storage.', ud_get_stateless_media()->domain ); ?></div>
5 <div class="no-js-error" ng-hide="jsLoaded" ng-controller="noJSWarning">You have a problem with JS.</div>
6 </div>
7 <h2 class="nav-tab-wrapper">
8 <a href="#stless_settings_tab" class="stless_setting_tab nav-tab nav-tab-active"><?php _e( 'Settings', ud_get_stateless_media()->domain ); ?></a>
9 <?php if(!is_network_admin() && !isset($_SERVER["GAE_VERSION"]) ): ?>
10 <a href="#stless_sync_tab" class="stless_setting_tab nav-tab"><?php _e( 'Sync', ud_get_stateless_media()->domain ); ?></a>
11 <?php endif; ?>
12 <a href="#stless_compatibility_tab" class="stless_setting_tab nav-tab"><?php _e( 'Compatibility', ud_get_stateless_media()->domain ); ?></a>
13 <a href="#stless_questions_tab" class="stless_setting_tab nav-tab"><?php _e( 'Support', ud_get_stateless_media()->domain ); ?></a>
14 </h2>
15
16 <div class="stless_settings">
17 <div id="stless_settings_tab" class="stless_settings_content active" ng-controller="wpStatelessSettings">
18 <form method="post" action="">
19 <input type="hidden" name="action" value="stateless_settings">
20 <?php wp_nonce_field('wp-stateless-settings', '_smnonce');?>
21 <table class="form-table">
22 <tbody>
23 <?php if(is_network_admin()): ?>
24 <tr>
25 <th scope="row"><?php _e( 'Settings Panel Visibility', ud_get_stateless_media()->domain ); ?></th>
26 <td>
27 <fieldset>
28 <legend class="screen-reader-text"><span><?php _e( 'Settings Panel Visibility', ud_get_stateless_media()->domain ); ?></span></legend>
29 <p>
30 <select name="sm[hide_settings_panel]" id="hide_settings_panel" ng-model="sm.hide_settings_panel" ng-disabled="sm.readonly.hide_settings_panel">
31 <option value="false"><?php _e( 'Visible', ud_get_stateless_media()->domain ); ?></option>
32 <option value="true"><?php _e( 'Hidden', ud_get_stateless_media()->domain ); ?></option>
33 </select>
34 </p>
35 <p class="description"><?php _e("Control the visibility and access of the WP-Stateless settings panel within individual network sites.");?></p>
36 </fieldset>
37 </td>
38 </tr>
39 <tr>
40 <th scope="row"><?php _e( 'Setup Assistant Visibility', ud_get_stateless_media()->domain ); ?></th>
41 <td>
42 <fieldset>
43 <legend class="screen-reader-text"><span><?php _e( 'Setup Assistant Visibility', ud_get_stateless_media()->domain ); ?></span></legend>
44 <p>
45 <select name="sm[hide_setup_assistant]" id="hide_setup_assistant" ng-model="sm.hide_setup_assistant" ng-disabled="sm.readonly.hide_setup_assistant">
46 <option value="false"><?php _e( 'Visible', ud_get_stateless_media()->domain ); ?></option>
47 <option value="true"><?php _e( 'Hidden', ud_get_stateless_media()->domain ); ?></option>
48 </select>
49 </p>
50 <p class="description"><?php _e("Control the visibility and access of the WP-Stateless setup assistant within individual network sites.");?></p>
51 </fieldset>
52 </td>
53 </tr>
54 <?php endif; ?>
55 <tr>
56 <th scope="row"><?php _e( 'General', ud_get_stateless_media()->domain ); ?></th>
57 <td>
58 <fieldset>
59 <legend class="screen-reader-text"><span><?php _e( 'General', ud_get_stateless_media()->domain ); ?></span></legend>
60 <h4><?php _e( 'Mode', ud_get_stateless_media()->domain ); ?></h4>
61 <p class="description"><strong ng-bind="sm.showNotice('mode')" ></strong></p>
62 <?php if(is_network_admin()): ?>
63 <p class="sm-mode">
64 <label for="sm_mode_not_override"><input ng-model="sm.mode" id="sm_mode_not_override" type="radio" name="sm[mode]" value="" ng-checked="sm.mode == ''" ng-disabled="sm.readonly.mode"><?php _e( 'Don\'t override', ud_get_stateless_media()->domain ); ?><small class="description"><?php _e( 'Don\'t override.', ud_get_stateless_media()->domain ); ?></small></label>
65 </p>
66 <?php endif; ?>
67 <p class="sm-mode">
68 <label for="sm_mode_disabled"><input ng-model="sm.mode" id="sm_mode_disabled" type="radio" name="sm[mode]" value="disabled" ng-checked="sm.mode == 'disabled'" ng-disabled="sm.readonly.mode"><?php _e( 'Disabled', ud_get_stateless_media()->domain ); ?><small class="description"><?php _e( 'Disable Stateless Media.', ud_get_stateless_media()->domain ); ?></small></label>
69 </p>
70 <p class="sm-mode">
71 <label for="sm_mode_backup"><input ng-model="sm.mode" id="sm_mode_backup" type="radio" name="sm[mode]" value="backup" ng-checked="sm.mode == 'backup'" ng-disabled="sm.readonly.mode"><?php _e( 'Backup', ud_get_stateless_media()->domain ); ?><small class="description"><?php _e( 'Upload media files to Google Storage and serve local file urls.', ud_get_stateless_media()->domain ); ?></small></label>
72 </p>
73 <p class="sm-mode">
74 <label for="sm_mode_cdn"><input ng-model="sm.mode" id="sm_mode_cdn" type="radio" name="sm[mode]" value="cdn" ng-checked="sm.mode == 'cdn'" ng-disabled="sm.readonly.mode"><?php _e( 'CDN', ud_get_stateless_media()->domain ); ?><small class="description"><?php _e( 'Copy media files to Google Storage and serve them directly from there.', ud_get_stateless_media()->domain ); ?></small></label>
75 </p>
76 <p class="sm-mode">
77 <label for="sm_mode_ephemeral"><input ng-model="sm.mode" id="sm_mode_ephemeral" type="radio" name="sm[mode]" value="ephemeral" ng-checked="sm.mode == 'ephemeral'" ng-disabled="sm.readonly.mode"><?php _e( 'Ephemeral', ud_get_stateless_media()->domain ); ?><small class="description"><?php _e( 'Store and serve media files with Google Cloud Storage only. Media files are not stored locally, but local storage is used temporarily for processing and is required for certain compatibilities.', ud_get_stateless_media()->domain ); ?></small></label>
78 </p>
79 <p class="sm-mode">
80 <label for="sm_mode_stateless"><input ng-model="sm.mode" id="sm_mode_stateless" type="radio" name="sm[mode]" value="stateless" ng-checked="sm.mode == 'stateless'" ng-disabled="sm.readonly.mode"><?php _e( 'Stateless', ud_get_stateless_media()->domain ); ?><small class="description"><?php _e( 'Store and serve media files with Google Cloud Storage only. Media files are not stored locally.', ud_get_stateless_media()->domain ); ?></small></label>
81 </p>
82 <hr>
83
84 <h4><?php _e( 'File URL Replacement', ud_get_stateless_media()->domain ); ?></h4>
85 <p class="sm-file-url">
86 <select name="sm[body_rewrite]" id="sm_body_rewrite" ng-model="sm.body_rewrite" ng-disabled="sm.readonly.body_rewrite">
87 <?php if(is_network_admin()): ?>
88 <option value=""><?php _e("Don't override");?></option>
89 <?php endif; ?>
90 <option value="false"><?php _e( 'Disable', ud_get_stateless_media()->domain ); ?></option>
91 <option value="enable_editor"><?php _e( 'Enable Editor', ud_get_stateless_media()->domain ); ?></option>
92 <option value="enable_meta"><?php _e( 'Enable Meta', ud_get_stateless_media()->domain ); ?></option>
93 <option value="true"><?php _e( 'Enable Editor & Meta', ud_get_stateless_media()->domain ); ?></option>
94 </select>
95 </p>
96 <p class="description"><strong ng-bind="sm.showNotice('body_rewrite')" ></strong> <?php _e( 'Scans post content and meta during presentation and replaces local media file urls with GCS urls. When selecting meta or true depending on the amount of meta, this could be significantly impact performance negatively. This setting does not modify your database.', ud_get_stateless_media()->domain ); ?></p>
97
98 <h4 ng-show="sm.body_rewrite == 'true' || sm.body_rewrite == 'enable_editor' || sm.body_rewrite == 'enable_meta'"><?php _e( 'Supported File Types', ud_get_stateless_media()->domain ); ?></h4>
99 <div ng-show="sm.body_rewrite == 'true' || sm.body_rewrite == 'enable_editor' || sm.body_rewrite == 'enable_meta'" class="body_rewrite_types">
100 <p>
101 <label for="body_rewrite_types">
102 <input name="sm[body_rewrite_types]" type="text" id="body_rewrite_types" class="regular-text ltr" ng-model="sm.body_rewrite_types" ng-disabled="sm.readonly.body_rewrite_types">
103 </label>
104 </p>
105 <p class="description"><strong ng-bind="sm.showNotice('body_rewrite_types')" ></strong> <?php _e( 'Define the file types you would like supported with File URL Replacement. Separate each type by a space.', ud_get_stateless_media()->domain ); ?></p>
106 </div>
107 </fieldset>
108 </td>
109 </tr>
110
111 <tr>
112 <th scope="row"><?php _e( 'Google Cloud Storage (GCS)', ud_get_stateless_media()->domain ); ?></th>
113 <td>
114 <fieldset>
115 <legend class="screen-reader-text"><span><?php _e( 'Google Cloud Storage (GCS)', ud_get_stateless_media()->domain ); ?></span></legend>
116 <h4><?php _e( 'Bucket', ud_get_stateless_media()->domain ); ?></h4>
117 <p>
118 <label for="bucket_name">
119 <input name="sm[bucket]" type="text" id="bucket_name" class="regular-text ltr" ng-model="sm.bucket" ng-change="sm.generatePreviewUrl()" ng-disabled="sm.readonly.bucket">
120 </label>
121 </p>
122 <p class="description"><strong ng-bind="sm.showNotice('bucket')" ></strong> <?php _e( 'The name of the GCS bucket.', ud_get_stateless_media()->domain ); ?></p>
123 <hr>
124
125 <h4><?php _e( 'Service Account JSON', ud_get_stateless_media()->domain ); ?></h4>
126 <p>
127 <label for="service_account_json">
128 <textarea name="sm[key_json]" type="text" id="service_account_json" class="regular-text ltr" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" ng-disabled="sm.readonly.key_json">{{sm.key_json}}</textarea>
129 </label>
130 </p>
131 <p class="description"><strong ng-bind="sm.showNotice('key_json')" ></strong> <?php _e( 'Private key in JSON format for the service account WP-Stateless will use to connect to your Google Cloud project and bucket. Empty this field to access the Stateless Setup Assistant.', ud_get_stateless_media()->domain ); ?></p>
132 <hr>
133
134 <h4><?php _e( 'Cache-Control', ud_get_stateless_media()->domain ); ?></h4>
135 <p>
136 <label for="gcs_cache_control_text">
137 <input name="sm[cache_control]" type="text" id="gcs_cache_control_text" class="regular-text ltr" placeholder="public, max-age=36000, must-revalidate" ng-model="sm.cache_control" ng-disabled="sm.readonly.cache_control">
138 </label>
139 </p>
140 <p class="description"><strong ng-bind="sm.showNotice('cache_control')" ></strong> <?php _e( 'Override the default cache control assigned by GCS.', ud_get_stateless_media()->domain ); ?></p>
141 <hr>
142
143 <h4><?php _e( 'Delete GCS File', ud_get_stateless_media()->domain ); ?></h4>
144 <p>
145 <select name="sm[delete_remote]" id="gcs_delete_file" ng-model="sm.delete_remote" ng-disabled="sm.readonly.delete_remote">
146 <?php if(is_network_admin()): ?>
147 <option value=""><?php _e( 'Don\'t override', ud_get_stateless_media()->domain ); ?></option>
148 <?php endif; ?>
149 <option value="true"><?php _e( 'Enable', ud_get_stateless_media()->domain ); ?></option>
150 <option value="false"><?php _e( 'Disable', ud_get_stateless_media()->domain ); ?></option>
151 </select>
152 </p>
153 <p class="description"><strong ng-bind="sm.showNotice('delete_remote')" ></strong> <?php _e( 'Delete the GCS file when the file is deleted from WordPress.', ud_get_stateless_media()->domain ); ?></p>
154 </fieldset>
155 </td>
156 </tr>
157 <tr>
158 <th scope="row"><?php _e( 'File URL', ud_get_stateless_media()->domain ); ?></th>
159 <td>
160 <fieldset class="file_url_block">
161 <legend class="screen-reader-text"><span><?php _e( 'File URL', ud_get_stateless_media()->domain ); ?></span></legend>
162 <h4><?php _e( 'Preview', ud_get_stateless_media()->domain ); ?></h4>
163 <p>
164 <label for="file_url_grp_preview">
165 <input type="text" id="file_url_grp_preview" class="regular-text ltr" readonly="readonly" ng-model="sm.preview_url" ng-disabled="sm.readonly">
166 </label>
167 </p>
168 <p class="description"><?php _e( 'An example file url utilizing all configured settings.', ud_get_stateless_media()->domain ); ?></p>
169 <hr>
170 <div class="form-table permalink-structure">
171 <h4><?php _e( 'Folder', ud_get_stateless_media()->domain ); ?></h4>
172 <p>
173 <label for="bucket_folder_name">
174 <select id="sm_bucket_folder_type" ng-model="sm.bucket_folder_type" ng-disabled="sm.readonly.root_dir">
175 <?php if(is_network_admin()): ?>
176 <option value=""><?php _e("Don't override");?></option>
177 <?php endif; ?>
178 <option value="single-site"><?php _e( 'Single Site', ud_get_stateless_media()->domain ); ?></option>
179 <option value="multi-site"><?php _e( 'Multisite', ud_get_stateless_media()->domain ); ?></option>
180 <option value="custom"><?php _e( 'Custom', ud_get_stateless_media()->domain ); ?></option>
181 </select>
182 </label>
183 </p>
184 <div class="sm-wildcards">
185 <select class=" select-wildcards" multiple="multiple" name="sm[root_dir][]" ng-disabled="sm.readonly.root_dir">
186 <?php foreach($wildcards as $wildcard => $replace): ?>
187 <option <?php echo in_array( $wildcard, $root_dir_values ) ? 'selected="selected"' : ""; ?> <?php echo ($wildcard == '/') ? 'disabled="disabled"' : ""; ?>><?php echo $wildcard; ?></option>
188 <?php if (in_array( $wildcard, $root_dir_values ) && $wildcard != '/') : ?>
189 <option selected="selected" disabled="disabled">/</option>
190 <?php endif; ?>
191 <?php endforeach;?>
192 </select>
193 <input type="text" style="display: none;" id="sm_root_dir" ng-model="sm.root_dir" ng-change="sm.generatePreviewUrl()" />
194 </div>
195
196 <p class="description"><strong ng-bind="sm.showNotice('root_dir')" ></strong> <?php _e( 'If you would like files to be uploaded into a particular folder within the bucket, define that path here.', ud_get_stateless_media()->domain ); ?></p>
197 </div>
198
199 <hr>
200
201 <h4><?php _e( 'Domain', ud_get_stateless_media()->domain ); ?></h4>
202 <p>
203 <label for="bucket_folder_name">
204 <input name="sm[custom_domain]" ng-model="sm.custom_domain" type="text" id="bucket_folder_name" class="regular-text ltr" placeholder="" ng-change="sm.generatePreviewUrl()" ng-disabled="sm.readonly.custom_domain">
205 </label>
206 </p>
207 <p class="description">
208 <strong ng-bind="sm.showNotice('custom_domain')" ></strong>
209 <strong class="notice" ng-show="sm.is_ssl"><?php printf(__( 'This will require proxy/load balancer.', ud_get_stateless_media()->domain )); ?></strong>
210 <?php printf(__( 'Replace the default GCS domain with your own custom domain. This will require you to <a href="%s" target="_blank">configure a CNAME</a>. Be advised that the bucket name and domain name must match exactly, and HTTPS is not supported with a custom domain out of the box.', ud_get_stateless_media()->domain ), 'https://cloud.google.com/storage/docs/xml-api/reference-uris#cname'); ?>
211 </p>
212 <hr>
213
214 <h4><?php _e( 'Cache-Busting', ud_get_stateless_media()->domain ); ?></h4>
215 <p>
216 <select id="cache_busting" name="sm[hashify_file_name]" ng-model="sm.hashify_file_name" ng-change="sm.generatePreviewUrl()" ng-disabled="sm.readonly.hashify_file_name || sm.mode == 'stateless'">
217 <?php if(is_network_admin()): ?>
218 <option value=""><?php _e( 'Don\'t override', ud_get_stateless_media()->domain ); ?></option>
219 <?php endif; ?>
220 <option value="true"><?php _e( 'Enable', ud_get_stateless_media()->domain ); ?></option>
221 <option value="false"><?php _e( 'Disable', ud_get_stateless_media()->domain ); ?></option>
222 </select>
223 </p>
224 <p class="description"><strong ng-bind="sm.showNotice('hashify_file_name')" ></strong>
225 <span ng-show="sm.mode == 'stateless' && sm.readonly.hashify_file_name != 'constant'">
226 <?php _e(sprintf( "<b>Required by Stateless Mode. Override with the <a href='%s' target='_blank'>WP_STATELESS_MEDIA_CACHE_BUSTING</a> constant.</b>","https://wp-stateless.github.io/docs/constants/#wp_stateless_media_cache_busting"), ud_get_stateless_media()->domain);?>
227 </span>
228 <?php _e( 'Prepends a random set of numbers and letters to the filename. This is useful for preventing caching issues when uploading files that have the same filename.', ud_get_stateless_media()->domain ); ?></p>
229 </fieldset>
230 </td>
231 </tr>
232 </tbody>
233 </table>
234
235
236 <?php submit_button(null, 'primary', 'submit', true, array('id' => 'save-settings')); ?>
237 </form>
238 </div>
239 <?php if(!is_network_admin()): ?>
240 <div id="stless_sync_tab" class="stless_settings_content">
241 <?php include 'regenerate_interface.php'; ?>
242 </div>
243 <?php endif; ?>
244 <div id="stless_compatibility_tab" class="stless_settings_content" ng-controller="wpStatelessCompatibility">
245 <div class="container-fluid">
246 <h2><?php _e("Enable or disable compatibility with other plugins.");?></h2>
247 <p><?php _e(sprintf("Having an issue with another plugin? <a class='stless_setting_tab' href='%s'>Submit feedback</a> and let us know your issue!", "#stless_questions_tab"));?></p>
248 <form method="post" action="">
249 <input type="hidden" name="action" value="stateless_modules">
250 <?php wp_nonce_field('wp-stateless-modules', '_smnonce');?>
251
252 <table class="form-table">
253 <tr ng-repeat="module in modules">
254 <th>
255 <label for="{{module.id}}">{{module.title}}</label>
256 </th>
257 <td>
258 <select name="stateless-modules[{{module.id}}]" id="{{module.id}}" ng-model="module.enabled" ng-disabled="module.is_constant || (module.is_network_override ||!module.is_plugin_active ||!module.is_mode_supported) && !module.is_network_admin">
259 <?php if(is_network_admin()): ?>
260 <option value=""><?php _e("Don't override");?></option>
261 <?php endif; ?>
262 <option value="inactive" ng-show="module.enabled == 'inactive'"><?php _e( 'Not Available', ud_get_stateless_media()->domain ); ?></option>
263 <option value="false"><?php _e( 'Disable', ud_get_stateless_media()->domain ); ?></option>
264 <option value="true"><?php _e( 'Enable', ud_get_stateless_media()->domain ); ?></option>
265 </select>
266 <p class="description">
267 <strong ng-show="!module.is_plugin_active && module.is_plugin && module.is_mode_supported"><?php _e("Please activate the plugin first.");?></strong>
268 <strong ng-show="!module.is_plugin_active && module.is_theme && module.is_mode_supported"><?php _e("Please activate the theme first.");?></strong>
269 <strong ng-show="!module.is_mode_supported"><?php _e("This compatibility does not support {{module.mode}} mode.");?></strong>
270 <strong ng-show="module.is_constant"><?php _e("Currently configured via a constant.");?></strong>
271 <strong ng-show="module.is_network_override"><?php _e("Currently configured via network settings.");?></strong>
272 <span ng-bind-html="module.description"></span>
273 </p>
274 </td>
275 </tr>
276 </table>
277 <?php submit_button(null, 'primary', 'submit', true, array('id' => 'save-compatibility')); ?>
278 </form>
279 </div>
280 </div>
281 <div id="stless_questions_tab" class="stless_settings_content">
282 <!--[if lte IE 8]>
283 <script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"></script>
284 <![endif]-->
285 <script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script>
286 <script>
287 hbspt.forms.create({
288 portalId: '3453418',
289 formId: 'cad1f6e1-7825-4e6d-a3e7-278c91abce7e',
290 submitButtonClass: 'button button-primary',
291 });
292 </script>
293 </div>
294 </div>
295
296 </div>