コード例 #1
0
ファイル: import_export.php プロジェクト: Aqro/NewDWM
/**
 * 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 -->';
}
コード例 #2
0
ファイル: taxonomies.php プロジェクト: Allan019/grupometa
/**
 * Create our settings page output.
 *
 * @since 1.0.0
 *
 * @return string HTML output for the page.
 */
function cptui_manage_taxonomies()
{
    if (!empty($_POST)) {
        if (isset($_POST['cpt_submit'])) {
            check_admin_referer('cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field');
            $notice = cptui_update_taxonomy($_POST);
        } elseif (isset($_POST['cpt_delete'])) {
            check_admin_referer('cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field');
            $notice = cptui_delete_taxonomy($_POST);
        }
    }
    $tab = !empty($_GET) && !empty($_GET['action']) && 'edit' == $_GET['action'] ? 'edit' : 'new';
    ?>

	<div class="wrap">

	<?php 
    if (isset($notice)) {
        echo $notice;
    }
    # Create our tabs.
    cptui_settings_tab_menu($page = 'taxonomies');
    if ('edit' == $tab) {
        $taxonomies = get_option('cptui_taxonomies');
        $selected_taxonomy = cptui_get_current_taxonomy();
        if ($selected_taxonomy) {
            if (array_key_exists($selected_taxonomy, $taxonomies)) {
                $current = $taxonomies[$selected_taxonomy];
            }
        }
    }
    $ui = new cptui_admin_ui();
    # Will only be set if we're already on the edit screen
    if (!empty($taxonomies)) {
        ?>
		<form id="cptui_select_taxonomy" method="post">
			<p><?php 
        _e('Select a taxonomy to edit. DO NOT EDIT the taxonomy slug unless necessary. Changing that value registers a new taxonomy entry for your install.', 'cpt-plugin');
        ?>
</p>
			<?php 
        cptui_taxonomies_dropdown($taxonomies);
        ?>
			<input type="submit" class="button-secondary" name="cptui_select_taxonomy_submit" value="<?php 
        echo esc_attr(apply_filters('cptui_taxonomy_submit_select', __('Select', 'cpt-plugin')));
        ?>
" />
		</form>
	<?php 
    }
    ?>

	<form method="post">
		<table class="form-table cptui-table">
			<tr>
				<td><!--LEFT SIDE-->
					<table>
						<?php 
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_tax', 'name' => 'name', 'textvalue' => isset($current['name']) ? esc_attr($current['name']) : '', 'maxlength' => '32', 'onblur' => 'this.value=this.value.toLowerCase()', 'labeltext' => __('Taxonomy Slug', 'cpt-plugin'), 'aftertext' => __('(e.g. actors)', 'cpt-plugin'), 'helptext' => esc_attr__('The taxonomy name. Used to retrieve custom taxonomy content. Should be short and unique', 'cpt-plugin'), 'required' => true));
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_tax', 'name' => 'label', 'textvalue' => isset($current['label']) ? esc_attr($current['label']) : '', 'aftertext' => __('(e.g. Actors)', 'cpt-plugin'), 'labeltext' => __('Plural Label', 'cpt-plugin'), 'helptext' => esc_attr__('Taxonomy label. Used in the admin menu for displaying custom taxonomy.', 'cpt-plugin')));
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_tax', 'name' => 'singular_label', 'textvalue' => isset($current['singular_label']) ? esc_attr($current['singular_label']) : '', 'aftertext' => __('(e.g. Actor)', 'cpt-plugin'), 'labeltext' => __('Singular Label', 'cpt-plugin'), 'helptext' => esc_attr__('Taxonomy Singular label.  Used in WordPress when a singular label is needed.', 'cpt-plugin')));
    echo $ui->get_tr_start() . $ui->get_th_start() . __('Attach to Post Type', 'cpt-plugin') . $ui->get_required();
    echo $ui->get_th_end() . $ui->get_td_start();
    /**
     * Filters the arguments for post types to list for taxonomy association.
     *
     * @since 1.0.0
     *
     * @param array $value Array of default arguments.
     */
    $args = apply_filters('cptui_attach_post_types_to_taxonomy', array('public' => true));
    # If they don't return an array, fall back to the original default. Don't need to check for empty, because empty array is default for $args param in get_post_types anyway.
    if (!is_array($args)) {
        $args = array('public' => true);
    }
    $output = 'objects';
    # or objects
    $post_types = get_post_types($args, $output);
    foreach ($post_types as $post_type) {
        /*
         * Supports Taxonomies Checkbox
         */
        echo $ui->get_check_input(array('checkvalue' => $post_type->name, 'checked' => !empty($current['object_types']) && is_array($current['object_types']) && in_array($post_type->name, $current['object_types']) ? 'true' : 'false', 'name' => $post_type->name, 'namearray' => 'cpt_post_types', 'textvalue' => $post_type->name, 'labeltext' => $post_type->label, 'helptext' => sprintf(esc_attr__('Adds %s support', 'cpt-plugin'), $post_type->label), 'wrap' => false));
    }
    echo $ui->get_td_end() . $ui->get_tr_end();
    ?>
					</table>
				<p class="submit">
					<?php 
    wp_nonce_field('cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field');
    if (!empty($_GET) && !empty($_GET['action']) && 'edit' == $_GET['action']) {
        ?>
						<input type="submit" class="button-primary" name="cpt_submit" value="<?php 
        echo esc_attr(apply_filters('cptui_taxonomy_submit_edit', __('Edit Taxonomy', 'cpt-plugin')));
        ?>
" />
						<input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php 
        echo apply_filters('cptui_taxonomy_submit_delete', __('Delete Taxonomy', 'cpt-plugin'));
        ?>
" />
					<?php 
    } else {
        ?>
						<input type="submit" class="button-primary" name="cpt_submit" value="<?php 
        echo esc_attr(apply_filters('cptui_taxonomy_submit_add', __('Add Taxonomy', 'cpt-plugin')));
        ?>
" />
					<?php 
    }
    ?>
					<input type="hidden" name="cpt_tax_status" id="cpt_tax_status" value="<?php 
    echo $tab;
    ?>
" />
				</p>
			</td>
			<td>
				<p><?php 
    _e('Click headings to reveal available options.', 'cpt-plugin');
    ?>
</p>

				<div id="cptui_accordion">
					<h3 title="<?php 
    esc_attr_e('Click to expand', 'cpt-plugin');
    ?>
"><?php 
    _e('Labels', 'cpt-plugin');
    ?>
</h3>
						<div>
							<table>
							<?php 
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'menu_name', 'textvalue' => isset($current['labels']['menu_name']) ? esc_attr($current['labels']['menu_name']) : '', 'aftertext' => __('(e.g. Actors)', 'cpt-plugin'), 'labeltext' => __('Menu Name', 'cpt-plugin'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'all_items', 'textvalue' => isset($current['labels']['all_items']) ? esc_attr($current['labels']['all_items']) : '', 'aftertext' => __('(e.g. All Actors)', 'cpt-plugin'), 'labeltext' => __('All Items', 'cpt-plugin'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'edit_item', 'textvalue' => isset($current['labels']['edit_item']) ? esc_attr($current['labels']['edit_item']) : '', 'aftertext' => __('(e.g. Edit Actor)', 'cpt-plugin'), 'labeltext' => __('Edit Item', 'cpt-plugin'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'view_item', 'textvalue' => isset($current['labels']['view_item']) ? esc_attr($current['labels']['view_item']) : '', 'aftertext' => __('(e.g. View Actor)', 'cpt-plugin'), 'labeltext' => __('View Item', 'cpt-plugin'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'update_item', 'textvalue' => isset($current['labels']['update_item']) ? esc_attr($current['labels']['update_item']) : '', 'aftertext' => __('(e.g. Update Actor Name)', 'cpt-plugin'), 'labeltext' => __('Update Item Name', 'cpt-plugin'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'add_new_item', 'textvalue' => isset($current['labels']['add_new_item']) ? esc_attr($current['labels']['add_new_item']) : '', 'aftertext' => __('(e.g. Add New Actor)', 'cpt-plugin'), 'labeltext' => __('Add New Item', 'cpt-plugin'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'new_item_name', 'textvalue' => isset($current['labels']['new_item_name']) ? esc_attr($current['labels']['new_item_name']) : '', 'aftertext' => __('(e.g. New Actor Name)', 'cpt-plugin'), 'labeltext' => __('New Item Name', 'cpt-plugin'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'parent_item', 'textvalue' => isset($current['labels']['parent_item']) ? esc_attr($current['labels']['parent_item']) : '', 'aftertext' => __('(e.g. Parent Actor)', 'cpt-plugin'), 'labeltext' => __('Parent Item', 'cpt-plugin'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'parent_item_colon', 'textvalue' => isset($current['labels']['parent_item_colon']) ? esc_attr($current['labels']['parent_item_colon']) : '', 'aftertext' => __('(e.g. Parent Actor:)', 'cpt-plugin'), 'labeltext' => __('Parent Item Colon', 'cpt-plugin'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'search_items', 'textvalue' => isset($current['labels']['search_items']) ? esc_attr($current['labels']['search_items']) : '', 'aftertext' => __('(e.g. Search Actors)', 'cpt-plugin'), 'labeltext' => __('Search Items', 'cpt-plugin'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'popular_items', 'textvalue' => isset($current['labels']['popular_items']) ? esc_attr($current['labels']['popular_items']) : null, 'aftertext' => __('(e.g. Popular Actors)', 'cpt-plugin'), 'labeltext' => __('Popular Items', 'cpt-plugin'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'separate_items_with_commas', 'textvalue' => isset($current['labels']['separate_items_with_commas']) ? esc_attr($current['labels']['separate_items_with_commas']) : null, 'aftertext' => __('(e.g. Separate actors with commas)', 'cpt-plugin'), 'labeltext' => __('Separate Items with Commas', 'cpt-plugin'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'add_or_remove_items', 'textvalue' => isset($current['labels']['add_or_remove_items']) ? esc_attr($current['labels']['add_or_remove_items']) : null, 'aftertext' => __('(e.g. Add or remove actors)', 'cpt-plugin'), 'labeltext' => __('Add or Remove Items', 'cpt-plugin'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'choose_from_most_used', 'textvalue' => isset($current['labels']['choose_from_most_used']) ? esc_attr($current['labels']['choose_from_most_used']) : null, 'aftertext' => __('(e.g. Choose from the most used actors)', 'cpt-plugin'), 'labeltext' => __('Choose From Most Used', 'cpt-plugin'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'not_found', 'textvalue' => isset($current['labels']['not_found']) ? esc_attr($current['labels']['not_found']) : null, 'aftertext' => __('(e.g. No actors found)', 'cpt-plugin'), 'labeltext' => __('Not found', 'cpt-plugin'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'cpt-plugin')));
    ?>
						</table>
					</div>
					<h3 title="<?php 
    esc_attr_e('Click to expand', 'cpt-plugin');
    ?>
"><?php 
    _e('Settings', 'cpt-plugin');
    ?>
</h3>
					<div>
						<table>
							<?php 
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'cpt-plugin'), 'default' => 'true'), array('attr' => '1', 'text' => __('True', 'cpt-plugin'))));
    $selected = isset($current) ? disp_boolean($current['hierarchical']) : '';
    $select['selected'] = !empty($selected) ? $current['hierarchical'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_tax', 'name' => 'hierarchical', 'labeltext' => __('Hierarchical', 'cpt-plugin'), 'aftertext' => __('(default: False)', 'cpt-plugin'), 'helptext' => esc_attr__('Whether the taxonomy can have parent-child relationships', 'cpt-plugin'), 'selections' => $select));
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'cpt-plugin')), array('attr' => '1', 'text' => __('True', 'cpt-plugin'), 'default' => 'true')));
    $selected = isset($current) ? disp_boolean($current['show_ui']) : '';
    $select['selected'] = !empty($selected) ? $current['show_ui'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_tax', 'name' => 'show_ui', 'labeltext' => __('Show UI', 'cpt-plugin'), 'aftertext' => __('(default: True)', 'cpt-plugin'), 'helptext' => esc_attr__('Whether to generate a default UI for managing this custom taxonomy', 'cpt-plugin'), 'selections' => $select));
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'cpt-plugin')), array('attr' => '1', 'text' => __('True', 'cpt-plugin'), 'default' => 'true')));
    $selected = isset($current) ? disp_boolean($current['query_var']) : '';
    $select['selected'] = !empty($selected) ? $current['query_var'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_tax', 'name' => 'query_var', 'labeltext' => __('Query Var', 'cpt-plugin'), 'aftertext' => __('(default: True)', 'cpt-plugin'), 'selections' => $select));
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_tax', 'name' => 'query_var_slug', 'textvalue' => isset($current['query_var_slug']) ? esc_attr($current['query_var_slug']) : '', 'aftertext' => __('(default: none). Query Var needs to be true to use.', 'cpt-plugin'), 'labeltext' => __('Custom Query Var String', 'cpt-plugin'), 'helptext' => esc_attr__('Custom Query Var Slug', 'cpt-plugin')));
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'cpt-plugin')), array('attr' => '1', 'text' => __('True', 'cpt-plugin'), 'default' => 'true')));
    $selected = isset($current) ? disp_boolean($current['rewrite']) : '';
    $select['selected'] = !empty($selected) ? $current['rewrite'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_tax', 'name' => 'rewrite', 'labeltext' => __('Rewrite', 'cpt-plugin'), 'aftertext' => __('(default: True)', 'cpt-plugin'), 'helptext' => esc_attr__('Triggers the handling of rewrites for this taxonomy', 'cpt-plugin'), 'selections' => $select));
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_tax', 'name' => 'rewrite_slug', 'textvalue' => isset($current['rewrite_slug']) ? esc_attr($current['rewrite_slug']) : '', 'aftertext' => __('(default: taxonomy name)', 'cpt-plugin'), 'labeltext' => __('Custom Rewrite Slug', 'cpt-plugin'), 'helptext' => esc_attr__('Custom Taxonomy Rewrite Slug', 'cpt-plugin')));
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'cpt-plugin')), array('attr' => '1', 'text' => __('True', 'cpt-plugin'), 'default' => 'true')));
    $selected = isset($current) ? disp_boolean($current['rewrite_withfront']) : '';
    $select['selected'] = !empty($selected) ? $current['rewrite_withfront'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_tax', 'name' => 'rewrite_withfront', 'labeltext' => __('Rewrite With Front', 'cpt-plugin'), 'aftertext' => __('(default: true)', 'cpt-plugin'), 'helptext' => esc_attr__('Should the permastruct be prepended with the front base.', 'cpt-plugin'), 'selections' => $select));
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'cpt-plugin'), 'default' => 'false'), array('attr' => '1', 'text' => __('True', 'cpt-plugin'))));
    $selected = isset($current) ? disp_boolean($current['rewrite_hierarchical']) : '';
    $select['selected'] = !empty($selected) ? $current['rewrite_hierarchical'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_tax', 'name' => 'rewrite_hierarchical', 'labeltext' => __('Rewrite Hierarchical', 'cpt-plugin'), 'aftertext' => __('(default: false)', 'cpt-plugin'), 'helptext' => esc_attr__('Should the permastruct allow hierarchical urls.', 'cpt-plugin'), 'selections' => $select));
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'cpt-plugin'), 'default' => 'true'), array('attr' => '1', 'text' => __('True', 'cpt-plugin'))));
    $selected = isset($current) ? disp_boolean($current['show_admin_column']) : '';
    $select['selected'] = !empty($selected) ? $current['show_admin_column'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_tax', 'name' => 'show_admin_column', 'labeltext' => __('Show Admin Column', 'cpt-plugin'), 'aftertext' => __('(default: False)', 'cpt-plugin'), 'helptext' => esc_attr__('Whether to allow automatic creation of taxonomy columns on associated post-types.', 'cpt-plugin'), 'selections' => $select));
    ?>
						</table>
					</div>

					<?php 
    if ('new' == $tab) {
        ?>
					<h3 title="<?php 
        esc_attr_e('Click to expand', 'cpt-plugin');
        ?>
"><?php 
        _e('Starter Notes', 'cpt-plugin');
        ?>
</h3>
						<div><ol>
						<?php 
        echo '<li>' . sprintf(__('Taxonomy names should have %smax 32 characters%s, and only contain alphanumeric, lowercase, characters, underscores in place of spaces, and letters that do not have accents.', 'cpt-plugin'), '<strong class="wp-ui-highlight">', '</strong>');
        echo '<li>' . sprintf(__('If you are unfamiliar with the advanced taxonomy settings, just fill in the %sTaxonomy Name%s and choose an %sAttach to Post Type%s option. Remaining settings will use default values. Labels, if left blank, will be automatically created based on the taxonomy name. Hover over the question marks for more details.', 'cpt-plugin'), '<strong class="wp-ui-highlight">', '</strong>', '<strong class="wp-ui-highlight">', '</strong>');
        echo '<li>' . sprintf(__('Deleting custom taxonomies do %sNOT%s delete terms added to those taxonomies. You can recreate your taxonomies and the terms will return. Changing the name, after adding terms to the taxonomy, will not update the terms in the database.', 'cpt-plugin'), '<strong class="wp-ui-highlight">', '</strong>');
        ?>
						</ol></div>
						<?php 
    }
    ?>
				</td>
			</tr>
		</table><!-- End outter table -->
	</form>
	</div><!-- End .wrap -->
<?php 
}
コード例 #3
0
ファイル: post-types.php プロジェクト: Allan019/grupometa
/**
 * Create our settings page output.
 *
 * @since 1.0.0
 *
 * @return string HTML output for the page.
 */
