PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 4.0.1
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v4.0.1
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 4.0.1, at add-ons-free/import-export/import-export.php

89 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // Exit if accessed directly
3 if ( ! defined( 'ABSPATH' ) ) exit;
4
5 /*
6 Description: Adds a PB subpage where you can Import and Export settings of Profile Builder.
7 */
8
9 /* include content of Import and Export tabs */
10 require_once 'pbie-import.php';
11 require_once 'pbie-export.php';
12
13 /* add submenu page */
14 add_action( 'admin_menu', 'wppb_pbie_register_submenu_page', 18 );
15
16 function wppb_pbie_register_submenu_page() {
17 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' );
18 }
19
20 function wppb_pbie_submenu_page_callback() {
21 wppb_pbie_page();
22 }
23
24 /**
25 * adds Import and Export tab
26 *
27 * @param string $current tab to display. default 'import'.
28 */
29 function wppb_pbie_tabs( $current = 'import' ) {
30 $tabs = array(
31 'import' => __( 'Import', 'profile-builder' ),
32 'export' => __( 'Export', 'profile-builder' )
33 );
34
35 echo '<nav class="nav-tab-wrapper cozmoslabs-nav-tab-wrapper">';
36 foreach( $tabs as $tab => $name ) {
37 $class = ( $tab == $current ) ? ' nav-tab-active' : '';
38 echo "<a class='nav-tab". esc_attr( $class )."' href='?page=pbie-import-export&tab=". esc_attr( $tab ) ."'>". esc_html( $name ) ."</a>";
39 }
40 echo '</nav>';
41 }
42
43 /* PB Import and Export subpage content function */
44 function wppb_pbie_page() {
45 global $pagenow;
46
47 ?>
48 <div class="wrap cozmoslabs-wrap">
49
50 <h1></h1>
51 <!-- WordPress Notices are added after the h1 tag -->
52
53 <div class="cozmoslabs-page-header">
54 <div class="cozmoslabs-section-title">
55
56 <h2 class="cozmoslabs-page-title">
57 <?php esc_html_e( 'Import and Export', 'profile-builder' ); ?>
58 <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>
59 </h2>
60
61 </div>
62 </div>
63
64 <?php
65 if( isset ( $_GET['tab'] ) ) wppb_pbie_tabs( sanitize_text_field( $_GET['tab'] ) );
66 else wppb_pbie_tabs( 'import' );
67 ?>
68
69 <form method="post" action="<?php admin_url( 'admin.php?page=pbie-import-export' ); ?>" enctype= "multipart/form-data">
70 <?php
71 if( $pagenow == 'admin.php' && isset( $_GET['page'] ) && $_GET['page'] === 'pbie-import-export' ) {
72 if( isset ( $_GET['tab'] ) ) $tab = sanitize_text_field( $_GET['tab'] );
73 else $tab = 'import';
74
75 switch ( $tab ) {
76 case 'export' :
77 wppb_pbie_export();
78 break;
79 case 'import' :
80 wppb_pbie_import();
81 break;
82 }
83 }
84 ?>
85 </form>
86 </div>
87 <?php
88 }
89