PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 3.9.9
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v3.9.9
4.0.3 4.0.2 4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 341 releases
profile-builder / add-ons-free / import-export / pbie-import.php

pbie-import.php in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 3.9.9, at add-ons-free/import-export/pbie-import.php

53 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /* include import class */
4 require_once 'inc/class-pbie-import.php';
5
6 /* Import tab content function */
7 function wppb_pbie_import() {
8
9 if( isset( $_POST['cozmos-import'] ) && isset( $_POST['wppb_nonce'] ) && wp_verify_nonce( sanitize_text_field( $_POST['wppb_nonce'] ), 'wppb_import_setttings' ) ) {
10 if( isset( $_FILES['cozmos-upload'] ) ) {
11 $pbie_cpts = array(
12 'wppb-ul-cpt',
13 'wppb-rf-cpt',
14 'wppb-epf-cpt'
15 );
16
17 $pbie_json_upload = new WPPB_ImpEx_Import( $pbie_cpts );
18 $pbie_json_upload->upload_json_file();
19 /* show error/success messages */
20 $pbie_messages = $pbie_json_upload->get_messages();
21 foreach ( $pbie_messages as $pbie_message ) {
22 echo '<div id="message" class=';
23 echo esc_attr( $pbie_message['type'] );
24 echo '>';
25 echo '<p>';
26 echo esc_html( $pbie_message['message'] );
27 echo '</p>';
28 echo '</div>';
29 }
30 }
31 }
32 ?>
33 <div class="cozmoslabs-form-subsection-wrapper">
34 <h4 class="cozmoslabs-subsection-title"><?php esc_html_e( 'Import Profile Builder Options', 'profile-builder' ); ?></h4>
35 <p class="cozmoslabs-description"><?php esc_html_e( 'This allows you to easily import the configuration from another site.', 'profile-builder' ); ?></p>
36
37 <form name="cozmos-upload" method="post" action="" enctype= "multipart/form-data">
38 <input type="hidden" name="wppb_nonce" value="<?php echo esc_attr( wp_create_nonce( 'wppb_import_setttings' ) ); ?>" />
39
40 <div class="cozmoslabs-form-field-wrapper">
41 <label class="cozmoslabs-form-field-label"><?php esc_html_e('JSON File', 'profile-builder'); ?></label>
42 <input type="file" name="cozmos-upload" value="cozmos-upload" id="cozmos-upload" />
43 </div>
44
45 <div class="cozmoslabs-form-field-wrapper">
46 <label class="cozmoslabs-form-field-label"><?php esc_html_e('Import Options', 'profile-builder'); ?></label>
47 <input class="button-secondary" type="submit" name="cozmos-import" value=<?php esc_html_e( 'Import', 'profile-builder' ); ?> id="cozmos-import" onclick="return confirm( '<?php esc_html_e( 'This will overwrite your old PB settings! Are you sure you want to continue?', 'profile-builder' ); ?>' )" />
48 <p class="cozmoslabs-description cozmoslabs-description-space-left"><?php esc_html_e( 'Import Profile Builder options from the JSON file selected above.', 'profile-builder' ); ?></p>
49 </div>
50 </form>
51 </div>
52 <?php
53 }