Пример #1
0
 function start($v)
 {
     global $fonts, $google_fonts, $social_media_icons, $RTThemePageLayoutOptionsClass;
     $fonts = $this->fonts;
     $google_fonts = $this->google_fonts;
     $social_media_icons = $this->social_media_icons;
     // Load text domain
     load_theme_textdomain('rt_theme', get_template_directory() . '/languages');
     //Call Theme Constants
     $this->theme_constants($v);
     //Load Classes
     $this->load_classes($v);
     //Load Widgets
     $this->load_widgets($v);
     //Load Functions
     $this->load_functions($v);
     //Create Menus
     add_action('init', array(&$this, 'rt_create_menus'));
     //Theme Supports
     $this->theme_supports();
     //Admin Panel Jobs
     if (is_admin()) {
         require_once THEMEFRAMEWORKDIR . '/classes/admin.php';
         $RTadmin = new RTThemeAdmin();
         $RTadmin->admin_init();
         //Save Default Options - First time loading or options resetted
         $this_page_url = 'http://' . $_SERVER['HTTP_HOST'] . '' . $_SERVER['SCRIPT_NAME'];
         $option_page_url = WPADMINURI . 'admin.php';
         if (get_option(THEMESLUG . '_' . UTHEMENAME . '_defaults') != 'saved' || isset($_GET['reset_settings']) && $_GET['reset_settings'] == 'true') {
             //reset options
             $this->rt_save_defaults($RTadmin);
             //create default templates
             $RTThemePageLayoutOptionsClass->rt_create_default_templates();
             if (isset($_GET['reset_settings']) && $_GET['reset_settings'] == 'true') {
                 add_action('admin_notices', array(&$this, 'reset_message'));
             }
         }
         //activate revslider
         add_action('tgmpa_register', array(&$this, 'activate_revslider'));
     }
     //check woocommerce
     if (class_exists('Woocommerce')) {
         include THEMEFRAMEWORKDIR . "/functions/woo-integration.php";
     }
     //Ajax Contact Form
     add_action('wp_ajax_rt_ajax_contact_form', array(&$this, 'rt_ajax_contact_form'));
     add_action('wp_ajax_nopriv_rt_ajax_contact_form', array(&$this, 'rt_ajax_contact_form'));
     //Ajax Product Scroller
     add_action('wp_ajax_rt_ajax_product_scroller', array(&$this, 'rt_ajax_product_scroller'));
     add_action('wp_ajax_nopriv_rt_ajax_product_scroller', array(&$this, 'rt_ajax_product_scroller'));
 }
Пример #2
0
 function start($v)
 {
     global $rt_websafe_fonts, $rt_google_fonts, $rt_social_media_icons, $RTThemePageLayoutOptionsClass, $RTThemePageLayouts;
     $rt_websafe_fonts = $this->rt_websafe_fonts;
     $rt_google_fonts = $this->rt_google_fonts;
     $rt_social_media_icons = apply_filters("rt_social_media_list", $this->rt_social_media_icons);
     // Load text domain
     if (!is_admin()) {
         load_theme_textdomain('rt_theme', get_template_directory() . '/languages');
     }
     //Call Theme Constants
     $this->theme_constants($v);
     //Load Classes
     $this->load_classes($v);
     //Load Widgets
     $this->load_widgets($v);
     //Load Functions
     $this->load_functions($v);
     //Create Menus
     add_action('init', array(&$this, 'rt_create_menus'));
     //Theme Supports
     $this->theme_supports();
     //Admin Panel Jobs
     if (is_admin()) {
         require_once RT_THEMEFRAMEWORKDIR . '/classes/admin.php';
         $RTadmin = new RTThemeAdmin();
         $RTadmin->admin_init();
         //activate revslider
         add_action('tgmpa_register', array(&$this, 'activate_plugins'));
     }
     //check woocommerce
     if (class_exists('Woocommerce')) {
         include RT_THEMEFRAMEWORKDIR . "/functions/woo-integration.php";
     }
     //Ajax Contact Form
     add_action('wp_ajax_rt_ajax_contact_form', array(&$this, 'rt_ajax_contact_form'));
     add_action('wp_ajax_nopriv_rt_ajax_contact_form', array(&$this, 'rt_ajax_contact_form'));
     //Ajax Product Scroller
     add_action('wp_ajax_rt_ajax_product_scroller', array(&$this, 'rt_ajax_product_scroller'));
     add_action('wp_ajax_nopriv_rt_ajax_product_scroller', array(&$this, 'rt_ajax_product_scroller'));
 }
