| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
die( 'You are not allowed to call this page directly.' ); |
| 4 |
} |
| 5 |
?> |
| 6 |
<div class="frm_wrap"> |
| 7 |
<?php |
| 8 |
FrmAppHelper::get_admin_header( |
| 9 |
array( |
| 10 |
'label' => __( 'Import/Export', 'formidable' ), |
| 11 |
) |
| 12 |
); |
| 13 |
?> |
| 14 |
<div class="wrap"> |
| 15 |
<?php include( FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php' ); ?> |
| 16 |
|
| 17 |
<h2 class="frm-h2"><?php esc_html_e( 'Import', 'formidable' ); ?></h2> |
| 18 |
<p class="howto"><?php echo esc_html( apply_filters( 'frm_upload_instructions1', __( 'Upload your Formidable XML file to import forms into this site. If your imported form key and creation date match a form on your site, that form will be updated.', 'formidable' ) ) ); ?></p> |
| 19 |
<br/> |
| 20 |
<form enctype="multipart/form-data" method="post"> |
| 21 |
<input type="hidden" name="frm_action" value="import_xml" /> |
| 22 |
<?php wp_nonce_field( 'import-xml-nonce', 'import-xml' ); ?> |
| 23 |
<p> |
| 24 |
<label> |
| 25 |
<?php echo esc_html( apply_filters( 'frm_upload_instructions2', __( 'Choose a Formidable XML file', 'formidable' ) ) ); ?> |
| 26 |
(<?php |
| 27 |
/* translators: %s: File size */ |
| 28 |
echo esc_html( sprintf( __( 'Maximum size: %s', 'formidable' ), ini_get( 'upload_max_filesize' ) ) ); |
| 29 |
?>) |
| 30 |
</label> |
| 31 |
<br/> |
| 32 |
<input type="file" name="frm_import_file" size="25" /> |
| 33 |
</p> |
| 34 |
|
| 35 |
<?php do_action( 'frm_csv_opts', $forms ); ?> |
| 36 |
|
| 37 |
<p class="submit"> |
| 38 |
<input type="submit" value="<?php esc_attr_e( 'Upload file and import', 'formidable' ); ?>" class="button-primary frm-button-primary" /> |
| 39 |
</p> |
| 40 |
</form> |
| 41 |
<?php FrmFormMigratorsHelper::maybe_show_download_link(); ?> |
| 42 |
<?php FrmTipsHelper::pro_tip( 'get_import_tip' ); ?> |
| 43 |
|
| 44 |
<?php do_action( 'frm_import_settings' ); ?> |
| 45 |
<br/><br/> |
| 46 |
<h2 class="frm-h2"><?php esc_html_e( 'Export', 'formidable' ); ?></h2> |
| 47 |
<p class="howto"> |
| 48 |
<?php echo esc_html( __( 'Export your forms, entries, views, and styles so you can easily import them on another site.', 'formidable' ) ); ?> |
| 49 |
</p> |
| 50 |
<form method="post" action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" id="frm_export_xml" class="frm-fields frm_grid_container"> |
| 51 |
<input type="hidden" name="action" value="frm_export_xml" /> |
| 52 |
<?php wp_nonce_field( 'export-xml-nonce', 'export-xml' ); ?> |
| 53 |
|
| 54 |
<p class="frm4 frm_form_field"> |
| 55 |
<label for="format"><?php esc_html_e( 'Export Format', 'formidable' ); ?></label> |
| 56 |
<select name="format"> |
| 57 |
<?php foreach ( $export_format as $t => $type ) { ?> |
| 58 |
<option value="<?php echo esc_attr( $t ); ?>" data-support="<?php echo esc_attr( $type['support'] ); ?>" <?php echo isset( $type['count'] ) ? 'data-count="' . esc_attr( $type['count'] ) . '"' : ''; ?>> |
| 59 |
<?php echo esc_html( isset( $type['name'] ) ? $type['name'] : $t ); ?> |
| 60 |
</option> |
| 61 |
<?php } ?> |
| 62 |
</select> |
| 63 |
</p> |
| 64 |
|
| 65 |
<p class="frm_hidden csv_opts export-filters frm4 frm_form_field"> |
| 66 |
<label for="csv_format" class="frm_help" title="<?php esc_attr_e( 'If your CSV special characters are not working correctly, try a different formatting option.', 'formidable' ); ?>"> |
| 67 |
<?php esc_html_e( 'CSV Encoding Format', 'formidable' ); ?> |
| 68 |
</label> |
| 69 |
<select name="csv_format"> |
| 70 |
<?php foreach ( FrmCSVExportHelper::csv_format_options() as $format ) { ?> |
| 71 |
<option value="<?php echo esc_attr( $format ); ?>"> |
| 72 |
<?php echo esc_html( $format ); ?> |
| 73 |
</option> |
| 74 |
<?php } ?> |
| 75 |
</select> |
| 76 |
</p> |
| 77 |
|
| 78 |
<p class="frm_hidden csv_opts export-filters frm4 frm_form_field"> |
| 79 |
<label for="csv_col_sep"> |
| 80 |
<?php esc_html_e( 'Column Separation', 'formidable' ); ?> |
| 81 |
</label> |
| 82 |
<input id="frm_csv_col_sep" name="csv_col_sep" value="," type="text" /> |
| 83 |
</p> |
| 84 |
|
| 85 |
<p id="frm_csv_data_export" class="xml_opts"> |
| 86 |
<label><?php esc_html_e( 'Include the following in the export file', 'formidable' ); ?></label> |
| 87 |
<?php foreach ( $export_types as $t => $type ) { ?> |
| 88 |
<label class="frm_inline_label"> |
| 89 |
<input type="checkbox" name="type[]" value="<?php echo esc_attr( $t ); ?>"/> |
| 90 |
<?php echo esc_html( $type ); ?> |
| 91 |
</label> |
| 92 |
<?php } ?> |
| 93 |
</p> |
| 94 |
|
| 95 |
<div class="frm-table-box"> |
| 96 |
<p class="alignleft" style="margin-bottom:0;"> |
| 97 |
<label class="xml_opts"> |
| 98 |
<?php esc_html_e( 'Select Form(s)', 'formidable' ); ?> |
| 99 |
</label> |
| 100 |
<label class="csv_opts frm_hidden"> |
| 101 |
<?php esc_html_e( 'Select a Form', 'formidable' ); ?> |
| 102 |
</label> |
| 103 |
</p> |
| 104 |
<?php |
| 105 |
FrmAppHelper::show_search_box( |
| 106 |
array( |
| 107 |
'input_id' => 'template', |
| 108 |
'placeholder' => __( 'Search Forms', 'formidable' ), |
| 109 |
'tosearch' => 'frm-row', |
| 110 |
) |
| 111 |
); |
| 112 |
?> |
| 113 |
<div class="frm-scroll-box"> |
| 114 |
<table class="widefat striped frm-border frm_no_top_margin"> |
| 115 |
<thead> |
| 116 |
<tr> |
| 117 |
<td class="column-cb check-column"></td> |
| 118 |
<td><?php esc_html_e( 'Form Title', 'formidable' ); ?></td> |
| 119 |
<td><?php esc_html_e( 'ID / Form Key', 'formidable' ); ?></td> |
| 120 |
<td><?php esc_html_e( 'Type', 'formidable' ); ?></td> |
| 121 |
<td class="column-entries"><?php esc_html_e( 'Entries', 'formidable' ); ?></td> |
| 122 |
<td class="column-entries"><?php esc_html_e( 'Style', 'formidable' ); ?></td> |
| 123 |
</tr> |
| 124 |
</thead> |
| 125 |
<tbody> |
| 126 |
<?php foreach ( $forms as $form ) { ?> |
| 127 |
<tr class="frm-row"> |
| 128 |
<td> |
| 129 |
<input type="checkbox" name="frm_export_forms[]" value="<?php echo esc_attr( $form->id ); ?>" id="export_form_<?php echo esc_attr( $form->id ); ?>" /> |
| 130 |
</td> |
| 131 |
<td> |
| 132 |
<label for="export_form_<?php echo esc_attr( $form->id ); ?>"> |
| 133 |
<?php echo esc_html( '' === $form->name ? __( '(no title)', 'formidable' ) : $form->name ); ?> |
| 134 |
</label> |
| 135 |
</td> |
| 136 |
<td> |
| 137 |
<?php echo esc_html( $form->id ); ?> / <?php echo esc_html( $form->form_key ); ?> |
| 138 |
</td> |
| 139 |
<td> |
| 140 |
<?php |
| 141 |
if ( $form->is_template ) { |
| 142 |
esc_html_e( 'Template', 'formidable' ); |
| 143 |
} elseif ( $form->parent_form_id ) { |
| 144 |
echo esc_html( |
| 145 |
sprintf( |
| 146 |
/* translators: %1$s: Form name */ |
| 147 |
__( 'Child Form (%1$s)', 'formidable' ), |
| 148 |
$form->parent_form_id |
| 149 |
) |
| 150 |
); |
| 151 |
} else { |
| 152 |
esc_html_e( 'Form', 'formidable' ); |
| 153 |
} |
| 154 |
?> |
| 155 |
</td> |
| 156 |
<td class="column-entries"> |
| 157 |
<a href="<?php echo esc_url( admin_url( 'admin.php?page=formidable-entries&form=' . absint( $form->id ) ) ); ?>" target="_blank"> |
| 158 |
<?php echo absint( FrmEntry::getRecordCount( $form->id ) ); ?> |
| 159 |
</a> |
| 160 |
</td> |
| 161 |
<td class="column-entries"> |
| 162 |
<?php |
| 163 |
$style = isset( $form->options['custom_style'] ) ? $form->options['custom_style'] : 1; |
| 164 |
if ( empty( $style ) ) { |
| 165 |
echo '0'; |
| 166 |
} else { |
| 167 |
echo '1'; |
| 168 |
} |
| 169 |
?> |
| 170 |
</td> |
| 171 |
</tr> |
| 172 |
<?php } ?> |
| 173 |
</tbody> |
| 174 |
</table> |
| 175 |
</div> |
| 176 |
</div> |
| 177 |
|
| 178 |
<p class="submit"> |
| 179 |
<input type="submit" value="<?php esc_attr_e( 'Export Selection', 'formidable' ); ?>" class="button-primary frm-button-primary" /> |
| 180 |
</p> |
| 181 |
</form> |
| 182 |
|
| 183 |
<?php do_action( 'frm_page_footer', array( 'table' => 'export' ) ); ?> |
| 184 |
</div> |
| 185 |
</div> |
| 186 |
|