/** * Create our settings page output. * * @since 1.0.0 * * @return string HTML output for the page. */ function cptui_importexport() { if (!empty($_GET)) { if (!empty($_GET['action']) && 'taxonomies' == $_GET['action']) { $tab = 'taxonomies'; } elseif (!empty($_GET['action']) && 'get_code' == $_GET['action']) { $tab = 'get_code'; } elseif (!empty($_GET['action']) && 'debuginfo' == $_GET['action']) { $tab = 'debuginfo'; } else { $tab = 'post_types'; } } if (!empty($_POST)) { $notice = cptui_import_types_taxes_settings($_POST); } if (isset($notice)) { echo $notice; } echo '<div class="wrap">'; # Create our tabs. cptui_settings_tab_menu($page = 'importexport'); do_action('cptui_import_export_sections', $tab); echo '</div><!-- End .wrap -->'; }
/** * Create our settings page output. * * @since 1.0.0 * * @internal * * @return string HTML output for the page. */ function cptui_importexport() { $tab = ''; if (!empty($_GET)) { if (!empty($_GET['action']) && 'taxonomies' == $_GET['action']) { $tab = 'taxonomies'; } elseif (!empty($_GET['action']) && 'get_code' == $_GET['action']) { $tab = 'get_code'; } elseif (!empty($_GET['action']) && 'debuginfo' == $_GET['action']) { $tab = 'debuginfo'; } else { $tab = 'post_types'; } } if (!empty($_POST)) { $notice = cptui_import_types_taxes_settings($_POST); } if (isset($notice)) { echo $notice; } echo '<div class="wrap">'; /** * Fires right inside the wrap div for the import/export pages. * * @since 1.3.0 */ do_action('cptui_inside_importexport_wrap'); // Create our tabs. cptui_settings_tab_menu($page = 'importexport'); /** * Fires inside the markup for the import/export section. * * Allows for more modular control and adding more sections more easily. * * @since 1.2.0 * * @param string $tab Current tab being displayed. */ do_action('cptui_import_export_sections', $tab); echo '</div><!-- End .wrap -->'; }
/** * Create our settings page output. * * @since 1.0.0 * * @return string HTML output for the page. */ function cptui_importexport() { if (!empty($_GET)) { if (!empty($_GET['action']) && 'taxonomies' == $_GET['action']) { $tab = 'taxonomies'; } elseif (!empty($_GET['action']) && 'get_code' == $_GET['action']) { $tab = 'get_code'; } else { $tab = 'post_types'; } } if (!empty($_POST)) { $notice = cptui_import_types_taxes_settings($_POST); } if (isset($notice)) { echo $notice; } echo '<div class="wrap">'; # Create our tabs. cptui_settings_tab_menu($page = 'importexport'); if (isset($tab) && ('post_types' == $tab || 'taxonomies' == $tab)) { ?> <p><?php _e('If you are wanting to migrate registered post types or taxonomies from this site to another, that will also use Custom Post Type UI, use the import and export functionality. If you are moving away from Custom Post Type UI, use the information in the "Get Code" tab.', 'cpt-plugin'); ?> </p> <p><?php printf('<strong>%s</strong>: %s', __('NOTE', 'cpt-plugin'), __('This will not export the associated posts, just the settings.', 'cpt-plugin')); ?> </p> <table class="form-table cptui-table"> <?php if (!empty($_GET) && empty($_GET['action'])) { ?> <tr> <td> <h3><?php _e('Import Post Types', 'cpt-plugin'); ?> </h3> <form method="post"> <textarea class="cptui_post_import" placeholder="<?php esc_attr_e('Paste content here.', 'cpt-plugin'); ?> " name="cptui_post_import"></textarea> <p class="wp-ui-highlight"><strong><?php _e('Note:', 'cpt-plugin'); ?> </strong> <?php _e('Importing will overwrite previous registered settings.', 'cpt-plugin'); ?> </p> <p><strong><?php _e('To import post types from a different WordPress site, paste the exported content from that site and click the "Import" button.', 'cpt-plugin'); ?> </strong></p> <p><input class="button button-primary" type="submit" value="<?php esc_attr_e('Import', 'cpt-plugin'); ?> "/></p> </form> </td> <td> <h3><?php _e('Export Post Types', 'cpt-plugin'); ?> </h3> <?php $cptui_post_types = get_option('cptui_post_types', array()); if (!empty($cptui_post_types)) { $content = esc_html(json_encode($cptui_post_types)); } else { $content = __('No post types registered yet.', 'cpt-plugin'); } ?> <textarea title="<?php esc_attr_e('To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'cpt-plugin'); ?> " onclick="this.focus();this.select()" readonly="readonly" class="cptui_post_import"><?php echo $content; ?> </textarea> <p><strong><?php _e('Use the content above to import current post types into a different WordPress site. You can also use this to simply back up your post type settings.', 'cpt-plugin'); ?> </strong></p> </td> </tr> <?php } elseif (!empty($_GET) && 'taxonomies' == $_GET['action']) { ?> <tr> <td> <h3><?php _e('Import Taxonomies', 'cpt-plugin'); ?> </h3> <form method="post"> <textarea class="cptui_tax_import" placeholder="<?php esc_attr_e('Paste content here.', 'cpt-plugin'); ?> " name="cptui_tax_import"></textarea> <p class="wp-ui-highlight"><strong><?php _e('Note:', 'cpt-plugin'); ?> </strong> <?php _e('Importing will overwrite previous registered settings.', 'cpt-plugin'); ?> </p> <p><strong><?php _e('To import taxonomies from a different WordPress site, paste the exported content from that site and click the "Import" button.', 'cpt-plugin'); ?> </strong></p> <p><input class="button button-primary" type="submit" value="<?php esc_attr_e('Import', 'cpt-plugin'); ?> "/></p> </form> </td> <td> <h3><?php _e('Export Taxonomies', 'cpt-plugin'); ?> </h3> <?php $cptui_taxonomies = get_option('cptui_taxonomies', array()); if (!empty($cptui_taxonomies)) { $content = esc_html(json_encode($cptui_taxonomies)); } else { $content = __('No taxonomies registered yet.', 'cpt-plugin'); } ?> <textarea title="<?php esc_attr_e('To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'cpt-plugin'); ?> " onclick="this.focus();this.select()" readonly="readonly" class="cptui_tax_import"><?php echo $content; ?> </textarea> <p><strong><?php _e('Use the content above to import current taxonomies into a different WordPress site. You can also use this to simply back up your taxonomy settings.', 'cpt-plugin'); ?> </strong></p> </td> </tr> <?php } ?> </table> <?php } else { ?> <h2><?php _e('Get Post Type and Taxonomy Code', 'cpt-plugin'); ?> </h2> <h3><?php _e('All CPT UI Post Types', 'cpt-plugin'); ?> </h3> <label for="cptui_post_type_get_code"><?php _e('Copy/paste the code below into your functions.php file.', 'cpt-plugin'); ?> </label> <textarea name="cptui_post_type_get_code" id="cptui_post_type_get_code" class="cptui_post_type_get_code" onclick="this.focus();this.select()" readonly="readonly"><?php cptui_get_post_type_code(); ?> </textarea> <h3><?php _e('All CPT UI Taxonomies', 'cpt-plugin'); ?> </h3> <label for="cptui_tax_get_code"><?php _e('Copy/paste the code below into your functions.php file.', 'cpt-plugin'); ?> </label> <textarea name="cptui_tax_get_code" id="cptui_tax_get_code" class="cptui_tax_get_code" onclick="this.focus();this.select()" readonly="readonly"><?php cptui_get_taxonomy_code(); ?> </textarea> <?php } echo '</div><!-- End .wrap -->'; }