Пример #3
0
    /**
     * Display the new Custom Fields meta box
     */
    function displayCustomFields()
    {
        global $post, $rt_google_fonts;
        $fontSystem = $extraClass = "";
        ?>
			 <div class="right-col metaboxes">
				<?php 
        wp_nonce_field($this->settings['slug'], $this->settings['slug'] . '_wpnonce', false, true);
        foreach ($this->customFields as $customField) {
            if (isset($customField['name'])) {
                $field_value = get_post_meta($post->ID, $this->prefix . $customField['name'], true);
            } else {
                $field_value = "";
            }
            $customField['default'] = isset($customField['default']) ? $customField['default'] : "";
            $customField['name'] = isset($customField['name']) ? $customField['name'] : "";
            $customField['help'] = isset($customField['help']) ? $customField['help'] : "";
            $customField['select'] = isset($customField['select']) ? $customField['select'] : "";
            $customField['class'] = isset($customField['class']) ? $customField['class'] : "";
            $customField['font-system'] = isset($customField['font-system']) ? $customField['font-system'] : "";
            $id = $this->prefix . $customField['name'];
            $title = isset($customField['title']) ? $customField['title'] : "";
            $description = isset($customField['description']) ? $customField['description'] : "";
            $check_desc = isset($customField['check_desc']) ? $customField['check_desc'] : "";
            $class = isset($customField['class']) ? $customField['class'] : "";
            $richEditor = isset($customField['richeditor']) ? $customField['richeditor'] : "";
            $label_position = isset($customField['label_position']) ? $customField['label_position'] : "";
            // Hidden Field value - check the content saved with rt-theme
            $hidden_value = get_post_meta($post->ID, $this->prefix . '_rt_hidden', true);
            // default value
            if ($field_value == "" && $customField['default']) {
                if (@$customField['type'] != "checkbox") {
                    $field_value = $customField['default'];
                }
            }
            if (!isset($_GET['action'])) {
                $field_value = $customField['default'];
            }
            // default value
            /*
             *	exeption for the background options
             */
            if ($this->settings['slug'] == "rt_background_custom_fields_template" && !$hidden_value) {
                $field_value = @$customField['default'];
            }
            if (@isset($customField['statical_value'])) {
                $field_value = @$customField['statical_value'];
            }
            //show default
            if (isset($customField['show_default']) && $customField['show_default'] == "true") {
                $showDefault = $customField['default'];
            } else {
                $showDefault = "";
            }
            // Check capability
            if (!current_user_can($this->settings['capability'], $post->ID)) {
                $output = false;
            } else {
                $output = true;
            }
            //labels
            $description = !empty($showDefault) ? $description . "<br /> Default Value = " . $showDefault . " " : $description;
            $label_stlye = !empty($label_position) ? "labels_block" : "";
            $desc_row = !empty($description) ? '<tr><td colspan="2"><div class="info icon-info-circled desc"><p>' . $description . '</p></div></td></tr>' : "";
            $help_icon = !empty($description) ? '<span title="' . __('click to show tips', 'rt_theme_admin') . '" class="tooltip_icon icon-help-circled"></span>' : "";
            $title_col = !empty($title) ? '<th><div>' . $help_icon . '<label for="' . $id . '">' . $title . '</label></div></th>' : "";
            $label = '<table class="table-row ' . $label_stlye . '"> ' . $desc_row . '<tr>' . $title_col;
            // Output if allowed
            if ($output) {
                ?>

							<?php 
                switch ($customField['type']) {
                    case 'tab_titles':
                        #	tab titles
                        $titles_output = '<ul>';
                        foreach ($customField['tab_names'] as $tab_id => $tab_name) {
                            $add_class = !empty($tab_name[1]) ? "with_icon" : "";
                            $icon_output = !empty($tab_name[1]) ? '<span class="' . $tab_name[1] . '"></span>' : "";
                            $titles_output .= sprintf('<li class="%s"><a href="#%s">%s %s</a></li>', $add_class, $tab_id, $icon_output, $tab_name[0]);
                        }
                        $titles_output .= "</ul>";
                        echo $titles_output;
                        break;
                    case 'table_start':
                        #	table Start
                        echo '<table class="table_master"><tr><td class="td_master">';
                        break;
                    case 'table_end':
                        #	table End
                        echo '</td></tr></table>';
                        break;
                    case 'td_col':
                        #	td split
                        echo '</td><td class="td_master">';
                        break;
                    case "group_start":
                        // group start
                        echo '<div id="' . $id . '" class="' . $class . '">';
                        break;
                    case "group_end":
                        // group end
                        echo '</div>';
                        break;
                        #
                        #	Checkbox
                        #
                    #
                    #	Checkbox
                    #
                    case 'checkbox2':
                        echo '<table class="table-row"><tr><td><div class="form_element check rt_checkbox "><input autocomplete="off" class="checkbox ' . $class . '" type="checkbox" name="' . $id . '"';
                        if ($field_value == "checked" || $field_value == "on") {
                            echo ' checked="checked" ';
                            $label_class = "icon-check";
                        } else {
                            $label_class = "icon-check-empty";
                        }
                        echo 'id="' . $id . '"/><div class="' . $label_class . '">' . $title . '';
                        echo !empty($description) ? '<div class="desc">' . $description . '</div>' : "";
                        echo '</label></div></td></tr></table>';
                        break;
                        #
                        #	Checkbox 2
                        #
                    #
                    #	Checkbox 2
                    #
                    case 'checkbox':
                        echo $label . '<td><div class="form_element check rt_checkbox"><input autocomplete="off" class="checkbox ' . $class . '" type="checkbox" name="' . $id . '"';
                        if ($field_value == "checked" || $field_value == "on") {
                            echo ' checked="checked" ';
                            $label_class = "icon-check";
                        } else {
                            $label_class = "icon-check-empty";
                        }
                        echo 'id="' . $id . '"/><div class="' . $label_class . '">' . $check_desc . '';
                        echo '</div></div></td></tr></table>';
                        break;
                        #
                        #	Radio Buttons
                        #
                    #
                    #	Radio Buttons
                    #
                    case 'radio':
                        echo $label . '<td class="col2"><div class="check"> ';
                        if ($class == "pattern_list") {
                            echo '<table class="image_radio ' . $class . ' " id="' . $id . '"><tr>';
                        } else {
                            echo '<div id="' . $id . '">';
                        }
                        //post formats
                        $post_format_value = get_post_format($post->ID);
                        $field_counter = 1;
                        foreach ($customField['options'] as $option_value => $option_name) {
                            //if array
                            if (is_array($option_name)) {
                                $option_name = $option_name[1];
                            }
                            //new post format value
                            if (isset($post_format_value) && $option_value == $post_format_value) {
                                $option_value = $field_value;
                            }
                            if (isset($customField['clean_name']) && $customField['clean_name'] == "post_format" && $post_format_value) {
                                $field_value = $post_format_value;
                            }
                            //clean name
                            if (isset($customField['clean_name'])) {
                                $name = $customField['clean_name'];
                            } else {
                                $name = $id;
                            }
                            //specific id defined?
                            if (isset($customField['ids']) && is_array($customField['options'])) {
                                $option_id = $customField['ids'][$field_counter - 1];
                            } else {
                                $option_id = $id . '-' . $field_counter;
                            }
                            if ($class == "pattern_list") {
                                if ($field_value == $option_value) {
                                    echo '<td><div class="first_div ' . $class . '"><div class="radio_cover checked radio_' . $option_value . ' ' . $class . '">';
                                    echo '<input type="radio" name="' . $name . '" value="' . $option_value . '"  id="' . $option_id . '" checked></div></div>';
                                    echo '<label for="' . $option_id . '">' . $option_name . '</label>';
                                    echo '</td>';
                                } else {
                                    echo '<td><div class="first_div ' . $class . '"><div class="radio_cover radio_' . $option_value . ' ' . $class . '">';
                                    echo '<input type="radio" name="' . $name . '" value="' . $option_value . '"  id="' . $option_id . '"></div></div>';
                                    echo '<label for="' . $option_id . '">' . $option_name . '</label>';
                                    echo '</td>';
                                }
                            } else {
                                if ($field_value == $option_value) {
                                    echo '<span class="radio_button_holder">';
                                    echo '<input type="radio" name="' . $name . '" value="' . $option_value . '" checked id="' . $option_id . '">';
                                    echo '<label for="' . $option_id . '">' . $option_name . '</label>';
                                    echo '</span>';
                                } else {
                                    echo '<span class="radio_button_holder">';
                                    echo '<input type="radio" name="' . $name . '" value="' . $option_value . '" id="' . $option_id . '">';
                                    echo '<label for="' . $option_id . '">' . $option_name . '</label>';
                                    echo '</span>';
                                }
                            }
                            $field_counter++;
                        }
                        if ($class == "pattern_list") {
                            echo '</tr></table>';
                        } else {
                            echo '</div>';
                        }
                        echo '</div></td></tr></table>';
                        break;
                        #
                        #	Select
                        #
                    #
                    #	Select
                    #
                    case 'select':
                        echo $label . '<td class="col2"><div class="form_element">';
                        echo '<select name="' . $id . '" id="' . $id . '" class="' . $class . ' ' . $fontSystem . ' ' . $extraClass . ' ">';
                        if ($customField['select']) {
                            echo '<option value="">' . $customField['select'] . '</option>';
                        }
                        foreach ($customField['options'] as $option_value => $option_name) {
                            //if array
                            if (is_array($option_name)) {
                                $option_name = $option_name[1];
                                $font_family_name = $rt_google_fonts[$option_value][0];
                            } else {
                                $font_family_name = "";
                            }
                            if (strpos($option_value, "-optgroup-start", 0)) {
                                echo '<optgroup label="' . $option_name . '">';
                            } elseif (strpos($option_value, "-optgroup-end", 0)) {
                                echo '</optgroup>';
                            } else {
                                if ($field_value == $option_value) {
                                    echo '<option value="' . $option_value . '"  class="' . @$font_family_name . '__" selected>' . $option_name . '</option>';
                                } else {
                                    echo '<option value="' . $option_value . '"  class="' . @$font_family_name . '__" >' . $option_name . '</option>';
                                }
                            }
                        }
                        echo '</select></div></td></tr></table>';
                        break;
                        #
                        #	Select Multiple
                        #
                    #
                    #	Select Multiple
                    #
                    case 'selectmultiple':
                        //Multiple Select
                        echo $label . '<td class="col2"><div class="form_element">';
                        $saved_array = $field_value;
                        echo '<select multiple name="' . $id . '" id="' . $id . '" class="multiple ' . $class . ' "  title="' . __('Select', 'rt_theme_admin') . '">';
                        foreach ($customField['options'] as $option_value => $option_name) {
                            $selected = "";
                            //if value selected
                            if (is_array($saved_array)) {
                                foreach ($saved_array as $a_key => $a_value) {
                                    if ($a_value == $option_value) {
                                        $selected = "selected";
                                    }
                                }
                            }
                            //if array
                            if (is_array($option_name)) {
                                $option_name = $option_name[1];
                            }
                            if (!$option_value) {
                                $option_value = " ";
                            }
                            echo '<option value="' . $option_value . '" ' . $selected . '>' . $option_name . '</option>';
                        }
                        echo '</select>';
                        echo '</div></td>';
                        echo '</tr>';
                        echo '</table>';
                        break;
                    case 'textarea':
                        // Textarea
                        echo $label;
                        if ($richEditor && function_exists('wp_editor')) {
                            echo '<td class="col2"><div class="form_element">';
                            wp_editor(htmlspecialchars_decode($field_value), '' . $id . '', array('quicktags' => array('buttons' => 'em,strong,link'), 'textarea_name' => '' . $id . '', 'quicktags' => true, 'tinymce' => true));
                            echo '</div>';
                        } else {
                            echo '<td class="col2"><div class="form_element"><textarea name="' . $id . '" id="' . $id . '" >' . htmlspecialchars($field_value) . '</textarea></div>';
                        }
                        echo '</td></tr></table>';
                        break;
                        #
                        #	Upload
                        #
                    #
                    #	Upload
                    #
                    case 'upload':
                        echo $label . '
								<td class="col2">
								<div class="form_element upload"><input autocomplete="off" type="text" name="' . $id . '" value="' . $field_value . '" id="' . $id . '" class="upload_field">  
								<button data-inputid="' . $id . '" class="icon-upload template_button light rttheme_upload_button" type="button">' . __('Upload', 'rt_theme_admin') . '</button>

								';
                        echo '</div>';
                        //the file extention
                        $ext = pathinfo($field_value, PATHINFO_EXTENSION);
                        //is the file an image?
                        if ($ext == "jpg" || $ext == "jpeg" || $ext == "png" || $ext == "gif") {
                            $ext_image = true;
                        } else {
                            $ext_image = false;
                        }
                        echo $field_value && $ext_image ? '<div data-holderid="' . $id . '" class="uploaded_file visible">' : '<div data-holderid="' . $id . '" class="uploaded_file ">';
                        if ($field_value) {
                            echo '<img class="loadit" src="' . $field_value . '"  data-image="' . $id . '" >';
                        } else {
                            echo '<img class="loadit" src="' . RT_THEMEADMINURI . '/images/blank.png"  data-image="' . $id . '">';
                        }
                        echo '<span class="icon-cancel delete_single" title="' . __("remove image", "rt_theme_admin") . '" data-inputid="' . $id . '"></span>';
                        echo '</div>';
                        echo '</td></tr></table>';
                        break;
                        #
                        #	Headings
                        #
                    #
                    #	Headings
                    #
                    case 'heading':
                        echo '<table class="seperator"><tr><td class="col1" colspan="2"><h4 class="sub_title icon-angle-down">' . $title . '</h4>';
                        if ($description) {
                            echo '<div class="desc">' . $description . '</div>';
                        }
                        echo '</td></tr></table>';
                        break;
                        #
                        #	Hidden
                        #
                    #
                    #	Hidden
                    #
                    case 'hidden':
                        echo '	<input type="hidden" name="' . $id . '" value="' . $field_value . '" id="' . $id . '">';
                        break;
                        #
                        #	Range input
                        #
                    #
                    #	Range input
                    #
                    case 'rangeinput':
                        echo $label . '<td class="col2"><div class="form_element"><input type="text" class="range" name="' . $id . '" id="' . $id . '" min="' . @$customField['min'] . '" max="' . @$customField['max'] . '" step="1" value="' . $field_value . '" /></div></td>';
                        echo '</tr></table>';
                        break;
                        #
                        #	Info Text
                        #
                    #
                    #	Info Text
                    #
                    case 'info_text_only':
                        echo '<table>';
                        echo '    <tr>';
                        echo '	<td class="col1" colspan="2"><div class="info_text">' . $description . '</div>';
                        echo '	</td>';
                        echo '    </tr>';
                        echo '</table>';
                        break;
                        #
                        #	Info Text - with value
                        #
                    #
                    #	Info Text - with value
                    #
                    case 'info_text':
                        echo '<table>';
                        echo '    <tr>';
                        echo '	<td class="col1" colspan="2"><label for="' . $id . '">' . $title . '</label>';
                        if ($description) {
                            echo '<div class="desc">' . $description . '</div>';
                        }
                        echo '	</td>';
                        echo '    </tr>';
                        echo '    <tr>';
                        echo '	<td class="col2"><div class="form_element">' . $description . '</div></td>';
                        echo @$help;
                        echo '    </tr>';
                        echo '</table>';
                        break;
                        #
                        #	Color Picker
                        #
                    #
                    #	Color Picker
                    #
                    case 'colorpicker':
                        echo $label . '<td class="col2"><div class="color-picker-holder"><div class="form_element color"><input type="text" name="' . $id . '" value="' . $field_value . '" id="' . $id . '"></div>';
                        echo '<div class="' . $id . ' colorSelector"><div style="background-color: ' . $field_value . '"></div></div></div></td>';
                        echo '</tr></table>';
                        $RTadmin = new RTThemeAdmin();
                        $RTadmin->color_picker($id, $field_value);
                        break;
                    default:
                        // Plain text field
                        echo $label . '<td class="col2"><div class="form_element"><input type="text" class="' . $class . '" name="' . $id . '" value="' . $field_value . '" id="' . $id . '"></div></td>';
                        echo '</tr></table>';
                }
                //	HR
                if (isset($customField['hr']) == "true") {
                    echo "<hr />";
                }
                ?>
						

					<?php 
            }
        }
        ?>
			</div>
			<?php 
    }
