| 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> |
| 6 |
<h2 class="nav-tab-wrapper"> |
| 7 |
<a href="#stless_settings_tab" class="stless_setting_tab nav-tab nav-tab-active"><?php _e( 'Settings', ud_get_stateless_media()->domain ); ?></a> |
| 8 |
<?php if(!is_network_admin()): ?> |
| 9 |
<a href="#stless_sync_tab" class="stless_setting_tab nav-tab"><?php _e( 'Sync', ud_get_stateless_media()->domain ); ?></a> |
| 10 |
<?php endif; ?> |
| 11 |
<a href="#stless_compatibility_tab" class="stless_setting_tab nav-tab"><?php _e( 'Compatibility', ud_get_stateless_media()->domain ); ?></a> |
| 12 |
<a href="#stless_questions_tab" class="stless_setting_tab nav-tab"><?php _e( 'Feedback', ud_get_stateless_media()->domain ); ?></a> |
| 13 |
</h2> |
| 14 |
|
| 15 |
<div class="stless_settings"> |
| 16 |
<div id="stless_settings_tab" class="stless_settings_content active" ng-controller="wpStatelessSettings"> |
| 17 |
<form method="post" action=""> |
| 18 |
<input type="hidden" name="action" value="stateless_settings"> |
| 19 |
<?php wp_nonce_field('wp-stateless-settings', '_smnonce');?> |
| 20 |
<table class="form-table"> |
| 21 |
<tbody> |
| 22 |
<?php if(is_network_admin()): ?> |
| 23 |
<tr> |
| 24 |
<th scope="row"><?php _e( 'Settings Panel Visibility', ud_get_stateless_media()->domain ); ?></th> |
| 25 |
<td> |
| 26 |
<fieldset> |
| 27 |
<legend class="screen-reader-text"><span><?php _e( 'Settings Panel Visibility', ud_get_stateless_media()->domain ); ?></span></legend> |
| 28 |
<p> |
| 29 |
<select name="sm[hide_settings_panel]" id="hide_settings_panel" ng-model="sm.hide_settings_panel" ng-disabled="sm.readonly.hide_settings_panel"> |
| 30 |
<option value="false"><?php _e( 'Visible', ud_get_stateless_media()->domain ); ?></option> |
| 31 |
<option value="true"><?php _e( 'Hidden', ud_get_stateless_media()->domain ); ?></option> |
| 32 |
</select> |
| 33 |
</p> |
| 34 |
<p class="description"><?php _e("Control the visibility and access of the WP-Stateless settings panel within individual network sites.");?></p> |
| 35 |
</fieldset> |
| 36 |
</td> |
| 37 |
</tr> |
| 38 |
<tr> |
| 39 |
<th scope="row"><?php _e( 'Setup Assistant Visibility', ud_get_stateless_media()->domain ); ?></th> |
| 40 |
<td> |
| 41 |
<fieldset> |
| 42 |
<legend class="screen-reader-text"><span><?php _e( 'Setup Assistant Visibility', ud_get_stateless_media()->domain ); ?></span></legend> |
| 43 |
<p> |
| 44 |
<select name="sm[hide_setup_assistant]" id="hide_setup_assistant" ng-model="sm.hide_setup_assistant" ng-disabled="sm.readonly.hide_setup_assistant"> |
| 45 |
<option value="false"><?php _e( 'Visible', ud_get_stateless_media()->domain ); ?></option> |
| 46 |
<option value="true"><?php _e( 'Hidden', ud_get_stateless_media()->domain ); ?></option> |
| 47 |
</select> |
| 48 |
</p> |
| 49 |
<p class="description"><?php _e("Control the visibility and access of the WP-Stateless setup assistant within individual network sites.");?></p> |
| 50 |
</fieldset> |
| 51 |
</td> |
| 52 |
</tr> |
| 53 |
<?php endif; ?> |
| 54 |
<tr> |
| 55 |
<th scope="row"><?php _e( 'General', ud_get_stateless_media()->domain ); ?></th> |
| 56 |
<td> |
| 57 |
<fieldset> |
| 58 |
<legend class="screen-reader-text"><span><?php _e( 'General', ud_get_stateless_media()->domain ); ?></span></legend> |
| 59 |
<h4><?php _e( 'Mode', ud_get_stateless_media()->domain ); ?></h4> |
| 60 |
<p class="description"><strong ng-bind="sm.showNotice('mode')" ></strong></p> |
| 61 |
<?php if(is_network_admin()): ?> |
| 62 |
<p class="sm-mode"> |
| 63 |
<label for="sm_mode_disabled"><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> |
| 64 |
</p> |
| 65 |
<?php endif; ?> |
| 66 |
<p class="sm-mode"> |
| 67 |
<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> |
| 68 |
</p> |
| 69 |
<p class="sm-mode"> |
| 70 |
<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> |
| 71 |
</p> |
| 72 |
<p class="sm-mode"> |
| 73 |
<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> |
| 74 |
</p> |
| 75 |
<p class="sm-mode"> |
| 76 |
<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> |
| 77 |
</p> |
| 78 |
<hr> |
| 79 |
|
| 80 |
<h4><?php _e( 'File URL Replacement', ud_get_stateless_media()->domain ); ?></h4> |
| 81 |
<p class="sm-file-url"> |
| 82 |
<select name="sm[body_rewrite]" id="sm_file_url" ng-model="sm.body_rewrite" ng-disabled="sm.readonly.body_rewrite"> |
| 83 |
<?php if(is_network_admin()): ?> |
| 84 |
<option value=""><?php _e("Don't override");?></option> |
| 85 |
<?php endif; ?> |
| 86 |
<option value="true"><?php _e( 'Enable', ud_get_stateless_media()->domain ); ?></option> |
| 87 |
<option value="false"><?php _e( 'Disable', ud_get_stateless_media()->domain ); ?></option> |
| 88 |
</select> |
| 89 |
</p> |
| 90 |
<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. This setting does not modify your database.', ud_get_stateless_media()->domain ); ?></p> |
| 91 |
|
| 92 |
<h4 ng-show="sm.body_rewrite == 'true'"><?php _e( 'Supported File Types', ud_get_stateless_media()->domain ); ?></h4> |
| 93 |
<div ng-show="sm.body_rewrite == 'true'" class="body_rewrite_types"> |
| 94 |
<p> |
| 95 |
<label for="body_rewrite_types"> |
| 96 |
<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"> |
| 97 |
</label> |
| 98 |
</p> |
| 99 |
<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> |
| 100 |
</div> |
| 101 |
</fieldset> |
| 102 |
</td> |
| 103 |
</tr> |
| 104 |
|
| 105 |
<tr> |
| 106 |
<th scope="row"><?php _e( 'Google Cloud Storage (GCS)', ud_get_stateless_media()->domain ); ?></th> |
| 107 |
<td> |
| 108 |
<fieldset> |
| 109 |
<legend class="screen-reader-text"><span><?php _e( 'Google Cloud Storage (GCS)', ud_get_stateless_media()->domain ); ?></span></legend> |
| 110 |
<h4><?php _e( 'Bucket', ud_get_stateless_media()->domain ); ?></h4> |
| 111 |
<p> |
| 112 |
<label for="bucket_name"> |
| 113 |
<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"> |
| 114 |
</label> |
| 115 |
</p> |
| 116 |
<p class="description"><strong ng-bind="sm.showNotice('bucket')" ></strong> <?php _e( 'The name of the GCS bucket.', ud_get_stateless_media()->domain ); ?></p> |
| 117 |
<hr> |
| 118 |
|
| 119 |
<h4><?php _e( 'Bucket Folder', ud_get_stateless_media()->domain ); ?></h4> |
| 120 |
<p> |
| 121 |
<label for="bucket_folder_name"> |
| 122 |
<input name="sm[root_dir]" type="text" id="bucket_folder_name" class="regular-text ltr" ng-model="sm.root_dir" ng-disabled="sm.readonly.root_dir" ng-change="sm.generatePreviewUrl()"> |
| 123 |
</label> |
| 124 |
</p> |
| 125 |
<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> |
| 126 |
<hr> |
| 127 |
|
| 128 |
<h4><?php _e( 'Service Account JSON', ud_get_stateless_media()->domain ); ?></h4> |
| 129 |
<p> |
| 130 |
<label for="service_account_json"> |
| 131 |
<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> |
| 132 |
</label> |
| 133 |
</p> |
| 134 |
<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.', ud_get_stateless_media()->domain ); ?></p> |
| 135 |
<hr> |
| 136 |
|
| 137 |
<h4><?php _e( 'Cache-Control', ud_get_stateless_media()->domain ); ?></h4> |
| 138 |
<p> |
| 139 |
<label for="gcs_cache_control_text"> |
| 140 |
<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"> |
| 141 |
</label> |
| 142 |
</p> |
| 143 |
<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> |
| 144 |
<hr> |
| 145 |
|
| 146 |
<h4><?php _e( 'Delete GCS File', ud_get_stateless_media()->domain ); ?></h4> |
| 147 |
<p> |
| 148 |
<select name="sm[delete_remote]" id="gcs_delete_file" ng-model="sm.delete_remote" ng-disabled="sm.readonly.delete_remote"> |
| 149 |
<?php if(is_network_admin()): ?> |
| 150 |
<option value=""><?php _e( 'Don\'t override', ud_get_stateless_media()->domain ); ?></option> |
| 151 |
<?php endif; ?> |
| 152 |
<option value="true"><?php _e( 'Enable', ud_get_stateless_media()->domain ); ?></option> |
| 153 |
<option value="false"><?php _e( 'Disable', ud_get_stateless_media()->domain ); ?></option> |
| 154 |
</select> |
| 155 |
</p> |
| 156 |
<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> |
| 157 |
</fieldset> |
| 158 |
</td> |
| 159 |
</tr> |
| 160 |
<tr> |
| 161 |
<th scope="row"><?php _e( 'File URL', ud_get_stateless_media()->domain ); ?></th> |
| 162 |
<td> |
| 163 |
<fieldset> |
| 164 |
<legend class="screen-reader-text"><span><?php _e( 'File URL', ud_get_stateless_media()->domain ); ?></span></legend> |
| 165 |
<h4><?php _e( 'Preview', ud_get_stateless_media()->domain ); ?></h4> |
| 166 |
<p> |
| 167 |
<label for="file_url_grp_preview"> |
| 168 |
<input type="text" id="file_url_grp_preview" class="regular-text ltr" readonly="readonly" ng-model="sm.preview_url" ng-disabled="sm.readonly"> |
| 169 |
</label> |
| 170 |
</p> |
| 171 |
<p class="description"><?php _e( 'An example file url utilizing all configured settings.', ud_get_stateless_media()->domain ); ?></p> |
| 172 |
<hr> |
| 173 |
|
| 174 |
<h4><?php _e( 'Domain', ud_get_stateless_media()->domain ); ?></h4> |
| 175 |
<p> |
| 176 |
<label for="bucket_folder_name"> |
| 177 |
<input name="sm[custom_domain]" ng-model="sm.custom_domain" type="text" id="bucket_folder_name" class="regular-text ltr" placeholder="storage.googleapis.com" ng-change="sm.generatePreviewUrl()" ng-disabled="sm.readonly.custom_domain"> |
| 178 |
</label> |
| 179 |
</p> |
| 180 |
<p class="description"> |
| 181 |
<strong ng-bind="sm.showNotice('custom_domain')" ></strong> <br> |
| 182 |
<?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.', ud_get_stateless_media()->domain ), 'https://cloud.google.com/storage/docs/xml-api/reference-uris#cname'); ?> |
| 183 |
</p> |
| 184 |
<hr> |
| 185 |
|
| 186 |
<?php if(!is_network_admin()): ?> |
| 187 |
<h4><?php _e( 'Organization', ud_get_stateless_media()->domain ); ?></h4> |
| 188 |
<p> |
| 189 |
<select id="org_url_grp" name="sm[organize_media]" ng-model="sm.organize_media" ng-change="sm.generatePreviewUrl()" ng-disabled="sm.readonly.organize_media"> |
| 190 |
<?php if(is_network_admin()): ?> |
| 191 |
<option value=""><?php _e( 'Don\'t override', ud_get_stateless_media()->domain ); ?></option> |
| 192 |
<?php endif; ?> |
| 193 |
<option value="1"><?php _e( 'Enable', ud_get_stateless_media()->domain ); ?></option> |
| 194 |
<option value=""><?php _e( 'Disable', ud_get_stateless_media()->domain ); ?></option> |
| 195 |
</select> |
| 196 |
</p> |
| 197 |
<p class="description"> |
| 198 |
<?php printf(__( 'Organize uploads into year and month based folders. This will update the <a href="%s">related WordPress media setting</a>.', ud_get_stateless_media()->domain ), admin_url("options-media.php")); ?> |
| 199 |
</p> |
| 200 |
<?php endif; ?> |
| 201 |
|
| 202 |
<hr> |
| 203 |
<h4><?php _e( 'Cache-Busting', ud_get_stateless_media()->domain ); ?></h4> |
| 204 |
<p> |
| 205 |
<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'"> |
| 206 |
<?php if(is_network_admin()): ?> |
| 207 |
<option value=""><?php _e( 'Don\'t override', ud_get_stateless_media()->domain ); ?></option> |
| 208 |
<?php endif; ?> |
| 209 |
<option value="true"><?php _e( 'Enable', ud_get_stateless_media()->domain ); ?></option> |
| 210 |
<option value="false"><?php _e( 'Disable', ud_get_stateless_media()->domain ); ?></option> |
| 211 |
</select> |
| 212 |
</p> |
| 213 |
<p class="description"><strong ng-bind="sm.showNotice('hashify_file_name')" ></strong> |
| 214 |
<span ng-show="sm.mode == 'stateless'"> |
| 215 |
<?php _e(sprintf( "<b>Required by Stateless Mode. Override with the <a href='%s' target='_blank'>WP_STATELESS_MEDIA_CACHE_CONTROL</a> constant.</b>","https://github.com/wpCloud/wp-stateless/wiki/Constants#wp_stateless_media_cache_control"), ud_get_stateless_media()->domain);?> |
| 216 |
</span> |
| 217 |
|
| 218 |
<?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> |
| 219 |
</fieldset> |
| 220 |
</td> |
| 221 |
</tr> |
| 222 |
</tbody> |
| 223 |
</table> |
| 224 |
|
| 225 |
|
| 226 |
<?php submit_button(); ?> |
| 227 |
</form> |
| 228 |
</div> |
| 229 |
<?php if(!is_network_admin()): ?> |
| 230 |
<div id="stless_sync_tab" class="stless_settings_content"> |
| 231 |
<?php include 'regenerate_interface.php'; ?> |
| 232 |
</div> |
| 233 |
<?php endif; ?> |
| 234 |
<div id="stless_compatibility_tab" class="stless_settings_content" ng-controller="wpStatelessCompatibility"> |
| 235 |
<div class="container-fluid"> |
| 236 |
<h2><?php _e("Enable or disable compatibility with other plugins.");?></h2> |
| 237 |
<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> |
| 238 |
<form method="post" action=""> |
| 239 |
<input type="hidden" name="action" value="stateless_modules"> |
| 240 |
<?php wp_nonce_field('wp-stateless-modules', '_smnonce');?> |
| 241 |
|
| 242 |
<table class="form-table"> |
| 243 |
<tr ng-repeat="module in modules"> |
| 244 |
<th> |
| 245 |
<label for="{{module.id}}">{{module.title}}</label> |
| 246 |
</th> |
| 247 |
<td> |
| 248 |
<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_network_admin"> |
| 249 |
<?php if(is_network_admin()): ?> |
| 250 |
<option value=""><?php _e("Don't override");?></option> |
| 251 |
<?php endif; ?> |
| 252 |
<option value="inactive" ng-show="module.enabled == 'inactive'"><?php _e( 'Not Available', ud_get_stateless_media()->domain ); ?></option> |
| 253 |
<option value="false"><?php _e( 'Disable', ud_get_stateless_media()->domain ); ?></option> |
| 254 |
<option value="true"><?php _e( 'Enable', ud_get_stateless_media()->domain ); ?></option> |
| 255 |
</select> |
| 256 |
<p class="description"> |
| 257 |
<strong ng-show="!module.is_plugin_active"><?php _e("Please activate the plugin first.");?></strong> |
| 258 |
<strong ng-show="module.is_constant"><?php _e("Currently configured via a constant.");?></strong> |
| 259 |
<strong ng-show="module.is_network_override"><?php _e("Currently configured via network settings.");?></strong> |
| 260 |
{{module.description}} |
| 261 |
</p> |
| 262 |
</td> |
| 263 |
</tr> |
| 264 |
</table> |
| 265 |
<?php submit_button(); ?> |
| 266 |
</form> |
| 267 |
</div> |
| 268 |
</div> |
| 269 |
<div id="stless_questions_tab" class="stless_settings_content"> |
| 270 |
<!--[if lte IE 8]> |
| 271 |
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"></script> |
| 272 |
<![endif]--> |
| 273 |
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script> |
| 274 |
<script> |
| 275 |
hbspt.forms.create({ |
| 276 |
portalId: '3453418', |
| 277 |
formId: 'cad1f6e1-7825-4e6d-a3e7-278c91abce7e', |
| 278 |
submitButtonClass: 'button button-primary', |
| 279 |
}); |
| 280 |
</script> |
| 281 |
</div> |
| 282 |
</div> |
| 283 |
|
| 284 |
</div> |