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 / import-export.php

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

86 lines 2.6 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 '<nav class="nav-tab-wrapper cozmoslabs-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 '</nav>';
38 }
39
40 /* PB Import and Export subpage content function */
41 function wppb_pbie_page() {
42 global $pagenow;
43
44 ?>
45 <div class="wrap cozmoslabs-wrap">
46
47 <h1></h1>
48 <!-- WordPress Notices are added after the h1 tag -->
49
50 <div class="cozmoslabs-page-header">
51 <div class="cozmoslabs-section-title">
52
53 <h2 class="cozmoslabs-page-title">
54 <?php esc_html_e( 'Import and Export', 'profile-builder' ); ?>
55 <a href="https://www.cozmoslabs.com/docs/profile-builder/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>
56 </h2>
57
58 </div>
59 </div>
60
61 <?php
62 if( isset ( $_GET['tab'] ) ) wppb_pbie_tabs( sanitize_text_field( $_GET['tab'] ) );
63 else wppb_pbie_tabs( 'import' );
64 ?>
65
66 <form method="post" action="<?php admin_url( 'admin.php?page=pbie-import-export' ); ?>" enctype= "multipart/form-data">
67 <?php
68 if( $pagenow == 'admin.php' && isset( $_GET['page'] ) && $_GET['page'] === 'pbie-import-export' ) {
69 if( isset ( $_GET['tab'] ) ) $tab = sanitize_text_field( $_GET['tab'] );
70 else $tab = 'import';
71
72 switch ( $tab ) {
73 case 'export' :
74 wppb_pbie_export();
75 break;
76 case 'import' :
77 wppb_pbie_import();
78 break;
79 }
80 }
81 ?>
82 </form>
83 </div>
84 <?php
85 }
86