Пример #4
0
    /**
     * Display the new Custom Fields meta box
     */
    function displayCustomFields()
    {
        global $post, $google_fonts;
        ?>
			 <div class="box right-col metaboxes">
				<?php 
        wp_nonce_field($this->settings['slug'], $this->settings['slug'] . '_wpnonce', false, true);
        foreach ($this->customFields as $customField) {
            if (isset($customField['name'])) {
                $field_value = get_post_meta($post->ID, $this->prefix . $customField['name'], true);
            } else {
                $field_value = "";
            }
            $customField['default'] = isset($customField['default']) ? $customField['default'] : "";
            $customField['name'] = isset($customField['name']) ? $customField['name'] : "";
            $customField['help'] = isset($customField['help']) ? $customField['help'] : "";
            $customField['select'] = isset($customField['select']) ? $customField['select'] : "";
            $customField['class'] = isset($customField['class']) ? $customField['class'] : "";
            $customField['font-system'] = isset($customField['font-system']) ? $customField['font-system'] : "";
            $id = $this->prefix . $customField['name'];
            $title = isset($customField['title']) ? $customField['title'] : "";
            $description = isset($customField['description']) ? $customField['description'] : "";
            $class = isset($customField['class']) ? $customField['class'] : "";
            $richEditor = isset($customField['richeditor']) ? $customField['richeditor'] : "";
            // Hidden Field value - check the content saved with rt-theme
            $hidden_value = get_post_meta($post->ID, $this->prefix . '_rt_hidden', true);
            // default value
            if ($field_value == "" && $customField['default']) {
                if (@$customField['type'] != "checkbox") {
                    $field_value = $customField['default'];
                }
            }
            if (!isset($_GET['action'])) {
                $field_value = $customField['default'];
            }
            // default value
            /*
             *	exeption for the background options
             */
            if ($this->settings['slug'] == "rt_background_custom_fields_template" && !$hidden_value) {
                $field_value = @$customField['default'];
            }
            if (@isset($customField['statical_value'])) {
                $field_value = @$customField['statical_value'];
            }
            //show default
            if (isset($customField['show_default']) && $customField['show_default'] == "true") {
                $showDefault = $customField['default'];
            } else {
                $showDefault = "";
            }
            // Check capability
            if (!current_user_can($this->settings['capability'], $post->ID)) {
                $output = false;
            } else {
                $output = true;
            }
            //help
            if (!empty($customField['help'])) {
                $help = '<td class="col3"><a class="question" href="#" rel="' . THEMEADMINURI . '/pages/help.php?tipID=' . $id . '&tipName=' . $title . '&adminURI=' . THEMEADMINURI . '" title="' . $title . '"></a></td>';
            } else {
                $help = "";
            }
            // Output if allowed
            if ($output) {
                ?>

							<?php 
                switch ($customField['type']) {
                    case "group_start":
                        // group start
                        echo '<div id="' . $id . '">';
                        break;
                    case "group_end":
                        // group end
                        echo '</div>';
                        break;
                    case "checkbox":
                        // Checkbox
                        echo '<table>';
                        echo '    <tr>';
                        echo '	<td class="col1" colspan="2"><label for="' . $id . '">' . $title . '</label>';
                        if ($description) {
                            echo '<div class="desc">' . $description . '</div>';
                        }
                        echo '	</td>';
                        echo '    </tr>';
                        echo '    <tr>';
                        echo '	<td class="col2"><div class="form_element check"><input type="checkbox" name="' . $id . '"';
                        if ($field_value == "checked" || $field_value == "on") {
                            echo ' checked="checked" ';
                        }
                        echo 'id="' . $id . '"/></div></td>';
                        if (!empty($customField['help'])) {
                            echo '<td class="col3"><a class="question" href="#" rel="' . THEMEADMINURI . '/pages/help.php?tipID=' . $id . '&tipName=' . $title . '&adminURI=' . THEMEADMINURI . '" title="' . $title . '"></a></td>';
                        }
                        echo '    </tr>';
                        echo '</table>';
                        break;
                        #
                        #	Radio Buttons
                        #
                    #
                    #	Radio Buttons
                    #
                    case 'radio':
                        echo '<table>';
                        echo '    <tr>';
                        echo '	<td class="col1" colspan="2"><label for="' . $id . '">' . $title . '</label>';
                        if ($description) {
                            echo '<div class="desc">' . $description . '</div>';
                        }
                        echo '	</td>';
                        echo '    </tr>';
                        echo '    <tr>';
                        echo '	<td class="col2"><div class="check"> ';
                        if ($class == "pattern_list") {
                            echo '<table class="image_radio ' . $class . ' " id="' . $id . '"><tr>';
                        } else {
                            echo '<div id="' . $id . '">';
                        }
                        //hiding old post formats for wp 3.6
                        $new_post_format_value = get_post_meta($post->ID, "post_format", true);
                        $old_post_format_value = get_post_format($post->ID);
                        $field_counter = 1;
                        foreach ($customField['options'] as $option_value => $option_name) {
                            //if array
                            if (is_array($option_name)) {
                                $option_name = $option_name[1];
                            }
                            //if this is an old post saved with wp 3.5 and version rt 2.3
                            if ($old_post_format_value && $option_value == $old_post_format_value && !trim($new_post_format_value)) {
                                $option_value = $field_value;
                            }
                            //new post format value
                            if (isset($new_post_format_value) && $option_value == $new_post_format_value) {
                                $option_value = $field_value;
                            }
                            if (isset($customField['clean_name']) && $customField['clean_name'] == "post_format" && ($old_post_format_value || $new_post_format_value)) {
                                $field_value = " ";
                            }
                            //clean name
                            if (isset($customField['clean_name'])) {
                                $name = $customField['clean_name'];
                            } else {
                                $name = $id;
                            }
                            //specific id defined?
                            if (isset($customField['ids']) && is_array($customField['options'])) {
                                $option_id = $customField['ids'][$field_counter - 1];
                            } else {
                                $option_id = $id . '-' . $field_counter;
                            }
                            if ($class == "pattern_list") {
                                if ($field_value == $option_value) {
                                    echo '<td><div class="first_div ' . $class . '"><div class="radio_cover checked radio_' . $option_value . ' ' . $class . '">';
                                    echo '<input type="radio" name="' . $name . '" value="' . $option_value . '"  id="' . $option_id . '" checked></div></div>';
                                    echo '<label for="' . $option_id . '">' . $option_name . '</label>';
                                    echo '</td>';
                                } else {
                                    echo '<td><div class="first_div ' . $class . '"><div class="radio_cover radio_' . $option_value . ' ' . $class . '">';
                                    echo '<input type="radio" name="' . $name . '" value="' . $option_value . '"  id="' . $option_id . '"></div></div>';
                                    echo '<label for="' . $option_id . '">' . $option_name . '</label>';
                                    echo '</td>';
                                }
                            } else {
                                if ($field_value == $option_value) {
                                    echo '<span class="radio_button_holder">';
                                    echo '<input type="radio" name="' . $name . '" value="' . $option_value . '" checked id="' . $option_id . '">';
                                    echo '<label for="' . $option_id . '">' . $option_name . '</label>';
                                    echo '</span>';
                                } else {
                                    echo '<span class="radio_button_holder">';
                                    echo '<input type="radio" name="' . $name . '" value="' . $option_value . '" id="' . $option_id . '">';
                                    echo '<label for="' . $option_id . '">' . $option_name . '</label>';
                                    echo '</span>';
                                }
                            }
                            $field_counter++;
                        }
                        if ($class == "pattern_list") {
                            echo '</tr></table>';
                        } else {
                            echo '</div>';
                        }
                        echo '</div></td>';
                        echo @$help;
                        echo '    </tr>';
                        echo '</table>';
                        break;
                        #
                        #	Select
                        #
                    #
                    #	Select
                    #
                    case 'select':
                        echo '<table>';
                        echo '    <tr>';
                        echo '	<td class="col1" colspan="2"><label for="' . $id . '">' . $title . '</label>';
                        if ($description) {
                            echo '<div class="desc">' . $description . ' ' . ($showDefault ? "Default Value = " . $showDefault : "") . '</div>';
                        }
                        if ($showDefault) {
                            echo '<div class="desc">Default Value = ' . $showDefault . '</div>';
                        }
                        echo '	</td>';
                        echo '    </tr>';
                        //font demo
                        $fontDemo = !empty($customField['font-demo']) ? $customField['font-demo'] : "";
                        //font system
                        $fontSystem = !empty($customField['font-system']) ? $customField['font-system'] : "";
                        //class
                        $class = !empty($customField['class']) ? $customField['class'] : "";
                        //side button
                        if (!empty($customField['sidebuttonName'])) {
                            $side_button = '<input type="button" value="' . $customField['sidebuttonName'] . '" id="' . $customField['id'] . '" class="' . $customField['sidebuttonClass'] . '"/>';
                        } else {
                            $side_button = "";
                        }
                        if (!empty($fontDemo)) {
                            $selectedFont = isset($google_fonts[$field_value][0]) ? $google_fonts[$field_value][0] : "";
                            echo '    <tr>';
                            echo '	<td class="col1" colspan="2">';
                            echo '	<iframe scrolling="no" id="' . $id . '_iframe" class="fontdemo" src="' . THEMEADMINURI . '/pages/rt-fonts.php?font=' . $field_value . '&system=' . $customField['font-system'] . '&font_face=' . $selectedFont . '&family_name=' . $selectedFont . '">Your browser does not support iframes.</iframe>';
                            echo '	</td>';
                            echo '    </tr>';
                        }
                        $extraClass = !empty($customField['sidebuttonName']) ? "withbutton" : '';
                        echo '    <tr>';
                        echo '	<td class="col2"><div class="form_element">';
                        echo '	<select name="' . $id . '" id="' . $id . '" class="' . $class . ' ' . $fontSystem . ' ' . $extraClass . ' ">';
                        if ($customField['select']) {
                            echo '<option value="">' . $customField['select'] . '</option>';
                        }
                        foreach ($customField['options'] as $option_value => $option_name) {
                            //if array
                            if (is_array($option_name)) {
                                $option_name = $option_name[1];
                                $font_family_name = $google_fonts[$option_value][0];
                            } else {
                                $font_family_name = "";
                            }
                            if (strpos($option_value, "-optgroup-start", 0)) {
                                echo '<optgroup label="' . $option_name . '">';
                            } elseif (strpos($option_value, "-optgroup-end", 0)) {
                                echo '</optgroup>';
                            } else {
                                if ($field_value == $option_value) {
                                    echo '<option value="' . $option_value . '"  class="' . @$font_family_name . '__" selected>' . $option_name . '</option>';
                                } else {
                                    echo '<option value="' . $option_value . '"  class="' . @$font_family_name . '__" >' . $option_name . '</option>';
                                }
                            }
                        }
                        echo '	</select>';
                        echo $side_button;
                        echo '</div></td>';
                        echo @$customField['help'];
                        echo '    </tr>';
                        echo '</table>';
                        break;
                    case 'selectmultiple':
                        //Multiple Select
                        echo '<table>';
                        echo '    <tr>';
                        echo '	<td class="col1" colspan="2"><label for="' . $id . '">' . $title . '</label>';
                        if ($description) {
                            echo '<div class="desc">' . $description . '</div>';
                        }
                        echo '	</td>';
                        echo '    </tr>';
                        echo '    <tr>';
                        echo '	<td class="col2"><div class="form_element">';
                        $saved_array = $field_value;
                        echo '<select multiple name="' . $id . '" id="' . $id . '" class="multiple ' . @$customField['class'] . ' ' . @$customField['font-system'] . '"  title="' . __('Select', 'rt_theme_admin') . '">';
                        foreach ($customField['options'] as $option_value => $option_name) {
                            $selected = "";
                            //if value selected
                            if (is_array($saved_array)) {
                                foreach ($saved_array as $a_key => $a_value) {
                                    if ($a_value == $option_value) {
                                        $selected = "selected";
                                    }
                                }
                            }
                            //if array
                            if (is_array($option_name)) {
                                $option_name = $option_name[1];
                            }
                            if (!$option_value) {
                                $option_value = " ";
                            }
                            echo '<option value="' . $option_value . '" ' . $selected . '>' . $option_name . '</option>';
                        }
                        echo '	</select>';
                        echo '</div></td>';
                        echo @$help;
                        echo '    </tr>';
                        echo '</table>';
                        break;
                    case 'textarea':
                        // Textarea
                        echo '<table>';
                        echo '    <tr>';
                        echo '	<td class="col1" colspan="2"><label for="' . $id . '">' . $title . '</label>';
                        if ($description) {
                            echo '<div class="desc">' . $description . '</div>';
                        }
                        echo '	</td>';
                        echo '    </tr>';
                        echo '    <tr>';
                        if ($richEditor && function_exists('wp_editor')) {
                            echo '<td class="col2"><div class="form_element">';
                            wp_editor(htmlspecialchars_decode($field_value), '' . $id . '', array('quicktags' => array('buttons' => 'em,strong,link'), 'textarea_name' => '' . $id . '', 'quicktags' => true, 'tinymce' => true));
                            echo '</div>';
                        } else {
                            echo '<td class="col2"><div class="form_element"><textarea name="' . $id . '" id="' . $id . '" >' . htmlspecialchars($field_value) . '</textarea></div>';
                        }
                        echo '	</td>';
                        echo @$help;
                        echo '    </tr>';
                        echo '</table>';
                        break;
                    case "upload":
                        // rt-upload button
                        echo '<table>';
                        echo '    <tr>';
                        echo '	<td class="col1" colspan="2"><label for="' . $id . '">' . $title . '</label>';
                        if ($description) {
                            echo '<div class="desc">' . $description . '</div>';
                        }
                        echo '	</td>';
                        echo '    </tr>';
                        echo '    <tr>';
                        echo '	<td class="col2"><div class="form_element upload"><input type="text" name="' . $id . '" value="' . $field_value . '" id="' . $id . '" class="upload_field"></div><input type="button" value="Upload" class="rttheme_upload_button ' . $id . ' button"/>';
                        echo @$help;
                        echo '    </tr>';
                        if ($field_value) {
                            echo '<tr><td class="col2" colspan="2">';
                            echo '<div class="form_element check"><img class="loadit" src="' . $field_value . '" id="' . $id . '-show"></div>';
                            echo '<img src="' . THEMEADMINURI . '/images/delete.png" class="delete ' . $id . '" id="delete_' . $id . '">';
                            echo '</td></tr>';
                        } else {
                            echo '<tr style="display:none;"><td class="col2" colspan="2">';
                            echo '<div class="form_element check"><img class="loadit" src="' . THEMEADMINURI . '/images/blank.png"  id="' . $id . '-show"></div>';
                            echo '<img src="' . THEMEADMINURI . '/images/delete.png" class="delete ' . $id . '" id="delete_' . $id . '">';
                            echo '</td></tr>';
                        }
                        echo '</table>';
                        break;
                    case 'heading':
                        echo '<table class="seperator">';
                        echo '    <tr>';
                        echo '	<td class="col1" colspan="2"><h4 class="sub_title">' . $title . '</h4>';
                        echo '	    <div class="desc">' . $description . '</div>';
                        echo '	</td>';
                        echo '    </tr>';
                        echo '</table>';
                        break;
                    case 'hidden':
                        echo '	<input type="hidden" name="' . $id . '" value="' . $field_value . '" id="' . $id . '">';
                        break;
                        #
                        #	Range input
                        #
                    #
                    #	Range input
                    #
                    case 'rangeinput':
                        echo '<table>';
                        echo '    <tr>';
                        echo '	<td class="col1" colspan="2"><label for="' . $id . '">' . $title . '</label>';
                        if ($description) {
                            echo '<div class="desc">' . $description . '</div>';
                        }
                        if ($showDefault) {
                            echo '<div class="desc">Default Value = ' . $showDefault . '</div>';
                        }
                        echo '	</td>';
                        echo '    </tr>';
                        echo '    <tr>';
                        echo '	<td class="col2"><div class="form_element"><input type="text" class="range" name="' . $id . '" id="' . $id . '" min="' . @$customField['min'] . '" max="' . @$customField['max'] . '" step="1" value="' . $field_value . '" /></div></td>';
                        echo @$help;
                        echo '    </tr>';
                        echo '</table>';
                        break;
                        #
                        #	Info Text
                        #
                    #
                    #	Info Text
                    #
                    case 'info_text_only':
                        echo '<table>';
                        echo '    <tr>';
                        echo '	<td class="col1" colspan="2"><div class="info_text">' . $description . '</div>';
                        echo '	</td>';
                        echo '    </tr>';
                        echo '</table>';
                        break;
                        #
                        #	Info Text - with value
                        #
                    #
                    #	Info Text - with value
                    #
                    case 'info_text':
                        echo '<table>';
                        echo '    <tr>';
                        echo '	<td class="col1" colspan="2"><label for="' . $id . '">' . $title . '</label>';
                        if ($description) {
                            echo '<div class="desc">' . $description . '</div>';
                        }
                        echo '	</td>';
                        echo '    </tr>';
                        echo '    <tr>';
                        echo '	<td class="col2"><div class="form_element">' . $description . '</div></td>';
                        echo @$help;
                        echo '    </tr>';
                        echo '</table>';
                        break;
                        #
                        #	Color Picker
                        #
                    #
                    #	Color Picker
                    #
                    case 'colorpicker':
                        echo '<table>';
                        echo '    <tr>';
                        echo '	<td class="col1" colspan="2"><label for="' . $id . '">' . $title . '</label>';
                        if ($description) {
                            echo '<div class="desc">' . $description . '</div>';
                        }
                        echo '	</td>';
                        echo '    </tr>';
                        echo '    <tr>';
                        echo '	<td class="col2"><div class="color-picker-holder"><div class="form_element color"><input type="text" name="' . $id . '" value="' . $field_value . '" id="' . $id . '"></div>';
                        echo '	<div class="' . $id . ' colorSelector"><div style="background-color: ' . $field_value . '"></div></div></div></td>';
                        echo @$help;
                        echo '    </tr>';
                        echo '</table>';
                        $RTadmin = new RTThemeAdmin();
                        $RTadmin->color_picker($id, $field_value);
                        break;
                    default:
                        // Plain text field
                        echo '<table>';
                        echo '    <tr>';
                        echo '	<td class="col1" colspan="2"><label for="' . $id . '">' . $title . '</label>';
                        if ($description) {
                            echo '<div class="desc">' . $description . '</div>';
                        }
                        echo '	</td>';
                        echo '    </tr>';
                        echo '    <tr>';
                        echo '	<td class="col2"><div class="form_element"><input type="text" name="' . $id . '" value="' . $field_value . '" id="' . $id . '"></div></td>';
                        echo @$help;
                        echo '    </tr>';
                        echo '</table>';
                }
                //	HR
                if (isset($customField['hr']) == "true") {
                    echo "<hr />";
                }
                ?>
						

					<?php 
            }
        }
        ?>
			</div>
			<?php 
    }