function bepro_admin_init()
{
    $data = get_option("bepro_listings");
    add_meta_box("contact_general_meta", " ", "contact_general_meta", "bepro_listings", "normal", "low");
    if ($data["show_cost"] == (1 || "on")) {
        add_meta_box("cost_meta", "Cost \$", "cost_meta", "bepro_listings", "side", "low");
    }
    if ($data["show_con"] == (1 || "on")) {
        add_meta_box("contact_details_meta", "Lisiting Details", "contact_details_meta", "bepro_listings", "normal", "low");
    }
    if ($data["show_geo"] == (1 || "on")) {
        add_meta_box("geographic_details_meta", "Geographic Details", "geographic_details_meta", "bepro_listings", "normal", "low");
    }
    permalink_save_options();
    permalink_admin_init();
}
function bepro_create_post_type()
{
    //some stuff we wanna tie to init. This must move
    bl_load_constants();
    //register custom post types
    $labels = array('name' => _x('BePro Listings', 'post type general name', 'bepro-listings'), 'singular_name' => _x('Listing', 'post type singular name', 'bepro-listings'), 'menu_name' => _x('BePro Listings', 'admin menu', 'bepro-listings'), 'name_admin_bar' => _x('BePro Listing', 'add new on admin bar', 'bepro-listings'), 'add_new' => _x('Add New', 'Listing', 'bepro-listings'), 'add_new_item' => __('Add New Listing', 'bepro-listings'), 'edit_item' => __('Edit Listing', 'bepro-listings'), 'new_item' => __('New Listing', 'bepro-listings'), 'view_item' => __('View Listing', 'bepro-listings'), 'all_items' => __('All Listings', 'bepro-listings'), 'search_items' => __('Search Listings', 'bepro-listings'), 'parent_item_colon' => __('Parent Listings:', 'bepro-listings'), 'not_found' => __('Nothing found', 'bepro-listings'), 'not_found_in_trash' => __('Nothing found in Trash', 'bepro-listings'), 'parent_item_colon' => '');
    $options = get_option("bepro_listings");
    $slug = !empty($options["permalink"]) ? stripslashes($options["permalink"]) : "listings";
    $args = array('labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'menu_icon' => 'dashicons-images-alt2', 'rewrite' => array("slug" => $slug, 'with_front' => false), 'capability_type' => 'post', 'hierarchical' => false, 'menu_position' => null, 'supports' => array('title', 'editor', 'thumbnail', 'comments', 'revisions', 'custom-fields', 'page-attributes', 'author'));
    register_post_type('bepro_listings', $args);
    $cat_slug = !empty($options["cat_permalink"]) ? stripslashes($options["cat_permalink"]) : BEPRO_LISTINGS_CATEGORY_SLUG;
    register_taxonomy(BEPRO_LISTINGS_CATEGORY, "bepro_listings", array('hierarchical' => true, 'public' => true, 'publicly_queryable' => true, 'label' => __('BePro Listing Categories', 'bepro_listings'), 'labels' => array('name' => __('Listing Categories', 'bepro_listings'), 'singular_name' => __('Listing Category', 'bepro_listings'), 'menu_name' => _x('Categories', 'Admin menu name', 'bepro_listings'), 'search_items' => __('Search Listing Categories', 'bepro_listings'), 'all_items' => __('All Listing Categories', 'bepro_listings'), 'parent_item' => __('Parent Listing Category', 'bepro_listings'), 'parent_item_colon' => __('Parent Listing Category:', 'bepro_listings'), 'edit_item' => __('Edit Listing Category', 'bepro_listings'), 'update_item' => __('Update Listing Category', 'bepro_listings'), 'add_new_item' => __('Add New Listing Category', 'bepro_listings'), 'new_item_name' => __('New Listing Category Name', 'bepro_listings')), 'show_ui' => true, 'query_var' => true, 'rewrite' => array("slug" => $cat_slug, 'with_front' => false)));
    register_taxonomy_for_object_type('bepro_listing_types', 'bepro_listings');
    //pagement if $options["require_payment"] == 2
    if ($options["require_payment"] == 2) {
        $labels = array('name' => _x('BPL Packages', 'post type general name', 'bepro-listings'), 'singular_name' => _x('Package', 'post type singular name', 'bepro-listings'), 'menu_name' => _x('BPL Package', 'admin menu', 'bepro-listings'), 'name_admin_bar' => _x('BPL Package', 'add new on admin bar', 'bepro-listings'), 'add_new' => _x('Add New', 'Package', 'bepro-listings'), 'add_new_item' => __('Add New Package', 'bepro-listings'), 'edit_item' => __('Edit Package', 'bepro-listings'), 'new_item' => __('New Package', 'bepro-listings'), 'view_item' => __('View Package', 'bepro-listings'), 'all_items' => __('BPL Packages', 'bepro-listings'), 'search_items' => __('Search BPL Packages', 'bepro-listings'), 'parent_item_colon' => __('Parent Package:', 'bepro-listings'), 'not_found' => __('Nothing found', 'bepro-listings'), 'not_found_in_trash' => __('Nothing found in Trash', 'bepro-listings'), 'parent_item_colon' => '');
        $args = array('labels' => $labels, 'public' => false, 'publicly_queryable' => false, 'show_ui' => true, 'show_in_menu' => "edit.php?post_type=bepro_listings", 'query_var' => true, 'rewrite' => false, 'capability_type' => 'post', 'hierarchical' => false, 'menu_position' => null, 'supports' => array('title', 'editor'));
        register_post_type('bpl_packages', $args);
    }
    //pagement if $options["require_payment"] == 2+
    if (!empty($options["require_payment"])) {
        $labels = array('name' => _x('BPL Orders', 'post type general name', 'bepro-listings'), 'singular_name' => _x('Order', 'post type singular name', 'bepro-listings'), 'menu_name' => _x('BPL Orders', 'admin menu', 'bepro-listings'), 'name_admin_bar' => _x('BPl Orders', 'add new on admin bar', 'bepro-listings'), 'add_new' => _x('Add New', 'Order', 'bepro-listings'), 'add_new_item' => __('Add New Order', 'bepro-listings'), 'edit_item' => __('Edit Order', 'bepro-listings'), 'new_item' => __('New Order', 'bepro-listings'), 'view_item' => __('View Order', 'bepro-listings'), 'all_items' => __('BPL Orders', 'bepro-listings'), 'search_items' => __('Search BPL Orders', 'bepro-listings'), 'parent_item_colon' => __('Parent BL Order:', 'bepro-listings'), 'not_found' => __('Nothing found', 'bepro-listings'), 'not_found_in_trash' => __('Nothing found in Trash', 'bepro-listings'), 'parent_item_colon' => '');
        $args = array('labels' => $labels, 'public' => false, 'publicly_queryable' => false, 'show_ui' => true, 'show_in_menu' => "edit.php?post_type=bepro_listings", 'query_var' => true, 'rewrite' => false, 'capability_type' => 'post', 'hierarchical' => false, 'menu_position' => null, 'supports' => array('title'));
        register_post_type('bpl_orders', $args);
    }
    if (@$options["perm_chng"]) {
        flush_rewrite_rules();
        $options["perm_chng"] = "";
        update_option("bepro_listings", $options);
    }
    permalink_save_options();
    bl_complete_startup();
}