function cmsms_default_tab()
{
    $cmsms_option = cmsms_get_global_options();
    $current_page = cmsms_get_admin_page();
    if ($current_page == 'cmsms-settings') {
        $default_tab = 'general';
    } elseif ($current_page == 'cmsms-settings-style') {
        if ($cmsms_option[CMSMS_SHORTNAME . '_theme_layout'] === 'boxed') {
            $default_tab = 'bg';
        } else {
            $default_tab = 'header';
        }
    } elseif ($current_page == 'cmsms-settings-logo') {
        $default_tab = 'image';
    } elseif ($current_page == 'cmsms-settings-font') {
        $default_tab = 'content';
    } elseif ($current_page == 'cmsms-settings-icon') {
        $default_tab = 'heading';
    } elseif ($current_page == 'cmsms-settings-blog') {
        $default_tab = 'page';
    } elseif ($current_page == 'cmsms-settings-portfolio') {
        $default_tab = 'full';
    } elseif ($current_page == 'cmsms-settings-testimonial') {
        $default_tab = 't_page';
    } else {
        $default_tab = 'general';
    }
    return $default_tab;
}
<?php

/**
 * @package WordPress
 * @subpackage Newgate
 * @since Newgate 1.0
 * 
 * Template Name: Portfolio Timeline
 * Created by CMSMasters
 * 
 */
