• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_disp_boolean函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_disp_boolean函数的典型用法代码示例。如果您正苦于以下问题:PHP get_disp_boolean函数的具体用法?PHP get_disp_boolean怎么用?PHP get_disp_boolean使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_disp_boolean函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: cptui_register_single_taxonomy

/**
 * Helper function to register the actual taxonomy.
 *
 * @param array $taxonomy Taxonomy array to register.
 *
 * @return null Result of register_taxonomy.
 */
function cptui_register_single_taxonomy($taxonomy = array())
{
    $labels = array('name' => $taxonomy['label'], 'singular_name' => $taxonomy['singular_label']);
    $preserved = cptui_get_preserved_keys('taxonomies');
    foreach ($taxonomy['labels'] as $key => $label) {
        if (!empty($label)) {
            $labels[$key] = $label;
        } elseif (empty($label) && in_array($key, $preserved)) {
            $labels[$key] = cptui_get_preserved_label('taxonomies', $key, $taxonomy['label'], $taxonomy['singular_label']);
        }
    }
    $rewrite = get_disp_boolean($taxonomy['rewrite']);
    if (false !== get_disp_boolean($taxonomy['rewrite'])) {
        $rewrite = array();
        $rewrite['slug'] = !empty($taxonomy['rewrite_slug']) ? $taxonomy['rewrite_slug'] : $taxonomy['name'];
        $rewrite['with_front'] = 'false' === disp_boolean($taxonomy['rewrite_withfront']) ? false : true;
        $rewrite['hierarchical'] = 'true' === disp_boolean($taxonomy['rewrite_hierarchical']) ? true : false;
    }
    if (in_array($taxonomy['query_var'], array('true', 'false', '0', '1'))) {
        $taxonomy['query_var'] = get_disp_boolean($taxonomy['query_var']);
    }
    if (true === $taxonomy['query_var'] && !empty($taxonomy['query_var_slug'])) {
        $taxonomy['query_var'] = $taxonomy['query_var_slug'];
    }
    $show_admin_column = !empty($taxonomy['show_admin_column']) && false !== get_disp_boolean($taxonomy['show_admin_column']) ? true : false;
    $args = array('labels' => $labels, 'label' => $taxonomy['label'], 'hierarchical' => get_disp_boolean($taxonomy['hierarchical']), 'show_ui' => get_disp_boolean($taxonomy['show_ui']), 'query_var' => $taxonomy['query_var'], 'rewrite' => $rewrite, 'show_admin_column' => $show_admin_column);
    $object_type = !empty($taxonomy['object_types']) ? $taxonomy['object_types'] : '';
    /**
     * Filters the arguments used for a taxonomy right before registering.
     *
     * @since 1.0.0
     *
     * @param array  $args Array of arguments to use for registering taxonomy.
     * @param string $value Taxonomy slug to be registered.
     */
    $args = apply_filters('cptui_pre_register_taxonomy', $args, $taxonomy['name']);
    return register_taxonomy($taxonomy['name'], $object_type, $args);
}
开发者ID:netpoe,项目名称:Gus.2016,代码行数:45,代码来源:custom-post-type-ui.php


示例2: cptui_register_single_taxonomy

/**
 * Helper function to register the actual taxonomy.
 *
 * @since 1.0.0
 *
 * @internal
 *
 * @param array $taxonomy Taxonomy array to register.
 * @return null Result of register_taxonomy.
 */
