PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 3.9.6
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v3.9.6
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 / import-export.php

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

76 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 Description: Adds a PB subpage where you can Import and Export settings of Profile Builder.
4 */
5
6 /* include content of Import and Export tabs */
7 require_once 'pbie-import.php';
8 require_once 'pbie-export.php';
9
10 /* add submenu page */
11 add_action( 'admin_menu', 'wppb_pbie_register_submenu_page', 18 );
12
13 function wppb_pbie_register_submenu_page() {
14 add_submenu_page( 'profile-builder', __( 'Import and Export', 'profile-builder' ), __( 'Import and Export', 'profile-builder' ), 'manage_options', 'pbie-import-export', 'wppb_pbie_submenu_page_callback' );
15 }
16
17 function wppb_pbie_submenu_page_callback() {
18 wppb_pbie_page();
19 }
20
21 /**
22 * adds Import and Export tab
23 *
24 * @param string $current tab to display. default 'import'.
25 */
26 function wppb_pbie_tabs( $current = 'import' ) {
27 $tabs = array(
28 'import' => __( 'Import', 'profile-builder' ),
29 'export' => __( 'Export', 'profile-builder' )
30 );
31
32 echo '<h2 class="nav-tab-wrapper">';
33 foreach( $tabs as $tab => $name ) {
34 $class = ( $tab == $current ) ? ' nav-tab-active' : '';
35 echo "<a class='nav-tab". esc_attr( $class )."' href='?page=pbie-import-export&tab=". esc_attr( $tab ) ."'>". esc_html( $name ) ."</a>";
36 }
37 echo '</h2>';
38 }
39
40 /* PB Import and Export subpage content function */
41 function wppb_pbie_page() {
42 global $pagenow;
43
44 ?>
45 <div class="wrap">
46 <?php
47 echo '<h2>';
48 esc_html_e( 'Import and Export', 'profile-builder' );
49 echo '<a href="https://www.cozmoslabs.com/docs/profile-builder-2/add-ons/import-export-pb-settings/?utm_source=wpbackend&utm_medium=pb-documentation&utm_campaign=PBDocs" target="_blank" data-code="f223" class="wppb-docs-link dashicons dashicons-editor-help" style="margin-left: 5px;"></a>';
50 echo '</h2>';
51
52 if( isset ( $_GET['tab'] ) ) wppb_pbie_tabs( sanitize_text_field( $_GET['tab'] ) );
53 else wppb_pbie_tabs( 'import' );
54 ?>
55
56 <form method="post" action="<?php admin_url( 'admin.php?page=pbie-import-export' ); ?>" enctype= "multipart/form-data">
57 <?php
58 if( $pagenow == 'admin.php' && isset( $_GET['page'] ) && $_GET['page'] === 'pbie-import-export' ) {
59 if( isset ( $_GET['tab'] ) ) $tab = sanitize_text_field( $_GET['tab'] );
60 else $tab = 'import';
61
62 switch ( $tab ) {
63 case 'export' :
64 wppb_pbie_export();
65 break;
66 case 'import' :
67 wppb_pbie_import();
68 break;
69 }
70 }
71 ?>
72 </form>
73 </div>
74 <?php
75 }
76