$cmsms_option = cmsms_get_global_options();
get_header();
$cmsms_layout = get_post_meta(get_the_ID(), 'cmsms_layout', true);
if (!$cmsms_layout) {
    $cmsms_layout = 'fullwidth';
}
echo '<!--_________________________ Start Content _________________________ -->' . "\n";
if ($cmsms_layout == 'r_sidebar') {
    echo '<section id="content" role="main">' . "\n";
} elseif ($cmsms_layout == 'l_sidebar') {
    echo '<section id="content" class="fr" role="main">' . "\n";
} else {
    echo '<section id="middle_content" role="main">' . "\n";
}
echo '<div class="entry">' . "\n";
if (have_posts()) {
    the_post();
    if (has_post_thumbnail()) {
        if (has_post_thumbnail()) {
            if ($cmsms_layout == 'r_sidebar' || $cmsms_layout == 'l_sidebar') {
function show_cmsms_meta_box()
{
    global $post, $custom_all_meta_fields;
    $cmsms_option = cmsms_get_global_options();
    echo '<input type="hidden" name="custom_meta_box_nonce" value="' . wp_create_nonce(basename(__FILE__)) . '" />';
    foreach ($custom_all_meta_fields as $field) {
        $meta = get_post_meta($post->ID, $field['id'], true);
        if (isset($field['std']) && $meta === '') {
            $meta = $field['std'];
        }
        if (!isset($field['hide'])) {
            $field['hide'] = 'false';
        }
        if ($field['type'] != 'tabs' && $field['type'] != 'tab_start' && $field['type'] != 'tab_finish' && $field['type'] != 'content_start' && $field['type'] != 'content_finish') {
            echo '<tr class="cmsms_tr_' . $field['type'] . '"' . ($field['hide'] == 'true' ? ' style="display:none;"' : '') . '>' . '<th>' . '<label for="' . $field['id'] . '">' . $field['label'] . '</label>' . '</th>' . '<td>';
        }
        switch ($field['type']) {
            case 'tab_start':
                echo '<div id="' . $field['id'] . '" class="nav-tab-content' . ($field['std'] === 'true' ? ' nav-tab-content-active' : '') . '">' . '<table class="form-table">';
                break;
            case 'tab_finish':
                echo '</table>' . '</div>';
                break;
            case 'content_start':
                echo '<table id="' . $field['id'] . '" class="form-table' . ($field['box'] === 'true' ? ' cmsms_box' : '') . '"' . ($field['hide'] === 'true' ? ' style="display:none;"' : '') . '>';
                break;
            case 'content_finish':
                echo '</table>';
                break;
            case 'tabs':
                echo '<h4 class="nav-tab-wrapper" id="' . $field['id'] . '">';
                foreach ($field['options'] as $option) {
                    echo '<a href="#' . $option['value'] . '" class="nav-tab' . ($field['std'] === $option['value'] ? ' nav-tab-active' : '') . '">' . $option['label'] . '</a>';
                }
                echo '</h4>';
                break;
            case 'text':
                echo '<input type="text" name="' . $field['id'] . '" id="' . $field['id'] . '" value="' . $meta . '" size="30" />' . '<br />' . '<span class="description">' . $field['desc'] . '</span>';
                break;
            case 'textcode':
                echo '<input type="text" name="' . $field['id'] . '" id="' . $field['id'] . '" value="' . htmlspecialchars(stripslashes($meta)) . '" size="30" />' . '<br />' . '<span class="description">' . $field['desc'] . '</span>';
                break;
            case 'text_long':
                echo '<input type="text" name="' . $field['id'] . '" id="' . $field['id'] . '" value="' . $meta . '" size="70" />' . '<br />' . '<span class="description">' . $field['desc'] . '</span>';
                break;
            case 'number':
                echo '<input type="text" name="' . $field['id'] . '" id="' . $field['id'] . '" value="' . $meta . '" size="5" />' . '<br />' . '<span class="description">' . $field['desc'] . '</span>';
                break;
            case 'textarea':
                echo '<textarea name="' . $field['id'] . '" id="' . $field['id'] . '" cols="50" rows="4">' . $meta . '</textarea>' . '<br />' . '<span class="description">' . $field['desc'] . '</span>';
                break;
            case 'checkbox':
                echo '<input type="checkbox" name="' . $field['id'] . '" id="' . $field['id'] . '" value="true"' . ($meta === 'false' ? '' : ' checked="checked"') . ' /> &nbsp; ' . '<label for="' . $field['id'] . '">' . $field['desc'] . '</label>';
                break;
            case 'radio':
                foreach ($field['options'] as $option) {
                    echo '<input type="radio" name="' . $field['id'] . '" id="' . $field['id'] . '_' . $option['value'] . '" value="' . $option['value'] . '"' . ($meta === $option['value'] ? ' checked="checked"' : '') . ' /> &nbsp; ' . '<label for="' . $field['id'] . '_' . $option['value'] . '">' . $option['label'] . '</label>' . '<br />';
                }
                echo '<span class="description">' . $field['desc'] . '</span>';
                break;
            case 'radio_img':
                echo '<table>' . '<tr>';
                foreach ($field['options'] as $option) {
                    echo '<td style="text-align:center;">' . '<input type="radio" name="' . $field['id'] . '" id="' . $field['id'] . '_' . $option['value'] . '" value="' . $option['value'] . '"' . ($meta === $option['value'] ? ' checked="checked"' : '') . ' />' . '<br />' . '<label for="' . $field['id'] . '_' . $option['value'] . '">' . '<img src="' . $option['img'] . '" alt="' . $option['label'] . '" />' . '<br />' . $option['label'] . '</label>' . '</td>';
                }
                echo '</tr>' . '</table>' . '<span class="description">' . $field['desc'] . '</span>';
                break;
            case 'checkbox_group':
                $i = 0;
                foreach ($field['options'] as $option) {
                    echo '<input type="checkbox" value="' . $option['value'] . '" name="' . $field['id'] . '[' . $i . ']" id="' . $field['id'] . '_' . $option['value'] . '"' . ($meta && in_array($option['value'], $meta) ? ' checked="checked"' : '') . ' /> &nbsp; ' . '<label for="' . $field['id'] . '_' . $option['value'] . '">' . $option['label'] . '</label>' . '<br />';
                    $i++;
                }
                echo '<span class="description">' . $field['desc'] . '</span>';
                break;
            case 'select':
                echo '<select name="' . $field['id'] . '" id="' . $field['id'] . '">';
                foreach ($field['options'] as $option) {
                    echo '<option value="' . $option['value'] . '"' . ($meta === $option['value'] ? ' selected="selected"' : '') . '>' . $option['label'] . ' &nbsp;</option>';
                }
                echo '</select>' . '<br />' . '<span class="description">' . $field['desc'] . '</span>';
                break;
            case 'select_sidebar':
                echo '<select name="' . $field['id'] . '" id="' . $field['id'] . '">' . '<option value="">' . __('Default Sidebar', 'cmsmasters') . ' &nbsp;</option>';
                if (!empty($cmsms_option[CMSMS_SHORTNAME . '_sidebar'])) {
                    foreach ($cmsms_option[CMSMS_SHORTNAME . '_sidebar'] as $sidebar_id => $sidebar_name) {
                        echo '<option value="' . generateSlug($sidebar_name, 45) . '"' . ($meta !== '' && $meta === generateSlug($sidebar_name, 45) ? ' selected="selected"' : '') . '>' . $sidebar_name . ' &nbsp;</option>';
                    }
                }
                echo '</select>' . '<br />' . '<span class="description">' . $field['desc'] . '</span>';
                break;
            case 'select_slider':
                $sliderManager = new cmsmsSliderManager();
                $sliders = $sliderManager->getSliders();
                echo '<select name="' . $field['id'] . '" id="' . $field['id'] . '">' . '<option value="">' . __('Select Slider', 'cmsmasters') . ' &nbsp;</option>';
                if (!empty($sliders)) {
                    foreach ($sliders as $slider) {
                        echo '<option value="' . $slider['id'] . '"' . ($meta !== '' && (int) $meta === $slider['id'] ? ' selected="selected"' : '') . '>' . $slider['name'] . ' &nbsp;</option>';
                    }
                }
                echo '</select>' . '<br />' . '<span class="description">' . $field['desc'] . '</span>';
                break;
            case 'select_post_categ':
                $categories = get_categories();
                echo '<select name="' . $field['id'] . '" id="' . $field['id'] . '">' . '<option value="">' . __('Select Blog Category', 'cmsmasters') . ' &nbsp;</option>';
                foreach ($categories as $category) {
                    echo '<option value="' . $category->cat_ID . '"' . ($meta !== '' && (int) $meta === $category->cat_ID ? ' selected="selected"' : '') . '>' . $category->cat_name . ' &nbsp;</option>';
                }
                echo '</select>' . '<br />' . '<span class="description">' . $field['desc'] . '</span>';
                break;
            case 'select_project_type':
                $types = get_terms('pj-categs', array('orderby' => 'name', 'hide_empty' => 0));
                echo '<select name="' . $field['id'] . '" id="' . $field['id'] . '">' . '<option value="">' . __('Select Project Type', 'cmsmasters') . ' &nbsp;</option>';
                if (is_array($types) && !empty($types)) {
                    foreach ($types as $type) {
                        echo '<option value="' . $type->slug . '"' . ($meta !== '' && $meta === $type->slug ? ' selected="selected"' : '') . '>' . $type->name . ' &nbsp;</option>';
                    }
                }
                echo '</select>' . '<br />' . '<span class="description">' . $field['desc'] . '</span>';
                break;
            case 'select_tl_categ':
                $tl_categs = get_terms('tl-categs', array('hide_empty' => 0));
                echo '<select name="' . $field['id'] . '" id="' . $field['id'] . '">' . '<option value="">' . __('Select Testimonial Category', 'cmsmasters') . ' &nbsp;</option>';
                if (is_array($tl_categs) && !empty($tl_categs)) {
                    foreach ($tl_categs as $tl_categ) {
                        echo '<option value="' . $tl_categ->slug . '"' . ($meta !== '' && $meta === $tl_categ->slug ? ' selected="selected"' : '') . '>' . $tl_categ->name . ' &nbsp;</option>';
                    }
                }
                echo '</select>' . '<br />' . '<span class="description">' . $field['desc'] . '</span>';
                break;
            case 'image':
                $image = $field['std'];
                if (is_numeric($image)) {
                    $image = wp_get_attachment_image_src($image, 'medium');
                    $image = $image[0];
                }
                echo '<span class="custom_default_image" style="display:none">' . $image . '</span>';
                if (is_numeric($meta)) {
                    $image = wp_get_attachment_image_src($meta, 'medium');
                    $image = $image[0];
                }
                echo '<input id="' . $field['id'] . '" name="' . $field['id'] . '" type="hidden" class="custom_upload_image" value="' . $meta . '" />' . '<img src="' . $image . '" class="custom_preview_image" alt="" style="max-width:250px;" />' . '<br />' . '<input id="' . $field['id'] . '_image_button" class="cmsms_options_upload_image_button button" type="button" value="' . __('Choose Image', 'cmsmasters') . '" />' . '<small>&nbsp; ' . '<a href="#" class="custom_clear_image_button">' . ($field['cancel'] == 'true' ? __('Cancel', 'cmsmasters') : __('Default Image', 'cmsmasters')) . '</a>' . '</small>' . '<div style="clear:both;"></div>' . '<br />' . '<span class="description">' . $field['desc'] . '</span>' . '<script type="text/javascript">' . 'jQuery(document).ready(function () { ' . '(function ($) { ' . "\$('#" . $field['id'] . "_image_button').bind('click', function (e) { " . 'e.preventDefault(); ' . '$(e.target).cmsmsMediaUploader( { ' . "frameId : 'cmsms-" . $field['id'] . "-media-frame', " . "frameClass : 'media-frame cmsms-media-frame cmsms-" . $field['id'] . "-media-frame', " . "frameTitle : '" . __('Choose image', 'cmsmasters') . "', " . "frameButton : '" . __('Choose', 'cmsmasters') . "', " . 'multiple : false ' . '} ); ' . '} ); ' . '} )(jQuery); ' . '} ); ' . '</script>';
                break;
            case 'color':
                echo '<input type="text" id="' . $field['id'] . '" name="' . $field['id'] . '" value="' . $meta . '" class="my-color-field" data-default-color="' . $field['std'] . '" />' . '<script type="text/javascript">' . 'jQuery(document).ready(function () { ' . '(function ($) { ' . "\$('#" . $field['id'] . "').wpColorPicker(); " . '} )(jQuery); ' . '} ); ' . '</script>';
                break;
            case 'icon':
                echo '<input type="hidden" name="' . $field['id'] . '" id="' . $field['id'] . '" value="' . $meta . '" />' . '<ul class="cmsms_heading_icons_list">';
                if (!empty($cmsms_option[CMSMS_SHORTNAME . '_heading_icons'])) {
                    foreach ($cmsms_option[CMSMS_SHORTNAME . '_heading_icons'] as $icon_numb => $icon_id) {
                        $image = wp_get_attachment_image_src($icon_id, 'thumbnail');
                        echo '<li id="cmsms_heading_icon_' . $icon_numb . '" class="cmsms_heading_icon ' . ($meta !== '' && $meta === $icon_id ? ' selected' : '') . '">' . '<a href="' . $icon_id . '">' . '<img src="' . $image[0] . '" alt="" />' . '</a>' . '</li>';
                    }
                } else {
                    echo '<li>' . __('Add new heading icons', 'cmsmasters') . ' <a href="' . admin_url() . 'admin.php?page=cmsms-settings-icon&tab=heading">' . __('here', 'cmsmasters') . '</a>.</li>';
                }
                echo '</ul>' . '<div style="clear:both;"></div>' . '<a href="#" class="cmsms_heading_icons_cancel">' . __('Cancel', 'cmsmasters') . '</a>' . '<div style="clear:both;"></div>' . '<span class="description">' . $field['desc'] . '</span>';
                break;
            case 'repeatable':
                echo '<ul id="' . $field['id'] . '-repeatable" class="custom_repeatable">';
                $i = 0;
                if ($meta) {
                    foreach ($meta as $row) {
                        if ($row !== '') {
                            echo '<li>' . '<span class="sort hndle">|||</span>' . '<input type="text" name="' . $field['id'] . '[' . $i . ']" id="' . $field['id'] . '[' . $i . ']" value="' . $row . '" size="30" />' . '<a class="repeatable-remove button" href="#">x</a>' . '</li>';
                        } else {
                            if ($i === 0) {
                                echo '<li style="display:none;">' . '<span class="sort hndle">|||</span>' . '<input type="text" name="' . $field['id'] . '[' . $i . ']" id="' . $field['id'] . '[' . $i . ']" value="" size="30" />' . '<a class="repeatable-remove button" href="#">x</a>' . '</li>';
                            }
                        }
                        $i++;
                    }
                } else {
                    echo '<li style="display:none;">' . '<span class="sort hndle">|||</span>' . '<input type="text" name="' . $field['id'] . '[' . $i . ']" id="' . $field['id'] . '[' . $i . ']" value="" size="30" />' . '<a class="repeatable-remove button" href="#">x</a>' . '</li>';
                }
                echo '</ul>' . '<a class="repeatable-add button" href="#">+</a>' . '<span class="description">' . $field['desc'] . '</span>';
                break;
            case 'repeatable_link':
                $post_items = get_posts(array('post_type' => 'post', 'posts_per_page' => -1));
                $page_items = get_posts(array('post_type' => 'page', 'posts_per_page' => -1));
                $project_items = get_posts(array('post_type' => 'project', 'posts_per_page' => -1));
                echo '<div class="ovh">' . '<div class="fl"><strong>' . __('Title', 'cmsmasters') . '</strong></div>' . '<div class="fl"><strong>' . __('Link', 'cmsmasters') . '</strong></div>' . '</div>' . '<ul id="' . $field['id'] . '-repeatable" class="custom_repeatable">';
                $i = 0;
                if ($meta !== '') {
                    foreach ($meta as $row) {
                        if ($row[0] !== '' && $row[1] !== '') {
                            echo '<li>' . '<span class="sort hndle"></span>' . '<input type="text" name="' . $field['id'] . '[' . $i . '][0]" id="' . $field['id'] . '[' . $i . '][0]" value="' . $row[0] . '" size="10" class="cmsms_name" />' . '<input type="text" name="' . $field['id'] . '[' . $i . '][1]" id="' . $field['id'] . '[' . $i . '][1]" value="' . $row[1] . '" size="25" class="cmsms_link" />' . '<a class="repeatable-remove button" href="#">x</a>' . '</li>';
                        } else {
                            if ($i === 0) {
                                echo '<li style="display:none;">' . '<span class="sort hndle"></span>' . '<input type="text" name="' . $field['id'] . '[' . $i . '][0]" id="' . $field['id'] . '[' . $i . '][0]" value="" size="10" class="cmsms_name" />' . '<input type="text" name="' . $field['id'] . '[' . $i . '][1]" id="' . $field['id'] . '[' . $i . '][1]" value="" size="25" class="cmsms_link" />' . '<a class="repeatable-remove button" href="#">x</a>' . '</li>';
                            }
                        }
                        $i++;
                    }
                } else {
                    echo '<li style="display:none;">' . '<span class="sort hndle"></span>' . '<input type="text" name="' . $field['id'] . '[' . $i . '][0]" id="' . $field['id'] . '[' . $i . '][0]" value="" size="10" class="cmsms_name" />' . '<input type="text" name="' . $field['id'] . '[' . $i . '][1]" id="' . $field['id'] . '[' . $i . '][1]" value="" size="25" class="cmsms_link" />' . '<a class="repeatable-remove button" href="#">x</a>' . '</li>';
                }
                echo '</ul>' . '<select name="' . $field['id'] . '-select" id="' . $field['id'] . '-select">' . '<optgroup label="' . __('Blank Field', 'cmsmasters') . '">' . '<option value="">' . __('Select Link', 'cmsmasters') . '</option>' . '</optgroup>' . '<optgroup label="' . __('Posts', 'cmsmasters') . '">';
                foreach ($post_items as $post_item) {
                    echo '<option value="' . get_permalink($post_item->ID) . '">' . $post_item->post_title . '</option>';
                }
                echo '</optgroup>' . '<optgroup label="' . __('Pages', 'cmsmasters') . '">';
                foreach ($page_items as $page_item) {
                    echo '<option value="' . get_permalink($page_item->ID) . '">' . $page_item->post_title . '</option>';
                }
                echo '</optgroup>' . '<optgroup label="' . __('Projects', 'cmsmasters') . '">';
                foreach ($project_items as $project_item) {
                    echo '<option value="' . get_permalink($project_item->ID) . '">' . $project_item->post_title . '</option>';
                }
                echo '</optgroup>' . '</select> &nbsp; ' . '<a class="repeatable-link-add button" href="#">+</a>' . '<span class="description">' . $field['desc'] . '</span>';
                break;
            case 'repeatable_multiple':
                echo '<div class="ovh">' . '<div class="fl"><strong>' . __('Title', 'cmsmasters') . '</strong></div>' . '<div class="fl"><strong>' . __('Values', 'cmsmasters') . '</strong></div>' . '</div>' . '<ul id="' . $field['id'] . '-repeatable" class="custom_repeatable">';
                $i = 0;
                if ($meta !== '') {
                    foreach ($meta as $row) {
                        if ($row[0] !== '' && $row[1] !== '') {
                            echo '<li>' . '<span class="sort hndle"></span>' . '<input type="text" name="' . $field['id'] . '[' . $i . '][0]" id="' . $field['id'] . '[' . $i . '][0]" value="' . $row[0] . '" size="10" class="cmsms_name" />' . '<textarea name="' . $field['id'] . '[' . $i . '][1]" id="' . $field['id'] . '[' . $i . '][1]" cols="25" rows="2" class="cmsms_val">' . $row[1] . '</textarea>' . '<a class="repeatable-remove button" href="#">x</a>' . '</li>';
                        } else {
                            if ($i === 0) {
                                echo '<li style="display:none;">' . '<span class="sort hndle"></span>' . '<input type="text" name="' . $field['id'] . '[' . $i . '][0]" id="' . $field['id'] . '[' . $i . '][0]" value="" size="10" class="cmsms_name" />' . '<textarea name="' . $field['id'] . '[' . $i . '][1]" id="' . $field['id'] . '[' . $i . '][1]" cols="25" rows="2" class="cmsms_val"></textarea>' . '<a class="repeatable-remove button" href="#">x</a>' . '</li>';
                            }
                        }
                        $i++;
                    }
                } else {
                    echo '<li style="display:none;">' . '<span class="sort hndle"></span>' . '<input type="text" name="' . $field['id'] . '[' . $i . '][0]" id="' . $field['id'] . '[' . $i . '][0]" value="" size="10" class="cmsms_name" />' . '<textarea name="' . $field['id'] . '[' . $i . '][1]" id="' . $field['id'] . '[' . $i . '][1]" cols="25" rows="2" class="cmsms_val"></textarea>' . '<a class="repeatable-remove button" href="#">x</a>' . '</li>';
                }
                echo '</ul>' . '<a class="repeatable-multiple-add button" href="#">+</a>' . '<span class="description">' . $field['desc'] . '</span>';
                break;
            case 'repeatable_media':
                echo '<select name="' . $field['id'] . '-select" id="' . $field['id'] . '-select">' . '<option value="">' . __('Select Format', 'cmsmasters') . ' &nbsp;</option>';
                foreach ($field['media'] as $key => $value) {
                    echo '<option value="' . $key . '">' . $value . '</option>';
                }
                echo '</select> &nbsp; ' . '<a class="repeatable-media-add button" href="#">+</a>' . '<br />' . '<ul id="' . $field['id'] . '-repeatable" class="custom_repeatable">';
                $i = 0;
                if ($meta !== '') {
                    foreach ($meta as $row) {
                        if ($row[1] !== '') {
                            echo '<li>' . '<input type="text" readonly="readonly" name="' . $field['id'] . '[' . $i . '][0]" id="' . $field['id'] . '[' . $i . '][0]" value="' . $row[0] . '" size="5" class="cmsms_format" />' . '<input type="text" name="' . $field['id'] . '[' . $i . '][1]" id="' . $field['id'] . '[' . $i . '][1]" value="' . $row[1] . '" size="30" class="cmsms_link" />' . '<a class="repeatable-remove button" href="#">x</a>' . '</li>';
                        } else {
                            if ($i === 0) {
                                echo '<li style="display:none;">' . '<input type="text" readonly="readonly" name="' . $field['id'] . '[' . $i . '][0]" id="' . $field['id'] . '[' . $i . '][0]" value="" size="5" class="cmsms_format" />' . '<input type="text" name="' . $field['id'] . '[' . $i . '][1]" id="' . $field['id'] . '[' . $i . '][1]" value="" size="30" class="cmsms_link" />' . '<a class="repeatable-remove button" href="#">x</a>' . '</li>';
                            }
                        }
                        $i++;
                    }
                } else {
                    echo '<li style="display:none;">' . '<input type="text" readonly="readonly" name="' . $field['id'] . '[' . $i . '][0]" id="' . $field['id'] . '[' . $i . '][0]" value="" size="5" class="cmsms_format" />' . '<input type="text" name="' . $field['id'] . '[' . $i . '][1]" id="' . $field['id'] . '[' . $i . '][1]" value="" size="30" class="cmsms_link" />' . '<a class="repeatable-remove button" href="#">x</a>' . '</li>';
                }
                echo '</ul>' . '<span class="description">' . $field['desc'] . '</span>';
                break;
            case 'images_list':
                if ($meta !== '') {
                    $ids = array();
                    $meta_array = explode(',', $meta);
                    foreach ($meta_array as $meta_val) {
                        $ids[] = str_replace('img_', '', $meta_val);
                    }
                }
                echo '<a href="#" id="' . $field['id'] . '_images_button" class="button open_gallery_post_image_list">' . __('Choose images', 'cmsmasters') . '</a>' . '<ul class="gallery_post_image_list selected_list">';
                if ($meta !== '') {
                    foreach ($ids as $id) {
                        $image = wp_get_attachment_image_src($id, 'thumbnail');
                        echo '<li>' . '<a href="' . $id . '" style="background-image:url(' . $image[0] . ');">' . '<span></span>' . '</a>' . '</li>';
                    }
                }
                echo '</ul>' . '<input type="hidden" id="' . $field['id'] . '" name="' . $field['id'] . '" value="' . $meta . '" class="gallery_post_images" />' . '<span class="description">' . $field['desc'] . '</span>' . '<script type="text/javascript">' . '(function ($) { ' . "\$(document.body).delegate('#" . $field['id'] . "_images_button', 'click', function (e) { " . 'e.preventDefault(); ' . '$(e.target).cmsmsMediaUploader( { ' . "frameId : 'cmsms-" . $field['id'] . "-media-frame', " . "frameClass : 'media-frame cmsms-media-frame cmsms-" . $field['id'] . "-media-frame', " . "frameTitle : '" . __('Choose images', 'cmsmasters') . "', " . "frameButton : '" . __('Choose', 'cmsmasters') . "', " . 'multiple : true ' . '} ); ' . '} ); ' . '} )(jQuery); ' . '</script>';
                break;
        }
        if ($field['type'] != 'tabs' && $field['type'] != 'tab_start' && $field['type'] != 'tab_finish' && $field['type'] != 'content_start' && $field['type'] != 'content_finish') {
            echo '</td>' . '</tr>';
        }
    }
}
示例#4
0
    function form($instance)
    {
        $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
        $subtitle = isset($instance['subtitle']) ? esc_attr($instance['subtitle']) : '';
        $icon = isset($instance['icon']) ? esc_attr($instance['icon']) : '';
        $text = isset($instance['text']) ? esc_attr($instance['text']) : '';
        $widget_width = isset($instance['widget_width']) && $instance['widget_width'] != '' ? $instance['widget_width'] : 'one_first';
        ?>
        <p>
            <label for="<?php 
        echo $this->get_field_id('title');
        ?>
"><?php 
        _e('Title', 'cmsmasters');
        ?>
:<br />
                <input class="widefat" id="<?php 
        echo $this->get_field_id('title');
        ?>
" name="<?php 
        echo $this->get_field_name('title');
        ?>
" type="text" value="<?php 
        echo $title;
        ?>
" />
            </label>
        </p>
        <p>
            <label for="<?php 
        echo $this->get_field_id('subtitle');
        ?>
"><?php 
        _e('Subtitle', 'cmsmasters');
        ?>
:<br />
                <input class="widefat" id="<?php 
        echo $this->get_field_id('subtitle');
        ?>
" name="<?php 
        echo $this->get_field_name('subtitle');
        ?>
" type="text" value="<?php 
        echo $subtitle;
        ?>
" />
            </label>
        </p>
        <p class="m0">
            <label for="<?php 
        echo $this->get_field_id('icon');
        ?>
"><?php 
        _e('Icon', 'cmsmasters');
        ?>
:<br />
                <input id="<?php 
        echo $this->get_field_id('icon');
        ?>
" name="<?php 
        echo $this->get_field_name('icon');
        ?>
" type="hidden" value="<?php 
        echo $icon;
        ?>
" />
            </label>
        </p>
		<div class="cmsmasters_icon_list">
			<ul id="icons<?php 
        echo $this->get_field_id('icon');
        ?>
" class="iconslist">
		<?php 
        $cmsms_option = cmsms_get_global_options();
        if (!empty($cmsms_option[CMSMS_SHORTNAME . '_heading_icons'])) {
            foreach ($cmsms_option[CMSMS_SHORTNAME . '_heading_icons'] as $icon_numb => $icon_id) {
                $image = wp_get_attachment_image_src($icon_id, 'thumbnail');
                echo '<li id="cmsms_heading_icon_' . $icon_numb . '"' . ($icon !== '' && $icon === $icon_id ? ' class="current_icon"' : '') . '>' . "\n" . '<a href="' . $icon_id . '" class="click_img">' . "\n" . '<img src="' . $image[0] . '" alt="' . $icon_numb . '" />' . "\n" . '</a>' . "\n" . '</li>' . "\n";
            }
        } else {
            echo '<li>' . __('Add new heading icons', 'cmsmasters') . ' <a href="' . admin_url() . 'admin.php?page=cmsms-settings-icon&tab=heading">' . __('here', 'cmsmasters') . '</a>.</li>';
        }
        ?>
			</ul>    
		</div>
        <p>
            <label for="<?php 
        echo $this->get_field_id('text');
        ?>
"><?php 
        _e('Text', 'cmsmasters');
        ?>
:<br />
                <textarea class="widefat" id="<?php 
        echo $this->get_field_id('text');
        ?>
" name="<?php 
        echo $this->get_field_name('text');
        ?>
" type="text" style="min-height:100px; resize:vertical;"><?php 
        echo $text;
        ?>
</textarea>
            </label>
        </p>
		<p class="w_col">
			<label for="<?php 
        echo $this->get_field_id('widget_width');
        ?>
">
				<?php 
        _e('Choose the width of widget', 'cmsmasters');
        ?>
:<br /><br />
                <small class="s_red"><?php 
        _e('Only for horizontal sidebars', 'cmsmasters');
        ?>
</small>
                <select id="<?php 
        echo $this->get_field_id('widget_width');
        ?>
" name="<?php 
        echo $this->get_field_name('widget_width');
        ?>
" class="fl">
                    <option <?php 
        if ($widget_width == 'one_first') {
            echo 'selected="selected" ';
        }
        ?>
value="one_first">-- 1/1 --&nbsp;</option>
                    <option <?php 
        if ($widget_width == 'three_fourth') {
            echo 'selected="selected" ';
        }
        ?>
value="three_fourth">-- 3/4 --&nbsp;</option>
                    <option <?php 
        if ($widget_width == 'two_third') {
            echo 'selected="selected" ';
        }
        ?>
value="two_third">-- 2/3 --&nbsp;</option>
                    <option <?php 
        if ($widget_width == 'one_half') {
            echo 'selected="selected" ';
        }
        ?>
value="one_half">-- 1/2 --&nbsp;</option>
                    <option <?php 
        if ($widget_width == 'one_third') {
            echo 'selected="selected" ';
        }
        ?>
value="one_third">-- 1/3 --&nbsp;</option>
                    <option <?php 
        if ($widget_width == 'one_fourth') {
            echo 'selected="selected" ';
        }
        ?>
value="one_fourth">-- 1/4 --&nbsp;</option>
                </select>
            </label>
		</p>
        <div class="cl"></div>
        <?php 
    }
function cmsms_header_styles()
{
    global $post;
    $cmsms_option = cmsms_get_global_options();
    if (!is_home() && !is_404() && !is_archive() && !is_search()) {
        $cmsms_bg_default = get_post_meta($post->ID, 'cmsms_bg_default', true);
        $cmsms_bg_col = get_post_meta($post->ID, 'cmsms_bg_col', true);
        $cmsms_bg_img_enable = get_post_meta($post->ID, 'cmsms_bg_img_enable', true);
        $cmsms_bg_img = get_post_meta($post->ID, 'cmsms_bg_img', true);
        $cmsms_bg_pos = get_post_meta($post->ID, 'cmsms_bg_pos', true);
        $cmsms_bg_rep = get_post_meta($post->ID, 'cmsms_bg_rep', true);
        $cmsms_bg_att = get_post_meta($post->ID, 'cmsms_bg_att', true);
    }
    echo '<style type="text/css">';
    if (!is_home() && !is_404() && !is_archive() && !is_search() && $cmsms_bg_default != 'true') {
        echo 'body { ' . 'background-color : ' . $cmsms_bg_col . '; ' . 'background-image : ' . ($cmsms_bg_img_enable == 'true' ? 'url(' . (is_numeric($cmsms_bg_img) ? array_shift(wp_get_attachment_image_src($cmsms_bg_img, 'full')) : $cmsms_bg_img) . ')' : 'none') . '; ' . 'background-position : ' . ($cmsms_bg_img_enable == 'true' ? $cmsms_bg_pos : 'top center') . '; ' . 'background-repeat : ' . ($cmsms_bg_img_enable == 'true' ? $cmsms_bg_rep : 'repeat') . '; ' . 'background-attachment : ' . ($cmsms_bg_img_enable == 'true' ? $cmsms_bg_att : 'scroll') . '; ' . '}';
    } else {
        echo 'body { ' . 'background-color : ' . $cmsms_option[CMSMS_SHORTNAME . '_bg_col'] . '; ' . 'background-image : ' . ($cmsms_option[CMSMS_SHORTNAME . '_bg_img_enable'] ? 'url(' . (is_numeric($cmsms_option[CMSMS_SHORTNAME . '_bg_img']) ? array_shift(wp_get_attachment_image_src($cmsms_option[CMSMS_SHORTNAME . '_bg_img'], 'full')) : $cmsms_option[CMSMS_SHORTNAME . '_bg_img']) . ')' : 'none') . '; ' . 'background-position : ' . ($cmsms_option[CMSMS_SHORTNAME . '_bg_img_enable'] ? $cmsms_option[CMSMS_SHORTNAME . '_bg_pos'] : 'top center') . '; ' . 'background-repeat : ' . ($cmsms_option[CMSMS_SHORTNAME . '_bg_img_enable'] ? $cmsms_option[CMSMS_SHORTNAME . '_bg_rep'] : 'repeat') . '; ' . 'background-attachment : ' . ($cmsms_option[CMSMS_SHORTNAME . '_bg_img_enable'] ? $cmsms_option[CMSMS_SHORTNAME . '_bg_att'] : 'scroll') . '; ' . '}';
    }
    $fixed_header_margin_top = $cmsms_option[CMSMS_SHORTNAME . '_header_height'];
    $fixed_header_height = $cmsms_option[CMSMS_SHORTNAME . '_header_height'] / 3 * 2;
    $margin_difference = $cmsms_option[CMSMS_SHORTNAME . '_header_height'] / 6;
    echo '#middle.cmsms_middle_margin { ' . 'margin-top : ' . $cmsms_option[CMSMS_SHORTNAME . '_header_height'] . 'px; ' . '} ' . '#header > .header_inner { ' . 'height : ' . $cmsms_option[CMSMS_SHORTNAME . '_header_height'] . 'px; ' . '} ' . '#header.fixed_header + * { ' . 'margin-top : ' . $fixed_header_margin_top . 'px; ' . '} ' . '#header > .header_inner > a.logo { ' . 'top : ' . $cmsms_option[CMSMS_SHORTNAME . '_logo_top'] . 'px; ' . 'left : ' . $cmsms_option[CMSMS_SHORTNAME . '_logo_left'] . 'px; ' . '} ' . '.header_inner:after { ' . 'width : ' . ($cmsms_option[CMSMS_SHORTNAME . '_logo_width'] < 255 ? 255 : $cmsms_option[CMSMS_SHORTNAME . '_logo_width']) . 'px; ' . '} ' . '#header > .header_inner > a.logo > img { ' . 'width : ' . $cmsms_option[CMSMS_SHORTNAME . '_logo_width'] . 'px; ' . 'height : ' . $cmsms_option[CMSMS_SHORTNAME . '_logo_height'] . 'px; ' . '} ' . '#header nav { ' . 'top : ' . $cmsms_option[CMSMS_SHORTNAME . '_header_nav_top'] . 'px; ' . 'left : ' . ($cmsms_option[CMSMS_SHORTNAME . '_logo_width'] < 255 ? 255 : $cmsms_option[CMSMS_SHORTNAME . '_logo_width']) . 'px; ' . '} ' . '#header .social_icons { ' . 'top : ' . $cmsms_option[CMSMS_SHORTNAME . '_header_social_top'] . 'px; ' . 'left : ' . ($cmsms_option[CMSMS_SHORTNAME . '_logo_width'] < 255 ? 255 : $cmsms_option[CMSMS_SHORTNAME . '_logo_width']) . 'px; ' . '} ' . '#header .search_line { ' . 'top : ' . $cmsms_option[CMSMS_SHORTNAME . '_header_height'] / 2 . 'px; ' . 'left : ' . ($cmsms_option[CMSMS_SHORTNAME . '_logo_width'] < 255 ? 255 : $cmsms_option[CMSMS_SHORTNAME . '_logo_width']) . 'px; ' . '} ' . '.header_html { ' . 'top : ' . $cmsms_option[CMSMS_SHORTNAME . '_header_custom_html_top'] . 'px; ' . 'right : ' . $cmsms_option[CMSMS_SHORTNAME . '_header_custom_html_right'] . 'px; ' . '} ' . '#header.fixed_header > .header_inner { ' . 'height : ' . $fixed_header_height . 'px; ' . '} ' . '#header.fixed_header > .header_inner > a.logo { ' . 'top : ' . ($cmsms_option[CMSMS_SHORTNAME . '_logo_top'] - $margin_difference) . 'px; ' . '} ' . '#header.fixed_header nav { ' . 'top : ' . ($cmsms_option[CMSMS_SHORTNAME . '_header_nav_top'] - $margin_difference) . 'px; ' . '} ' . '#header.fixed_header .social_icons { ' . 'top : ' . ($cmsms_option[CMSMS_SHORTNAME . '_header_social_top'] - $margin_difference) . 'px; ' . '} ' . '#header.fixed_header .search_line { ' . 'top : ' . $fixed_header_height / 2 . 'px; ' . '} ' . '@media only screen and (max-width : 1024px) { ' . '.cmsms_responsive #middle.cmsms_middle_margin { ' . 'margin-top : 0px; ' . '} ' . '.cmsms_responsive .header_inner:after { ' . 'margin-left : 5%; ' . '} ' . '.cmsms_responsive #header nav { ' . 'top : auto; ' . 'left : auto; ' . '} ' . '.cmsms_responsive #header > .header_inner > a.logo { ' . 'top : auto; ' . 'left : auto; ' . '} ' . '.cmsms_responsive #header > .header_inner { ' . 'height : auto; ' . '} ' . '} ' . '@media only screen and (max-width : 767px) { ' . '.cmsms_responsive #header .search_line, .cmsms_responsive #header .social_icons { ' . 'top : auto; ' . 'left : auto; ' . '} ' . '} ' . '@media only screen and (max-width : 450px) { ' . '.cmsms_responsive .header_html { ' . 'top : auto; ' . '} ' . '.cmsms_responsive #header > .header_inner > a.logo { ' . 'width : 90%; ' . 'height : auto; ' . '} ' . '.cmsms_responsive #header > .header_inner > a.logo > img { ' . 'margin : 0 auto; ' . '} ' . '.cmsms_responsive .header_inner:after { ' . 'width : 90%; ' . '} ' . '} ' . '</style>';
}
function cmsms_more($cmsms_id, $type = 'post')
{
    if ($type == 'post') {
        // Post type - blog
        $cmsms_option = cmsms_get_global_options();
        if ($cmsms_option[CMSMS_SHORTNAME . '_blog_page_more']) {
            $cmsms_post_read_more = get_post_meta($cmsms_id, 'cmsms_post_read_more', true);
            if ($cmsms_post_read_more == '') {
                $cmsms_post_read_more = __('Read More', 'cmsmasters');
            }
            echo '<a class="more_button" href="' . get_permalink($cmsms_id) . '">' . $cmsms_post_read_more . '<span></span></a>' . "\n";
        }
    } elseif ($type == 'project') {
        // Post type - portfolio
        $cmsms_project_more = get_post_meta($cmsms_id, 'project_more', true);
        if ($cmsms_project_more == '') {
            $cmsms_project_more = __('Read More', 'cmsmasters');
        }
        echo '<a class="more_button" href="' . get_permalink($cmsms_id) . '">' . $cmsms_project_more . '<span></span></a>';
    } elseif ($type == 'testimonial') {
        // Post type - testimonial
        $cmsms_option = cmsms_get_global_options();
        if ($cmsms_option[CMSMS_SHORTNAME . '_testimonial_page_more']) {
            $cmsms_testimonial_more = get_post_meta($cmsms_id, 'cmsms_testimonial_more', true);
            if ($cmsms_testimonial_more == '') {
                $cmsms_testimonial_more = __('Read More', 'cmsmasters');
            }
            echo '<a class="button" href="' . get_permalink($cmsms_id) . '">' . $cmsms_testimonial_more . '</a>' . "\n";
        }
    }
}
function cmsms_form_field_fn($args = array())
{
    $cmsms_option = cmsms_get_global_options();
    extract($args);
    $settings_output = cmsms_get_settings();
    $cmsms_option_name = $settings_output['cmsms_option_name'];
    $options = get_option($cmsms_option_name);
    if (!isset($options[$id])) {
        $options[$id] = $std;
    }
    $field_class = $class != '' ? ' ' . $class : '';
    switch ($type) {
        case 'text':
            $options[$id] = esc_attr(stripslashes($options[$id]));
            echo '<input class="regular-text' . $field_class . '" type="text" id="' . $id . '" name="' . $cmsms_option_name . '[' . $id . ']" value="' . $options[$id] . '" />' . ($desc != '' ? '<br />' . '<span class="description">' . $desc . '</span>' : '');
            break;
        case 'multi-text':
            foreach ($choices as $item) {
                $item = explode('|', $item);
                $item[0] = esc_html($item[0]);
                if (!empty($options[$id])) {
                    foreach ($options[$id] as $option_key => $option_val) {
                        if ($item[1] == $option_key) {
                            $value = $option_val;
                        }
                    }
                } else {
                    $value = '';
                }
                echo '<span>' . $item[0] . ':</span> ' . '<input class="' . $field_class . '" type="text" id="' . $id . '|' . $item[1] . '" name="' . $cmsms_option_name . '[' . $id . '|' . $item[1] . ']" value="' . $value . '" />' . '<br />';
            }
            echo $desc != '' ? '<span class="description">' . $desc . '</span>' : '';
            break;
        case 'textarea':
            $options[$id] = esc_html(stripslashes($options[$id]));
            echo '<textarea class="textarea' . $field_class . '" type="text" id="' . $id . '" name="' . $cmsms_option_name . '[' . $id . ']" rows="5" cols="30">' . $options[$id] . '</textarea>' . ($desc != '' ? '<br />' . '<span class="description">' . $desc . '</span>' : '');
            break;
        case 'select':
            echo '<select id="' . $id . '" class="select' . $field_class . '" name="' . $cmsms_option_name . '[' . $id . ']">';
            foreach ($choices as $item) {
                $item = explode('|', $item);
                $item[0] = esc_html($item[0]);
                $selected = $options[$id] == $item[1] ? ' selected="selected"' : '';
                echo '<option value="' . $item[1] . '"' . $selected . '>' . $item[0] . '</option>';
            }
            echo '</select>' . ($desc != '' ? '<br />' . '<span class="description">' . $desc . '</span>' : '');
            break;
        case 'select_sidebar':
            echo '<select id="' . $id . '" class="select' . $field_class . '" name="' . $cmsms_option_name . '[' . $id . ']">' . '<option value="">' . __('None', 'cmsmasters') . ' &nbsp;</option>' . '<option value="default"' . ($options[$id] !== '' && $options[$id] === 'default' ? ' selected="selected"' : '') . '>' . __('Default Sidebar', 'cmsmasters') . ' &nbsp;</option>';
            foreach ($cmsms_option[CMSMS_SHORTNAME . '_sidebar'] as $sidebar_id => $sidebar_name) {
                echo '<option value="' . generateSlug($sidebar_name, 45) . '"' . ($options[$id] !== '' && $options[$id] === generateSlug($sidebar_name, 45) ? ' selected="selected"' : '') . '>' . $sidebar_name . ' &nbsp;</option>';
            }
            echo '</select>' . '<br />' . ($desc != '' ? '<br />' . '<span class="description">' . $desc . '</span>' : '');
            break;
        case 'checkbox':
            echo '<input class="checkbox' . $field_class . '" type="checkbox" id="' . $id . '" name="' . $cmsms_option_name . '[' . $id . ']" value="1" ' . checked($options[$id], 1, false) . ' /> &nbsp;' . ($desc != '' ? '<span class="description">' . $desc . '</span>' : '');
            break;
        case 'multi-checkbox':
            foreach ($choices as $item) {
                $item = explode('|', $item);
                $item[0] = esc_html($item[0]);
                $checked = '';
                if (isset($options[$id][$item[1]]) && $options[$id][$item[1]] == 'true') {
                    $checked = ' checked="checked"';
                }
                echo '<input class="checkbox' . $field_class . '" type="checkbox" id="' . $id . '|' . $item[1] . '" name="' . $cmsms_option_name . '[' . $id . '|' . $item[1] . ']" value="1"' . $checked . ' /> &nbsp;' . '<label for="' . $id . '|' . $item[1] . '">' . $item[0] . '</label>' . '<br />';
            }
            echo $desc != '' ? '<span class="description">' . $desc . '</span>' : '';
            break;
        case 'number':
            $options[$id] = esc_attr(stripslashes($options[$id]));
            echo '<input class="small-text' . $field_class . '" type="number" id="' . $id . '" name="' . $cmsms_option_name . '[' . $id . ']" value="' . $options[$id] . '" />' . ($desc != '' ? ' &nbsp; ' . '<span class="description">' . $desc . '</span>' : '');
            break;
        case 'radio':
            foreach ($choices as $item) {
                $item = explode('|', $item);
                $item[0] = esc_html($item[0]);
                echo '<input class="radio' . $field_class . '" type="radio" id="' . $id . '|' . $item[1] . '" name="' . $cmsms_option_name . '[' . $id . ']" value="' . $item[1] . '" ' . checked($options[$id], $item[1], false) . ' /> &nbsp;' . '<label for="' . $id . '|' . $item[1] . '">' . $item[0] . '</label>' . '<br />';
            }
            echo $desc != '' ? '<span class="description">' . $desc . '</span>' : '';
            break;
        case 'radio_img':
            foreach ($choices as $item) {
                $item = explode('|', $item);
                $item[0] = esc_html($item[0]);
                echo '<div style="text-align:center; float:left; margin-right:20px;">' . '<input class="radio' . $field_class . '" type="radio" id="' . $id . '|' . $item[2] . '" name="' . $cmsms_option_name . '[' . $id . ']" value="' . $item[2] . '" ' . checked($options[$id], $item[2], false) . ' />' . '<br />' . '<label for="' . $id . '|' . $item[2] . '">' . '<img src="' . $item[1] . '" alt="' . $item[0] . '" title="' . $item[0] . '" />' . '<br />' . $item[0] . '</label>' . '</div>';
            }
            echo $desc != '' ? '<div style="clear:both;"></div>' . '<br />' . '<span class="description">' . $desc . '</span>' : '';
            break;
        case 'color':
            $options[$id] = esc_attr(stripslashes($options[$id]));
            echo '<input type="text" id="' . $id . '" name="' . $cmsms_option_name . '[' . $id . ']" value="' . $options[$id] . '" class="my-color-field" data-default-color="' . $std . '" />' . '<br />' . '<span class="description">' . ($desc != '' ? $desc . '<br />' : '') . '</span>' . '<script type="text/javascript">' . 'jQuery(document).ready(function () { ' . '(function ($) { ' . "\$('#" . $id . "').wpColorPicker(); " . '} )(jQuery); ' . '} ); ' . '</script>';
            break;
        case 'upload':
            $options[$id] = esc_attr(stripslashes($options[$id]));
            $image = $std;
            echo '<span id="' . $id . '_default" class="custom_default_image" style="display:none;">' . $image . '</span>';
            if (isset($options[$id]) && $options[$id] != '' && $options[$id] != $std) {
                if (is_numeric($options[$id])) {
                    $image = wp_get_attachment_image_src($options[$id], 'medium');
                    $image = $image[0];
                } else {
                    $image = $options[$id];
                }
            }
            echo '<input id="' . $id . '" name="' . $cmsms_option_name . '[' . $id . ']" type="hidden" class="custom_upload_image" value="' . (isset($options[$id]) && $options[$id] != '' && $options[$id] != $std ? $options[$id] : $std) . '" />' . '<img src="' . $image . '" id="' . $id . '_preview" class="custom_preview_image" alt="" />' . '<br />' . '<input id="' . $id . '_button" class="custom_upload_image_button button" type="button" value="' . __('Choose Image', 'cmsmasters') . '" />' . ' &nbsp; &nbsp; ' . '<small>' . '<a href="#" id="' . $id . '_clear" class="custom_clear_image_button">' . __('Default Image', 'cmsmasters') . '</a>' . '</small>' . '<div style="clear:both;"></div>' . ($desc != '' ? '<br />' . '<span class="description">' . $desc . '</span>' : '') . '<script type="text/javascript">' . 'jQuery(document).ready(function () { ' . '(function ($) { ' . "\$('#" . $id . "_button').bind('click', function (e) { " . 'e.preventDefault(); ' . '$(e.target).cmsmsMediaUploader( { ' . "frameId : 'cmsms-" . $id . "-media-frame', " . "frameClass : 'media-frame cmsms-media-frame cmsms-" . $id . "-media-frame', " . "frameTitle : '" . __('Choose image', 'cmsmasters') . "', " . "frameButton : '" . __('Choose', 'cmsmasters') . "', " . 'multiple : false ' . '} ); ' . '} ); ' . '} )(jQuery); ' . '} ); ' . '</script>';
            break;
        case 'typorgaphy':
            $system_font = in_array('system_font', $choices) ? true : false;
            $google_font = in_array('google_font', $choices) ? true : false;
            $font_color = in_array('font_color', $choices) ? true : false;
            $font_size = in_array('font_size', $choices) ? true : false;
            $line_height = in_array('line_height', $choices) ? true : false;
            $font_weight = in_array('font_weight', $choices) ? true : false;
            $font_style = in_array('font_style', $choices) ? true : false;
            if ($system_font) {
                echo '<div class="cmsms_admin_block">' . '<select class="select" id="' . $id . '_system_font" name="' . $cmsms_option_name . '[' . $id . '_system_font]">';
                foreach (cmsms_system_fonts_list() as $key => $value) {
                    echo '<option value="' . $key . '"' . ($options[$id . '_system_font'] == $key ? ' selected="selected"' : '') . '>' . $value . '</option>';
                }
                echo '</select>' . ' &nbsp; ' . '<label for="' . $id . '_system_font">' . __('System Font', 'cmsmasters') . '</label>' . '</div>';
            }
            if ($google_font) {
                echo '<div class="cmsms_admin_block">' . '<select class="select" id="' . $id . '_google_font" name="' . $cmsms_option_name . '[' . $id . '_google_font]">';
                foreach (cmsms_google_fonts_list() as $key => $value) {
                    echo '<option value="' . $key . '"' . ($options[$id . '_google_font'] == $key ? ' selected="selected"' : '') . '>' . $value . '</option>';
                }
                echo '</select>' . ' &nbsp; ' . '<label for="' . $id . '_google_font">' . __('Google Font', 'cmsmasters') . '</label>' . '</div>';
            }
            if ($font_color) {
                echo '<div class="cmsms_admin_block" style="padding-bottom:20px;">' . '<input type="text" id="' . $id . '_font_color" name="' . $cmsms_option_name . '[' . $id . '_font_color]" value="' . $options[$id . '_font_color'] . '" class="my-color-field" data-default-color="' . $std['font_color'] . '" />' . ' &nbsp; ' . '<label for="' . $id . '_font_color" style="padding-bottom:15px;">' . __('Font Color', 'cmsmasters') . '</label>' . '</div>' . '<script type="text/javascript">' . 'jQuery(document).ready(function () { ' . '(function ($) { ' . "\$('#" . $id . "_font_color').wpColorPicker(); " . '} )(jQuery); ' . '} ); ' . '</script>';
            }
            if ($font_size) {
                echo '<div class="cmsms_admin_block">' . '<input class="small-text" type="text" id="' . $id . '_font_size_number" name="' . $cmsms_option_name . '[' . $id . '_font_size]" value="' . $options[$id . '_font_size'] . '" /> ' . ' &nbsp; ' . '<label for="' . $id . '_font_size_number">' . __('Font Size', 'cmsmasters') . ' <em>(' . __('in pixels', 'cmsmasters') . ')</em></label>' . '</div>';
            }
            if ($line_height) {
                echo '<div class="cmsms_admin_block">' . '<input class="small-text" type="text" id="' . $id . '_line_height_number" name="' . $cmsms_option_name . '[' . $id . '_line_height]" value="' . $options[$id . '_line_height'] . '" /> ' . ' &nbsp; ' . '<label for="' . $id . '_line_height_number">' . __('Line Height', 'cmsmasters') . ' <em>(' . __('in pixels', 'cmsmasters') . ')</em></label>' . '</div>';
            }
            if ($font_weight) {
                echo '<div class="cmsms_admin_block">' . '<select class="select" id="' . $id . '_font_weight" name="' . $cmsms_option_name . '[' . $id . '_font_weight]">';
                foreach (cmsms_font_weight_list() as $key => $value) {
                    echo '<option value="' . $key . '"' . ($options[$id . '_font_weight'] == $key ? ' selected="selected"' : '') . '>' . $value . '</option>';
                }
                echo '</select>' . ' &nbsp; ' . '<label for="' . $id . '_font_weight">' . __('Font Weight', 'cmsmasters') . '</label>' . '</div>';
            }
            if ($font_style) {
                echo '<div class="cmsms_admin_block">' . '<select class="select" id="' . $id . '_font_style" name="' . $cmsms_option_name . '[' . $id . '_font_style]">';
                foreach (cmsms_font_style_list() as $key => $value) {
                    echo '<option value="' . $key . '"' . ($options[$id . '_font_style'] == $key ? ' selected="selected"' : '') . '>' . $value . '</option>';
                }
                echo '</select>' . ' &nbsp; ' . '<label for="' . $id . '_font_style">' . __('Font Style', 'cmsmasters') . '</label>' . '</div>';
            }
            echo $desc != '' ? '<span class="description">' . $desc . '</span>' : '';
            break;
        case 'sidebar':
            echo '<script type="text/javascript"> ' . 'jQuery(document).ready(function () { ' . "jQuery('.sidebar_management').on('click', '.sidebar_del', function () { " . "var del_sidebar_number = Number(jQuery('#custom_sidebars_number').val()) - 1; " . "jQuery('#custom_sidebars_number').val(del_sidebar_number); " . 'jQuery(this).parent().remove(); ' . 'var li_input = undefined, ' . "li_input_val = '';" . 'for (var n = 1; n <= del_sidebar_number; n += 1) { ' . "li_input = jQuery('.sidebar_management ul li:eq(' + (n - 1) + ')').find('input[type=\"hidden\"]');" . "li_input_val = li_input.attr('name').split('_-_');" . "jQuery('.sidebar_management ul li:eq(' + (n - 1) + ')').find('input[type=\"hidden\"]').attr( { name :  li_input_val[0] + '_-_' + n + ']'} );" . '} ' . 'return false; ' . '} ); ' . "jQuery('#add_sidebar').click(function () { " . "if (jQuery('#new_sidebar_name').val() !== '') { " . "var sidebar_number = Number(jQuery('#custom_sidebars_number').val()) + 1; " . "jQuery('#custom_sidebars_number').val(sidebar_number); " . "jQuery('.sidebar_management ul').append('<li>' + " . "'<a href=\"#\" class=\"sidebar_del\">" . __('Delete', 'cmsmasters') . "</a> ' + " . "jQuery('#new_sidebar_name').val() + " . "'<input type=\"hidden\" name=\"" . $cmsms_option_name . "[" . $id . "_-_' + sidebar_number + ']\" value=\"' + jQuery('#new_sidebar_name').val() + '\" />' + " . "'</li>'); " . "jQuery('#new_sidebar_name').val(''); " . '}' . 'return false; ' . '} ); ' . '} ); ' . '</script>' . ($desc != '' ? '<span class="description">' . $desc . '</span>' . '<br />' . '<br />' : '') . '<div class="sidebar_management">' . '<p>' . '<input class="all-options" type="text" id="new_sidebar_name" />' . '<input class="button" type="button" id="add_sidebar" value="' . __('Add Sidebar', 'cmsmasters') . '" />' . '</p>' . '<div></div>' . '<ul>';
            if (isset($options[$id]) && is_array($options[$id])) {
                $i = 0;
                foreach ($options[$id] as $sidebar) {
                    $i++;
                    echo '<li>' . '<a href="#" class="sidebar_del">' . __('Delete', 'cmsmasters') . '</a> ' . $sidebar . '<input type="hidden" name="' . $cmsms_option_name . '[' . $id . '_-_' . $i . ']" value="' . $sidebar . '" />' . '</li>';
                }
            }
            echo '</ul>' . '<input id="custom_sidebars_number" type="hidden" name="' . $cmsms_option_name . '[' . $id . '_number]" value="' . (isset($options[$id]) && is_array($options[$id]) ? $i : 0) . '" />' . '</div>';
            break;
        case 'heading':
            echo ($desc != '' ? '<span class="description">' . $desc . '</span>' . '<br />' . '<br />' : '') . '<div class="icon_management">' . '<p>' . '<input id="' . $id . '_button" class="heading_upload_image_button button" type="button" value="' . __('Add Icons', 'cmsmasters') . '" />' . '</p>' . '<div></div>' . '<ul>';
            if (isset($options[$id]) && is_array($options[$id])) {
                $i = 0;
                foreach ($options[$id] as $icon) {
                    $image = wp_get_attachment_image_src($icon, 'thumbnail');
                    $image = $image[0];
                    $i++;
                    echo '<li>' . '<div>' . '<img src="' . $image . '" alt="" class="icon_list_image" />' . '<input type="hidden" name="' . $cmsms_option_name . '[' . $id . '_-_' . $i . ']" value="' . $icon . '" />' . '</div>' . '<a href="#" class="icon_del" title="' . __('Delete', 'cmsmasters') . '">' . __('Delete', 'cmsmasters') . '</a> ' . '</li>';
                }
            }
            echo '</ul>' . '<input id="heading_icons_number" type="hidden" name="' . $cmsms_option_name . '[' . $id . '_number]" value="' . $i . '" />' . '</div>' . '<script type="text/javascript">' . 'jQuery(document).ready(function () { ' . '(function ($) { ' . "\$('#" . $id . "_button').bind('click', function (e) { " . 'e.preventDefault(); ' . '$(e.target).cmsmsMediaUploader( { ' . "frameId : 'cmsms-" . $id . "-media-frame', " . "frameClass : 'media-frame cmsms-media-frame cmsms-" . $id . "-media-frame', " . "frameTitle : '" . __('Choose heading icons', 'cmsmasters') . "', " . "frameButton : '" . __('Choose', 'cmsmasters') . "', " . "optionName : '" . $cmsms_option_name . "', " . "optionID : '" . $id . "', " . "deleteText : '" . __('Delete', 'cmsmasters') . "', " . 'multiple : true ' . '} ); ' . '} ); ' . '} )(jQuery); ' . '} ); ' . '</script>';
            break;
        case 'social':
            echo ($desc != '' ? '<span class="description">' . $desc . '</span>' . '<br />' . '<br />' : '') . '<div class="icon_management">' . '<p>' . '<img src="" class="icon_preview_image" alt="" style="display:none;" />' . '<small style="display:none;">' . '<a href="#" class="icon_clear_image_button">[X] ' . __('Cancel', 'cmsmasters') . '</a>' . '</small>' . '<span class="cl"></span>' . '<span class="icon_upload_link" style="display:none;">' . '<input class="my-color-field" type="text" id="new_icon_color" value="#000000" data-default-color="#000000" />' . '<label for="new_icon_color">' . __('Choose Color for This Icon', 'cmsmasters') . '</label>' . '<br /><br />' . '<input class="all-options" type="text" id="new_icon_link" /> ' . '<label for="new_icon_link">' . __('Enter Link for This Icon', 'cmsmasters') . '</label>' . '<br />' . '<input class="all-options" type="text" id="new_icon_title" /> ' . '<label for="new_icon_title">' . __('Enter Title for This Icon', 'cmsmasters') . '</label>' . '<br /><br />' . '<input type="checkbox" id="new_icon_target" value="true" /> ' . '<label for="new_icon_target">' . __('Open Link in a New Tab', 'cmsmasters') . '</label>' . '</span>' . '<span class="cl"></span>' . '<input class="icon_upload_image all-options" type="hidden" id="new_icon_name" />' . '<input id="' . $id . '_button" class="icon_upload_image_button button" type="button" value="' . __('Choose new social icon image', 'cmsmasters') . '" />' . '<span class="cl"><br /></span>' . '<input class="button-primary" type="button" id="add_icon" value="' . __('Add Icon', 'cmsmasters') . '" />' . '<input class="button-primary" type="button" id="edit_icon" value="' . __('Save Icon', 'cmsmasters') . '" style="display:none;" />' . '</p>' . '<div></div>' . '<ul>';
            if (isset($options[$id]) && is_array($options[$id])) {
                $i = 0;
                foreach ($options[$id] as $icon) {
                    $icon_array = explode('|', $icon);
                    if (is_numeric($icon_array[0])) {
                        $image = wp_get_attachment_image_src($icon_array[0], 'thumbnail');
                        $image = $image[0];
                    } else {
                        $image = $icon_array[0];
                    }
                    $i++;
                    echo '<li>' . '<div>' . '<img src="' . $image . '" alt="" class="icon_list_image" />' . '<input type="hidden" id="' . $cmsms_option_name . '_' . $id . '_-_' . $i . '" name="' . $cmsms_option_name . '[' . $id . '_-_' . $i . ']" value="' . $icon . '" />' . '</div>' . '<a href="#" class="icon_del" title="' . __('Delete', 'cmsmasters') . '">' . __('Delete', 'cmsmasters') . '</a> ' . '<a href="#" class="icon_edit" title="' . __('Edit', 'cmsmasters') . '">' . __('Edit', 'cmsmasters') . '</a> ' . '</li>';
                }
            }
            echo '</ul>' . '<input id="custom_icons_number" type="hidden" name="' . $cmsms_option_name . '[' . $id . '_number]" value="' . $i . '" />' . '</div>' . '<script type="text/javascript"> ' . 'jQuery(document).ready(function () { ' . "jQuery('#add_icon').click(function () { " . "if (jQuery('#new_icon_name').val() !== '') { " . "var icon_number = Number(jQuery('#custom_icons_number').val()) + 1; " . "jQuery('#custom_icons_number').val(icon_number); " . "jQuery('.icon_management ul').append('<li>' + " . "'<div>' + " . "'<img src=\"' + jQuery('#new_icon_name').parent().find('.icon_preview_image').attr('src') + '\" alt=\"\" class=\"icon_list_image\" />' + " . "'<input type=\"hidden\" id=\"" . $cmsms_option_name . "_" . $id . "_-_' + icon_number + '\" name=\"" . $cmsms_option_name . "[" . $id . "_-_' + icon_number + ']\" value=\"' + jQuery('#new_icon_name').val() + '|' + jQuery('#new_icon_color').val() + '|' + jQuery('#new_icon_link').val() + '|' + jQuery('#new_icon_title').val() + '|' + ((jQuery('#new_icon_target').is(':checked')) ? 'true' : 'false') + '\" />' + " . "'</div>' + " . "'<a href=\"#\" class=\"icon_del\" title=\"" . __('Delete', 'cmsmasters') . "\">" . __('Delete', 'cmsmasters') . "</a> ' + " . "'<a href=\"#\" class=\"icon_edit\" title=\"" . __('Edit', 'cmsmasters') . "\">" . __('Edit', 'cmsmasters') . "</a> ' + " . "'</li>'); " . "jQuery('#new_icon_name').val(''); " . "jQuery('#new_icon_color').val('#000000'); " . "jQuery('#new_icon_link').val(''); " . "jQuery('#new_icon_title').val(''); " . "jQuery('.icon_preview_image').attr( { src : '' } ).hide();" . "jQuery('.icon_clear_image_button').parent().hide();" . "jQuery('.icon_upload_link').hide();" . '}' . 'return false; ' . '} ); ' . '(function ($) { ' . "\$('#" . $id . "_button').bind('click', function (e) { " . 'e.preventDefault(); ' . '$(e.target).cmsmsSocialUploader( { ' . "frameId : 'cmsms-" . $id . "-media-frame', " . "frameClass : 'media-frame cmsms-media-frame cmsms-" . $id . "-media-frame', " . "frameTitle : '" . __('Choose heading icons', 'cmsmasters') . "', " . "frameButton : '" . __('Choose', 'cmsmasters') . "', " . "optionName : '" . $cmsms_option_name . "', " . "optionID : '" . $id . "' " . '} ); ' . '} ); ' . '} )(jQuery); ' . '} ); ' . '</script>';
            break;
    }
}