function cptui_register_single_taxonomy($taxonomy = array())
{
    $labels = array('name' => $taxonomy['label'], 'singular_name' => $taxonomy['singular_label']);
    $description = '';
    if (!empty($taxonomy['description'])) {
        $description = $taxonomy['description'];
    }
    $preserved = cptui_get_preserved_keys('taxonomies');
    foreach ($taxonomy['labels'] as $key => $label) {
        if (!empty($label)) {
            $labels[$key] = $label;
        } elseif (empty($label) && in_array($key, $preserved)) {
            $labels[$key] = cptui_get_preserved_label('taxonomies', $key, $taxonomy['label'], $taxonomy['singular_label']);
        }
    }
    $rewrite = get_disp_boolean($taxonomy['rewrite']);
    if (false !== get_disp_boolean($taxonomy['rewrite'])) {
        $rewrite = array();
        $rewrite['slug'] = !empty($taxonomy['rewrite_slug']) ? $taxonomy['rewrite_slug'] : $taxonomy['name'];
        $rewrite['with_front'] = 'false' === disp_boolean($taxonomy['rewrite_withfront']) ? false : true;
        $rewrite['hierarchical'] = 'true' === disp_boolean($taxonomy['rewrite_hierarchical']) ? true : false;
    }
    if (in_array($taxonomy['query_var'], array('true', 'false', '0', '1'))) {
        $taxonomy['query_var'] = get_disp_boolean($taxonomy['query_var']);
    }
    if (true === $taxonomy['query_var'] && !empty($taxonomy['query_var_slug'])) {
        $taxonomy['query_var'] = $taxonomy['query_var_slug'];
    }
    $public = !empty($taxonomy['public']) && false === get_disp_boolean($taxonomy['public']) ? false : true;
    $show_admin_column = !empty($taxonomy['show_admin_column']) && false !== get_disp_boolean($taxonomy['show_admin_column']) ? true : false;
    $show_in_menu = !empty($taxonomy['show_in_menu']) && false !== get_disp_boolean($taxonomy['show_in_menu']) ? true : false;
    if (empty($taxonomy['show_in_menu'])) {
        $show_in_menu = get_disp_boolean($taxonomy['show_ui']);
    }
    $show_in_nav_menus = !empty($taxonomy['show_in_nav_menus']) && false !== get_disp_boolean($taxonomy['show_in_nav_menus']) ? true : false;
    if (empty($taxonomy['show_in_nav_menus'])) {
        $show_in_nav_menus = $public;
    }
    $show_in_rest = !empty($taxonomy['show_in_rest']) && false !== get_disp_boolean($taxonomy['show_in_rest']) ? true : false;
    $show_in_quick_edit = !empty($taxonomy['show_in_quick_edit']) && false !== get_disp_boolean($taxonomy['show_in_quick_edit']) ? true : false;
    $rest_base = null;
    if (!empty($taxonomy['rest_base'])) {
        $rest_base = $taxonomy['rest_base'];
    }
    $args = array('labels' => $labels, 'label' => $taxonomy['label'], 'description' => $description, 'public' => $public, 'hierarchical' => get_disp_boolean($taxonomy['hierarchical']), 'show_ui' => get_disp_boolean($taxonomy['show_ui']), 'show_in_menu' => $show_in_menu, 'show_in_nav_menus' => $show_in_nav_menus, 'query_var' => $taxonomy['query_var'], 'rewrite' => $rewrite, 'show_admin_column' => $show_admin_column, 'show_in_rest' => $show_in_rest, 'rest_base' => $rest_base, 'show_in_quick_edit' => $show_in_quick_edit);
    $object_type = !empty($taxonomy['object_types']) ? $taxonomy['object_types'] : '';
    /**
     * Filters the arguments used for a taxonomy right before registering.
     *
     * @since 1.0.0
     * @since 1.3.0 Added original passed in values array
     *
     * @param array  $args     Array of arguments to use for registering taxonomy.
     * @param string $value    Taxonomy slug to be registered.
     * @param array  $taxonomy Original passed in values for taxonomy.
     */
    $args = apply_filters('cptui_pre_register_taxonomy', $args, $taxonomy['name'], $taxonomy);
    return register_taxonomy($taxonomy['name'], $object_type, $args);
}
开发者ID:pacificano,项目名称:pacificano,代码行数:69,代码来源:custom-post-type-ui.php


示例3: cpt_create_custom_taxonomies