function cptui_manage_post_types()
{
    if (!empty($_POST)) {
        if (isset($_POST['cpt_submit'])) {
            check_admin_referer('cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field');
            $notice = cptui_update_post_type($_POST);
        } elseif (isset($_POST['cpt_delete'])) {
            check_admin_referer('cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field');
            $notice = cptui_delete_post_type($_POST);
        }
    }
    $tab = !empty($_GET) && !empty($_GET['action']) && 'edit' == $_GET['action'] ? 'edit' : 'new';
    ?>

	<div class="wrap">

	<?php 
    if (isset($notice)) {
        echo $notice;
    }
    cptui_settings_tab_menu();
    if ('edit' == $tab) {
        $post_types = get_option('cptui_post_types');
        $selected_post_type = cptui_get_current_post_type();
        if ($selected_post_type) {
            if (array_key_exists($selected_post_type, $post_types)) {
                $current = $post_types[$selected_post_type];
            }
        }
    }
    $ui = new cptui_admin_ui();
    # Will only be set if we're already on the edit screen
    if (!empty($post_types)) {
        ?>
		<form id="cptui_select_post_type" method="post">
			<p><?php 
        _e('Select a post type to edit. DO NOT EDIT the post type slug unless necessary. Changing that value registers a new post type entry for your install.', 'cpt-plugin');
        ?>
</p>
			<?php 
        cptui_post_types_dropdown($post_types);
        ?>
			<input type="submit" class="button-secondary" name="cptui_select_post_type_submit" value="<?php 
        echo esc_attr(apply_filters('cptui_post_type_submit_select', __('Select', 'cpt-plugin')));
        ?>
" />
		</form>
	<?php 
    }
    ?>

	<form method="post">
		<table class="form-table cptui-table">
			<tr>
				<td><!--LEFT SIDE-->
					<table>
						<?php 
    /*
     * Post Slug
     */
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'name', 'textvalue' => isset($current['name']) ? esc_attr($current['name']) : '', 'maxlength' => '20', 'onblur' => 'this.value=this.value.toLowerCase()', 'labeltext' => __('Post Type Slug', 'cpt-plugin'), 'aftertext' => __('(e.g. movie)', 'cpt-plugin'), 'helptext' => esc_attr__('The post type name. Used to retrieve custom post type content. Should be short and unique', 'cpt-plugin'), 'required' => true));
    /*
     * Post Label
     */
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'label', 'textvalue' => isset($current['label']) ? esc_attr($current['label']) : '', 'labeltext' => __('Plural Label', 'cpt-plugin'), 'aftertext' => __('(e.g. Movies)', 'cpt-plugin'), 'helptext' => esc_attr__('Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin')));
    /*
     * Post Singular Slug
     */
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'singular_label', 'textvalue' => isset($current['singular_label']) ? esc_attr($current['singular_label']) : '', 'labeltext' => __('Singular Label', 'cpt-plugin'), 'aftertext' => __('(e.g. Movie)', 'cpt-plugin'), 'helptext' => esc_attr__('Custom Post Type Singular label. Used in WordPress when a singular label is needed.', 'cpt-plugin')));
    /*
     * Post Description
     */
    if (isset($current['description'])) {
        $current['description'] = stripslashes_deep($current['description']);
    }
    echo $ui->get_textarea_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'description', 'rows' => '4', 'cols' => '40', 'textvalue' => isset($current['description']) ? esc_textarea($current['description']) : '', 'labeltext' => __('Description', 'cpt-plugin'), 'helptext' => esc_attr__('Custom Post Type Description. Describe what your custom post type is used for.', 'cpt-plugin')));
    ?>
					</table>
				<p class="submit">
					<?php 
    wp_nonce_field('cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field');
    if (!empty($_GET) && !empty($_GET['action']) && 'edit' == $_GET['action']) {
        ?>
						<input type="submit" class="button-primary" name="cpt_submit" value="<?php 
        echo esc_attr(apply_filters('cptui_post_type_submit_edit', __('Edit Post Type', 'cpt-plugin')));
        ?>
" />
						<input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php 
        echo esc_attr(apply_filters('cptui_post_type_submit_delete', __('Delete Post Type', 'cpt-plugin')));
        ?>
" />
					<?php 
    } else {
        ?>
						<input type="submit" class="button-primary" name="cpt_submit" value="<?php 
        echo esc_attr(apply_filters('cptui_post_type_submit_add', __('Add Post Type', 'cpt-plugin')));
        ?>
" />
					<?php 
    }
    ?>
					<input type="hidden" name="cpt_type_status" id="cpt_type_status" value="<?php 
    echo $tab;
    ?>
" />
				</p>
			</td>
			<td>
				<p> <?php 
    _e('Click headings to reveal available options.', 'cpt-plugin');
    ?>
</p>

				<div id="cptui_accordion">
					<h3 title="<?php 
    esc_attr_e('Click to expand', 'cpt-plugin');
    ?>
"><?php 
    _e('Labels', 'cpt-plugin');
    ?>
</h3>
						<div>
							<table>
							<?php 
    /*
     * Post Admin Menu Name
     */
    echo $ui->get_text_input(array('labeltext' => __('Menu Name', 'cpt-plugin'), 'helptext' => esc_attr__('Custom menu name for your custom post type.', 'cpt-plugin'), 'namearray' => 'cpt_labels', 'name' => 'menu_name', 'textvalue' => isset($current['labels']['menu_name']) ? esc_attr($current['labels']['menu_name']) : '', 'aftertext' => __('(e.g. My Movies)', 'cpt-plugin')));
    /*
     * Post All Items
     */
    echo $ui->get_text_input(array('labeltext' => __('All Items', 'cpt-plugin'), 'helptext' => esc_attr__('Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin'), 'namearray' => 'cpt_labels', 'name' => 'all_items', 'textvalue' => isset($current['labels']['all_items']) ? esc_attr($current['labels']['all_items']) : '', 'aftertext' => __('(e.g. All Movies)', 'cpt-plugin')));
    /*
     * Add New Label
     */
    echo $ui->get_text_input(array('labeltext' => __('Add New', 'cpt-plugin'), 'helptext' => esc_attr__('Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin'), 'namearray' => 'cpt_labels', 'name' => 'add_new', 'textvalue' => isset($current['labels']['add_new']) ? esc_attr($current['labels']['add_new']) : '', 'aftertext' => __('(e.g. Add New)', 'cpt-plugin')));
    /*
     * Add New Item Label
     */
    echo $ui->get_text_input(array('labeltext' => __('Add New Item', 'cpt-plugin'), 'helptext' => esc_attr__('Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin'), 'namearray' => 'cpt_labels', 'name' => 'add_new_item', 'textvalue' => isset($current['labels']['add_new_item']) ? esc_attr($current['labels']['add_new_item']) : '', 'aftertext' => __('(e.g. Add New Movie)', 'cpt-plugin')));
    /*
     * Edit Label
     */
    echo $ui->get_text_input(array('labeltext' => __('Edit', 'cpt-plugin'), 'helptext' => esc_attr__('Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin'), 'namearray' => 'cpt_labels', 'name' => 'edit', 'textvalue' => isset($current['labels']['edit']) ? esc_attr($current['labels']['edit']) : '', 'aftertext' => __('(e.g. Edit)', 'cpt-plugin')));
    /*
     * Edit Item Label
     */
    echo $ui->get_text_input(array('labeltext' => __('Edit Item', 'cpt-plugin'), 'helptext' => esc_attr__('Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin'), 'namearray' => 'cpt_labels', 'name' => 'edit_item', 'textvalue' => isset($current['labels']['edit_item']) ? esc_attr($current['labels']['edit_item']) : '', 'aftertext' => __('(e.g. Edit Movie)', 'cpt-plugin')));
    /*
     * New Item Label
     */
    echo $ui->get_text_input(array('labeltext' => __('New Item', 'cpt-plugin'), 'helptext' => esc_attr__('Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin'), 'namearray' => 'cpt_labels', 'name' => 'new_item', 'textvalue' => isset($current['labels']['new_item']) ? esc_attr($current['labels']['new_item']) : '', 'aftertext' => __('(e.g. New Movie)', 'cpt-plugin')));
    /*
     * View Label
     */
    echo $ui->get_text_input(array('labeltext' => __('View', 'cpt-plugin'), 'helptext' => esc_attr__('Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin'), 'namearray' => 'cpt_labels', 'name' => 'view', 'textvalue' => isset($current['labels']['view']) ? esc_attr($current['labels']['view']) : '', 'aftertext' => __('(e.g. View)', 'cpt-plugin')));
    /*
     * View Item Label
     */
    echo $ui->get_text_input(array('labeltext' => __('View Item', 'cpt-plugin'), 'helptext' => esc_attr__('Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin'), 'namearray' => 'cpt_labels', 'name' => 'view_item', 'textvalue' => isset($current['labels']['view_item']) ? esc_attr($current['labels']['view_item']) : '', 'aftertext' => __('(e.g. View Movie)', 'cpt-plugin')));
    /*
     * Search Item Label
     */
    echo $ui->get_text_input(array('labeltext' => __('Search Item', 'cpt-plugin'), 'helptext' => esc_attr__('Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin'), 'namearray' => 'cpt_labels', 'name' => 'search_items', 'textvalue' => isset($current['labels']['search_items']) ? esc_attr($current['labels']['search_items']) : '', 'aftertext' => __('(e.g. Search Movie)', 'cpt-plugin')));
    /*
     * Not Found Label
     */
    echo $ui->get_text_input(array('labeltext' => __('Not Found', 'cpt-plugin'), 'helptext' => esc_attr__('Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin'), 'namearray' => 'cpt_labels', 'name' => 'not_found', 'textvalue' => isset($current['labels']['not_found']) ? esc_attr($current['labels']['not_found']) : '', 'aftertext' => __('(e.g. No Movies found)', 'cpt-plugin')));
    /*
     * Not Found In Trash Label
     */
    echo $ui->get_text_input(array('labeltext' => __('Not Found in Trash', 'cpt-plugin'), 'helptext' => esc_attr__('Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin'), 'namearray' => 'cpt_labels', 'name' => 'not_found_in_trash', 'textvalue' => isset($current['labels']['not_found_in_trash']) ? esc_attr($current['labels']['not_found_in_trash']) : '', 'aftertext' => __('(e.g. No Movies found in Trash)', 'cpt-plugin')));
    /*
     * Parent Label
     */
    echo $ui->get_text_input(array('labeltext' => __('Parent', 'cpt-plugin'), 'helptext' => esc_attr__('Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin'), 'namearray' => 'cpt_labels', 'name' => 'parent', 'textvalue' => isset($current['labels']['parent']) ? esc_attr($current['labels']['parent']) : '', 'aftertext' => __('(e.g. Parent Movie)', 'cpt-plugin')));
    ?>
							</table>
						</div>
					<h3 title="<?php 
    esc_attr_e('Click to expand', 'cpt-plugin');
    ?>
"><?php 
    _e('Settings', 'cpt-plugin');
    ?>
</h3>
						<div>
							<table>
							<?php 
    /*
     * Public Boolean
     */
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'cpt-plugin')), array('attr' => '1', 'text' => __('True', 'cpt-plugin'), 'default' => 'true')));
    $selected = isset($current) ? disp_boolean($current['public']) : '';
    $select['selected'] = !empty($selected) ? $current['public'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'public', 'labeltext' => __('Public', 'cpt-plugin'), 'aftertext' => __('(default: True)', 'cpt-plugin'), 'helptext' => esc_attr__('Whether posts of this type should be shown in the admin UI', 'cpt-plugin'), 'selections' => $select));
    /*
     * Show UI Boolean
     */
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'cpt-plugin')), array('attr' => '1', 'text' => __('True', 'cpt-plugin'), 'default' => 'true')));
    $selected = isset($current) ? disp_boolean($current['show_ui']) : '';
    $select['selected'] = !empty($selected) ? $current['show_ui'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'show_ui', 'labeltext' => __('Show UI', 'cpt-plugin'), 'aftertext' => __('(default: True)', 'cpt-plugin'), 'helptext' => esc_attr__('Whether to generate a default UI for managing this post type', 'cpt-plugin'), 'selections' => $select));
    /*
     * Has Archive Boolean
     */
    echo $ui->get_tr_start() . $ui->get_th_start() . __('Has Archive', 'cpt-plugin');
    echo $ui->get_p(__('If left blank, the archive slug will default to the post type slug.', 'cpt-plugin'));
    echo $ui->get_th_end() . $ui->get_td_start();
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'cpt-plugin'), 'default' => 'true'), array('attr' => '1', 'text' => __('True', 'cpt-plugin'))));
    $selected = isset($current) ? disp_boolean($current['has_archive']) : '';
    $select['selected'] = !empty($selected) ? $current['has_archive'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'has_archive', 'labeltext' => __('Has Archive', 'cpt-plugin'), 'aftertext' => __('(default: False)', 'cpt-plugin'), 'helptext' => esc_attr__('Whether the post type will have a post type archive page', 'cpt-plugin'), 'selections' => $select, 'wrap' => false));
    /*
     * Has Archive Input
     */
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'has_archive_string', 'textvalue' => isset($current['has_archive_string']) ? esc_attr($current['has_archive_string']) : '', 'helptext' => esc_attr__('Slug to be used for archive page.', 'cpt-plugin'), 'wrap' => false));
    echo $ui->get_td_end() . $ui->get_tr_end();
    /*
     * Exclude From Search Boolean
     */
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'cpt-plugin'), 'default' => 'true'), array('attr' => '1', 'text' => __('True', 'cpt-plugin'))));
    $selected = isset($current) ? disp_boolean($current['exclude_from_search']) : '';
    $select['selected'] = !empty($selected) ? $current['exclude_from_search'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'exclude_from_search', 'labeltext' => __('Exclude From Search', 'cpt-plugin'), 'aftertext' => __('(default: False)', 'cpt-plugin'), 'helptext' => esc_attr__('Whether the post type will be searchable', 'cpt-plugin'), 'selections' => $select));
    /*
     * Capability Type Input
     */
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'capability_type', 'textvalue' => isset($current['capability_type']) ? esc_attr($current['capability_type']) : 'post', 'labeltext' => __('Capability Type', 'cpt-plugin'), 'helptext' => esc_attr__('The post type to use for checking read, edit, and delete capabilities', 'cpt-plugin')));
    /*
     * Hierarchical Boolean
     */
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'cpt-plugin'), 'default' => 'true'), array('attr' => '1', 'text' => __('True', 'cpt-plugin'))));
    $selected = isset($current) ? disp_boolean($current['hierarchical']) : '';
    $select['selected'] = !empty($selected) ? $current['hierarchical'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'hierarchical', 'labeltext' => __('Hierarchical', 'cpt-plugin'), 'aftertext' => __('(default: False)', 'cpt-plugin'), 'helptext' => esc_attr__('Whether the post type can have parent-child relationships', 'cpt-plugin'), 'selections' => $select));
    /*
     * Rewrite Boolean
     */
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'cpt-plugin')), array('attr' => '1', 'text' => __('True', 'cpt-plugin'), 'default' => 'true')));
    $selected = isset($current) ? disp_boolean($current['rewrite']) : '';
    $select['selected'] = !empty($selected) ? $current['rewrite'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'rewrite', 'labeltext' => __('Rewrite', 'cpt-plugin'), 'aftertext' => __('(default: True)', 'cpt-plugin'), 'helptext' => esc_attr__('Triggers the handling of rewrites for this post type', 'cpt-plugin'), 'selections' => $select));
    /*
     * Rewrite Slug Input
     */
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'rewrite_slug', 'textvalue' => isset($current['rewrite_slug']) ? esc_attr($current['rewrite_slug']) : '', 'labeltext' => __('Custom Rewrite Slug', 'cpt-plugin'), 'aftertext' => __('(default: post type name)', 'cpt-plugin'), 'helptext' => esc_attr__('Custom slug to use instead of the default.', 'cpt-plugin')));
    /*
     * Rewrite With Front Boolean
     */
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'cpt-plugin')), array('attr' => '1', 'text' => __('True', 'cpt-plugin'), 'default' => 'true')));
    $selected = isset($current) ? disp_boolean($current['rewrite_withfront']) : '';
    $select['selected'] = !empty($selected) ? $current['rewrite_withfront'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'rewrite_withfront', 'labeltext' => __('With Front', 'cpt-plugin'), 'aftertext' => __('(default: True)', 'cpt-plugin'), 'helptext' => esc_attr__('Should the permastruct be prepended with the front base.', 'cpt-plugin'), 'selections' => $select));
    /*
     * Query Var Boolean
     */
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'cpt-plugin')), array('attr' => '1', 'text' => __('True', 'cpt-plugin'), 'default' => 'true')));
    $selected = isset($current) ? disp_boolean($current['query_var']) : '';
    $select['selected'] = !empty($selected) ? $current['query_var'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'query_var', 'labeltext' => __('Query Var', 'cpt-plugin'), 'aftertext' => __('(default: True)', 'cpt-plugin'), 'helptext' => esc_attr__('Should the permastruct be prepended with the front base.', 'cpt-plugin'), 'selections' => $select));
    echo $ui->get_tr_start() . $ui->get_th_start() . __('Menu Position', 'cpt-plugin');
    echo $ui->get_help(esc_attr__('The position in the menu order the post type should appear. show_in_menu must be true.', 'cpt-plugin'));
    echo $ui->get_p(__('See <a href="http://codex.wordpress.org/Function_Reference/register_post_type#Parameters">Available options</a> in the "menu_position" section. Range of 5-100', 'cpt-plugin'));
    echo $ui->get_th_end() . $ui->get_td_start();
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'menu_position', 'textvalue' => isset($current['menu_position']) ? esc_attr($current['menu_position']) : '', 'helptext' => esc_attr__('URL or Dashicon value for image to be used as menu icon.', 'cpt-plugin'), 'wrap' => false));
    echo $ui->get_td_end() . $ui->get_tr_end();
    /*
     * Show In Menu Boolean
     */
    echo $ui->get_tr_start() . $ui->get_th_start() . __('Show in Menu', 'cpt-plugin');
    echo $ui->get_p(__('"Show UI" must be "true". If an existing top level page such as "tools.php" is indicated for second input, post type will be sub menu of that.', 'cpt-plugin'));
    echo $ui->get_th_end() . $ui->get_td_start();
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'cpt-plugin')), array('attr' => '1', 'text' => __('True', 'cpt-plugin'), 'default' => 'true')));
    $selected = isset($current) ? disp_boolean($current['show_in_menu']) : '';
    $select['selected'] = !empty($selected) ? $current['show_in_menu'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'show_in_menu', 'labeltext' => __('Show In Menu', 'cpt-plugin'), 'aftertext' => __('(default: True)', 'cpt-plugin'), 'helptext' => esc_attr__('Whether to show the post type in the admin menu and where to show that menu. Note that show_ui must be true', 'cpt-plugin'), 'selections' => $select, 'wrap' => false));
    /*
     * Show In Menu Input
     */
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'show_in_menu_string', 'textvalue' => isset($current['show_in_menu_string']) ? esc_attr($current['show_in_menu_string']) : '', 'helptext' => esc_attr__('URL to image to be used as menu icon.', 'cpt-plugin'), 'wrap' => false));
    echo $ui->get_td_end() . $ui->get_tr_end();
    /*
     * Menu Icon
     */
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'menu_icon', 'textvalue' => isset($current['menu_icon']) ? esc_attr($current['menu_icon']) : '', 'labeltext' => __('Menu Icon', 'cpt-plugin'), 'aftertext' => __('(Full URL for icon or Dashicon class)', 'cpt-plugin'), 'helptext' => esc_attr__('URL to image to be used as menu icon or Dashicon class to use instead.', 'cpt-plugin')));
    echo $ui->get_tr_start() . $ui->get_th_start() . __('Supports', 'cpt-plugin') . $ui->get_th_end() . $ui->get_td_start();
    /*
     * Supports Title Checkbox
     */
    echo $ui->get_check_input(array('checkvalue' => 'title', 'checked' => !empty($current['supports']) && is_array($current['supports']) && in_array('title', $current['supports']) ? 'true' : 'false', 'name' => 'title', 'namearray' => 'cpt_supports', 'textvalue' => 'title', 'labeltext' => __('Title', 'cpt-plugin'), 'helptext' => esc_attr__('Adds the title meta box when creating content for this custom post type', 'cpt-plugin'), 'default' => true, 'wrap' => false));
    /*
     * Supports Editor Checkbox
     */
    echo $ui->get_check_input(array('checkvalue' => 'editor', 'checked' => !empty($current['supports']) && is_array($current['supports']) && in_array('editor', $current['supports']) ? 'true' : 'false', 'name' => 'editor', 'namearray' => 'cpt_supports', 'textvalue' => 'editor', 'labeltext' => __('Editor', 'cpt-plugin'), 'helptext' => esc_attr__('Adds the content editor meta box when creating content for this custom post type', 'cpt-plugin'), 'default' => true, 'wrap' => false));
    /*
     * Supports Excerpt Checkbox
     */
    echo $ui->get_check_input(array('checkvalue' => 'excerpt', 'checked' => !empty($current['supports']) && is_array($current['supports']) && in_array('excerpt', $current['supports']) ? 'true' : 'false', 'name' => 'excerpt', 'namearray' => 'cpt_supports', 'textvalue' => 'excerpt', 'labeltext' => __('Excerpt', 'cpt-plugin'), 'helptext' => esc_attr__('Adds the excerpt meta box when creating content for this custom post type', 'cpt-plugin'), 'default' => true, 'wrap' => false));
    /*
     * Supports Trackbacks Checkbox
     */
    echo $ui->get_check_input(array('checkvalue' => 'trackbacks', 'checked' => !empty($current['supports']) && is_array($current['supports']) && in_array('trackbacks', $current['supports']) ? 'true' : 'false', 'name' => 'trackbacks', 'namearray' => 'cpt_supports', 'textvalue' => 'trackbacks', 'labeltext' => __('Trackbacks', 'cpt-plugin'), 'helptext' => esc_attr__('Adds the trackbacks meta box when creating content for this custom post type', 'cpt-plugin'), 'default' => true, 'wrap' => false));
    /*
     * Supports Custom Fields Checkbox
     */
    echo $ui->get_check_input(array('checkvalue' => 'custom-fields', 'checked' => !empty($current['supports']) && is_array($current['supports']) && in_array('custom-fields', $current['supports']) ? 'true' : 'false', 'name' => 'custom-fields', 'namearray' => 'cpt_supports', 'textvalue' => 'custom-fields', 'labeltext' => __('Custom Fields', 'cpt-plugin'), 'helptext' => esc_attr__('Adds the custom fields meta box when creating content for this custom post type', 'cpt-plugin'), 'default' => true, 'wrap' => false));
    /*
     * Supports Comments Checkbox
     */
    echo $ui->get_check_input(array('checkvalue' => 'comments', 'checked' => !empty($current['supports']) && is_array($current['supports']) && in_array('comments', $current['supports']) ? 'true' : 'false', 'name' => 'comments', 'namearray' => 'cpt_supports', 'textvalue' => 'comments', 'labeltext' => __('Comments', 'cpt-plugin'), 'helptext' => esc_attr__('Adds the comments meta box when creating content for this custom post type', 'cpt-plugin'), 'default' => true, 'wrap' => false));
    /*
     * Supports Revisions Checkbox
     */
    echo $ui->get_check_input(array('checkvalue' => 'revisions', 'checked' => !empty($current['supports']) && is_array($current['supports']) && in_array('revisions', $current['supports']) ? 'true' : 'false', 'name' => 'revisions', 'namearray' => 'cpt_supports', 'textvalue' => 'revisions', 'labeltext' => __('Revisions', 'cpt-plugin'), 'helptext' => esc_attr__('Adds the revisions meta box when creating content for this custom post type', 'cpt-plugin'), 'default' => true, 'wrap' => false));
    /*
     * Supports Post Thumbnail Checkbox
     */
    echo $ui->get_check_input(array('checkvalue' => 'thumbnail', 'checked' => !empty($current['supports']) && is_array($current['supports']) && in_array('thumbnail', $current['supports']) ? 'true' : 'false', 'name' => 'thumbnail', 'namearray' => 'cpt_supports', 'textvalue' => 'thumbnail', 'labeltext' => __('Featured Image', 'cpt-plugin'), 'helptext' => esc_attr__('Adds the featured image meta box when creating content for this custom post type', 'cpt-plugin'), 'default' => true, 'wrap' => false));
    /*
     * Supports Author Checkbox
     */
    echo $ui->get_check_input(array('checkvalue' => 'author', 'checked' => !empty($current['supports']) && is_array($current['supports']) && in_array('author', $current['supports']) ? 'true' : 'false', 'name' => 'author', 'namearray' => 'cpt_supports', 'textvalue' => 'author', 'labeltext' => __('Author', 'cpt-plugin'), 'helptext' => esc_attr__('Adds the author meta box when creating content for this custom post type', 'cpt-plugin'), 'default' => true, 'wrap' => false));
    /*
     * Supports Page Attributes Checkbox
     */
    echo $ui->get_check_input(array('checkvalue' => 'page-attributes', 'checked' => !empty($current['supports']) && is_array($current['supports']) && in_array('page-attributes', $current['supports']) ? 'true' : 'false', 'name' => 'page-attributes', 'namearray' => 'cpt_supports', 'textvalue' => 'page-attributes', 'labeltext' => __('Page Attributes', 'cpt-plugin'), 'helptext' => esc_attr__('Adds the page attribute meta box when creating content for this custom post type', 'cpt-plugin'), 'default' => true, 'wrap' => false));
    /*
     * Supports Post Formats Checkbox
     */
    echo $ui->get_check_input(array('checkvalue' => 'post-formats', 'checked' => !empty($current['supports']) && is_array($current['supports']) && in_array('post-formats', $current['supports']) ? 'true' : 'false', 'name' => 'post-formats', 'namearray' => 'cpt_supports', 'textvalue' => 'post-formats', 'labeltext' => __('Post Formats', 'cpt-plugin'), 'helptext' => esc_attr__('Adds post format support', 'cpt-plugin'), 'default' => true, 'wrap' => false));
    echo $ui->get_p(__('Use the option below to explicitly set "supports" to false.', 'cpt-plugin'));
    echo $ui->get_check_input(array('checkvalue' => 'none', 'checked' => !empty($current['supports']) && (is_array($current['supports']) && in_array('none', $current['supports'])) ? 'true' : 'false', 'name' => 'none', 'namearray' => 'cpt_supports', 'textvalue' => 'none', 'labeltext' => __('None', 'cpt-plugin'), 'helptext' => esc_attr__('Remove all support features', 'cpt-plugin'), 'default' => false, 'wrap' => false));
    echo $ui->get_td_end() . $ui->get_tr_end();
    echo $ui->get_tr_start() . $ui->get_th_start() . __('Built-in Taxonomies', 'cpt-plugin') . $ui->get_th_end() . $ui->get_td_start();
    /**
     * Filters the arguments for taxonomies to list for post type association.
     *
     * @since 1.0.0
     *
     * @param array $value Array of default arguments.
     */
    $args = apply_filters('cptui_attach_taxonomies_to_post_type', array('public' => true));
    /**
     * Filters the arguments for output type for returned results.
     *
     * @since 1.0.0
     *
     * @param string $value Default output type.
     */
    $output = apply_filters('cptui_attach_taxonomies_to_post_type_output', 'objects');
    # If they don't return an array, fall back to the original default. Don't need to check for empty, because empty array is default for $args param in get_post_types anyway.
    if (!is_array($args)) {
        $args = array('public' => true);
    }
    $add_taxes = get_taxonomies($args, $output);
    unset($add_taxes['nav_menu']);
    unset($add_taxes['post_format']);
    foreach ($add_taxes as $add_tax) {
        /*
         * Supports Taxonomies Checkbox
         */
        echo $ui->get_check_input(array('checkvalue' => $add_tax->name, 'checked' => !empty($current['taxonomies']) && is_array($current['taxonomies']) && in_array($add_tax->name, $current['taxonomies']) ? 'true' : 'false', 'name' => $add_tax->name, 'namearray' => 'cpt_addon_taxes', 'textvalue' => $add_tax->name, 'labeltext' => $add_tax->label, 'helptext' => sprintf(esc_attr__('Adds %s support', 'cpt-plugin'), $add_tax->label), 'wrap' => false));
    }
    echo $ui->get_td_end() . $ui->get_tr_end();
    ?>
							</table>
						</div>
						<?php 
    if ('new' == $tab) {
        ?>
						<h3 title="<?php 
        esc_attr_e('Click to expand', 'cpt-plugin');
        ?>
"><?php 
        _e('Starter Notes', 'cpt-plugin');
        ?>
</h3>
							<div><ol>
								<?php 
        echo '<li>' . sprintf(__('Post Type names should have %smax 20 characters%s, and only contain alphanumeric, lowercase characters, underscores in place of spaces and letters that do not have accents. Reserved names: post, page, attachment, revision, nav_menu_item.', 'cpt-plugin'), '<strong class="wp-ui-highlight">', '</strong>');
        echo '<li>' . sprintf(__('If you are unfamiliar with the advanced post type settings, just fill in the %sPost Type Name%s and %sLabel%s fields. Remaining settings will use default values. Labels, if left blank, will be automatically created based on the post type name. Hover over the question mark for more details.', 'cpt-plugin'), '<strong class="wp-ui-highlight">', '</strong>', '<strong class="wp-ui-highlight">', '</strong>');
        echo '<li>' . sprintf(__('Deleting custom post types will %sNOT%s delete any content into the database or added to those post types. You can easily recreate your post types and the content will still exist.', 'cpt-plugin'), '<strong class="wp-ui-highlight">', '</strong>');
        ?>
							</ol></div>
						<?php 
    }
    ?>
				</td>
			</tr>
		</table>
	</form>
	</div><!-- End .wrap -->
<?php 
}
コード例 #4
0
ファイル: import_export.php プロジェクト: netpoe/Gus.2016
/**
 * 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 -->';
}
コード例 #5
0
/**
 * Create our settings page output.
 *
 * @since 1.0.0
 *
 * @internal
 */
function cptui_manage_post_types()
{
    $post_type_deleted = false;
    if (!empty($_POST)) {
        if (isset($_POST['cpt_submit'])) {
            check_admin_referer('cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field');
            $notice = cptui_update_post_type($_POST);
        } elseif (isset($_POST['cpt_delete'])) {
            check_admin_referer('cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field');
            $notice = cptui_delete_post_type($_POST);
            $post_type_deleted = true;
        }
    }
    $tab = !empty($_GET) && !empty($_GET['action']) && 'edit' === $_GET['action'] ? 'edit' : 'new';
    $tab_class = 'cptui-' . $tab;
    ?>

	<div class="wrap <?php 
    echo esc_attr($tab_class);
    ?>
">

	<?php 
    /**
     * Fires right inside the wrap div for the post type editor screen.
     *
     * @since 1.3.0
     */
    do_action('cptui_inside_post_type_wrap');
    if (isset($notice)) {
        echo $notice;
    }
    cptui_settings_tab_menu();
    /**
     * Fires below the output for the tab menu on the post type add/edit screen.
     *
     * @since 1.3.0
     */
    do_action('cptui_below_post_type_tab_menu');
    if ('edit' == $tab) {
        $post_types = cptui_get_post_type_data();
        $selected_post_type = cptui_get_current_post_type($post_type_deleted);
        if ($selected_post_type) {
            if (array_key_exists($selected_post_type, $post_types)) {
                $current = $post_types[$selected_post_type];
            }
        }
    }
    $ui = new cptui_admin_ui();
    // Will only be set if we're already on the edit screen.
    if (!empty($post_types)) {
        ?>
		<form id="cptui_select_post_type" method="post" action="<?php 
        echo esc_url(cptui_get_post_form_action($ui));
        ?>
">
			<label for="post_type"><?php 
        esc_html_e('Select: ', 'custom-post-type-ui');
        ?>
</label>
			<?php 
        cptui_post_types_dropdown($post_types);
        /**
         * Filters the text value to use on the select post type button.
         *
         * @since 1.0.0
         *
         * @param string $value Text to use for the button.
         */
        ?>
			<input type="submit" class="button-secondary" name="cptui_select_post_type_submit" value="<?php 
        echo esc_attr(apply_filters('cptui_post_type_submit_select', __('Select', 'custom-post-type-ui')));
        ?>
" />
		</form>
	<?php 
        /**
         * Fires below the post type select input.
         *
         * @since 1.1.0
         *
         * @param string $value Current post type selected.
         */
        do_action('cptui_below_post_type_select', $current['name']);
    }
    ?>

	<form class="posttypesui" method="post" action="<?php 
    echo esc_url(cptui_get_post_form_action($ui));
    ?>
">
		<div class="cptui-section">
			<?php 
    echo $ui->get_fieldset_start();
    echo $ui->get_legend_start();
    esc_html_e('Basic settings', 'custom-post-type-ui');
    echo $ui->get_legend_end();
    ?>
			<table class="form-table cptui-table">
				<?php 
    echo $ui->get_tr_start() . $ui->get_th_start();
    echo $ui->get_label('name', __('Post Type Slug', 'custom-post-type-ui'));
    echo $ui->get_required_span();
    echo $ui->get_th_end() . $ui->get_td_start();
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'name', 'textvalue' => isset($current['name']) ? esc_attr($current['name']) : '', 'maxlength' => '20', 'helptext' => esc_html__('The post type name/slug. Used for various queries for post type content.', 'custom-post-type-ui'), 'required' => true, 'placeholder' => false, 'wrap' => false));
    echo '<p class="cptui-slug-details">';
    esc_html_e('Slugs should only contain alphanumeric, latin characters. Underscores or dashes should be used in place of spaces.', 'custom-post-type-ui');
    echo '</p>';
    if ('edit' == $tab) {
        echo '<p>';
        esc_html_e('DO NOT EDIT the post type slug unless also planning to migrate posts. Changing the slug registers a new post type entry.', 'custom-post-type-ui');
        echo '</p>';
        echo '<div class="cptui-spacer">';
        echo $ui->get_check_input(array('checkvalue' => 'update_post_types', 'checked' => 'false', 'name' => 'update_post_types', 'namearray' => 'update_post_types', 'labeltext' => esc_html__('Migrate posts to newly renamed post type?', 'custom-post-type-ui'), 'helptext' => false, 'default' => false, 'wrap' => false));
        echo '</div>';
    }
    echo $ui->get_td_end();
    echo $ui->get_tr_end();
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'label', 'textvalue' => isset($current['label']) ? esc_attr($current['label']) : '', 'labeltext' => esc_html__('Plural Label', 'custom-post-type-ui'), 'aftertext' => esc_html__('(e.g. Movies)', 'custom-post-type-ui'), 'helptext' => esc_html__('Used for the post type admin menu item.', 'custom-post-type-ui'), 'required' => true));
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'singular_label', 'textvalue' => isset($current['singular_label']) ? esc_attr($current['singular_label']) : '', 'labeltext' => esc_html__('Singular Label', 'custom-post-type-ui'), 'aftertext' => esc_html__('(e.g. Movie)', 'custom-post-type-ui'), 'helptext' => esc_html__('Used when a singular label is needed.', 'custom-post-type-ui'), 'required' => true));
    ?>
			</table>
			<p class="submit">
				<?php 
    wp_nonce_field('cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field');
    if (!empty($_GET) && !empty($_GET['action']) && 'edit' == $_GET['action']) {
        ?>
					<?php 
        /**
         * Filters the text value to use on the button when editing.
         *
         * @since 1.0.0
         *
         * @param string $value Text to use for the button.
         */
        ?>
					<input type="submit" class="button-primary" name="cpt_submit" value="<?php 
        echo esc_attr(apply_filters('cptui_post_type_submit_edit', __('Save Post Type', 'custom-post-type-ui')));
        ?>
" />
					<?php 
        /**
         * Filters the text value to use on the button when deleting.
         *
         * @since 1.0.0
         *
         * @param string $value Text to use for the button.
         */
        ?>
					<input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php 
        echo esc_attr(apply_filters('cptui_post_type_submit_delete', __('Delete Post Type', 'custom-post-type-ui')));
        ?>
" />
				<?php 
    } else {
        ?>
					<?php 
        /**
         * Filters the text value to use on the button when adding.
         *
         * @since 1.0.0
         *
         * @param string $value Text to use for the button.
         */
        ?>
					<input type="submit" class="button-primary" name="cpt_submit" value="<?php 
        echo esc_attr(apply_filters('cptui_post_type_submit_add', __('Add Post Type', 'custom-post-type-ui')));
        ?>
" />
				<?php 
    }
    if (!empty($current)) {
        ?>
					<input type="hidden" name="cpt_original" id="cpt_original" value="<?php 
        esc_attr_e($current['name']);
        ?>
" />
				<?php 
    }
    // Used to check and see if we should prevent duplicate slugs.
    ?>
				<input type="hidden" name="cpt_type_status" id="cpt_type_status" value="<?php 
    esc_attr_e($tab);
    ?>
" />
			</p>
			<?php 
    echo $ui->get_fieldset_end();
    ?>
		</div>
		<div class="cptui-section">
			<p>
				<a href="#" id="togglelabels" class="button-secondary"><?php 
    esc_html_e('Edit additional labels', 'custom-post-type-ui');
    ?>
</a>
			</p>
			<?php 
    $fieldset_classes = 'edit' == $tab ? '' : 'toggledclosed';
    echo $ui->get_fieldset_start(array('id' => 'labels_expand', 'classes' => array($fieldset_classes)));
    echo $ui->get_legend_start();
    esc_html_e('Additional labels', 'custom-post-type-ui');
    echo $ui->get_legend_end();
    ?>
			<table class="form-table cptui-table">
				<?php 
    if (isset($current['description'])) {
        $current['description'] = stripslashes_deep($current['description']);
    }
    echo $ui->get_textarea_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'description', 'rows' => '4', 'cols' => '40', 'textvalue' => isset($current['description']) ? esc_textarea($current['description']) : '', 'labeltext' => __('Post Type Description', 'custom-post-type-ui'), 'helptext' => esc_attr__('Perhaps describe what your custom post type is used for?', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('labeltext' => __('Menu Name', 'custom-post-type-ui'), 'helptext' => esc_attr__('Custom admin menu name for your custom post type.', 'custom-post-type-ui'), 'namearray' => 'cpt_labels', 'name' => 'menu_name', 'textvalue' => isset($current['labels']['menu_name']) ? esc_attr($current['labels']['menu_name']) : '', 'aftertext' => __('(e.g. My Movies)', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('labeltext' => __('All Items', 'custom-post-type-ui'), 'helptext' => esc_attr__('Used in the post type admin submenu.', 'custom-post-type-ui'), 'namearray' => 'cpt_labels', 'name' => 'all_items', 'textvalue' => isset($current['labels']['all_items']) ? esc_attr($current['labels']['all_items']) : '', 'aftertext' => __('(e.g. All Movies)', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('labeltext' => __('Add New', 'custom-post-type-ui'), 'helptext' => esc_attr__('Used in the post type admin submenu.', 'custom-post-type-ui'), 'namearray' => 'cpt_labels', 'name' => 'add_new', 'textvalue' => isset($current['labels']['add_new']) ? esc_attr($current['labels']['add_new']) : '', 'aftertext' => __('(e.g. Add New)', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('labeltext' => __('Add New Item', 'custom-post-type-ui'), 'helptext' => esc_attr__('Used at the top of the post editor screen for a new post type post.', 'custom-post-type-ui'), 'namearray' => 'cpt_labels', 'name' => 'add_new_item', 'textvalue' => isset($current['labels']['add_new_item']) ? esc_attr($current['labels']['add_new_item']) : '', 'aftertext' => __('(e.g. Add New Movie)', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('labeltext' => __('Edit Item', 'custom-post-type-ui'), 'helptext' => esc_attr__('Used at the top of the post editor screen for an existing post type post.', 'custom-post-type-ui'), 'namearray' => 'cpt_labels', 'name' => 'edit_item', 'textvalue' => isset($current['labels']['edit_item']) ? esc_attr($current['labels']['edit_item']) : '', 'aftertext' => __('(e.g. Edit Movie)', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('labeltext' => __('New Item', 'custom-post-type-ui'), 'helptext' => esc_attr__('Post type label. Used in the admin menu for displaying post types.', 'custom-post-type-ui'), 'namearray' => 'cpt_labels', 'name' => 'new_item', 'textvalue' => isset($current['labels']['new_item']) ? esc_attr($current['labels']['new_item']) : '', 'aftertext' => __('(e.g. New Movie)', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('labeltext' => __('View Item', 'custom-post-type-ui'), 'helptext' => esc_attr__('Used in the admin bar when viewing editor screen for a published post in the post type.', 'custom-post-type-ui'), 'namearray' => 'cpt_labels', 'name' => 'view_item', 'textvalue' => isset($current['labels']['view_item']) ? esc_attr($current['labels']['view_item']) : '', 'aftertext' => __('(e.g. View Movie)', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('labeltext' => __('Search Item', 'custom-post-type-ui'), 'helptext' => esc_attr__('Used as the text for the search button on post type list screen.', 'custom-post-type-ui'), 'namearray' => 'cpt_labels', 'name' => 'search_items', 'textvalue' => isset($current['labels']['search_items']) ? esc_attr($current['labels']['search_items']) : '', 'aftertext' => __('(e.g. Search Movie)', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('labeltext' => __('Not Found', 'custom-post-type-ui'), 'helptext' => esc_attr__('Used when there are no posts to display on the post type list screen.', 'custom-post-type-ui'), 'namearray' => 'cpt_labels', 'name' => 'not_found', 'textvalue' => isset($current['labels']['not_found']) ? esc_attr($current['labels']['not_found']) : '', 'aftertext' => __('(e.g. No Movies found)', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('labeltext' => __('Not Found in Trash', 'custom-post-type-ui'), 'helptext' => esc_attr__('Used when there are no posts to display on the post type list trash screen.', 'custom-post-type-ui'), 'namearray' => 'cpt_labels', 'name' => 'not_found_in_trash', 'textvalue' => isset($current['labels']['not_found_in_trash']) ? esc_attr($current['labels']['not_found_in_trash']) : '', 'aftertext' => __('(e.g. No Movies found in Trash)', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('labeltext' => __('Parent', 'custom-post-type-ui'), 'helptext' => esc_attr__('Post type label. Used in the admin menu for displaying post types.', 'custom-post-type-ui'), 'namearray' => 'cpt_labels', 'name' => 'parent', 'textvalue' => isset($current['labels']['parent']) ? esc_attr($current['labels']['parent']) : '', 'aftertext' => __('(e.g. Parent Movie)', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('labeltext' => __('Featured Image', 'custom-post-type-ui'), 'helptext' => esc_attr__('Used as the "Featured Image" phrase for the post type.', 'custom-post-type-ui'), 'namearray' => 'cpt_labels', 'name' => 'featured_image', 'textvalue' => isset($current['labels']['featured_image']) ? esc_attr($current['labels']['featured_image']) : '', 'aftertext' => __('(e.g. Featured image for this movie)', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('labeltext' => __('Set Featured Image', 'custom-post-type-ui'), 'helptext' => esc_attr__('Used as the "Set featured image" phrase for the post type.', 'custom-post-type-ui'), 'namearray' => 'cpt_labels', 'name' => 'set_featured_image', 'textvalue' => isset($current['labels']['set_featured_image']) ? esc_attr($current['labels']['set_featured_image']) : '', 'aftertext' => __('(e.g. Set featured image for this movie)', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('labeltext' => __('Remove Featured Image', 'custom-post-type-ui'), 'helptext' => esc_attr__('Used as the "Remove featured image" phrase for the post type.', 'custom-post-type-ui'), 'namearray' => 'cpt_labels', 'name' => 'remove_featured_image', 'textvalue' => isset($current['labels']['remove_featured_image']) ? esc_attr($current['labels']['remove_featured_image']) : '', 'aftertext' => __('(e.g. Remove featured image for this movie)', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('labeltext' => __('Use Featured Image', 'custom-post-type-ui'), 'helptext' => esc_attr__('Used as the "Use as featured image" phrase for the post type.', 'custom-post-type-ui'), 'namearray' => 'cpt_labels', 'name' => 'use_featured_image', 'textvalue' => isset($current['labels']['use_featured_image']) ? esc_attr($current['labels']['use_featured_image']) : '', 'aftertext' => __('(e.g. Use as featured image for this movie)', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('labeltext' => __('Archives', 'custom-post-type-ui'), 'helptext' => esc_attr__('Post type archive label used in nav menus.', 'custom-post-type-ui'), 'namearray' => 'cpt_labels', 'name' => 'archives', 'textvalue' => isset($current['labels']['archives']) ? esc_attr($current['labels']['archives']) : '', 'aftertext' => __('(e.g. Movie archives)', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('labeltext' => __('Insert into item', 'custom-post-type-ui'), 'helptext' => esc_attr__('Used as the "Insert into post" or "Insert into page" phrase for the post type.', 'custom-post-type-ui'), 'namearray' => 'cpt_labels', 'name' => 'insert_into_item', 'textvalue' => isset($current['labels']['insert_into_item']) ? esc_attr($current['labels']['insert_into_item']) : '', 'aftertext' => __('(e.g. Insert into movie)', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('labeltext' => __('Uploaded to this Item', 'custom-post-type-ui'), 'helptext' => esc_attr__('Used as the "Uploaded to this post" or "Uploaded to this page" phrase for the post type.', 'custom-post-type-ui'), 'namearray' => 'cpt_labels', 'name' => 'uploaded_to_this_item', 'textvalue' => isset($current['labels']['uploaded_to_this_item']) ? esc_attr($current['labels']['uploaded_to_this_item']) : '', 'aftertext' => __('(e.g. Uploaded to this movie)', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('labeltext' => __('Filter Items List', 'custom-post-type-ui'), 'helptext' => esc_attr__('Screen reader text for the filter links heading on the post type listing screen.', 'custom-post-type-ui'), 'namearray' => 'cpt_labels', 'name' => 'filter_items_list', 'textvalue' => isset($current['labels']['filter_items_list']) ? esc_attr($current['labels']['filter_items_list']) : '', 'aftertext' => __('(e.g. Filter movies list)', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('labeltext' => __('Items List Navigation', 'custom-post-type-ui'), 'helptext' => esc_attr__('Screen reader text for the pagination heading on the post type listing screen.', 'custom-post-type-ui'), 'namearray' => 'cpt_labels', 'name' => 'items_list_navigation', 'textvalue' => isset($current['labels']['items_list_navigation']) ? esc_attr($current['labels']['items_list_navigation']) : '', 'aftertext' => __('(e.g. Movies list navigation)', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('labeltext' => __('Items List', 'custom-post-type-ui'), 'helptext' => esc_attr__('Screen reader text for the items list heading on the post type listing screen.', 'custom-post-type-ui'), 'namearray' => 'cpt_labels', 'name' => 'items_list', 'textvalue' => isset($current['labels']['items_list']) ? esc_attr($current['labels']['items_list']) : '', 'aftertext' => __('(e.g. Movies list)', 'custom-post-type-ui')));
    ?>
			</table>
			<?php 
    echo $ui->get_fieldset_end();
    ?>
		</div>
		<div class="cptui-section">
			<p>
				<a href="#" id="togglesettings" class="button-secondary"><?php 
    esc_html_e('Edit settings', 'custom-post-type-ui');
    ?>
</a>
			</p>
			<?php 
    $fieldset_classes = '';
    echo $ui->get_fieldset_start(array('id' => 'settings_expand', 'classes' => array($fieldset_classes)));
    echo $ui->get_legend_start();
    esc_html_e('Settings', 'custom-post-type-ui');
    echo $ui->get_legend_end();
    ?>
			<table class="form-table cptui-table">
				<?php 
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'custom-post-type-ui')), array('attr' => '1', 'text' => __('True', 'custom-post-type-ui'), 'default' => 'true')));
    $selected = isset($current) ? disp_boolean($current['public']) : '';
    $select['selected'] = !empty($selected) ? $current['public'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'public', 'labeltext' => __('Public', 'custom-post-type-ui'), 'aftertext' => __('(CPTUI default: true)', 'custom-post-type-ui'), 'helptext' => esc_attr__('WordPress core defaults to false. CPTUI defaults to true for user sake. Whether posts of this type should be shown in the admin UI and is publicly queryable.', 'custom-post-type-ui'), 'selections' => $select));
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'custom-post-type-ui')), array('attr' => '1', 'text' => __('True', 'custom-post-type-ui'), 'default' => 'true')));
    $selected = isset($current) ? disp_boolean($current['show_ui']) : '';
    $select['selected'] = !empty($selected) ? $current['show_ui'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'show_ui', 'labeltext' => __('Show UI', 'custom-post-type-ui'), 'aftertext' => __('(default: true)', 'custom-post-type-ui'), 'helptext' => esc_attr__('Whether to generate a default UI for managing this post type.', 'custom-post-type-ui'), 'selections' => $select));
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'custom-post-type-ui')), array('attr' => '1', 'text' => __('True', 'custom-post-type-ui'), 'default' => 'true')));
    $selected = isset($current) && !empty($current['show_in_nav_menus']) ? disp_boolean($current['show_in_nav_menus']) : '';
    $select['selected'] = !empty($selected) && !empty($current['show_in_nav_menus']) ? $current['show_in_nav_menus'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'show_in_nav_menus', 'labeltext' => __('Show in Nav Menus', 'custom-post-type-ui'), 'aftertext' => __('(CPTUI default: true)', 'custom-post-type-ui'), 'helptext' => esc_attr__('Whether post type is available for selection in navigation menus.', 'custom-post-type-ui'), 'selections' => $select));
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'custom-post-type-ui'), 'default' => 'false'), array('attr' => '1', 'text' => __('True', 'custom-post-type-ui'))));
    $selected = isset($current) && !empty($current['show_in_rest']) ? disp_boolean($current['show_in_rest']) : '';
    $select['selected'] = !empty($selected) && !empty($current['show_in_rest']) ? $current['show_in_rest'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'show_in_rest', 'labeltext' => __('Show in REST API', 'custom-post-type-ui'), 'aftertext' => __('(default: false)', 'custom-post-type-ui'), 'helptext' => esc_attr__('Whether to show this post type data in the WP REST API.', 'custom-post-type-ui'), 'selections' => $select));
    echo $ui->get_text_input(array('labeltext' => __('REST API base slug', 'custom-post-type-ui'), 'helptext' => esc_attr__('Slug to use in REST API URLs.', 'custom-post-type-ui'), 'namearray' => 'cpt_custom_post_type', 'name' => 'rest_base', 'textvalue' => isset($current['rest_base']) ? esc_attr($current['rest_base']) : ''));
    echo $ui->get_tr_start() . $ui->get_th_start();
    echo $ui->get_label('has_archive', __('Has Archive', 'custom-post-type-ui'));
    echo $ui->get_help(esc_attr__('Whether the post type will have a post type archive URL.', 'custom-post-type-ui'));
    echo $ui->get_p(__('If left blank, the archive slug will default to the post type slug.', 'custom-post-type-ui'));
    echo $ui->get_th_end() . $ui->get_td_start();
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'custom-post-type-ui'), 'default' => 'true'), array('attr' => '1', 'text' => __('True', 'custom-post-type-ui'))));
    $selected = isset($current) ? disp_boolean($current['has_archive']) : '';
    $select['selected'] = !empty($selected) ? $current['has_archive'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'has_archive', 'aftertext' => __('(default: false)', 'custom-post-type-ui'), 'selections' => $select, 'wrap' => false));
    echo '<br/>';
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'has_archive_string', 'textvalue' => isset($current['has_archive_string']) ? esc_attr($current['has_archive_string']) : '', 'helptext' => esc_attr__('Slug to be used for archive URL.', 'custom-post-type-ui'), 'helptext_after' => true, 'wrap' => false));
    echo $ui->get_td_end() . $ui->get_tr_end();
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'custom-post-type-ui'), 'default' => 'true'), array('attr' => '1', 'text' => __('True', 'custom-post-type-ui'))));
    $selected = isset($current) ? disp_boolean($current['exclude_from_search']) : '';
    $select['selected'] = !empty($selected) ? $current['exclude_from_search'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'exclude_from_search', 'labeltext' => __('Exclude From Search', 'custom-post-type-ui'), 'aftertext' => __('(default: false)', 'custom-post-type-ui'), 'helptext' => esc_attr__('Whether to exclude posts with this post type from front end search results.', 'custom-post-type-ui'), 'selections' => $select));
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'capability_type', 'textvalue' => isset($current['capability_type']) ? esc_attr($current['capability_type']) : 'post', 'labeltext' => __('Capability Type', 'custom-post-type-ui'), 'helptext' => esc_attr__('The post type to use for checking read, edit, and delete capabilities', 'custom-post-type-ui')));
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'custom-post-type-ui'), 'default' => 'true'), array('attr' => '1', 'text' => __('True', 'custom-post-type-ui'))));
    $selected = isset($current) ? disp_boolean($current['hierarchical']) : '';
    $select['selected'] = !empty($selected) ? $current['hierarchical'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'hierarchical', 'labeltext' => __('Hierarchical', 'custom-post-type-ui'), 'aftertext' => __('(default: false)', 'custom-post-type-ui'), 'helptext' => esc_attr__('Whether the post type can have parent-child relationships', 'custom-post-type-ui'), 'selections' => $select));
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'custom-post-type-ui')), array('attr' => '1', 'text' => __('True', 'custom-post-type-ui'), 'default' => 'true')));
    $selected = isset($current) ? disp_boolean($current['rewrite']) : '';
    $select['selected'] = !empty($selected) ? $current['rewrite'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'rewrite', 'labeltext' => __('Rewrite', 'custom-post-type-ui'), 'aftertext' => __('(default: true)', 'custom-post-type-ui'), 'helptext' => esc_attr__('Whether or not WordPress should use rewrites for this post type', 'custom-post-type-ui'), 'selections' => $select));
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'rewrite_slug', 'textvalue' => isset($current['rewrite_slug']) ? esc_attr($current['rewrite_slug']) : '', 'labeltext' => __('Custom Rewrite Slug', 'custom-post-type-ui'), 'aftertext' => __('(default: post type slug)', 'custom-post-type-ui'), 'helptext' => esc_attr__('Custom post type slug to use instead of the default.', 'custom-post-type-ui')));
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'custom-post-type-ui')), array('attr' => '1', 'text' => __('True', 'custom-post-type-ui'), 'default' => 'true')));
    $selected = isset($current) ? disp_boolean($current['rewrite_withfront']) : '';
    $select['selected'] = !empty($selected) ? $current['rewrite_withfront'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'rewrite_withfront', 'labeltext' => __('With Front', 'custom-post-type-ui'), 'aftertext' => __('(default: true)', 'custom-post-type-ui'), 'helptext' => esc_attr__('Should the permastruct be prepended with the front base.', 'custom-post-type-ui'), 'selections' => $select));
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'custom-post-type-ui')), array('attr' => '1', 'text' => __('True', 'custom-post-type-ui'), 'default' => 'true')));
    $selected = isset($current) ? disp_boolean($current['query_var']) : '';
    $select['selected'] = !empty($selected) ? $current['query_var'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'query_var', 'labeltext' => __('Query Var', 'custom-post-type-ui'), 'aftertext' => __('(default: true)', 'custom-post-type-ui'), 'helptext' => esc_attr__('Sets the query_var key for this post type.', 'custom-post-type-ui'), 'selections' => $select));
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'query_var_slug', 'textvalue' => isset($current['query_var_slug']) ? esc_attr($current['query_var_slug']) : '', 'labeltext' => __('Custom Query Var Slug', 'custom-post-type-ui'), 'aftertext' => __('(default: post type slug) Query var needs to be true to use.', 'custom-post-type-ui'), 'helptext' => esc_attr__('Custom query var slug to use instead of the default.', 'custom-post-type-ui')));
    echo $ui->get_tr_start() . $ui->get_th_start();
    echo $ui->get_label('menu_position', __('Menu Position', 'custom-post-type-ui'));
    echo $ui->get_help(esc_attr__('The position in the menu order the post type should appear. show_in_menu must be true.', 'custom-post-type-ui'));
    echo $ui->get_p(__('See <a href="http://codex.wordpress.org/Function_Reference/register_post_type#Parameters" target="_blank">Available options</a> in the "menu_position" section. Range of 5-100', 'custom-post-type-ui'));
    echo $ui->get_th_end() . $ui->get_td_start();
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'menu_position', 'textvalue' => isset($current['menu_position']) ? esc_attr($current['menu_position']) : '', 'wrap' => false));
    echo $ui->get_td_end() . $ui->get_tr_end();
    echo $ui->get_tr_start() . $ui->get_th_start();
    echo $ui->get_label('show_in_menu', __('Show in Menu', 'custom-post-type-ui'));
    echo $ui->get_help(esc_attr__('Whether to show the post type in the admin menu and where to show that menu.', 'custom-post-type-ui'));
    echo $ui->get_p(__('"Show UI" must be "true". If an existing top level page such as "tools.php" is indicated for second input, post type will be sub menu of that.', 'custom-post-type-ui'));
    echo $ui->get_th_end() . $ui->get_td_start();
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'custom-post-type-ui')), array('attr' => '1', 'text' => __('True', 'custom-post-type-ui'), 'default' => 'true')));
    $selected = isset($current) ? disp_boolean($current['show_in_menu']) : '';
    $select['selected'] = !empty($selected) ? $current['show_in_menu'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'show_in_menu', 'aftertext' => __('(default: true)', 'custom-post-type-ui'), 'selections' => $select, 'wrap' => false));
    echo '<br/>';
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'show_in_menu_string', 'textvalue' => isset($current['show_in_menu_string']) ? esc_attr($current['show_in_menu_string']) : '', 'helptext' => esc_attr__('Top-level page file name to make post type a sub-menu of.', 'custom-post-type-ui'), 'helptext_after' => true, 'wrap' => false));
    echo $ui->get_td_end() . $ui->get_tr_end();
    echo $ui->get_tr_start() . $ui->get_th_start() . '<label for="menu_icon">' . __('Menu Icon', 'custom-post-type-ui') . '</label>' . $ui->get_th_end() . $ui->get_td_start();
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'menu_icon', 'textvalue' => isset($current['menu_icon']) ? esc_attr($current['menu_icon']) : '', 'aftertext' => __('(Full URL for icon or Dashicon class)', 'custom-post-type-ui'), 'helptext' => esc_attr__('Image URL or Dashicon class name to use for icon. Custom image should be 20px by 20px.', 'custom-post-type-ui'), 'wrap' => false));
    echo '<div class="cptui-spacer">';
    echo $ui->get_button(array('id' => 'cptui_choose_icon', 'textvalue' => __('Choose image icon', 'custom-post-type-ui')));
    echo '</div>';
    echo $ui->get_td_end() . $ui->get_tr_end();
    echo $ui->get_tr_start() . $ui->get_th_start() . __('Supports', 'custom-post-type-ui') . $ui->get_th_end() . $ui->get_td_start() . $ui->get_fieldset_start();
    $title_checked = !empty($current['supports']) && is_array($current['supports']) && in_array('title', $current['supports']) ? 'true' : 'false';
    if ('new' == $tab) {
        $title_checked = 'true';
    }
    echo $ui->get_check_input(array('checkvalue' => 'title', 'checked' => $title_checked, 'name' => 'title', 'namearray' => 'cpt_supports', 'textvalue' => 'title', 'labeltext' => __('Title', 'custom-post-type-ui'), 'helptext' => esc_attr__('Adds the title meta box when creating content for this custom post type', 'custom-post-type-ui'), 'default' => true, 'wrap' => false));
    $editor_checked = !empty($current['supports']) && is_array($current['supports']) && in_array('editor', $current['supports']) ? 'true' : 'false';
    if ('new' == $tab) {
        $editor_checked = 'true';
    }
    echo $ui->get_check_input(array('checkvalue' => 'editor', 'checked' => $editor_checked, 'name' => 'editor', 'namearray' => 'cpt_supports', 'textvalue' => 'editor', 'labeltext' => __('Editor', 'custom-post-type-ui'), 'helptext' => esc_attr__('Adds the content editor meta box when creating content for this custom post type', 'custom-post-type-ui'), 'default' => true, 'wrap' => false));
    $thumb_checked = !empty($current['supports']) && is_array($current['supports']) && in_array('thumbnail', $current['supports']) ? 'true' : 'false';
    if ('new' == $tab) {
        $thumb_checked = 'true';
    }
    echo $ui->get_check_input(array('checkvalue' => 'thumbnail', 'checked' => $thumb_checked, 'name' => 'thumbnail', 'namearray' => 'cpt_supports', 'textvalue' => 'thumbnail', 'labeltext' => __('Featured Image', 'custom-post-type-ui'), 'helptext' => esc_attr__('Adds the featured image meta box when creating content for this custom post type', 'custom-post-type-ui'), 'default' => true, 'wrap' => false));
    echo $ui->get_check_input(array('checkvalue' => 'excerpt', 'checked' => !empty($current['supports']) && is_array($current['supports']) && in_array('excerpt', $current['supports']) ? 'true' : 'false', 'name' => 'excerpts', 'namearray' => 'cpt_supports', 'textvalue' => 'excerpt', 'labeltext' => __('Excerpt', 'custom-post-type-ui'), 'helptext' => esc_attr__('Adds the excerpt meta box when creating content for this custom post type', 'custom-post-type-ui'), 'default' => true, 'wrap' => false));
    echo $ui->get_check_input(array('checkvalue' => 'trackbacks', 'checked' => !empty($current['supports']) && is_array($current['supports']) && in_array('trackbacks', $current['supports']) ? 'true' : 'false', 'name' => 'trackbacks', 'namearray' => 'cpt_supports', 'textvalue' => 'trackbacks', 'labeltext' => __('Trackbacks', 'custom-post-type-ui'), 'helptext' => esc_attr__('Adds the trackbacks meta box when creating content for this custom post type', 'custom-post-type-ui'), 'default' => true, 'wrap' => false));
    echo $ui->get_check_input(array('checkvalue' => 'custom-fields', 'checked' => !empty($current['supports']) && is_array($current['supports']) && in_array('custom-fields', $current['supports']) ? 'true' : 'false', 'name' => 'custom-fields', 'namearray' => 'cpt_supports', 'textvalue' => 'custom-fields', 'labeltext' => __('Custom Fields', 'custom-post-type-ui'), 'helptext' => esc_attr__('Adds the custom fields meta box when creating content for this custom post type', 'custom-post-type-ui'), 'default' => true, 'wrap' => false));
    echo $ui->get_check_input(array('checkvalue' => 'comments', 'checked' => !empty($current['supports']) && is_array($current['supports']) && in_array('comments', $current['supports']) ? 'true' : 'false', 'name' => 'comments', 'namearray' => 'cpt_supports', 'textvalue' => 'comments', 'labeltext' => __('Comments', 'custom-post-type-ui'), 'helptext' => esc_attr__('Adds the comments meta box when creating content for this custom post type', 'custom-post-type-ui'), 'default' => true, 'wrap' => false));
    echo $ui->get_check_input(array('checkvalue' => 'revisions', 'checked' => !empty($current['supports']) && is_array($current['supports']) && in_array('revisions', $current['supports']) ? 'true' : 'false', 'name' => 'revisions', 'namearray' => 'cpt_supports', 'textvalue' => 'revisions', 'labeltext' => __('Revisions', 'custom-post-type-ui'), 'helptext' => esc_attr__('Adds the revisions meta box when creating content for this custom post type', 'custom-post-type-ui'), 'default' => true, 'wrap' => false));
    echo $ui->get_check_input(array('checkvalue' => 'author', 'checked' => !empty($current['supports']) && is_array($current['supports']) && in_array('author', $current['supports']) ? 'true' : 'false', 'name' => 'author', 'namearray' => 'cpt_supports', 'textvalue' => 'author', 'labeltext' => __('Author', 'custom-post-type-ui'), 'helptext' => esc_attr__('Adds the author meta box when creating content for this custom post type', 'custom-post-type-ui'), 'default' => true, 'wrap' => false));
    echo $ui->get_check_input(array('checkvalue' => 'page-attributes', 'checked' => !empty($current['supports']) && is_array($current['supports']) && in_array('page-attributes', $current['supports']) ? 'true' : 'false', 'name' => 'page-attributes', 'namearray' => 'cpt_supports', 'textvalue' => 'page-attributes', 'labeltext' => __('Page Attributes', 'custom-post-type-ui'), 'helptext' => esc_attr__('Adds the page attribute meta box when creating content for this custom post type', 'custom-post-type-ui'), 'default' => true, 'wrap' => false));
    echo $ui->get_check_input(array('checkvalue' => 'post-formats', 'checked' => !empty($current['supports']) && is_array($current['supports']) && in_array('post-formats', $current['supports']) ? 'true' : 'false', 'name' => 'post-formats', 'namearray' => 'cpt_supports', 'textvalue' => 'post-formats', 'labeltext' => __('Post Formats', 'custom-post-type-ui'), 'helptext' => esc_attr__('Adds post format support', 'custom-post-type-ui'), 'default' => true, 'wrap' => false));
    echo $ui->get_p(__('Use the option below to explicitly set "supports" to false.', 'custom-post-type-ui'));
    echo $ui->get_check_input(array('checkvalue' => 'none', 'checked' => !empty($current['supports']) && (is_array($current['supports']) && in_array('none', $current['supports'])) ? 'true' : 'false', 'name' => 'none', 'namearray' => 'cpt_supports', 'textvalue' => 'none', 'labeltext' => __('None', 'custom-post-type-ui'), 'helptext' => esc_attr__('Remove all support features', 'custom-post-type-ui'), 'default' => false, 'wrap' => false));
    echo $ui->get_fieldset_end() . $ui->get_td_end() . $ui->get_tr_end();
    echo $ui->get_tr_start() . $ui->get_th_start() . __('Custom "Supports"', 'custom-post-type-ui');
    echo $ui->get_p(__('Use this input to register custom "supports" values, separated by commas.', 'custom-post-type-ui'));
    echo $ui->get_th_end() . $ui->get_td_start();
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'custom_supports', 'textvalue' => isset($current['custom_supports']) ? esc_attr($current['custom_supports']) : '', 'helptext' => esc_attr__('Provide custom support slugs here.', 'custom-post-type-ui'), 'helptext_after' => true, 'wrap' => false));
    echo $ui->get_td_end() . $ui->get_tr_end();
    echo $ui->get_tr_start() . $ui->get_th_start() . __('Built-in Taxonomies', 'custom-post-type-ui') . $ui->get_th_end() . $ui->get_td_start() . $ui->get_fieldset_start();
    /**
     * Filters the arguments for taxonomies to list for post type association.
     *
     * @since 1.0.0
     *
     * @param array $value Array of default arguments.
     */
    $args = apply_filters('cptui_attach_taxonomies_to_post_type', array('public' => true));
    // If they don't return an array, fall back to the original default. Don't need to check for empty, because empty array is default for $args param in get_post_types anyway.
    if (!is_array($args)) {
        $args = array('public' => true);
    }
    $add_taxes = get_taxonomies($args, 'objects');
    unset($add_taxes['nav_menu']);
    unset($add_taxes['post_format']);
    foreach ($add_taxes as $add_tax) {
        $core_label = in_array($add_tax->name, array('category', 'post_tag')) ? __('(WP Core)', 'custom-post-type-ui') : '';
        echo $ui->get_check_input(array('checkvalue' => $add_tax->name, 'checked' => !empty($current['taxonomies']) && is_array($current['taxonomies']) && in_array($add_tax->name, $current['taxonomies']) ? 'true' : 'false', 'name' => $add_tax->name, 'namearray' => 'cpt_addon_taxes', 'textvalue' => $add_tax->name, 'labeltext' => $add_tax->label . ' ' . $core_label, 'helptext' => sprintf(esc_attr__('Adds %s support', 'custom-post-type-ui'), $add_tax->label), 'wrap' => false));
    }
    echo $ui->get_fieldset_end() . $ui->get_td_end() . $ui->get_tr_end();
    ?>
			</table>
			<?php 
    echo $ui->get_fieldset_end();
    /**
     * Fires after the default fieldsets on the post editor screen.
     *
     * @since 1.3.0
     *
     * @param cptui_admin_ui $ui Admin UI instance.
     */
    do_action('cptui_post_type_after_fieldsets', $ui);
    ?>
		</div>
		<p>
		<?php 
    if (!empty($_GET) && !empty($_GET['action']) && 'edit' == $_GET['action']) {
        /**
         * Filters the text value to use on the button when editing.
         *
         * @since 1.0.0
         *
         * @param string $value Text to use for the button.
         */
        ?>
				<input type="submit" class="button-primary" name="cpt_submit" value="<?php 
        echo esc_attr(apply_filters('cptui_post_type_submit_edit', __('Save Post Type', 'custom-post-type-ui')));
        ?>
" />
				<?php 
        /**
         * Filters the text value to use on the button when deleting.
         *
         * @since 1.0.0
         *
         * @param string $value Text to use for the button.
         */
        ?>
				<input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php 
        echo esc_attr(apply_filters('cptui_post_type_submit_delete', __('Delete Post Type', 'custom-post-type-ui')));
        ?>
" />
		<?php 
    } else {
        /**
         * Filters the text value to use on the button when adding.
         *
         * @since 1.0.0
         *
         * @param string $value Text to use for the button.
         */
        ?>
				<input type="submit" class="button-primary" name="cpt_submit" value="<?php 
        echo esc_attr(apply_filters('cptui_post_type_submit_add', __('Add Post Type', 'custom-post-type-ui')));
        ?>
" />
		<?php 
    }
    ?>
		</p>
	</form>
	</div><!-- End .wrap -->
<?php 
}
コード例 #6
0
ファイル: taxonomies.php プロジェクト: jasonglisson/selingo
/**
 * Create our settings page output.
 *
 * @since 1.0.0
 *
 * @internal
 */
function cptui_manage_taxonomies()
{
    $taxonomy_deleted = false;
    if (!empty($_POST)) {
        if (isset($_POST['cpt_submit'])) {
            check_admin_referer('cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field');
            $notice = cptui_update_taxonomy($_POST);
        } elseif (isset($_POST['cpt_delete'])) {
            check_admin_referer('cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field');
            $notice = cptui_delete_taxonomy($_POST);
            $taxonomy_deleted = true;
        }
    }
    $tab = !empty($_GET) && !empty($_GET['action']) && 'edit' == $_GET['action'] ? 'edit' : 'new';
    $tab_class = 'cptui-' . $tab;
    ?>

	<div class="wrap <?php 
    echo esc_attr($tab_class);
    ?>
">

	<?php 
    /**
     * Fires right inside the wrap div for the taxonomy editor screen.
     *
     * @since 1.3.0
     */
    do_action('cptui_inside_taxonomy_wrap');
    if (isset($notice)) {
        echo $notice;
    }
    // Create our tabs.
    cptui_settings_tab_menu($page = 'taxonomies');
    /**
     * Fires below the output for the tab menu on the taxonomy add/edit screen.
     *
     * @since 1.3.0
     */
    do_action('cptui_below_taxonomy_tab_menu');
    if ('edit' == $tab) {
        $taxonomies = cptui_get_taxonomy_data();
        $selected_taxonomy = cptui_get_current_taxonomy($taxonomy_deleted);
        if ($selected_taxonomy) {
            if (array_key_exists($selected_taxonomy, $taxonomies)) {
                $current = $taxonomies[$selected_taxonomy];
            }
        }
    }
    $ui = new cptui_admin_ui();
    // Will only be set if we're already on the edit screen.
    if (!empty($taxonomies)) {
        ?>
		<form id="cptui_select_taxonomy" method="post" action="<?php 
        echo esc_url(cptui_get_post_form_action($ui));
        ?>
">
			<label for="taxonomy"><?php 
        _e('Select: ', 'custom-post-type-ui');
        ?>
</label>
			<?php 
        cptui_taxonomies_dropdown($taxonomies);
        /**
         * Filters the text value to use on the select taxonomy button.
         *
         * @since 1.0.0
         *
         * @param string $value Text to use for the button.
         */
        ?>
			<input type="submit" class="button-secondary" name="cptui_select_taxonomy_submit" value="<?php 
        echo esc_attr(apply_filters('cptui_taxonomy_submit_select', __('Select', 'custom-post-type-ui')));
        ?>
" />
		</form>
	<?php 
        /**
         * Fires below the taxonomy select input.
         *
         * @since 1.1.0
         *
         * @param string $value Current taxonomy selected.
         */
        do_action('cptui_below_taxonomy_select', $current['name']);
    }
    ?>

	<form class="taxonomiesui" method="post" action="<?php 
    echo esc_url(cptui_get_post_form_action($ui));
    ?>
">
		<div class="cptui-section">
			<?php 
    echo $ui->get_fieldset_start();
    echo $ui->get_legend_start();
    esc_html_e('Basic settings', 'custom-post-type-ui');
    echo $ui->get_legend_end();
    ?>
			<table class="form-table cptui-table">
				<?php 
    echo $ui->get_tr_start() . $ui->get_th_start();
    echo $ui->get_label('name', __('Taxonomy Slug', 'custom-post-type-ui')) . $ui->get_required_span();
    echo $ui->get_th_end() . $ui->get_td_start();
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_tax', 'name' => 'name', 'textvalue' => isset($current['name']) ? esc_attr($current['name']) : '', 'maxlength' => '32', 'helptext' => esc_attr__('The taxonomy name/slug. Used for various queries for taxonomy content.', 'custom-post-type-ui'), 'required' => true, 'placeholder' => false, 'wrap' => false));
    echo '<p class="cptui-slug-details">';
    esc_html_e('Slugs should only contain alphanumeric, latin characters. Underscores or dashes should be used in place of spaces.', 'custom-post-type-ui');
    echo '</p>';
    if ('edit' == $tab) {
        echo '<p>';
        esc_html_e('DO NOT EDIT the taxonomy slug unless also planning to migrate terms. Changing the slug registers a new taxonomy entry.', 'custom-post-type-ui');
        echo '</p>';
        echo '<div class="cptui-spacer">';
        echo $ui->get_check_input(array('checkvalue' => 'update_taxonomy', 'checked' => 'false', 'name' => 'update_taxonomy', 'namearray' => 'update_taxonomy', 'labeltext' => __('Migrate terms to newly renamed taxonomy?', 'custom-post-type-ui'), 'helptext' => '', 'default' => false, 'wrap' => false));
        echo '</div>';
    }
    echo $ui->get_td_end() . $ui->get_tr_end();
    echo $ui->get_tr_start() . $ui->get_th_start() . __('Attach to Post Type', 'custom-post-type-ui') . $ui->get_required_span();
    echo $ui->get_th_end() . $ui->get_td_start() . $ui->get_fieldset_start();
    /**
     * Filters the arguments for post types to list for taxonomy association.
     *
     * @since 1.0.0
     *
     * @param array $value Array of default arguments.
     */
    $args = apply_filters('cptui_attach_post_types_to_taxonomy', array('public' => true));
    // If they don't return an array, fall back to the original default. Don't need to check for empty, because empty array is default for $args param in get_post_types anyway.
    if (!is_array($args)) {
        $args = array('public' => true);
    }
    $output = 'objects';
    // Or objects.
    /**
     * Filters the results returned to display for available post types for taxonomy.
     *
     * @since 1.3.0
     *
     * @param array  $value  Array of post type objects.
     * @param array  $args   Array of arguments for the post type query.
     * @param string $output The output type we want for the results.
     */
    $post_types = apply_filters('cptui_get_post_types_for_taxonomies', get_post_types($args, $output), $args, $output);
    foreach ($post_types as $post_type) {
        $core_label = in_array($post_type->name, array('post', 'page', 'attachment')) ? __('(WP Core)', 'custom-post-type-ui') : '';
        echo $ui->get_check_input(array('checkvalue' => $post_type->name, 'checked' => !empty($current['object_types']) && is_array($current['object_types']) && in_array($post_type->name, $current['object_types']) ? 'true' : 'false', 'name' => $post_type->name, 'namearray' => 'cpt_post_types', 'textvalue' => $post_type->name, 'labeltext' => $post_type->label . ' ' . $core_label, 'helptext' => sprintf(esc_attr__('Adds %s support', 'custom-post-type-ui'), $post_type->label), 'wrap' => false));
    }
    echo $ui->get_fieldset_end() . $ui->get_td_end() . $ui->get_tr_end();
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_tax', 'name' => 'label', 'textvalue' => isset($current['label']) ? esc_attr($current['label']) : '', 'aftertext' => __('(e.g. Actors)', 'custom-post-type-ui'), 'labeltext' => __('Plural Label', 'custom-post-type-ui'), 'helptext' => esc_attr__('Used for the taxonomy admin menu item.', 'custom-post-type-ui'), 'required' => true));
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_tax', 'name' => 'singular_label', 'textvalue' => isset($current['singular_label']) ? esc_attr($current['singular_label']) : '', 'aftertext' => __('(e.g. Actor)', 'custom-post-type-ui'), 'labeltext' => __('Singular Label', 'custom-post-type-ui'), 'helptext' => esc_attr__('Used when a singular label is needed.', 'custom-post-type-ui'), 'required' => true));
    ?>
			</table>
			<p class="submit">
				<?php 
    wp_nonce_field('cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field');
    if (!empty($_GET) && !empty($_GET['action']) && 'edit' == $_GET['action']) {
        ?>
					<?php 
        /**
         * Filters the text value to use on the button when editing.
         *
         * @since 1.0.0
         *
         * @param string $value Text to use for the button.
         */
        ?>
					<input type="submit" class="button-primary" name="cpt_submit" value="<?php 
        echo esc_attr(apply_filters('cptui_taxonomy_submit_edit', __('Save Taxonomy', 'custom-post-type-ui')));
        ?>
" />
					<?php 
        /**
         * Filters the text value to use on the button when deleting.
         *
         * @since 1.0.0
         *
         * @param string $value Text to use for the button.
         */
        ?>
					<input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php 
        echo apply_filters('cptui_taxonomy_submit_delete', __('Delete Taxonomy', 'custom-post-type-ui'));
        ?>
" />
				<?php 
    } else {
        ?>
					<?php 
        /**
         * Filters the text value to use on the button when adding.
         *
         * @since 1.0.0
         *
         * @param string $value Text to use for the button.
         */
        ?>
					<input type="submit" class="button-primary" name="cpt_submit" value="<?php 
        echo esc_attr(apply_filters('cptui_taxonomy_submit_add', __('Add Taxonomy', 'custom-post-type-ui')));
        ?>
" />
				<?php 
    }
    ?>

				<?php 
    if (!empty($current)) {
        ?>
					<input type="hidden" name="tax_original" id="tax_original" value="<?php 
        echo $current['name'];
        ?>
" />
				<?php 
    }
    // Used to check and see if we should prevent duplicate slugs
    ?>
				<input type="hidden" name="cpt_tax_status" id="cpt_tax_status" value="<?php 
    echo $tab;
    ?>
" />
			</p>
			<?php 
    echo $ui->get_fieldset_end();
    ?>
		</div>
		<div class="cptui-section">
			<p>
				<a href="#" id="togglelabels" class="button-secondary"><?php 
    esc_html_e('Edit additional labels', 'custom-post-type-ui');
    ?>
</a>
			</p>
			<?php 
    $fieldset_classes = 'edit' == $tab ? '' : 'toggledclosed';
    echo $ui->get_fieldset_start(array('id' => 'labels_expand', 'classes' => array($fieldset_classes)));
    echo $ui->get_legend_start();
    esc_html_e('Additional labels', 'custom-post-type-ui');
    echo $ui->get_legend_end();
    ?>
			<table class="form-table cptui-table">

				<?php 
    if (isset($current['description'])) {
        $current['description'] = stripslashes_deep($current['description']);
    }
    echo $ui->get_textarea_input(array('namearray' => 'cpt_custom_tax', 'name' => 'description', 'rows' => '4', 'cols' => '40', 'textvalue' => isset($current['description']) ? esc_textarea($current['description']) : '', 'labeltext' => __('Description', 'custom-post-type-ui'), 'helptext' => esc_attr__('Describe what your taxonomy is used for.', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'menu_name', 'textvalue' => isset($current['labels']['menu_name']) ? esc_attr($current['labels']['menu_name']) : '', 'aftertext' => __('(e.g. Actors)', 'custom-post-type-ui'), 'labeltext' => __('Menu Name', 'custom-post-type-ui'), 'helptext' => esc_attr__('Custom admin menu name for your taxonomy.', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'all_items', 'textvalue' => isset($current['labels']['all_items']) ? esc_attr($current['labels']['all_items']) : '', 'aftertext' => __('(e.g. All Actors)', 'custom-post-type-ui'), 'labeltext' => __('All Items', 'custom-post-type-ui'), 'helptext' => esc_attr__('Used as tab text when showing all terms for hierarchical taxonomy while editing post.', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'edit_item', 'textvalue' => isset($current['labels']['edit_item']) ? esc_attr($current['labels']['edit_item']) : '', 'aftertext' => __('(e.g. Edit Actor)', 'custom-post-type-ui'), 'labeltext' => __('Edit Item', 'custom-post-type-ui'), 'helptext' => esc_attr__('Used at the top of the term editor screen for an existing taxonomy term.', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'view_item', 'textvalue' => isset($current['labels']['view_item']) ? esc_attr($current['labels']['view_item']) : '', 'aftertext' => __('(e.g. View Actor)', 'custom-post-type-ui'), 'labeltext' => __('View Item', 'custom-post-type-ui'), 'helptext' => esc_attr__('Used in the admin bar when viewing editor screen for an existing taxonomy term.', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'update_item', 'textvalue' => isset($current['labels']['update_item']) ? esc_attr($current['labels']['update_item']) : '', 'aftertext' => __('(e.g. Update Actor Name)', 'custom-post-type-ui'), 'labeltext' => __('Update Item Name', 'custom-post-type-ui'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'add_new_item', 'textvalue' => isset($current['labels']['add_new_item']) ? esc_attr($current['labels']['add_new_item']) : '', 'aftertext' => __('(e.g. Add New Actor)', 'custom-post-type-ui'), 'labeltext' => __('Add New Item', 'custom-post-type-ui'), 'helptext' => esc_attr__('Used at the top of the term editor screen and button text for a new taxonomy term.', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'new_item_name', 'textvalue' => isset($current['labels']['new_item_name']) ? esc_attr($current['labels']['new_item_name']) : '', 'aftertext' => __('(e.g. New Actor Name)', 'custom-post-type-ui'), 'labeltext' => __('New Item Name', 'custom-post-type-ui'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'parent_item', 'textvalue' => isset($current['labels']['parent_item']) ? esc_attr($current['labels']['parent_item']) : '', 'aftertext' => __('(e.g. Parent Actor)', 'custom-post-type-ui'), 'labeltext' => __('Parent Item', 'custom-post-type-ui'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'parent_item_colon', 'textvalue' => isset($current['labels']['parent_item_colon']) ? esc_attr($current['labels']['parent_item_colon']) : '', 'aftertext' => __('(e.g. Parent Actor:)', 'custom-post-type-ui'), 'labeltext' => __('Parent Item Colon', 'custom-post-type-ui'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'search_items', 'textvalue' => isset($current['labels']['search_items']) ? esc_attr($current['labels']['search_items']) : '', 'aftertext' => __('(e.g. Search Actors)', 'custom-post-type-ui'), 'labeltext' => __('Search Items', 'custom-post-type-ui'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'popular_items', 'textvalue' => isset($current['labels']['popular_items']) ? esc_attr($current['labels']['popular_items']) : null, 'aftertext' => __('(e.g. Popular Actors)', 'custom-post-type-ui'), 'labeltext' => __('Popular Items', 'custom-post-type-ui'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'separate_items_with_commas', 'textvalue' => isset($current['labels']['separate_items_with_commas']) ? esc_attr($current['labels']['separate_items_with_commas']) : null, 'aftertext' => __('(e.g. Separate Actors with commas)', 'custom-post-type-ui'), 'labeltext' => __('Separate Items with Commas', 'custom-post-type-ui'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'add_or_remove_items', 'textvalue' => isset($current['labels']['add_or_remove_items']) ? esc_attr($current['labels']['add_or_remove_items']) : null, 'aftertext' => __('(e.g. Add or remove Actors)', 'custom-post-type-ui'), 'labeltext' => __('Add or Remove Items', 'custom-post-type-ui'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'choose_from_most_used', 'textvalue' => isset($current['labels']['choose_from_most_used']) ? esc_attr($current['labels']['choose_from_most_used']) : null, 'aftertext' => __('(e.g. Choose from the most used Actors)', 'custom-post-type-ui'), 'labeltext' => __('Choose From Most Used', 'custom-post-type-ui'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'not_found', 'textvalue' => isset($current['labels']['not_found']) ? esc_attr($current['labels']['not_found']) : null, 'aftertext' => __('(e.g. No Actors found)', 'custom-post-type-ui'), 'labeltext' => __('Not found', 'custom-post-type-ui'), 'helptext' => esc_attr__('Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'no_terms', 'textvalue' => isset($current['labels']['no_terms']) ? esc_attr($current['labels']['no_terms']) : null, 'aftertext' => __('(e.g. No actors)', 'custom-post-type-ui'), 'labeltext' => __('No terms', 'custom-post-type-ui'), 'helptext' => esc_attr__('Used when indicating that there are no terms in the given taxonomy associated with an object.', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'items_list_navigation', 'textvalue' => isset($current['labels']['items_list_navigation']) ? esc_attr($current['labels']['items_list_navigation']) : null, 'aftertext' => __('(e.g. Actors list navigation)', 'custom-post-type-ui'), 'labeltext' => __('Items List Navigation', 'custom-post-type-ui'), 'helptext' => esc_attr__('Screen reader text for the pagination heading on the term listing screen.', 'custom-post-type-ui')));
    echo $ui->get_text_input(array('namearray' => 'cpt_tax_labels', 'name' => 'items_list', 'textvalue' => isset($current['labels']['items_list']) ? esc_attr($current['labels']['items_list']) : null, 'aftertext' => __('(e.g. Actors list)', 'custom-post-type-ui'), 'labeltext' => __('Items List', 'custom-post-type-ui'), 'helptext' => esc_attr__('Screen reader text for the items list heading on the term listing screen.', 'custom-post-type-ui')));
    ?>
			</table>
			<?php 
    echo $ui->get_fieldset_end();
    ?>
		</div>

		<div class="cptui-section">
			<p>
				<a href="#" id="togglesettings" class="button-secondary"><?php 
    esc_html_e('Edit settings', 'custom-post-type-ui');
    ?>
</a>
			</p>
			<?php 
    $fieldset_classes = '';
    echo $ui->get_fieldset_start(array('id' => 'settings_expand', 'classes' => array($fieldset_classes)));
    echo $ui->get_legend_start();
    esc_html_e('Settings', 'custom-post-type-ui');
    echo $ui->get_legend_end();
    ?>
			<table class="form-table cptui-table">
				<?php 
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'custom-post-type-ui')), array('attr' => '1', 'text' => __('True', 'custom-post-type-ui'), 'default' => 'true')));
    $selected = isset($current) ? disp_boolean($current['public']) : '';
    $select['selected'] = !empty($selected) ? $current['public'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_tax', 'name' => 'public', 'labeltext' => __('Public', 'custom-post-type-ui'), 'aftertext' => __('(default: true)', 'custom-post-type-ui'), 'helptext' => esc_attr__('Whether the taxonomy should be publicly queryable.', 'custom-post-type-ui'), 'selections' => $select));
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'custom-post-type-ui'), 'default' => 'true'), array('attr' => '1', 'text' => __('True', 'custom-post-type-ui'))));
    $selected = isset($current) ? disp_boolean($current['hierarchical']) : '';
    $select['selected'] = !empty($selected) ? $current['hierarchical'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_tax', 'name' => 'hierarchical', 'labeltext' => __('Hierarchical', 'custom-post-type-ui'), 'aftertext' => __('(default: false)', 'custom-post-type-ui'), 'helptext' => esc_attr__('Whether the taxonomy can have parent-child relationships', 'custom-post-type-ui'), 'selections' => $select));
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'custom-post-type-ui')), array('attr' => '1', 'text' => __('True', 'custom-post-type-ui'), 'default' => 'true')));
    $selected = isset($current) ? disp_boolean($current['show_ui']) : '';
    $select['selected'] = !empty($selected) ? $current['show_ui'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_tax', 'name' => 'show_ui', 'labeltext' => __('Show UI', 'custom-post-type-ui'), 'aftertext' => __('(default: true)', 'custom-post-type-ui'), 'helptext' => esc_attr__('Whether to generate a default UI for managing this custom taxonomy.', 'custom-post-type-ui'), 'selections' => $select));
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'custom-post-type-ui')), array('attr' => '1', 'text' => __('True', 'custom-post-type-ui'), 'default' => 'true')));
    $selected = isset($current) ? disp_boolean($current['query_var']) : '';
    $select['selected'] = !empty($selected) ? $current['query_var'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_tax', 'name' => 'query_var', 'labeltext' => __('Query Var', 'custom-post-type-ui'), 'aftertext' => __('(default: true)', 'custom-post-type-ui'), 'helptext' => esc_attr__('Sets the query_var key for this taxonomy.', 'custom-post-type-ui'), 'selections' => $select));
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_tax', 'name' => 'query_var_slug', 'textvalue' => isset($current['query_var_slug']) ? esc_attr($current['query_var_slug']) : '', 'aftertext' => __('(default: taxonomy slug). Query var needs to be true to use.', 'custom-post-type-ui'), 'labeltext' => __('Custom Query Var String', 'custom-post-type-ui'), 'helptext' => esc_attr__('Sets a custom query_var slug for this taxonomy.', 'custom-post-type-ui')));
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'custom-post-type-ui')), array('attr' => '1', 'text' => __('True', 'custom-post-type-ui'), 'default' => 'true')));
    $selected = isset($current) ? disp_boolean($current['rewrite']) : '';
    $select['selected'] = !empty($selected) ? $current['rewrite'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_tax', 'name' => 'rewrite', 'labeltext' => __('Rewrite', 'custom-post-type-ui'), 'aftertext' => __('(default: true)', 'custom-post-type-ui'), 'helptext' => esc_attr__('Whether or not WordPress should use rewrites for this taxonomy.', 'custom-post-type-ui'), 'selections' => $select));
    echo $ui->get_text_input(array('namearray' => 'cpt_custom_tax', 'name' => 'rewrite_slug', 'textvalue' => isset($current['rewrite_slug']) ? esc_attr($current['rewrite_slug']) : '', 'aftertext' => __('(default: taxonomy name)', 'custom-post-type-ui'), 'labeltext' => __('Custom Rewrite Slug', 'custom-post-type-ui'), 'helptext' => esc_attr__('Custom taxonomy rewrite slug.', 'custom-post-type-ui')));
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'custom-post-type-ui')), array('attr' => '1', 'text' => __('True', 'custom-post-type-ui'), 'default' => 'true')));
    $selected = isset($current) ? disp_boolean($current['rewrite_withfront']) : '';
    $select['selected'] = !empty($selected) ? $current['rewrite_withfront'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_tax', 'name' => 'rewrite_withfront', 'labeltext' => __('Rewrite With Front', 'custom-post-type-ui'), 'aftertext' => __('(default: true)', 'custom-post-type-ui'), 'helptext' => esc_attr__('Should the permastruct be prepended with the front base.', 'custom-post-type-ui'), 'selections' => $select));
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'custom-post-type-ui'), 'default' => 'false'), array('attr' => '1', 'text' => __('True', 'custom-post-type-ui'))));
    $selected = isset($current) ? disp_boolean($current['rewrite_hierarchical']) : '';
    $select['selected'] = !empty($selected) ? $current['rewrite_hierarchical'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_tax', 'name' => 'rewrite_hierarchical', 'labeltext' => __('Rewrite Hierarchical', 'custom-post-type-ui'), 'aftertext' => __('(default: false)', 'custom-post-type-ui'), 'helptext' => esc_attr__('Should the permastruct allow hierarchical urls.', 'custom-post-type-ui'), 'selections' => $select));
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'custom-post-type-ui'), 'default' => 'true'), array('attr' => '1', 'text' => __('True', 'custom-post-type-ui'))));
    $selected = isset($current) ? disp_boolean($current['show_admin_column']) : '';
    $select['selected'] = !empty($selected) ? $current['show_admin_column'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_tax', 'name' => 'show_admin_column', 'labeltext' => __('Show Admin Column', 'custom-post-type-ui'), 'aftertext' => __('(default: false)', 'custom-post-type-ui'), 'helptext' => esc_attr__('Whether to allow automatic creation of taxonomy columns on associated post-types.', 'custom-post-type-ui'), 'selections' => $select));
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'custom-post-type-ui'), 'default' => 'false'), array('attr' => '1', 'text' => __('True', 'custom-post-type-ui'))));
    $selected = isset($current) ? disp_boolean($current['show_in_rest']) : '';
    $select['selected'] = !empty($selected) ? $current['show_in_rest'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_tax', 'name' => 'show_in_rest', 'labeltext' => __('Show in REST API', 'custom-post-type-ui'), 'aftertext' => __('(default: false)', 'custom-post-type-ui'), 'helptext' => esc_attr__('Whether to show this taxonomy data in the WP REST API.', 'custom-post-type-ui'), 'selections' => $select));
    echo $ui->get_text_input(array('labeltext' => __('REST API base slug', 'custom-post-type-ui'), 'helptext' => esc_attr__('Slug to use in REST API URLs.', 'custom-post-type-ui'), 'namearray' => 'cpt_custom_tax', 'name' => 'rest_base', 'textvalue' => isset($current['rest_base']) ? esc_attr($current['rest_base']) : ''));
    $select = array('options' => array(array('attr' => '0', 'text' => __('False', 'custom-post-type-ui'), 'default' => 'false'), array('attr' => '1', 'text' => __('True', 'custom-post-type-ui'))));
    $selected = isset($current) && !empty($current['show_in_quick_edit']) ? disp_boolean($current['show_in_quick_edit']) : '';
    $select['selected'] = !empty($selected) ? $current['show_in_quick_edit'] : '';
    echo $ui->get_select_input(array('namearray' => 'cpt_custom_tax', 'name' => 'show_in_quick_edit', 'labeltext' => __('Show in quick/bulk edit panel.', 'custom-post-type-ui'), 'aftertext' => __('(default: false)', 'custom-post-type-ui'), 'helptext' => esc_attr__('Whether to show the taxonomy in the quick/bulk edit panel.', 'custom-post-type-ui'), 'selections' => $select));
    ?>
				</table>
			<?php 
    echo $ui->get_fieldset_end();
    /**
     * Fires after the default fieldsets on the taxonomy screen.
     *
     * @since 1.3.0
     *
     * @param cptui_admin_ui $ui Admin UI instance.
     */
    do_action('cptui_taxonomy_after_fieldsets', $ui);
    ?>
		</div>

		<p class="submit">
			<?php 
    wp_nonce_field('cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field');
    if (!empty($_GET) && !empty($_GET['action']) && 'edit' == $_GET['action']) {
        ?>
				<?php 
        /**
         * Filters the text value to use on the button when editing.
         *
         * @since 1.0.0
         *
         * @param string $value Text to use for the button.
         */
        ?>
				<input type="submit" class="button-primary" name="cpt_submit" value="<?php 
        echo esc_attr(apply_filters('cptui_taxonomy_submit_edit', __('Save Taxonomy', 'custom-post-type-ui')));
        ?>
" />
				<?php 
        /**
         * Filters the text value to use on the button when deleting.
         *
         * @since 1.0.0
         *
         * @param string $value Text to use for the button.
         */
        ?>
				<input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php 
        echo apply_filters('cptui_taxonomy_submit_delete', __('Delete Taxonomy', 'custom-post-type-ui'));
        ?>
" />
			<?php 
    } else {
        ?>
				<?php 
        /**
         * Filters the text value to use on the button when adding.
         *
         * @since 1.0.0
         *
         * @param string $value Text to use for the button.
         */
        ?>
				<input type="submit" class="button-primary" name="cpt_submit" value="<?php 
        echo esc_attr(apply_filters('cptui_taxonomy_submit_add', __('Add Taxonomy', 'custom-post-type-ui')));
        ?>
" />
			<?php 
    }
    ?>

			<?php 
    if (!empty($current)) {
        ?>
				<input type="hidden" name="tax_original" id="tax_original" value="<?php 
        echo $current['name'];
        ?>
" />
			<?php 
    }
    // Used to check and see if we should prevent duplicate slugs
    ?>
			<input type="hidden" name="cpt_tax_status" id="cpt_tax_status" value="<?php 
    echo $tab;
    ?>
" />
		</p>
	</form>
	</div><!-- End .wrap -->
<?php 
}
コード例 #7
0
/**
 * 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 -->';
}