| 1 |
<p> |
| 2 |
<?php _e( 'To import content from your Substack Newsletter, upload an export zip file below.', 'substack-importer' ); ?> |
| 3 |
</p> |
| 4 |
<p> |
| 5 |
<a target="_blank" href="https://support.substack.com/hc/en-us/articles/360037466012-How-do-I-export-my-posts"> |
| 6 |
<?php _e( 'How to get an export file from Substack.', 'substack-importer' ); ?> |
| 7 |
</a> |
| 8 |
</p> |
| 9 |
|
| 10 |
<?php if ( $progress ) : ?> |
| 11 |
<p class="notice"> |
| 12 |
<?php printf( __( 'An import is already in progess, you can start a new import or <a href="%s">continue the previous import</a>', 'substack-importer' ), admin_url( 'admin.php?import=substack&action=progress' ) ); ?> |
| 13 |
</p> |
| 14 |
<?php endif; ?> |
| 15 |
|
| 16 |
<?php if ( ! empty( $error ) ) : ?> |
| 17 |
<p><strong><?php _e( 'Sorry, there has been an error.', 'substack-importer' ); ?></strong> |
| 18 |
<p class="notice notice-error"><?php echo $error; ?></p> |
| 19 |
<?php endif; ?> |
| 20 |
|
| 21 |
<?php |
| 22 |
wp_import_upload_form( |
| 23 |
add_query_arg( |
| 24 |
array( |
| 25 |
'action' => 'upload', |
| 26 |
'noheader' => 1, |
| 27 |
) |
| 28 |
) |
| 29 |
); |
| 30 |
?> |
| 31 |
|
| 32 |
|
| 33 |
<script> |
| 34 |
let url_input_container = document.createElement('p'); |
| 35 |
let url_input_label = document.createElement('label'); |
| 36 |
url_input_label.appendChild(document.createTextNode('<?php _e( 'Substack Newsletter Url (Recommended):', 'substack-importer' ); ?>')); |
| 37 |
url_input_label.setAttribute('for', 'substack-url'); |
| 38 |
|
| 39 |
let explanation = document.createElement('p'); |
| 40 |
explanation.classList.add('explanation'); |
| 41 |
explanation.appendChild(document.createTextNode('<?php esc_html_e( 'The Substack Newsletter Url is needed to import comments and author information.', 'substack-importer' ); ?>')) |
| 42 |
|
| 43 |
url_input_container.appendChild(explanation); |
| 44 |
|
| 45 |
let url_input = document.createElement('input'); |
| 46 |
url_input.setAttribute('name', 'substack-url'); |
| 47 |
url_input.setAttribute('id', 'substack-url'); |
| 48 |
url_input.setAttribute('type', 'text'); |
| 49 |
url_input.setAttribute('placeholder', 'eg: https://example.substack.com'); |
| 50 |
|
| 51 |
let note = document.createElement('p'); |
| 52 |
note.classList.add('note'); |
| 53 |
note.appendChild(document.createTextNode("<?php _e( "If you don't know the URL or the Substack Newsletter no longer exists, you can leave the field empty.", 'substack-importer' ); ?>")); |
| 54 |
|
| 55 |
url_input_container.appendChild(url_input_label); |
| 56 |
url_input_container.appendChild(explanation); |
| 57 |
url_input_container.appendChild(url_input) |
| 58 |
url_input_container.appendChild(note); |
| 59 |
|
| 60 |
let form = document.querySelector('#import-upload-form p:first-child'); |
| 61 |
form.appendChild(url_input_container); |
| 62 |
|
| 63 |
let file_input = document.getElementById('upload'); |
| 64 |
upload.setAttribute('accept', '.zip'); |
| 65 |
|
| 66 |
document.querySelector('label[for="upload"]').textContent = '<?php _e( 'Pick a Substack export file from your computer', 'substack-importer' ); ?>' |
| 67 |
</script> |
| 68 |
|