function cpt_create_custom_taxonomies()
{
    //register custom taxonomies
    $cpt_tax_types = get_option('cpt_custom_tax_types');
    //check if option value is an array before proceeding
    if (is_array($cpt_tax_types)) {
        foreach ($cpt_tax_types as $cpt_tax_type) {
            //set custom taxonomy values
            $cpt_label = !empty($cpt_tax_type["label"]) ? esc_html($cpt_tax_type["label"]) : esc_html($cpt_tax_type["name"]);
            $cpt_singular_label = !empty($cpt_tax_type["singular_label"]) ? esc_html($cpt_tax_type["singular_label"]) : esc_html($cpt_tax_type["name"]);
            $cpt_rewrite_slug = !empty($cpt_tax_type["rewrite_slug"]) ? esc_html($cpt_tax_type["rewrite_slug"]) : esc_html($cpt_tax_type["name"]);
            $cpt_tax_show_admin_column = !empty($cpt_tax_type["show_admin_column"]) ? esc_html($cpt_tax_type["show_admin_column"]) : false;
            $cpt_post_types = !empty($cpt_tax_type[1]) ? $cpt_tax_type[1] : $cpt_tax_type["cpt_name"];
            //set custom label values
            $cpt_labels['name'] = $cpt_label;
            $cpt_labels['singular_name'] = $cpt_tax_type["singular_label"];
            $cpt_labels['search_items'] = $cpt_tax_type[0]["search_items"] ? $cpt_tax_type[0]["search_items"] : 'Search ' . $cpt_label;
            $cpt_labels['popular_items'] = $cpt_tax_type[0]["popular_items"] ? $cpt_tax_type[0]["popular_items"] : 'Popular ' . $cpt_label;
            $cpt_labels['all_items'] = $cpt_tax_type[0]["all_items"] ? $cpt_tax_type[0]["all_items"] : 'All ' . $cpt_label;
            $cpt_labels['parent_item'] = $cpt_tax_type[0]["parent_item"] ? $cpt_tax_type[0]["parent_item"] : 'Parent ' . $cpt_singular_label;
            $cpt_labels['parent_item_colon'] = $cpt_tax_type[0]["parent_item_colon"] ? $cpt_tax_type[0]["parent_item_colon"] : 'Parent ' . $cpt_singular_label . ':';
            $cpt_labels['edit_item'] = $cpt_tax_type[0]["edit_item"] ? $cpt_tax_type[0]["edit_item"] : 'Edit ' . $cpt_singular_label;
            $cpt_labels['update_item'] = $cpt_tax_type[0]["update_item"] ? $cpt_tax_type[0]["update_item"] : 'Update ' . $cpt_singular_label;
            $cpt_labels['add_new_item'] = $cpt_tax_type[0]["add_new_item"] ? $cpt_tax_type[0]["add_new_item"] : 'Add New ' . $cpt_singular_label;
            $cpt_labels['new_item_name'] = $cpt_tax_type[0]["new_item_name"] ? $cpt_tax_type[0]["new_item_name"] : 'New ' . $cpt_singular_label . ' Name';
            $cpt_labels['separate_items_with_commas'] = $cpt_tax_type[0]["separate_items_with_commas"] ? $cpt_tax_type[0]["separate_items_with_commas"] : 'Separate ' . $cpt_label . ' with commas';
            $cpt_labels['add_or_remove_items'] = $cpt_tax_type[0]["add_or_remove_items"] ? $cpt_tax_type[0]["add_or_remove_items"] : 'Add or remove ' . $cpt_label;
            $cpt_labels['choose_from_most_used'] = $cpt_tax_type[0]["choose_from_most_used"] ? $cpt_tax_type[0]["choose_from_most_used"] : 'Choose from the most used ' . $cpt_label;
            //register our custom taxonomies
            register_taxonomy($cpt_tax_type["name"], $cpt_post_types, array('hierarchical' => get_disp_boolean($cpt_tax_type["hierarchical"]), 'label' => $cpt_label, 'show_ui' => get_disp_boolean($cpt_tax_type["show_ui"]), 'query_var' => get_disp_boolean($cpt_tax_type["query_var"]), 'rewrite' => array('slug' => $cpt_rewrite_slug), 'singular_label' => $cpt_singular_label, 'labels' => $cpt_labels, 'show_admin_column' => $cpt_tax_show_admin_column));
        }
    }
}
开发者ID:Natedaug,项目名称:WordPressSites,代码行数:33,代码来源:custom-post-type-ui.php


示例4: cptui_get_single_post_type_registery

/**
 * Create output for single post type to be ready for copy/paste from Get Code.
 *
 * @since 1.0.0
 *
 * @param array $post_type Post type data to output.
 *
 * @return string Copy/paste ready "php" code.
 */
