コード例 #1
0
function Grafik_Functions_Shortcode_TypePosts($atts, $content = '')
{
    global $wp_query;
    global $GRAFIK_MODE;
    $callback_output = '';
    $a = shortcode_atts(array('type' => 'post', 'empty_msg' => 'No posts to show, this archive is empty!', 'listing_page' => 'single', 'single_mode' => 'scroll', 'single_scroll' => 'Loading More', 'single_click' => 'Load More', 'multi_prev' => '“ Prev', 'multi_next' => 'Next ”', 'class' => '', 'id' => ''), $atts, 'TypePosts');
    $callback_structures = array('home' => json_decode(get_option('Grafik_Functions_Blog_Structure', true), true), 'author' => json_decode(get_option('Grafik_Functions_BlogAuthors_Structure', true), true), 'category' => json_decode(get_option('Grafik_Functions_BlogCategories_Structure', true), true), 'post' => json_decode(get_option('Grafik_Functions_BlogPosts_Structure', true), true), 'search' => json_decode(get_option('Grafik_Functions_Search_Structure', true), true));
    if ($GRAFIK_MODE['is_single'] == 1) {
        // Determine which template to use...
        // $post_structure = Grafik_ReadDecode( $callback_structures[ 'post' ][ 'html' ] );
        $post_structure = $content;
        // Get the post...
        $callback_output .= Grafik_CurlyCodes(get_the_ID(), $post_structure);
    } else {
        // Determine which template to use...
        if ($GRAFIK_MODE['is_author'] == 1) {
            $post_structure = Grafik_ReadDecode($callback_structures[$callback_structures['author']['behavior-html'] == 1 ? 'home' : 'author']['html']);
        } else {
            if ($GRAFIK_MODE['is_category'] == 1) {
                $post_structure = Grafik_ReadDecode($callback_structures[$callback_structures['category']['behavior-html'] == 1 ? 'home' : 'category']['html']);
            } else {
                if ($GRAFIK_MODE['is_search'] == 1) {
                    $post_structure = Grafik_ReadDecode($callback_structures[$callback_structures['search']['behavior-html '] == 1 ? 'home' : 'search']['html']);
                } else {
                    $post_structure = Grafik_ReadDecode($callback_structures['home']['html']);
                }
            }
        }
        // Construct the query...
        $callback_query = new WP_Query(array('post_type' => explode(',', $a['type']), 'author' => $wp_query->query_vars['author'], 'cat' => $wp_query->query_vars['cat'], 'paged' => $wp_query->query_vars['paged'], 's' => get_search_query()));
        // Loop the query...
        if ($callback_query->have_posts()) {
            while ($callback_query->have_posts()) {
                $callback_query->the_post();
                $callback_output .= Grafik_CurlyCodes(get_the_ID(), $post_structure);
            }
            wp_reset_postdata();
        } else {
            $callback_output .= '<span class="empty-message">' . $a['empty_msg'] . '</span>';
        }
        // Additional posts...
        if ($a['listing_page'] == 'single') {
            $callback_output = '<div class="single-wrapper">' . $callback_output . '</div>' . ($a['single_mode'] != 'scroll' ? '' : '<div class="single-scroll-loader"><span>' . $a['single_scroll'] . '</span></div>') . ($a['single_mode'] != 'click' ? '' : '<div class="single-click-loader"><span>' . $a['single_click'] . '</span></div>') . '<script src="' . esc_url(get_template_directory_uri()) . '/js/shortcodes/TypePosts.js"></script>';
        } else {
            if ($a['listing_page'] == 'multi') {
                $callback_output = '<div class="multi-wrapper">' . $callback_output . '</div>' . '<div class="links-pagination">## TODO: PAGINATION ##</div>';
            } else {
                $callback_output = '<div class="default-wrapper">' . $callback_output . '</div>';
            }
        }
    }
    return '<!-- ' . print_r($callback_query, true) . ' -->' . '<div class="theme-typeposts' . (empty($a['class']) ? null : ' ' . $a['class']) . '"' . (empty($a['id']) ? null : ' id="' . $a['id'] . '"') . '>' . $callback_output . '</div>';
}
コード例 #2
0
function Grafik_Functions_Shortcode_Blog($atts)
{
    global $GRAFIK_MODE;
    $a = shortcode_atts(array('empty_msg' => 'No posts to show, the blog is empty!', 'page_mode' => 'lazy', 'page_links_prev' => '&ldquo; Prev', 'page_links_next' => 'Next &rdquo;', 'page_lazy_mode' => 'scroll', 'page_lazy_scroll' => 'Loading More', 'page_lazy_click' => 'Load More', 'class' => '', 'id' => ''), $atts, "Blog");
    $callback_structures = array('home' => json_decode(get_option('Grafik_Functions_Blog_Structure', true), true), 'author' => json_decode(get_option('Grafik_Functions_BlogAuthors_Structure', true), true), 'category' => json_decode(get_option('Grafik_Functions_BlogCategories_Structure', true), true), 'post' => json_decode(get_option('Grafik_Functions_BlogPosts_Structure', true), true));
    $callback_output = '';
    if (have_posts()) {
        while (have_posts()) {
            $callback_template = '';
            if ($GRAFIK_MODE['is_home'] == 1) {
                $callback_template = Grafik_ReadDecode($callback_structures['home']['html']);
            } else {
                if ($GRAFIK_MODE['is_archive'] == 1) {
                    $callback_template = Grafik_ReadDecode($callback_structures['home']['html']);
                } else {
                    if ($GRAFIK_MODE['is_author'] == 1) {
                        $callback_template = Grafik_ReadDecode($callback_structures[$callback_structures['author']['behavior-html'] == 1 ? 'home' : 'author']['html']);
                    } else {
                        if ($GRAFIK_MODE['is_category'] == 1) {
                            $callback_template = Grafik_ReadDecode($callback_structures[$callback_structures['category']['behavior-html'] == 1 ? 'home' : 'category']['html']);
                        } else {
                            if ($GRAFIK_MODE['is_single'] == 1) {
                                $callback_template = Grafik_ReadDecode($callback_structures['post']['html']);
                            }
                        }
                    }
                }
            }
            $callback_assets = Grafik_Functions_Shortcode_Blog_Assets();
            $callback_output .= str_replace($callback_assets['tokens'], $callback_assets['values'], $callback_template);
        }
    } else {
        $callback_output .= '<span class="empty-message">' . $a['empty_msg'] . '</span>';
    }
    if ($GRAFIK_MODE['is_single'] != 1) {
        if ($a['page_mode'] == 'lazy') {
            $callback_output = '<div class="lazy-wrapper">' . $callback_output . '</div>' . ($a['page_lazy_mode'] != 'scroll' ? '' : '<div class="lazy-loader-scroll"><span>' . $a['page_lazy_scroll'] . '</span></div>') . ($a['page_lazy_mode'] != 'click' ? '' : '<div class="lazy-loader-click"><span>' . $a['page_lazy_click'] . '</span></div>') . '<script src="' . esc_url(get_template_directory_uri()) . '/js/shortcodes/Blog.js"></script>';
        } else {
            if ($a['page_mode'] == 'links') {
                $callback_output = '<div class="links-wrapper">' . $callback_output . '</div>' . '<div class="links-pagination">' . '<span>## TODO: PAGINATION ##</span>' . '</div>';
            } else {
                $callback_output = '<div class="default-wrapper">' . $callback_output . '</div>';
            }
        }
    }
    return '<div class="theme-blog' . (empty($a['class']) ? null : ' ' . $a['class']) . '"' . (empty($a['id']) ? null : ' id="' . $a['id'] . '"') . '>' . $callback_output . '</div>';
}
コード例 #3
0
# FILTERS
add_filter('show_admin_bar', '__return_false');
add_filter('get_search_form', function ($form) {
    return '<form role="search" method="GET" class="theme-blogsearch" action="' . get_permalink(get_option('page_for_posts')) . '">' . '<label>' . '<div class="label">Search</div>' . '<div class="input"><input type="text" value="' . get_search_query() . '" name="s" placeholder="SEARCH BLOG" /></div>' . '</label>' . '<div class="submit"><button type="submit">Search</button></div>' . '<input type="hidden" value="post" name="post_type" />' . '</form>';
});
# ACTIONS
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
add_action('init', function () {
    register_nav_menus(array('Header_TopLeft' => 'Header (Top Left)', 'Header_TopRight' => 'Header (Top Right)', 'Header_MiddleLeft' => 'Header (Middle Left)', 'Header_MiddleRight' => 'Header (Middle Right)', 'Header_BottomLeft' => 'Header (Bottom Left)', 'Header_BottomRight' => 'Header (Bottom Right)', 'Content_Top' => 'Content (Top)', 'Content_Left' => 'Content (Left)', 'Content_Center' => 'Content (Center)', 'Content_Right' => 'Content (Right)', 'Content_Bottom' => 'Content (Bottom)', 'Footer_TopLeft' => 'Footer (Top Left)', 'Footer_TopRight' => 'Footer (Top Right)', 'Footer_MiddleLeft' => 'Footer (Middle Left)', 'Footer_MiddleRight' => 'Footer (Middle Right)', 'Footer_BottomLeft' => 'Footer (Bottom Left)', 'Footer_BottomRight' => 'Footer (Bottom Right)'));
    $Grafik_CustomTypes = json_decode(get_option('Grafik_PostType_Info', '[]'), true);
    foreach ($Grafik_CustomTypes as $key => $val) {
        if ($key == 'save-time' || $key == 'save-user') {
            continue;
        }
        register_post_type($key, array('labels' => array('name' => Grafik_ReadDecode($val['plural']), 'singular_name' => Grafik_ReadDecode($val['single']), 'add_new' => 'Add New', 'add_new_item' => 'Add New ' . Grafik_ReadDecode($val['single']), 'edit' => 'Edit', 'edit_item' => 'Edit ' . Grafik_ReadDecode($val['single']), 'new_item' => 'New ' . Grafik_ReadDecode($val['single']), 'view' => 'View', 'view_item' => 'View ' . Grafik_ReadDecode($val['single']), 'search_items' => 'Search ' . Grafik_ReadDecode($val['plural']), 'not_found' => 'No ' . Grafik_ReadDecode($val['plural']) . ' Found', 'not_found_in_trash' => 'No ' . Grafik_ReadDecode($val['plural']) . ' Found In Trash', 'parent' => 'Parent ' . Grafik_ReadDecode($val['single'])), 'public' => true, 'has_archive' => true, 'menu_position' => 6, 'supports' => array('author', 'custom-fields', 'editor', 'thumbnail', 'title', 'excerpt'), 'taxonomies' => array('category')));
    }
});
add_action('admin_init', function () {
    global $submenu;
    unset($submenu['themes.php'][6]);
    remove_submenu_page('themes.php', 'theme-editor.php');
}, 102);
add_action('admin_enqueue_scripts', function () {
    wp_enqueue_style('grafik-css', get_template_directory_uri() . '/style.css', false);
});
# FUNCTIONS
include 'functions/filters.php';
include 'functions/utilities.php';
include 'functions/menus.php';
include 'functions/metabox.php';
コード例 #4
0
function Grafik_CurlyCodes($post_id, $structure = '')
{
    if (empty($structure)) {
        return '';
    }
    $post = get_post($post_id);
    $assets_author = get_userdata($post->post_author);
    $options = json_decode(get_option('Grafik_CategoryFilters', '[]'), true);
    $exclusions = array();
    foreach ($options as $key => $val) {
        if (strpos($key, 'behavior-') !== 0) {
            continue;
        }
        if ($val == 1 || $val == 3) {
            $key_parts = explode('-', $key);
            $key_id = (int) end($key_parts);
            $exclusions[] = $key_id;
        }
    }
    $category_names = array();
    $category_links = array();
    $post_categories = wp_get_post_categories($post_id);
    foreach ($post_categories as $category_id) {
        if ($options['behavior-' . $category_id] == 1) {
            continue;
        }
        if ($options['behavior-' . $category_id] == 3) {
            continue;
        }
        $category = get_category($category_id);
        $category->URL = get_category_link($category_id);
        $category_names[] = '<li class="cat-item cat-item-' . $category_id . '">' . $category->name . '</li>';
        $category_links[] = '<li class="cat-item cat-item-' . $category_id . '"><a href="' . $category->URL . '">' . $category->name . '</a></li>';
    }
    $post_type = $post->post_type;
    $post_types = json_decode(get_option('Grafik_PostType_Info', '[]'), true);
    preg_match_all("/ src=\"([^\"]*)\"/", get_the_post_thumbnail(), $assets_image);
    $assets_date = explode('|', date("d|j|S|l|D|m|n|F|M|Y|y|a|A|g|h|G|H|i|s|T|c|r", strtotime($post->post_date)));
    $assets = array(array('{{ RAW }}', print_r($post, true)), array('{{ ID }}', $post->ID), array('{{ PARENT_ID }}', $post->post_parent), array('{{ AUTHOR_ID }}', $post->post_author), array('{{ AUTHOR_SLUG }}', get_the_author_meta('user_nicename', $post->post_author)), array('{{ AUTHOR_NAME }}', $assets_author->first_name . ' ' . $assets_author->last_name), array('{{ AUTHOR_FIRST }}', $assets_author->first_name), array('{{ AUTHOR_LAST }}', $assets_author->last_name), array('{{ AUTHOR_USERNAME }}', $assets_author->user_login), array('{{ CATEGORY_NAMES }}', '<ul>' . implode('', $category_names) . '</ul>'), array('{{ CATEGORY_LINKS }}', '<ul>' . implode('', $category_links) . '</ul>'), array('{{ FEATURED_IMAGE }}', get_the_post_thumbnail()), array('{{ FEATURED_IMAGE_URL }}', empty($assets_image) ? '' : $assets_image[1][0]), array('{{ CONTENT }}', $post->post_content), array('{{ TITLE }}', $post->post_title), array('{{ TITLE_SLUG }}', $post->post_name), array('{{ EXCERPT }}', get_the_excerpt()), array('{{ GUID }}', $post->guid), array('{{ PERMALINK }}', get_permalink()), array('{{ DATE_DAY }}', $assets_date[1]), array('{{ DATE_DAY_PADDED }}', $assets_date[0]), array('{{ DATE_DAY_SUFFIX }}', $assets_date[2]), array('{{ DATE_WEEKDAY }}', $assets_date[3]), array('{{ DATE_WEEKDAY_ABBR }}', $assets_date[4]), array('{{ DATE_MONTH }}', $assets_date[6]), array('{{ DATE_MONTH_PADDED }}', $assets_date[5]), array('{{ DATE_MONTH_FULL }}', $assets_date[7]), array('{{ DATE_MONTH_ABBR }}', $assets_date[8]), array('{{ DATE_YEAR }}', $assets_date[9]), array('{{ DATE_YEAR_ABBR }}', $assets_date[10]), array('{{ TIME_24H }}', $assets_date[15]), array('{{ TIME_24H_PADDED }}', $assets_date[16]), array('{{ TIME_12H }}', $assets_date[13]), array('{{ TIME_12H_PADDED }}', $assets_date[14]), array('{{ TIME_12H_SUFFIX }}', $assets_date[11]), array('{{ TIME_MINUTES }}', $assets_date[17]), array('{{ TIME_SECONDS }}', $assets_date[18]), array('{{ TIME_ZONE }}', $assets_date[19]), array('{{ TIME_ISO8601 }}', $assets_date[20]), array('{{ TIME_RFC2822 }}', $assets_date[21]), array('{{ TYPE_SLUG }}', $post_type), array('{{ TYPE_SINGLE }}', Grafik_ReadDecode($post_types[$post_type]['single'])), array('{{ TYPE_PLURAL }}', Grafik_ReadDecode($post_types[$post_type]['plural'])));
    foreach ($assets as $asset) {
        $structure = str_replace($asset[0], $asset[1], $structure);
    }
    return $structure;
}
コード例 #5
0
function Grafik_Templates_GetHTML($template, $single_id = false)
{
    $inherits = Grafik_Templates_GetInherits();
    $sections = Grafik_Templates_GetFields();
    $order = $inherits[$template];
    $order[] = $template;
    $options = array();
    foreach ($order as $current) {
        $options[] = Grafik_Templates_GetOptions($current);
    }
    if ($single_id !== false) {
        $options[] = get_post_meta($single_id, 'Grafik_Metaboxes');
    }
    $html = array();
    foreach ($options as $option) {
        foreach ($sections as $section => $fields) {
            foreach ($fields as $field) {
                $key = $section . '_' . $field;
                if (!is_array($html[$key])) {
                    $html[$key] = array();
                }
                if (isset($option[$key . '_Mode'])) {
                    switch ($option[$key . '_Mode']) {
                        case '0':
                            continue;
                            break;
                        case '1':
                            array_unshift($html[$key], $option[$key . '_HTML']);
                            break;
                        case '2':
                            array_push($html[$key], $option[$key . '_HTML']);
                            break;
                        case '3':
                            $html[$key] = array($option[$key . '_HTML']);
                            break;
                    }
                }
            }
            // foreach( $fields )
        }
        // foreach ( $sections )
    }
    // foreach ( $options )
    foreach ($html as $section => $blocks) {
        $output = '';
        foreach ($blocks as $block) {
            $output .= Grafik_ReadDecode($block);
        }
        $html[$section] = Grafik_Menus_GetHTML($section, Grafik_ShortcodeLoop($output));
    }
    return $html;
}
コード例 #6
0
function Grafik_PostTypes_Output()
{
    /*
    .o8888 888888 888888    .o88o. 8888o. 888888 88 .o88o. 8888o. .o8888
    		88     88       88      88  88 88  88   88   88 88  88 88  88 88    
    		88  88 8888     88      88  88 8888Y'   88   88 88  88 88  88 'Y88o.
    		88  88 88       88      88  88 88       88   88 88  88 88  88     88
    		'Y8888 888888   88      'Y88Y' 88       88   88 'Y88Y' 88  88 8888Y'
    */
    $edit_options_info = $options_info = json_decode(get_option('Grafik_PostType_Info', '[]'), true);
    $edit_options_styles = $options_styles = json_decode(get_option('Grafik_PostType_Styles', '[]'), true);
    $edit_options_header = $options_header = json_decode(get_option('Grafik_PostType_Header', '[]'), true);
    $edit_options_content = $options_content = json_decode(get_option('Grafik_PostType_Content', '[]'), true);
    $edit_options_footer = $options_footer = json_decode(get_option('Grafik_PostType_Footer', '[]'), true);
    $edit_options_scripts = $options_scripts = json_decode(get_option('Grafik_PostType_Scripts', '[]'), true);
    $edit_options_structure = $options_structure = json_decode(get_option('Grafik_PostType_Structure', '[]'), true);
    ksort($options_info);
    /*
    888888 .o88o. 8888o. 888888o.    .o8888 88  88 8888o. 888888o. 88 888888
    		88     88  88 88  88 88 88 88    88     88  88 88  88 88 88 88 88   88  
    		8888   88  88 8888Y' 88 88 88    'Y88o. 88  88 8888Y' 88 88 88 88   88  
    		88     88  88 88  88 88 88 88        88 88  88 88  88 88 88 88 88   88  
    		88     'Y88Y' 88  88 88 88 88    8888Y' 'Y88Y' 8888Y' 88 88 88 88   88  
    */
    $submit_status = '';
    if (isset($_POST['Grafik_PostTypes_Nonce']) && wp_verify_nonce($_POST['Grafik_PostTypes_Nonce'], 'Grafik_PostTypes_Nonce')) {
        $submit_save = array('time' => time(), 'user' => get_current_user_id());
        $submit_id = empty($_POST['edit-id']) ? '' : sanitize_text_field($_POST['edit-id']);
        switch (strtolower($_POST['action'])) {
            case 'create':
                $submit_id = sanitize_text_field($_POST['create-slug']);
                $edit_options_info[$submit_id]['single'] = Grafik_WriteEncode($_POST['create-single']);
                $edit_options_info[$submit_id]['plural'] = Grafik_WriteEncode($_POST['create-plural']);
                $edit_options_info[$submit_id]['save'] = $submit_save;
                update_option('Grafik_PostType_Info', json_encode($edit_options_info));
                break;
            case 'edit-info':
                $edit_options_info[$submit_id]['single'] = Grafik_WriteEncode($_POST['edit-single']);
                $edit_options_info[$submit_id]['plural'] = Grafik_WriteEncode($_POST['edit-plural']);
                $edit_options_info[$submit_id]['save'] = $submit_save;
                update_option('Grafik_PostType_Info', json_encode($edit_options_info));
                break;
            case 'edit-styles':
                $edit_options_styles[$submit_id]['html'] = Grafik_WriteEncode($_POST['edit-html']);
                $edit_options_styles[$submit_id]['behavior'] = (int) $_POST['edit-behavior'];
                $edit_options_styles[$submit_id]['save'] = $submit_save;
                update_option('Grafik_PostType_Styles', json_encode($edit_options_styles));
                break;
            case 'edit-header':
                $edit_options_header[$submit_id]['tl'] = Grafik_WriteEncode($_POST['edit-header-tl-html']);
                $edit_options_header[$submit_id]['tr'] = Grafik_WriteEncode($_POST['edit-header-tr-html']);
                $edit_options_header[$submit_id]['ml'] = Grafik_WriteEncode($_POST['edit-header-ml-html']);
                $edit_options_header[$submit_id]['mr'] = Grafik_WriteEncode($_POST['edit-header-mr-html']);
                $edit_options_header[$submit_id]['bl'] = Grafik_WriteEncode($_POST['edit-header-bl-html']);
                $edit_options_header[$submit_id]['br'] = Grafik_WriteEncode($_POST['edit-header-br-html']);
                $edit_options_header[$submit_id]['behavior-tl'] = (int) $_POST['edit-header-tl-behavior'];
                $edit_options_header[$submit_id]['behavior-tr'] = (int) $_POST['edit-header-tr-behavior'];
                $edit_options_header[$submit_id]['behavior-ml'] = (int) $_POST['edit-header-ml-behavior'];
                $edit_options_header[$submit_id]['behavior-mr'] = (int) $_POST['edit-header-mr-behavior'];
                $edit_options_header[$submit_id]['behavior-bl'] = (int) $_POST['edit-header-bl-behavior'];
                $edit_options_header[$submit_id]['behavior-br'] = (int) $_POST['edit-header-br-behavior'];
                $edit_options_header[$submit_id]['save'] = $submit_save;
                update_option('Grafik_PostType_Header', json_encode($edit_options_header));
                break;
            case 'edit-content':
                $edit_options_content[$submit_id]['t'] = Grafik_WriteEncode($_POST['edit-content-t-html']);
                $edit_options_content[$submit_id]['l'] = Grafik_WriteEncode($_POST['edit-content-l-html']);
                $edit_options_content[$submit_id]['c'] = Grafik_WriteEncode($_POST['edit-content-c-html']);
                $edit_options_content[$submit_id]['r'] = Grafik_WriteEncode($_POST['edit-content-r-html']);
                $edit_options_content[$submit_id]['b'] = Grafik_WriteEncode($_POST['edit-content-b-html']);
                $edit_options_content[$submit_id]['behavior-t'] = (int) $_POST['edit-content-t-behavior'];
                $edit_options_content[$submit_id]['behavior-l'] = (int) $_POST['edit-content-l-behavior'];
                $edit_options_content[$submit_id]['behavior-c'] = (int) $_POST['edit-content-c-behavior'];
                $edit_options_content[$submit_id]['behavior-r'] = (int) $_POST['edit-content-r-behavior'];
                $edit_options_content[$submit_id]['behavior-b'] = (int) $_POST['edit-content-b-behavior'];
                $edit_options_content[$submit_id]['save'] = $submit_save;
                update_option('Grafik_PostType_Content', json_encode($edit_options_content));
                break;
            case 'edit-footer':
                $edit_options_footer[$submit_id]['tl'] = Grafik_WriteEncode($_POST['edit-footer-tl-html']);
                $edit_options_footer[$submit_id]['tr'] = Grafik_WriteEncode($_POST['edit-footer-tr-html']);
                $edit_options_footer[$submit_id]['ml'] = Grafik_WriteEncode($_POST['edit-footer-ml-html']);
                $edit_options_footer[$submit_id]['mr'] = Grafik_WriteEncode($_POST['edit-footer-mr-html']);
                $edit_options_footer[$submit_id]['bl'] = Grafik_WriteEncode($_POST['edit-footer-bl-html']);
                $edit_options_footer[$submit_id]['br'] = Grafik_WriteEncode($_POST['edit-footer-br-html']);
                $edit_options_footer[$submit_id]['behavior-tl'] = (int) $_POST['edit-footer-tl-behavior'];
                $edit_options_footer[$submit_id]['behavior-tr'] = (int) $_POST['edit-footer-tr-behavior'];
                $edit_options_footer[$submit_id]['behavior-ml'] = (int) $_POST['edit-footer-ml-behavior'];
                $edit_options_footer[$submit_id]['behavior-mr'] = (int) $_POST['edit-footer-mr-behavior'];
                $edit_options_footer[$submit_id]['behavior-bl'] = (int) $_POST['edit-footer-bl-behavior'];
                $edit_options_footer[$submit_id]['behavior-br'] = (int) $_POST['edit-footer-br-behavior'];
                $edit_options_footer[$submit_id]['save'] = $submit_save;
                update_option('Grafik_PostType_Footer', json_encode($edit_options_footer));
                break;
            case 'edit-scripts':
                $edit_options_scripts[$submit_id]['html'] = Grafik_WriteEncode($_POST['edit-html']);
                $edit_options_scripts[$submit_id]['behavior'] = (int) $_POST['edit-behavior'];
                $edit_options_scripts[$submit_id]['save'] = $submit_save;
                update_option('Grafik_PostType_Scripts', json_encode($edit_options_scripts));
                break;
            case 'edit-structure':
                $edit_options_structure[$submit_id]['html'] = Grafik_WriteEncode($_POST['edit-html']);
                $edit_options_structure[$submit_id]['behavior'] = (int) $_POST['edit-behavior'];
                $edit_options_structure[$submit_id]['save'] = $submit_save;
                update_option('Grafik_PostType_Structure', json_encode($edit_options_structure));
                break;
        }
    }
    /*
    88  88 8888o. 88        .o88o. 88  88 888888 8888o. 88  88    888888o. .o88o. 8888o. .o8888
    		88  88 88  88 88        88  88 88  88 88     88  88 88  88    88 88 88 88  88 88  88 88    
    		88  88 8888Y' 88        88  88 88  88 8888   8888Y' 'Y8888    88 88 88 888888 8888Y' 'Y88o.
    		88  88 88  88 88        'Y8888 88  88 88     88  88     88    88 88 88 88  88 88         88
    		'Y88Y' 88  88 888888        88 'Y88Y' 888888 88  88 8888Y'    88 88 88 88  88 88     8888Y'
    */
    $map_func = array('create' => 'Create Type', 'edit' => 'Edit Type');
    $map_edit = array();
    foreach ($options_info as $key => $val) {
        if (!is_array($val)) {
            continue;
        }
        $map_edit[$key] = $val['plural'];
    }
    $map_data = array('info' => 'Info', 'styles' => 'Styles', 'header' => 'Header', 'content' => 'Content', 'footer' => 'Footer', 'scripts' => 'Scripts', 'structure' => 'Structure');
    $mapped_func = isset($_GET['func']) && array_key_exists($_GET['func'], $map_func) ? $_GET['func'] : null;
    $mapped_edit = isset($_GET['edit']) && array_key_exists($_GET['edit'], $map_edit) ? $_GET['edit'] : null;
    $mapped_data = isset($_GET['data']) && array_key_exists($_GET['data'], $map_data) ? $_GET['data'] : null;
    if (!isset($_GET['func'])) {
        $mapped_func = 'create';
    }
    if (!isset($_GET['data'])) {
        $mapped_data = 'info';
    }
    /*
    8888o. 8888o. 88 888888o. .o88o. 8888o. 88  88    8888o. .o88o. 88  88
    		88  88 88  88 88 88 88 88 88  88 88  88 88  88    88  88 88  88 88  88
    		8888Y' 8888Y' 88 88 88 88 888888 8888Y' 'Y8888    88  88 888888 88  88
    		88     88  88 88 88 88 88 88  88 88  88     88    88  88 88  88 88 .8'
    		88     88  88 88 88 88 88 88  88 88  88 8888Y'    88  88 88  88 888'  
    */
    $nav_edit = '<li' . ($mapped_func != 'edit' ? ' class="active"' : '') . '>' . '<a href="?page=ge-posttypes&amp;func=create">Create Type</a>' . '</li>';
    foreach ($map_edit as $key => $val) {
        $count = wp_count_posts($key);
        $nav_edit .= '<li' . ($mapped_edit == $key ? ' class="active"' : '') . '>' . '<a href="?page=ge-posttypes&amp;func=edit&amp;edit=' . $key . '">' . '<span>' . Grafik_ReadDecode($val) . '</span>' . '<span style="float:right;">(' . $count->publish . ')</span>' . '</a>' . '</li>';
    }
    $nav_edit = '<div class="grafik-functions-primarynav">' . '<ul>' . $nav_edit . '</ul>' . '</div>';
    /*
    .o8888 888888 .o8888 .o88o. 8888o. 8888o. .o88o. 8888o. 88  88    8888o. .o88o. 88  88
    		88     88     88     88  88 88  88 88  88 88  88 88  88 88  88    88  88 88  88 88  88
    		'Y88o. 8888   88     88  88 88  88 88  88 888888 8888Y' 'Y8888    88  88 888888 88  88
    		    88 88     88     88  88 88  88 88  88 88  88 88  88     88    88  88 88  88 88 .8'
    		8888Y' 888888 'Y8888 'Y88Y' 88  88 8888Y' 88  88 88  88 8888Y'    88  88 88  88 888'  
    */
    $nav_data = '';
    foreach ($map_data as $key => $val) {
        $nav_data .= '<li' . ($mapped_data == $key ? ' class="active"' : '') . '>' . '<a href="?page=ge-posttypes&amp;func=edit&amp;edit=' . $mapped_edit . '&amp;data=' . $key . '">' . $val . '</a>' . '</li>';
    }
    $nav_data = '<div class="grafik-functions-secondarynav">' . '<ul>' . $nav_data . '</ul>' . '</div>';
    /*
    8888o. 8888o. 88 888888o. .o88o. 8888o. 88  88    888888 88 888888 88     888888
    		88  88 88  88 88 88 88 88 88  88 88  88 88  88      88   88   88   88     88    
    		8888Y' 8888Y' 88 88 88 88 888888 8888Y' 'Y8888      88   88   88   88     8888  
    		88     88  88 88 88 88 88 88  88 88  88     88      88   88   88   88     88    
    		88     88  88 88 88 88 88 88  88 88  88 8888Y'      88   88   88   888888 888888
    */
    $display_title = '';
    if ($mapped_func == 'create') {
        $display_title .= 'Create Type';
    } else {
        $display_title .= 'Edit Type: ';
        if (empty($mapped_edit)) {
            $display_title .= 'Error!';
        } else {
            $display_title .= Grafik_ReadDecode($options_info[$mapped_edit]['plural']);
        }
    }
    $display_title = '<h2>' . $display_title . '</h2>';
    /*
    .o8888 888888 .o8888 .o88o. 8888o. 8888o. .o88o. 8888o. 88  88    888888 88 888888 88     888888
    		88     88     88     88  88 88  88 88  88 88  88 88  88 88  88      88   88   88   88     88    
    		'Y88o. 8888   88     88  88 88  88 88  88 888888 8888Y' 'Y8888      88   88   88   88     8888  
    		    88 88     88     88  88 88  88 88  88 88  88 88  88     88      88   88   88   88     88    
    		8888Y' 888888 'Y8888 'Y88Y' 88  88 8888Y' 88  88 88  88 8888Y'      88   88   88   888888 888888
    */
    $display_subtitle = '';
    if (empty($mapped_data)) {
        $display_subtitle .= 'Error!';
    } else {
        $display_subtitle .= $map_data[$mapped_data];
    }
    $display_subtitle = '<h3>' . $display_subtitle . '</h3>';
    /*
    88 8888o. 8888o. 88  88 888888    888888 88 888888 88     8888o. .o8888
    		88 88  88 88  88 88  88   88      88     88 88     88     88  88 88    
    		88 88  88 8888Y' 88  88   88      8888   88 8888   88     88  88 'Y88o.
    		88 88  88 88     88  88   88      88     88 88     88     88  88     88
    		88 88  88 88     'Y88Y'   88      88     88 888888 888888 8888Y' 8888Y'
    */
    $display_form = '';
    if (empty($mapped_func) || $mapped_func == 'create') {
        $display_form .= '<input type="hidden" name="action" value="create">' . '<p><strong>Unique Slug:</strong></p>' . '<p><input type="text" name="create-slug" placeholder="custom-type" value="' . $mapped_edit . '"></p>' . '<p><strong>Single Name:</strong></p>' . '<p><input type="text" name="create-single" placeholder="Custom Type" value=""></p>' . '<p><strong>Plural Name:</strong></p>' . '<p><input type="text" name="create-plural" placeholder="Custom Types" value=""></p>';
    } else {
        if (empty($mapped_edit) || empty($mapped_data)) {
            $display_form .= '<p>Requested operation cannot be performed.</p>';
        } else {
            $display_form .= '<input type="hidden" name="action" value="edit-' . $mapped_data . '" />' . '<input type="hidden" name="edit-id" value="' . $mapped_edit . '" />';
            switch ($mapped_data) {
                case 'info':
                    $display_form .= '<p><strong>Unique Slug:</strong></p>' . '<p><input type="text" value="' . $mapped_edit . '" disabled="disabled"></p>' . '<p><strong>Single Name:</strong></p>' . '<p><input type="text" name="edit-single" placeholder="Custom Type" value="' . Grafik_ReadDecode($edit_options_info[$mapped_edit]['single']) . '"></p>' . '<p><strong>Plural Name:</strong></p>' . '<p><input type="text" name="edit-plural" placeholder="Custom Types" value="' . Grafik_ReadDecode($edit_options_info[$mapped_edit]['plural']) . '"></p>' . '<!-- ' . print_r($edit_options_info[$mapped_edit], true) . ' -->';
                    $blame_user = get_userdata($edit_options_info[$mapped_edit]['save']['user']);
                    $blame_time = date("l, F jS, Y @ g:i A", $edit_options_info[$mapped_edit]['save']['time']);
                    break;
                case 'styles':
                    $display_form .= '<p><strong>HTML:</strong></p>' . '<p><textarea name="edit-html">' . Grafik_PrefillTextarea($edit_options_styles[$mapped_edit]['html']) . '</textarea></p>' . '<p><select name="edit-behavior"><option value="0" selected="selected">Enabled</option><option value="1">Disabled</option></select></p>' . '<!-- ' . print_r($edit_options_styles[$mapped_edit], true) . ' -->';
                    $blame_user = get_userdata($edit_options_styles[$mapped_edit]['save']['user']);
                    $blame_time = date("l, F jS, Y @ g:i A", $edit_options_styles[$mapped_edit]['save']['time']);
                    break;
                case 'header':
                    $display_form .= '<table>' . '<tr>' . '<td>' . '<p><strong>Top Left:</strong></p>' . '<p><textarea name="edit-header-tl-html">' . Grafik_PrefillTextarea($edit_options_header[$mapped_edit]['tl']) . '</textarea></p>' . '<p><select name="edit-header-tl-behavior"><option value="0" selected="selected">Enabled</option><option value="1">Disabled</option></select></p>' . '</td>' . '<td>' . '<p><strong>Top Right:</strong></p>' . '<p><textarea name="edit-header-tr-html">' . Grafik_PrefillTextarea($edit_options_header[$mapped_edit]['tr']) . '</textarea></p>' . '<p><select name="edit-header-tr-behavior"><option value="0" selected="selected">Enabled</option><option value="1">Disabled</option></select></p>' . '</td>' . '</tr>' . '<tr>' . '<td>' . '<p><strong>Middle Left:</strong></p>' . '<p><textarea name="edit-header-ml-html">' . Grafik_PrefillTextarea($edit_options_header[$mapped_edit]['ml']) . '</textarea></p>' . '<p><select name="edit-header-ml-behavior"><option value="0" selected="selected">Enabled</option><option value="1">Disabled</option></select></p>' . '</td>' . '<td>' . '<p><strong>Middle Right:</strong></p>' . '<p><textarea name="edit-header-mr-html">' . Grafik_PrefillTextarea($edit_options_header[$mapped_edit]['mr']) . '</textarea></p>' . '<p><select name="edit-header-mr-behavior"><option value="0" selected="selected">Enabled</option><option value="1">Disabled</option></select></p>' . '</td>' . '</tr>' . '<tr>' . '<td>' . '<p><strong>Bottom Left:</strong></p>' . '<p><textarea name="edit-header-bl-html">' . Grafik_PrefillTextarea($edit_options_header[$mapped_edit]['bl']) . '</textarea></p>' . '<p><select name="edit-header-bl-behavior"><option value="0" selected="selected">Enabled</option><option value="1">Disabled</option></select></p>' . '</td>' . '<td>' . '<p><strong>Bottom Right:</strong></p>' . '<p><textarea name="edit-header-br-html">' . Grafik_PrefillTextarea($edit_options_header[$mapped_edit]['br']) . '</textarea></p>' . '<p><select name="edit-header-br-behavior"><option value="0" selected="selected">Enabled</option><option value="1">Disabled</option></select></p>' . '</td>' . '</tr>' . '</table>' . '<!-- ' . print_r($edit_options_header[$mapped_edit], true) . ' -->';
                    $blame_user = get_userdata($edit_options_header[$mapped_edit]['save']['user']);
                    $blame_time = date("l, F jS, Y @ g:i A", $edit_options_header[$mapped_edit]['save']['time']);
                    break;
                case 'content':
                    $display_form .= '<table>' . '<tr>' . '<td colspan="3">' . '<p><strong>Top:</strong></p>' . '<p><textarea name="edit-content-t-html">' . Grafik_PrefillTextarea($edit_options_content[$mapped_edit]['t']) . '</textarea></p>' . '<p><select name="edit-content-t-behavior"><option value="0" selected="selected">Enabled</option><option value="1">Disabled</option></select></p>' . '</td>' . '</tr>' . '<tr>' . '<td style="width:25%">' . '<p><strong>Left:</strong></p>' . '<p><textarea name="edit-content-l-html">' . Grafik_PrefillTextarea($edit_options_content[$mapped_edit]['l']) . '</textarea></p>' . '<p><select name="edit-content-l-behavior"><option value="0" selected="selected">Enabled</option><option value="1">Disabled</option></select></p>' . '</td>' . '<td style="width:50%">' . '<p><strong>Center:</strong></p>' . '<p><textarea name="edit-content-c-html">' . Grafik_PrefillTextarea($edit_options_content[$mapped_edit]['c']) . '</textarea></p>' . '<p><select name="edit-content-c-behavior"><option value="0" selected="selected">Enabled</option><option value="1">Disabled</option></select></p>' . '</td>' . '<td style="width:25%">' . '<p><strong>Right:</strong></p>' . '<p><textarea name="edit-content-r-html">' . Grafik_PrefillTextarea($edit_options_content[$mapped_edit]['r']) . '</textarea></p>' . '<p><select name="edit-content-r-behavior"><option value="0" selected="selected">Enabled</option><option value="1">Disabled</option></select></p>' . '</td>' . '</tr>' . '<tr>' . '<td colspan="3">' . '<p><strong>Bottom:</strong></p>' . '<p><textarea name="edit-content-b-html">' . Grafik_PrefillTextarea($edit_options_content[$mapped_edit]['b']) . '</textarea></p>' . '<p><select name="edit-content-b-behavior"><option value="0" selected="selected">Enabled</option><option value="1">Disabled</option></select></p>' . '</td>' . '</tr>' . '</table>' . '<!-- ' . print_r($edit_options_content[$mapped_edit], true) . ' -->';
                    $blame_user = get_userdata($edit_options_content[$mapped_edit]['save']['user']);
                    $blame_time = date("l, F jS, Y @ g:i A", $edit_options_content[$mapped_edit]['save']['time']);
                    break;
                case 'footer':
                    $display_form .= '<table>' . '<tbody>' . '<tr>' . '<td>' . '<p><strong>Top Left:</strong></p>' . '<p><textarea name="edit-footer-tl-html">' . Grafik_PrefillTextarea($edit_options_footer[$mapped_edit]['tl']) . '</textarea></p>' . '<p><select name="edit-footer-tl-behavior"><option value="0" selected="selected">Enabled</option><option value="1">Disabled</option></select></p>' . '</td>' . '<td>' . '<p><strong>Top Right:</strong></p>' . '<p><textarea name="edit-footer-tr-html">' . Grafik_PrefillTextarea($edit_options_footer[$mapped_edit]['tr']) . '</textarea></p>' . '<p><select name="edit-footer-tr-behavior"><option value="0" selected="selected">Enabled</option><option value="1">Disabled</option></select></p>' . '</td>' . '</tr>' . '<tr>' . '<td>' . '<p><strong>Middle Left:</strong></p>' . '<p><textarea name="edit-footer-ml-html">' . Grafik_PrefillTextarea($edit_options_footer[$mapped_edit]['ml']) . '</textarea></p>' . '<p><select name="edit-footer-ml-behavior"><option value="0" selected="selected">Enabled</option><option value="1">Disabled</option></select></p>' . '</td>' . '<td>' . '<p><strong>Middle Right:</strong></p>' . '<p><textarea name="edit-footer-mr-html">' . Grafik_PrefillTextarea($edit_options_footer[$mapped_edit]['mr']) . '</textarea></p>' . '<p><select name="edit-footer-mr-behavior"><option value="0" selected="selected">Enabled</option><option value="1">Disabled</option></select></p>' . '</td>' . '</tr>' . '<tr>' . '<td>' . '<p><strong>Bottom Left:</strong></p>' . '<p><textarea name="edit-footer-bl-html">' . Grafik_PrefillTextarea($edit_options_footer[$mapped_edit]['bl']) . '</textarea></p>' . '<p><select name="edit-footer-bl-behavior"><option value="0" selected="selected">Enabled</option><option value="1">Disabled</option></select></p>' . '</td>' . '<td>' . '<p><strong>Bottom Right:</strong></p>' . '<p><textarea name="edit-footer-br-html">' . Grafik_PrefillTextarea($edit_options_footer[$mapped_edit]['br']) . '</textarea></p>' . '<p><select name="edit-footer-br-behavior"><option value="0" selected="selected">Enabled</option><option value="1">Disabled</option></select></p>' . '</td>' . '</tr>' . '</tbody>' . '</table>' . '<!-- ' . print_r($edit_options_footer[$mapped_edit], true) . ' -->';
                    $blame_user = get_userdata($edit_options_footer[$mapped_edit]['save']['user']);
                    $blame_time = date("l, F jS, Y @ g:i A", $edit_options_footer[$mapped_edit]['save']['time']);
                    break;
                case 'scripts':
                    $display_form .= '<p><strong>HTML:</strong></p>' . '<p><textarea name="edit-html">' . Grafik_PrefillTextarea($edit_options_scripts[$mapped_edit]['html']) . '</textarea></p>' . '<p><select name="edit-behavior"><option value="0" selected="selected">Enabled</option><option value="1">Disabled</option></select></p>' . '<!-- ' . print_r($edit_options_scripts[$mapped_edit], true) . ' -->';
                    $blame_user = get_userdata($edit_options_scripts[$mapped_edit]['save']['user']);
                    $blame_time = date("l, F jS, Y @ g:i A", $edit_options_scripts[$mapped_edit]['save']['time']);
                    break;
                case 'structure':
                    $display_form .= '<p><strong>HTML:</strong></p>' . '<p><textarea name="edit-html">' . Grafik_PrefillTextarea($edit_options_structure[$mapped_edit]['html']) . '</textarea></p>' . '<p><select name="edit-behavior"><option value="0" selected="selected">Enabled</option><option value="1">Disabled</option></select></p>' . '<!-- ' . print_r($edit_options_structure[$mapped_edit], true) . ' -->';
                    $blame_user = get_userdata($edit_options_structure[$mapped_edit]['save']['user']);
                    $blame_time = date("l, F jS, Y @ g:i A", $edit_options_structure[$mapped_edit]['save']['time']);
                    break;
                default:
                    $display_form .= '<p>Requested operation cannot be performed.</p>';
                    break;
            }
        }
    }
    /*
    8888o. 88     .o88o. 888888o. 888888
    		88  88 88     88  88 88 88 88 88    
    		8888Y' 88     888888 88 88 88 8888  
    		88  88 88     88  88 88 88 88 88    
    		8888Y' 888888 88  88 88 88 88 888888
    */
    if (!empty($option_modified[$mapped_edit]['save'])) {
        $blame_user = get_userdata($option_modified[$mapped_edit]['save']['user']);
        $blame_time = date("l, F jS, Y @ g:i A", $option_modified[$mapped_edit]['save']['time']);
    }
    /*
    8888o. 888888 888888 88  88 8888o. 8888o.    .o88o. 88  88 888888 8888o. 88  88 888888
    		88  88 88       88   88  88 88  88 88  88    88  88 88  88   88   88  88 88  88   88  
    		8888Y' 8888     88   88  88 8888Y' 88  88    88  88 88  88   88   8888Y' 88  88   88  
    		88  88 88       88   88  88 88  88 88  88    88  88 88  88   88   88     88  88   88  
    		88  88 888888   88   'Y88Y' 88  88 88  88    'Y88Y' 'Y88Y'   88   88     'Y88Y'   88  
    */
    echo '<div class="grafik-functions">' . '<h1><span>Post Types</span></h1>' . '<div class="grafik-functions-display">' . $nav_edit . '<div class="grafik-functions-primarydisplay">' . $display_title . ($mapped_func == 'create' ? '' : $nav_data) . '<div class="grafik-functions-secondarydisplay">' . $display_subtitle . '<form method="POST">' . $display_form . '<div>' . '<hr/>' . '<button type="submit" class="button button-primary button-large">Save Changes</button>' . ($mapped_func == 'create' ? '' : '<span class="last-update">Last Updated: ' . $blame_time . (empty($blame_user) ? '' : ' by ' . $blame_user->display_name) . '</span>') . '</div>' . wp_nonce_field('Grafik_PostTypes_Nonce', 'Grafik_PostTypes_Nonce', true, false) . '</form>' . '</div>' . '</div>' . '</div>' . '</div>' . '<script type="text/javascript">' . '(function($){' . 'var ReflowInterval = window.setInterval(function(){' . '$(".grafik-functions-secondarydisplay").css({' . '"min-height":$(".grafik-functions-primarynav").outerHeight()' . '});' . '},50);' . '})(jQuery);' . '</script>' . Grafik_ProfileColors();
}