function cptui_get_single_post_type_registery($post_type = array())
{
    /** This filter is documented in custom-post-type-ui/custom-post-type-ui.php */
    $post_type['map_meta_cap'] = apply_filters('cptui_map_meta_cap', 'true', $post_type['name'], $post_type);
    $user_supports_params = apply_filters('cptui_user_supports_params', array(), $post_type['name'], $post_type);
    if (is_array($user_supports_params)) {
        $post_type['supports'] = array_merge($post_type['supports'], $user_supports_params);
    }
    $rewrite = get_disp_boolean($post_type['rewrite']);
    if (false !== $rewrite) {
        $rewrite = disp_boolean($post_type['rewrite']);
        $rewrite_slug = ' "slug" => "' . $post_type['name'] . '",';
        if (!empty($post_type['rewrite_slug'])) {
            $rewrite_slug = ' "slug" => "' . $post_type['rewrite_slug'] . '",';
        }
        $withfront = disp_boolean($post_type['rewrite_withfront']);
        if (!empty($withfront)) {
            $rewrite_withfront = ' "with_front" => ' . $withfront . ' ';
        }
        if (!empty($post_type['rewrite_slug']) || !empty($post_type['rewrite_withfront'])) {
            $rewrite_start = 'array(';
            $rewrite_end = ')';
            $rewrite = $rewrite_start . $rewrite_slug . $rewrite_withfront . $rewrite_end;
        }
    } else {
        $rewrite = disp_boolean($post_type['rewrite']);
    }
    $supports = '';
    # Do a little bit of php work to get these into strings.
    if (!empty($post_type['supports']) && is_array($post_type['supports'])) {
        $supports = 'array( "' . implode('", "', $post_type['supports']) . '" )';
    }
    if (in_array('none', $post_type['supports'])) {
        $supports = 'false';
    }
    $taxonomies = '';
    if (!empty($post_type['taxonomies']) && is_array($post_type['taxonomies'])) {
        $taxonomies = 'array( "' . implode('", "', $post_type['taxonomies']) . '" )';
    }
    if (in_array($post_type['query_var'], array('true', 'false', '0', '1'))) {
        $post_type['query_var'] = get_disp_boolean($post_type['query_var']);
    }
    $post_type['description'] = addslashes($post_type['description']);
    ?>
	$labels = array(
		"name" => "<?php 
    echo $post_type['label'];
    ?>
",
		"singular_name" => "<?php 
    echo $post_type['singular_label'];
    ?>
",
		<?php 
    foreach ($post_type['labels'] as $key => $label) {
        if (!empty($label)) {
            echo '"' . $key . '" => "' . $label . '",' . "\n\t\t";
        }
    }
    ?>
);

	$args = array(
		"labels" => $labels,
		"description" => "<?php 
    echo $post_type['description'];
    ?>
",
		"public" => <?php 
    echo disp_boolean($post_type['public']);
    ?>
,
		"show_ui" => <?php 
    echo disp_boolean($post_type['show_ui']);
    ?>
,
		"has_archive" => <?php 
    echo disp_boolean($post_type['has_archive']);
    ?>
,
		"show_in_menu" => <?php 
    echo disp_boolean($post_type['show_in_menu']);
    ?>
,
		"exclude_from_search" => <?php 
    echo disp_boolean($post_type['exclude_from_search']);
    ?>
,
		"capability_type" => "<?php 
    echo $post_type['capability_type'];
    ?>
//.........这里部分代码省略.........
开发者ID:netpoe,项目名称:Gus.2016,代码行数:101,代码来源:import_export.php


示例5: test_get_disp_boolean

 public function test_get_disp_boolean()
 {
     $this->assertFalse(get_disp_boolean(0));
     $this->assertFalse(get_disp_boolean('0'));
     $this->assertFalse(get_disp_boolean(false));
     $this->assertFalse(get_disp_boolean('false'));
     $this->assertFalse(get_disp_boolean(''));
     $this->assertFalse(get_disp_boolean(null));
     $this->assertTrue(get_disp_boolean(1));
     $this->assertTrue(get_disp_boolean('1'));
     $this->assertTrue(get_disp_boolean(true));
     $this->assertTrue(get_disp_boolean('true'));
     $this->assertTrue(get_disp_boolean('abcd'));
     $this->assertTrue(get_disp_boolean(1235));
 }
开发者ID:netpoe,项目名称:Gus.2016,代码行数:15,代码来源:CPTUI-Utilities-Test.php


示例6: cpt_manage_cpt


//.........这里部分代码省略.........
				<td valign="top"><?php 
            echo $cpt_counts->publish;
            ?>
</td>
				<td valign="top"><?php 
            echo $cpt_counts->draft;
            ?>
</td>
				<td>
					<?php 
            if (is_array($cpt_post_type[0])) {
                foreach ($cpt_post_type[0] as $cpt_supports) {
                    echo $cpt_supports . '<br />';
                }
            }
            ?>
				</td>
			</tr>
			<tr>
				<td colspan="12">
					<div style="display:none;" id="slidepanel<?php 
            echo $thecounter;
            ?>
">
						<?php 
            // Begin the display for the "Get code" feature
            //display register_post_type code
            $custom_post_type = '';
            $cpt_support_array = '';
            $cpt_tax_array = '';
            $cpt_label = empty($cpt_post_type["label"]) ? esc_html($cpt_post_type["name"]) : esc_html($cpt_post_type["label"]);
            $cpt_singular = empty($cpt_post_type["singular_label"]) ? $cpt_label : esc_html($cpt_post_type["singular_label"]);
            $cpt_rewrite_slug = empty($cpt_post_type["rewrite_slug"]) ? esc_html($cpt_post_type["name"]) : esc_html($cpt_post_type["rewrite_slug"]);
            $cpt_rewrite_withfront = empty($cpt_post_type['rewrite_withfront']) ? get_disp_boolean($cpt_post_type['rewrite_withfront']) : 'true';
            //not reversed because false is empty, making the assignment go to true
            $cpt_menu_position = empty($cpt_post_type["menu_position"]) ? null : intval($cpt_post_type["menu_position"]);
            $cpt_menu_icon = !empty($cpt_post_type["menu_icon"]) ? esc_attr($cpt_post_type["menu_icon"]) : null;
            if (true == $cpt_post_type["show_ui"]) {
                $cpt_show_in_menu = $cpt_post_type["show_in_menu"] == 1 ? 1 : 0;
                $cpt_show_in_menu = $cpt_post_type["show_in_menu_string"] ? '\'' . $cpt_post_type["show_in_menu_string"] . '\'' : $cpt_show_in_menu;
            } else {
                $cpt_show_in_menu = 0;
            }
            //set custom label values
            $cpt_labels['name'] = $cpt_label;
            $cpt_labels['singular_name'] = $cpt_post_type["singular_label"];
            $cpt_labels['menu_name'] = $cpt_post_type[2]["menu_name"] ? $cpt_post_type[2]["menu_name"] : $cpt_label;
            $cpt_labels['add_new'] = $cpt_post_type[2]["add_new"] ? $cpt_post_type[2]["add_new"] : 'Add ' . $cpt_singular;
            $cpt_labels['add_new_item'] = $cpt_post_type[2]["add_new_item"] ? $cpt_post_type[2]["add_new_item"] : 'Add New ' . $cpt_singular;
            $cpt_labels['edit'] = $cpt_post_type[2]["edit"] ? $cpt_post_type[2]["edit"] : 'Edit';
            $cpt_labels['edit_item'] = $cpt_post_type[2]["edit_item"] ? $cpt_post_type[2]["edit_item"] : 'Edit ' . $cpt_singular;
            $cpt_labels['new_item'] = $cpt_post_type[2]["new_item"] ? $cpt_post_type[2]["new_item"] : 'New ' . $cpt_singular;
            $cpt_labels['view'] = $cpt_post_type[2]["view"] ? $cpt_post_type[2]["view"] : 'View ' . $cpt_singular;
            $cpt_labels['view_item'] = $cpt_post_type[2]["view_item"] ? $cpt_post_type[2]["view_item"] : 'View ' . $cpt_singular;
            $cpt_labels['search_items'] = $cpt_post_type[2]["search_items"] ? $cpt_post_type[2]["search_items"] : 'Search ' . $cpt_label;
            $cpt_labels['not_found'] = $cpt_post_type[2]["not_found"] ? $cpt_post_type[2]["not_found"] : 'No ' . $cpt_label . ' Found';
            $cpt_labels['not_found_in_trash'] = $cpt_post_type[2]["not_found_in_trash"] ? $cpt_post_type[2]["not_found_in_trash"] : 'No ' . $cpt_label . ' Found in Trash';
            $cpt_labels['parent'] = $cpt_post_type[2]["parent"] ? $cpt_post_type[2]["parent"] : 'Parent ' . $cpt_singular;
            if (false == (bool) $cpt_post_type["rewrite"]) {
                $rewrite = 'false';
            } else {
                if (!empty($cpt_post_type["rewrite_slug"])) {
                    $rewrite = "array('slug' => '" . $cpt_post_type["rewrite_slug"] . "', 'with_front' => " . $cpt_post_type['rewrite_withfront'] . "),\n";
                } else {
                    if (empty($cpt_post_type['rewrite_withfront'])) {
                        $cpt_post_type['rewrite_withfront'] = 1;
开发者ID:marcmascort,项目名称:custom-post-type-ui,代码行数:67,代码来源:custom-post-type-ui.php


示例7: cptui_get_single_post_type_registery

/**
 * Create output for single post type to be ready for copy/paste from Get Code.
 *
 * @since 1.0.0
 *
 * @param array $post_type Post type data to output.
 * @return string Copy/paste ready "php" code.
 */
function cptui_get_single_post_type_registery($post_type = array())
{
    /** This filter is documented in custom-post-type-ui/custom-post-type-ui.php */
    $post_type['map_meta_cap'] = apply_filters('cptui_map_meta_cap', 'true', $post_type['name'], $post_type);
    /** This filter is documented in custom-post-type-ui/custom-post-type-ui.php */
    $user_supports_params = apply_filters('cptui_user_supports_params', array(), $post_type['name'], $post_type);
    if (is_array($user_supports_params)) {
        $post_type['supports'] = array_merge($post_type['supports'], $user_supports_params);
    }
    $yarpp = false;
    // Prevent notices.
    if (!empty($post_type['custom_supports'])) {
        $custom = explode(',', $post_type['custom_supports']);
        foreach ($custom as $part) {
            // We'll handle YARPP separately.
            if (in_array($part, array('YARPP', 'yarpp'))) {
                $yarpp = true;
                continue;
            }
            $post_type['supports'][] = $part;
        }
    }
    $rewrite_withfront = '';
    $rewrite = get_disp_boolean($post_type['rewrite']);
    if (false !== $rewrite) {
        $rewrite = disp_boolean($post_type['rewrite']);
        $rewrite_slug = ' "slug" => "' . $post_type['name'] . '",';
        if (!empty($post_type['rewrite_slug'])) {
            $rewrite_slug = ' "slug" => "' . $post_type['rewrite_slug'] . '",';
        }
        $withfront = disp_boolean($post_type['rewrite_withfront']);
        if (!empty($withfront)) {
            $rewrite_withfront = ' "with_front" => ' . $withfront . ' ';
        }
        if (!empty($post_type['rewrite_slug']) || !empty($post_type['rewrite_withfront'])) {
            $rewrite_start = 'array(';
            $rewrite_end = ')';
            $rewrite = $rewrite_start . $rewrite_slug . $rewrite_withfront . $rewrite_end;
        }
    } else {
        $rewrite = disp_boolean($post_type['rewrite']);
    }
    $supports = '';
    // Do a little bit of php work to get these into strings.
    if (!empty($post_type['supports']) && is_array($post_type['supports'])) {
        $supports = 'array( "' . implode('", "', $post_type['supports']) . '" )';
    }
    if (in_array('none', $post_type['supports'])) {
        $supports = 'false';
    }
    $taxonomies = '';
    if (!empty($post_type['taxonomies']) && is_array($post_type['taxonomies'])) {
        $taxonomies = 'array( "' . implode('", "', $post_type['taxonomies']) . '" )';
    }
    if (in_array($post_type['query_var'], array('true', 'false', '0', '1'))) {
        $post_type['query_var'] = disp_boolean($post_type['query_var']);
    }
    if (!empty($post_type['query_var_slug'])) {
        $post_type['query_var'] = '"' . $post_type['query_var_slug'] . '"';
    }
    if (empty($post_type['show_in_rest'])) {
        $post_type['show_in_rest'] = 'false';
    }
    $post_type['description'] = addslashes($post_type['description']);
    $my_theme = wp_get_theme();
    $textdomain = $my_theme->get('TextDomain');
    ?>
	$labels = array(
		"name" => __( '<?php 
    echo $post_type['label'];
    ?>
', '<?php 
    echo $textdomain;
    ?>
' ),
		"singular_name" => __( '<?php 
    echo $post_type['singular_label'];
    ?>
', '<?php 
    echo $textdomain;
    ?>
' ),
		<?php 
    foreach ($post_type['labels'] as $key => $label) {
        if (!empty($label)) {
            echo '"' . $key . '" => __( \'' . $label . '\', \'' . $textdomain . '\' ),' . "\n\t\t";
        }
    }
    ?>
);

	$args = array(
//.........这里部分代码省略.........
开发者ID:pacificano,项目名称:sweet-tooth-sweets,代码行数:101,代码来源:import_export.php


示例8: cptui_get_single_post_type_registery

/**
 * Create output for single post type to be ready for copy/paste from Get Code.
 *
 * @since 1.0.0
 *
 * @param array $post_type Post type data to output.
 *
 * @return string Copy/paste ready "php" code.
 */
function cptui_get_single_post_type_registery($post_type = array())
{
    /** This filter is documented in custom-post-type-ui/custom-post-type-ui.php */
    $post_type['map_meta_cap'] = apply_filters('cptui_map_meta_cap', 'true', $post_type['name'], $post_type);
    $user_supports_params = apply_filters('cptui_user_supports_params', array(), $post_type['name'], $post_type);
    if (is_array($user_supports_params)) {
        $post_type['supports'] = array_merge($post_type['supports'], $user_supports_params);
    }
    $rewrite = get_disp_boolean($post_type['rewrite']);
    if (false !== $rewrite) {
        $rewrite = disp_boolean($post_type['rewrite']);
        $rewrite_slug = ' \'slug\' => \'' . $post_type['name'] . '\',';
        if (!empty($post_type['rewrite_slug'])) {
            $rewrite_slug = ' \'slug\' => \'' . $post_type['rewrite_slug'] . '\',';
        }
        $withfront = disp_boolean($post_type['rewrite_withfront']);
        if (!empty($withfront)) {
            $rewrite_withfront = ' \'with_front\' => ' . $withfront . ' ';
        }
        if (!empty($post_type['rewrite_slug']) || !empty($post_type['rewrite_withfront'])) {
            $rewrite_start = 'array(';
            $rewrite_end = ')';
            $rewrite = $rewrite_start . $rewrite_slug . $rewrite_withfront . $rewrite_end;
        }
    } else {
        $rewrite = disp_boolean($post_type['rewrite']);
    }
    $supports = '';
    # Do a little bit of php work to get these into strings.
    if (!empty($post_type['supports']) && is_array($post_type['supports'])) {
        $supports = 'array( \'' . implode('\', \'', $post_type['supports']) . '\' )';
    }
    $taxonomies = '';
    if (!empty($post_type['taxonomies']) && is_array($post_type['taxonomies'])) {
        $taxonomies = 'array( \'' . implode('\', \'', $post_type['taxonomies']) . '\' )';
    }
    $post_type['description'] = addslashes($post_type['description']);
    ?>
	$labels = array(
		'name' => '<?php 
    echo $post_type['label'];
    ?>
',
		'singular_name' => '<?php 
    echo $post_type['singular_label'];
    ?>
',
		<?php 
    foreach ($post_type['labels'] as $key => $label) {
        if (!empty($label)) {
            echo "'{$key}' => '{$label}',\n\t\t";
        }
    }
    ?>
);

	$args = array(
		'labels' => $labels,
		'description' => '<?php 
    echo $post_type['description'];
    ?>
',
		'public' => <?php 
    echo $post_type['public'];
    ?>
,
		'show_ui' => <?php 
    echo $post_type['show_ui'];
    ?>
,
		'has_archive' => <?php 
    echo $post_type['has_archive'];
    ?>
,
		'show_in_menu' => <?php 
    echo $post_type['show_in_menu'];
    ?>
,
		'exclude_from_search' => <?php 
    echo $post_type['exclude_from_search'];
    ?>
,
		'capability_type' => '<?php 
    echo $post_type['capability_type'];
    ?>
',
		'map_meta_cap' => <?php 
    echo $post_type['map_meta_cap'];
    ?>
,
		'hierarchical' => <?php 
//.........这里部分代码省略.........
开发者ID:karenwingyee,项目名称:Superdry-blog,代码行数:101,代码来源:import_export.php



注:本文中的get_disp_boolean函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_display_language函数代码示例发布时间:2022-05-15
下一篇:
PHP get_discount函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap