function get_categories_inherited_properties($cats)
{
    $cat_options = array();
    if ($cats) {
        foreach ($cats as $cat) {
            $new_options = get_category_inherited_properties($cat['term_id']);
            foreach ($new_options as $k => $v) {
                if (!empty($v) && !is_inherit_option($v) && (!isset($cat_options[$k]) || empty($cat_options[$k]) || is_inherit_option($cat_options[$k]))) {
                    $cat_options[$k] = $v;
                }
            }
        }
    }
    return $cat_options;
}
Beispiel #2
0
    function getReviewsMarkup($field, $value, $editable = false, $clear = false, $snippets = false)
    {
        $maxLevel = max(5, (int) get_custom_option('reviews_max_level'));
        $reviews_style = get_custom_option('reviews_style');
        $output = '';
        $criterias = $field['options'];
        $marks = explode(',', $value);
        if (is_array($criterias) && count($criterias) > 0) {
            $i = 0;
            foreach ($criterias as $num => $sb) {
                if (empty($sb)) {
                    continue;
                }
                if ($clear || !isset($marks[$i]) || $marks[$i] == '' || is_inherit_option($marks[$i])) {
                    $marks[$i] = 0;
                }
                $output .= '<div class="revWrap revStyle' . $maxLevel . '">' . getReviewsSummaryStars($marks[$i], $editable, true, $reviews_style) . '<div class="revName">' . $sb . '</div>' . '</div>';
                $i++;
            }
        }
        $output .= isset($field['accept']) && $field['accept'] ? '<div class="revAccept">' . do_shortcode('[trx_button id="rev_author" skin="global" style="bg" size="medium" title="' . __('Accept your votes', 'themerex') . '"]' . __('Accept your votes', 'themerex') . '[/trx_button]') . '</div>' : '';
        $avg = getReviewsRatingAverage($value);
        $output .= '
            <div class="revTotalWrap">
            	<div class="revTotal"><div class="revRating" data-mark="' . $avg . '">' . $avg . (themerex_strlen($avg) == 1 ? '.0' : '') . '</div></div>
                <div class="revDesc">' . (isset($field['descr']) ? $field['descr'] : '') . '</div>
            </div>
		';
        return $output;
    }
Beispiel #3
0
function themerex_save_data_page($post_id)
{
    global $THEMEREX_meta_box_page, $THEMEREX_options;
    // check autosave
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return $post_id;
    }
    // verify nonce
    if (!isset($_POST['meta_box_page_nonce']) || !wp_verify_nonce($_POST['meta_box_page_nonce'], basename(__FILE__))) {
        return $post_id;
    }
    // check permissions
    if ('page' == $_POST['post_type']) {
        if (!current_user_can('edit_page', $post_id)) {
            return $post_id;
        }
    } elseif (!current_user_can('edit_post', $post_id)) {
        return $post_id;
    }
    $custom_options = array();
    $page_options = array_merge($THEMEREX_options, $THEMEREX_meta_box_page['fields']);
    $need_save = false;
    foreach ($page_options as $field) {
        if (!isset($field['override']) || !in_array('page', explode(',', $field['override']))) {
            continue;
        }
        if (!isset($field['std'])) {
            continue;
        }
        $id = $field['id'];
        if (!isset($_POST[$id . '_inherit'])) {
            continue;
        }
        $need_save = true;
        if (is_inherit_option($_POST[$id . '_inherit'])) {
            $new = '';
        } else {
            if (isset($_POST[$id])) {
                if ($field['type'] == 'socials') {
                    if (!empty($field['cloneable'])) {
                        foreach ($_POST[$id] as $k => $v) {
                            $_POST[$id][$k] = array('url' => stripslashes($v), 'icon' => stripslashes($_POST[$id . '_icon'][$k]));
                        }
                    } else {
                        $_POST[$id] = array('url' => stripslashes($_POST[$id]), 'icon' => stripslashes($_POST[$id . '_icon']));
                    }
                } else {
                    if (is_array($_POST[$id])) {
                        foreach ($_POST[$id] as $k => $v) {
                            $_POST[$id][$k] = stripslashes($v);
                        }
                    } else {
                        $_POST[$id] = stripslashes($_POST[$id]);
                    }
                }
                // Add cloneable index
                if (!empty($field['cloneable'])) {
                    $rez = array();
                    foreach ($_POST[$id] as $k => $v) {
                        $rez[$_POST[$id . '_numbers'][$k]] = $v;
                    }
                    $_POST[$id] = $rez;
                }
                $new = $_POST[$id];
            } else {
                $new = $field['type'] == 'checkbox' ? 'false' : '';
            }
        }
        $custom_options[$id] = $new ? $new : 'inherit';
    }
    if ($need_save) {
        update_post_meta($post_id, 'post_custom_options', $custom_options);
    }
}
Beispiel #4
0
function show_meta_box_post()
{
    global $THEMEREX_meta_box_post, $post, $THEMEREX_options;
    // Use nonce for verification
    echo '<input type="hidden" name="meta_box_post_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';
    // Nonce for ajax queries
    $THEMEREX_ajax_nonce = wp_create_nonce('ajax_nonce');
    $THEMEREX_ajax_url = admin_url('admin-ajax.php');
    $maxLevel = max(5, (int) get_theme_option('reviews_max_level'));
    $custom_options = get_post_meta($post->ID, 'post_custom_options', true);
    if (isset($custom_options['reviews_marks'])) {
        $custom_options['reviews_marks'] = marksToDisplay($custom_options['reviews_marks']);
    }
    $post_options = array_merge($THEMEREX_options, $THEMEREX_meta_box_post['fields']);
    themerex_options_load_scripts();
    themerex_options_prepare_js('post');
    ?>
    
    <script type="text/javascript">
		// AJAX fields
		var THEMEREX_ajax_url = "<?php 
    echo $THEMEREX_ajax_url;
    ?>
";
		var THEMEREX_ajax_nonce = "<?php 
    echo $THEMEREX_ajax_nonce;
    ?>
";
		//var reviews_criterias = "";
		var reviews_levels = "<?php 
    echo get_theme_option('reviews_criterias_levels');
    ?>
";
		var reviews_max_level = <?php 
    echo $maxLevel;
    ?>
;
		var allowUserReviews = true;
		jQuery(document).ready(function() {
			// Init post specific meta fields
			//initPostReviews();
		});
	</script>
    
	<div class="reviews_<?php 
    echo $maxLevel;
    ?>
">

    <?php 
    themerex_options_page_start(array('data' => $post_options, 'add_inherit' => true, 'show_page_layout' => false, 'override' => 'post'));
    foreach ($post_options as $option) {
        if (!isset($option['override']) || !in_array('post', explode(',', $option['override']))) {
            continue;
        }
        $id = isset($option['id']) ? $option['id'] : '';
        $meta = isset($custom_options[$id]) ? $custom_options[$id] : '';
        if ($id == 'reviews_marks') {
            $cat_list = getCategoriesByPostId($post->ID);
            if (count($cat_list) > 0) {
                foreach ($cat_list as $cat) {
                    $id = (int) $cat['term_id'];
                    $prop = get_category_inherited_property($id, 'reviews_criterias');
                    if (!empty($prop) && !is_inherit_option($prop)) {
                        $option['options'] = $prop;
                        break;
                    }
                }
            }
        }
        themerex_options_show_field($option, $meta);
    }
    themerex_options_page_stop();
    ?>
	</div>
	<?php 
}
Beispiel #5
0
 function themerex_nav_menu_classes($items, $args)
 {
     if (is_admin()) {
         return $items;
     }
     if ($args->menu_id == 'mainmenu' && get_theme_option('menu_colored') == 'yes') {
         foreach ($items as $k => $item) {
             if ($item->menu_item_parent == 0) {
                 if ($item->type == 'taxonomy' && $item->object == 'category') {
                     $cur_theme = get_category_inherited_property($item->object_id, 'blog_theme');
                     if (!empty($cur_theme) && !is_inherit_option($cur_theme)) {
                         $items[$k]->classes[] = 'theme_' . $cur_theme;
                     }
                 }
             }
         }
     }
     return $items;
 }
Beispiel #6
0
function sc_slider($atts, $content = null)
{
    if (in_shortcode_blogger()) {
        return '';
    }
    extract(shortcode_atts(array("id" => "", "class" => "", "engine" => get_custom_option('substitute_slider_engine'), "chop_effect" => "", "alias" => "", "ids" => "", "cat" => "", "count" => "0", "offset" => "", "orderby" => "date", "order" => 'desc', "border" => "none", "controls" => "no", "pagination" => "no", "titles" => "no", "descriptions" => get_custom_option('slider_descriptions'), "links" => "no", "align" => "", "interval" => "", "date_format" => "", "crop" => "on", "width" => "", "height" => "", "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts));
    global $THEMEREX_sc_slider_engine, $THEMEREX_sc_slider_width, $THEMEREX_sc_slider_height, $THEMEREX_sc_slider_links;
    if (empty($width)) {
        $width = "100%";
    }
    if (empty($interval)) {
        $interval = mt_rand(5000, 10000);
    }
    if ($engine == 'chop' && !file_exists(themerex_get_file_dir('/js/chopslider/jquery.id.chopslider-2.0.0.free.min.js'))) {
        $engine = 'swiper';
    }
    if ($engine == 'chop' && empty($chop_effect)) {
        $effects2D = array("vertical", "horizontal", "half", "multi");
        $effects3D = array("3DBlocks", "3DFlips");
        $chop_effect = $effects2D[min(3, mt_rand(0, 3))] . '|' . $effects3D[min(1, mt_rand(0, 1))];
    }
    $THEMEREX_sc_slider_engine = $engine;
    $THEMEREX_sc_slider_width = getStyleValue($width);
    $THEMEREX_sc_slider_height = getStyleValue($height);
    $THEMEREX_sc_slider_links = sc_param_is_on($links);
    if (empty($id)) {
        $id = "sc_slider_" . str_replace('.', '', mt_rand());
    }
    $ms = getStyleString($top, $right, $bottom, $left);
    $ws = getStyleString('', '', '', '', $width);
    $hs = getStyleString('', '', '', '', '', $height);
    $s = ($border == 'none' && !in_array($pagination, array('full', 'over')) ? $ms : '') . $hs . $ws;
    if ($border != 'none' && in_array($pagination, array('full', 'over'))) {
        $pagination = 'yes';
    }
    if ($engine != 'flex' && $engine != 'chop' && $engine != 'swiper' && in_array($pagination, array('full', 'over'))) {
        $pagination = 'yes';
    }
    $output = ($border != 'none' ? '<div class="sc_border sc_border_' . $border . ($align != '' && $align != 'none' ? ' sc_align' . $align : '') . '"' . ($ms . $hs ? ' style="' . $ms . $hs . '"' : '') . '>' : '') . (in_array($pagination, array('full', 'over')) ? '<div class="sc_slider_pagination_area sc_slider_pagination_' . $pagination . '"' . ($ms . $hs ? ' style="' . $ms . $hs . '"' : '') . '>' : '') . '<div' . ($id ? ' id="' . $id . '"' : '') . ' class="sc_slider' . (!empty($class) ? ' ' . $class : '') . ' sc_slider_' . $engine . (sc_param_is_on($controls) ? ' sc_slider_controls' : ' sc_slider_nocontrols') . (sc_param_is_on($pagination) ? ' sc_slider_pagination' : ' sc_slider_nopagination') . ($border == 'none' && $align != '' && $align != 'none' ? ' sc_align' . $align : '') . ($engine == 'swiper' ? ' swiper-slider-container' : '') . '"' . ((int) $interval > 0 ? ' data-interval="' . $interval . '"' : '') . ($engine == 'chop' ? ' data-effect="' . $chop_effect . '"' : '') . ($s != '' ? ' style="' . $s . '"' : '') . '>';
    $pagination_items = '';
    if ($engine == 'revo') {
        if (revslider_exists() && !empty($alias)) {
            $output .= do_shortcode('[rev_slider ' . $alias . ']');
        } else {
            $output = '';
        }
    } else {
        if ($engine == 'royal') {
            if (royalslider_exists() && !empty($alias)) {
                $output .= do_shortcode('[[new_royalslider id="' . $alias . '"]');
            } else {
                $output = '';
            }
        } else {
            if ($engine == 'flex' || $engine == 'chop' || $engine == 'swiper') {
                $imageAsBackground = $engine != 'chop';
                $caption = '';
                $output .= '<ul class="slides' . ($engine == 'swiper' ? ' swiper-wrapper' : '') . '">';
                $content = do_shortcode($content);
                if ($content) {
                    $output .= $content;
                } else {
                    global $post;
                    if (!empty($ids)) {
                        $posts = explode(',', $ids);
                        $count = count($posts);
                    }
                    $args = array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $count, 'ignore_sticky_posts' => 1, 'order' => $order == 'asc' ? 'asc' : 'desc');
                    if ($offset > 0 && empty($ids)) {
                        $args['offset'] = $offset;
                    }
                    $args = addSortOrderInQuery($args, $orderby, $order);
                    $args = addFiltersInQuery($args, array('thumbs'));
                    $args = addPostsAndCatsInQuery($args, $ids, $cat);
                    $query = new WP_Query($args);
                    $numSlide = 0;
                    while ($query->have_posts()) {
                        $query->the_post();
                        $numSlide++;
                        $post_id = get_the_ID();
                        $post_title = get_the_title();
                        $post_link = get_permalink();
                        $post_date = get_the_date(!empty($date_format) ? $date_format : 'd.m.y');
                        $post_attachment = wp_get_attachment_url(get_post_thumbnail_id($post_id));
                        if (sc_param_is_on($crop)) {
                            $post_attachment = $imageAsBackground ? getResizedImageURL($post_attachment, !empty($width) && themerex_strpos($width, '%') === false ? $width : null, !empty($height) && themerex_strpos($height, '%') === false ? $height : null) : getResizedImageTag($post_attachment, !empty($width) && themerex_strpos($width, '%') === false ? $width : null, !empty($height) && themerex_strpos($height, '%') === false ? $height : null);
                        } else {
                            if (!$imageAsBackground) {
                                $post_attachment = '<img src="' . $post_attachment . '" alt="">';
                            }
                        }
                        $post_accent_color = '';
                        $post_category = '';
                        $post_category_link = '';
                        if (in_array($pagination, array('full', 'over'))) {
                            // Get all post's tags
                            $post_tags_links = '';
                            if (($post_tags_list = get_the_tags()) != 0) {
                                $tag_number = 0;
                                foreach ($post_tags_list as $tag) {
                                    $tag_number++;
                                    $post_tags_links .= '<span class="slide_tag">' . $tag->name . ($tag_number == count($post_tags_list) ? '' : ',') . '</span> ';
                                }
                            }
                            $pagination_items .= '<li' . (empty($pagination_items) ? ' class="' . ($engine == 'chop' ? 'cs-active-pagination' : 'active') . '"' : '') . '>' . '<div class="slide_pager">' . '<div class="slide_date">' . $post_date . '</div>' . '<div class="slide_info">' . '<h4 class="slide_title">' . $post_title . '</h4>' . '<div class="slide_tags">' . $post_tags_links . '</div>' . '</div>' . '</div>' . '</li>';
                        }
                        $output .= '<li' . ' class="' . $engine . '-slide' . ($engine == 'chop' && $numSlide == 1 ? ' cs-activeSlide' : '') . '"' . ' style="' . ($engine == 'chop' && $numSlide == 1 ? 'display:block;' : '') . ($imageAsBackground ? 'background-image:url(' . $post_attachment . ');' : '') . $ws . $hs . '"' . '>' . (sc_param_is_on($links) ? '<a href="' . $post_link . '" title="' . htmlspecialchars($post_title) . '">' : '') . (!$imageAsBackground ? $post_attachment : '');
                        $caption = $engine == 'swiper' || $engine == 'flex' ? '' : $caption;
                        if (!sc_param_is_off($titles)) {
                            $post_hover_bg = get_custom_option('theme_color', null, $post_id);
                            $post_bg = '';
                            if ($post_hover_bg != '' && !is_inherit_option($post_hover_bg)) {
                                $rgb = Hex2RGB($post_hover_bg);
                                $post_hover_ie = str_replace('#', '', $post_hover_bg);
                                $post_bg = "background-color: rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},0.8);";
                            }
                            $caption .= ($engine == 'chop' ? '<div class="sc_slider_info_item">' : '') . '<div class="sc_slider_info' . ($titles == 'fixed' ? ' sc_slider_info_fixed' : '') . ($engine == 'swiper' ? ' content-slide' : '') . '"' . ($post_bg != '' ? ' style="' . $post_bg . '"' : '') . '>';
                            $post_descr = getPostDescription();
                            if (get_custom_option("slider_info_category") == 'yes') {
                                // || empty($cat)) {
                                // Get all post's categories
                                $post_categories = getCategoriesByPostId($post_id);
                                $post_categories_str = '';
                                for ($i = 0; $i < count($post_categories); $i++) {
                                    if ($post_category == '') {
                                        if (get_theme_option('close_category') == 'parental') {
                                            $parent_cat_id = 0;
                                            //(int) get_custom_option('category_id');
                                            $parent_cat = getParentCategory($post_categories[$i]['term_id'], $parent_cat_id);
                                            if ($parent_cat) {
                                                $post_category = $parent_cat['name'];
                                                $post_category_link = $parent_cat['link'];
                                                if ($post_accent_color == '') {
                                                    $post_accent_color = get_category_inherited_property($parent_cat['term_id'], 'theme_color');
                                                }
                                            }
                                        } else {
                                            $post_category = $post_categories[$i]['name'];
                                            $post_category_link = $post_categories[$i]['link'];
                                            if ($post_accent_color == '') {
                                                $post_accent_color = get_category_inherited_property($post_categories[$i]['term_id'], 'theme_color');
                                            }
                                        }
                                    }
                                    if ($post_category != '' && $post_accent_color != '') {
                                        break;
                                    }
                                }
                                if ($post_category == '' && count($post_categories) > 0) {
                                    $post_category = $post_categories[0]['name'];
                                    $post_category_link = $post_categories[0]['link'];
                                    if ($post_accent_color == '') {
                                        $post_accent_color = get_category_inherited_property($post_categories[0]['term_id'], 'theme_color');
                                    }
                                }
                                if ($post_category != '') {
                                    $caption .= '<div class="sc_slider_category"' . (themerex_substr($post_accent_color, 0, 1) == '#' ? ' style="background-color: ' . $post_accent_color . '"' : '') . '><a href="' . $post_category_link . '">' . $post_category . '</a></div>';
                                }
                            }
                            $output_reviews = '';
                            if (get_custom_option('show_reviews') == 'yes' && get_custom_option('slider_reviews') == 'yes') {
                                $avg_author = marksToDisplay(get_post_meta($post_id, 'reviews_avg' . (get_theme_option('reviews_first') == 'author' && $orderby != 'users_rating' || $orderby == 'author_rating' ? '' : '2'), true));
                                if ($avg_author > 0) {
                                    $output_reviews .= '<div class="sc_slider_reviews reviews_summary blog_reviews' . (get_custom_option("slider_info_category") == 'yes' ? ' after_category' : '') . '">' . '<div class="criteria_summary criteria_row">' . getReviewsSummaryStars($avg_author) . '</div>' . '</div>';
                                }
                            }
                            if (get_custom_option("slider_info_category") == 'yes') {
                                $caption .= $output_reviews;
                            }
                            $caption .= '<h2 class="sc_slider_subtitle"><a href="' . $post_link . '">' . $post_title . '</a></h2>';
                            if (get_custom_option("slider_info_category") != 'yes') {
                                $caption .= $output_reviews;
                            }
                            if ($descriptions > 0) {
                                $caption .= '<div class="sc_slider_descr">' . getShortString($post_descr, $descriptions) . '</div>';
                            }
                            $caption .= '</div>' . ($engine == 'chop' ? '</div>' : '');
                        }
                        $output .= ($engine == 'swiper' || $engine == 'flex' ? $caption : '') . (sc_param_is_on($links) ? '</a>' : '') . '</li>';
                    }
                    wp_reset_postdata();
                }
                $output .= '</ul>';
                if ($engine == 'swiper' || $engine == 'chop') {
                    if (sc_param_is_on($controls)) {
                        $output .= '
					<ul class="flex-direction-nav">
					<li><a class="flex-prev" href="#"></a></li>
					<li><a class="flex-next" href="#"></a></li>
					</ul>';
                    }
                    if (sc_param_is_on($pagination)) {
                        $output .= '<div class="flex-control-nav"></div>';
                    }
                }
                if ($engine == 'chop') {
                    $output .= '
				<div class="sc_slider_info_slides">' . $caption . '</div>
				<div class="sc_slider_info_holder"></div>
				';
                }
            } else {
                $output = '';
            }
        }
    }
    if (!empty($output)) {
        $output .= '</div>' . ($border != 'none' ? '</div>' : '');
        if ($pagination_items) {
            $output .= '
				<div class="flex-control-nav manual"' . ($hs ? ' style="' . $hs . '"' : '') . '>
					<div id="' . $id . '_scroll" class="sc_scroll sc_scroll_vertical swiper-slider-container scroll-container"' . ($hs ? ' style="' . $hs . '"' : '') . '>
						<div class="sc_scroll_wrapper swiper-wrapper">
							<div class="sc_scroll_slide swiper-slide">
								<ul>' . $pagination_items . '</ul>
							</div>
						</div>
						<div id="' . $id . '_scroll_bar" class="sc_scroll_bar sc_scroll_bar_vertical"></div>
					</div>
				</div>';
            $output .= '</div>';
        }
    }
    return $output;
}
Beispiel #7
0
function themerex_options_show_field($field, $value = null)
{
    global $THEMEREX_flags, $themerex_options_delimiter, $themerex_options_data;
    // Set start field value
    if ($value !== null) {
        $field['val'] = $value;
    }
    if (!isset($field['val']) || $field['val'] == '') {
        $field['val'] = 'inherit';
    }
    if (!empty($field['subset'])) {
        $sbs = get_theme_option($field['subset'], '', $themerex_options_data);
        $field['val'] = isset($field['val'][$sbs]) ? $field['val'][$sbs] : '';
    }
    if (empty($field['id'])) {
        $field['id'] = 'themerex_options_id_' . str_replace('.', '', mt_rand());
    }
    if (!isset($field['title'])) {
        $field['title'] = '';
    }
    // Divider after field
    $divider = !isset($field['divider']) || $field['divider'] ? ' themerex_options_divider' : '';
    $padding = '';
    if (array_key_exists('padding', $field)) {
        $padding = $field['padding'] == true ? ' themerex_options_padding' : '';
    }
    // Setup default parameters
    if ($field['type'] == 'media') {
        if (!isset($field['before'])) {
            $field['before'] = array('title' => __('Choose image', 'themerex'), 'action' => 'media_upload', 'type' => 'image', 'multiple' => false, 'linked_field' => '', 'captions' => array('choose' => __('Choose image', 'themerex'), 'update' => __('Select image', 'themerex')));
        }
        if (!isset($field['after'])) {
            $field['after'] = array('icon' => 'iconadmin-cancel', 'action' => 'media_reset');
        }
    }
    // Buttons before and after field
    $before = $after = $buttons_classes = '';
    if (!empty($field['before'])) {
        list($before, $class) = themerex_options_action_button($field['before'], 'before');
        $buttons_classes .= $class;
    }
    if (!empty($field['after'])) {
        list($after, $class) = themerex_options_action_button($field['after'], 'after');
        $buttons_classes .= $class;
    }
    if (in_array($field['type'], array('list', 'select', 'fonts')) || $field['type'] == 'socials' && (empty($field['style']) || $field['style'] == 'icons')) {
        $buttons_classes .= ' themerex_options_button_after_small';
    }
    // Is it inherit field?
    $inherit = is_inherit_option($field['val']) ? 'inherit' : '';
    // Is it cloneable field?
    $cloneable = isset($field['cloneable']) && $field['cloneable'];
    // Prepare field
    if (!$cloneable) {
        $field['val'] = array($field['val']);
    } else {
        if (!is_array($field['val'])) {
            $field['val'] = array($field['val']);
        } else {
            if ($field['type'] == 'socials' && (!isset($field['val'][0]) || !is_array($field['val'][0]))) {
                $field['val'] = array($field['val']);
            }
        }
    }
    // Field container
    if (themerex_options_is_group($field['type'])) {
        // Close nested containers
        if (empty($field['start']) && (!in_array($field['type'], array('group', 'toggle')) || !empty($field['end']))) {
            echo themerex_options_close_nested_groups($field['type'], !empty($field['end']));
            if (!empty($field['end'])) {
                return;
            }
        }
    } else {
        // Start field layout
        if ($field['type'] != 'hidden') {
            echo '<div class="themerex_options_field' . ' themerex_options_field_' . (in_array($field['type'], array('list', 'fonts')) ? 'select' : $field['type']) . (in_array($field['type'], array('media', 'fonts', 'list', 'select', 'socials', 'date', 'time')) ? ' themerex_options_field_text' : '') . ($field['type'] == 'socials' && !empty($field['style']) && $field['style'] == 'images' ? ' themerex_options_field_images' : '') . ($field['type'] == 'socials' && (empty($field['style']) || $field['style'] == 'icons') ? ' themerex_options_field_icons' : '') . (isset($field['dir']) && $field['dir'] == 'vertical' ? ' themerex_options_vertical' : '') . (!empty($field['multiple']) ? ' themerex_options_multiple' : '') . (isset($field['size']) ? ' themerex_options_size_' . $field['size'] : '') . (isset($field['class']) ? ' ' . $field['class'] : '') . $divider . $padding . '">' . "\n";
            echo '<label class="themerex_options_field_label' . (!empty($THEMEREX_flags['add_inherit']) && isset($field['std']) ? ' themerex_options_field_label_inherit' : '') . '" for="' . $field['id'] . '">' . $field['title'] . (!empty($THEMEREX_flags['add_inherit']) && isset($field['std']) ? '<span id="' . $field['id'] . '_inherit" class="themerex_options_button_inherit' . ($inherit ? '' : ' themerex_options_inherit_off') . '" title="' . __('Unlock this field', 'themerex') . '"></span>' : '') . '</label>' . "\n";
            echo '<div class="themerex_options_field_content' . $buttons_classes . ($cloneable ? ' themerex_options_cloneable_area' : '') . '">' . "\n";
        }
    }
    // Parse field type
    foreach ($field['val'] as $clone_num => $clone_val) {
        if ($cloneable) {
            echo '<div class="themerex_options_cloneable_item">' . '<span class="themerex_options_input_button themerex_options_clone_button themerex_options_clone_button_del">-</span>';
        }
        switch ($field['type']) {
            case 'group':
                echo '<fieldset id="' . $field['id'] . '" class="themerex_options_container themerex_options_group themerex_options_content' . $divider . $padding . '">';
                if (!empty($field['title'])) {
                    echo '<legend>' . (!empty($field['icon']) ? '<span class="' . $field['icon'] . '"></span>' : '') . $field['title'] . '</legend>' . "\n";
                }
                array_push($THEMEREX_flags['nesting'], 'group');
                break;
            case 'toggle':
                array_push($THEMEREX_flags['nesting'], 'toggle');
                echo '<div id="' . $field['id'] . '" class="themerex_options_container themerex_options_toggle' . $divider . $padding . '">';
                echo '<h3 id="' . $field['id'] . '_title"' . ' class="themerex_options_toggle_header' . (empty($field['closed']) ? ' ui-state-active' : '') . '"' . (!empty($field['action']) ? ' onclick="themerex_options_action_' . $field['action'] . '(this);return false;"' : '') . '>' . (!empty($field['icon']) ? '<span class="themerex_options_toggle_header_icon ' . $field['icon'] . '"></span>' : '') . $field['title'] . '<span class="themerex_options_toggle_header_marker iconadmin-left-open"></span>' . '</h3>' . '<div class="themerex_options_content themerex_options_toggle_content"' . (!empty($field['closed']) ? ' style="display:none;"' : '') . '>';
                break;
            case 'accordion':
                array_push($THEMEREX_flags['nesting'], 'accordion');
                if (!empty($field['start'])) {
                    echo '<div id="' . $field['start'] . '" class="themerex_options_container themerex_options_accordion' . $divider . $padding . '">';
                }
                echo '<div id="' . $field['id'] . '" class="themerex_options_accordion_item">' . '<h3 id="' . $field['id'] . '_title"' . ' class="themerex_options_accordion_header"' . (!empty($field['action']) ? ' onclick="themerex_options_action_' . $field['action'] . '(this);return false;"' : '') . '>' . (!empty($field['icon']) ? '<span class="themerex_options_accordion_header_icon ' . $field['icon'] . '"></span>' : '') . $field['title'] . '<span class="themerex_options_accordion_header_marker iconadmin-left-open"></span>' . '</h3>' . '<div id="' . $field['id'] . '_content" class="themerex_options_content themerex_options_accordion_content">';
                break;
            case 'tab':
                array_push($THEMEREX_flags['nesting'], 'tab');
                if (!empty($field['start'])) {
                    echo '<div id="' . $field['start'] . '" class="themerex_options_container themerex_options_tab' . $divider . $padding . '">' . '<ul>' . themerex_options_collect_tabs($field['type'], $field['start']) . '</ul>';
                }
                echo '<div id="' . $field['id'] . '_content"  class="themerex_options_content themerex_options_tab_content">';
                break;
            case 'partition':
                array_push($THEMEREX_flags['nesting'], 'partition');
                if (!empty($field['start'])) {
                    echo '<div id="' . $field['start'] . '" class="themerex_options_container themerex_options_partition' . $divider . $padding . '">' . '<ul>' . themerex_options_collect_tabs($field['type'], $field['start']) . '</ul>';
                }
                echo '<div id="' . $field['id'] . '_content" class="themerex_options_content themerex_options_partition_content">';
                break;
            case 'hidden':
                echo '<input class="themerex_options_input themerex_options_input_hidden" name="' . $field['id'] . '" id="' . $field['id'] . '" type="hidden" value="' . htmlspecialchars(is_inherit_option($clone_val) ? '' : $clone_val) . '" />';
                break;
            case 'date':
                if (isset($field['style']) && $field['style'] == 'inline') {
                    echo '<div class="themerex_options_input_date" id="' . $field['id'] . '_calendar"' . ' data-format="' . (!empty($field['format']) ? $field['format'] : 'yy-mm-dd') . '"' . ' data-months="' . (!empty($field['months']) ? max(1, min(3, $field['months'])) : 1) . '"' . ' data-linked-field="' . (!empty($data['linked_field']) ? $data['linked_field'] : $field['id']) . '"' . '></div>' . '<input id="' . $field['id'] . '"' . ' name="' . $field['id'] . ($cloneable ? '[]' : '') . '"' . ' type="hidden"' . ' value="' . htmlspecialchars(is_inherit_option($clone_val) ? '' : $clone_val) . '"' . (!empty($field['action']) ? ' onchange="themerex_options_action_' . $field['action'] . '(this);return false;"' : '') . ' />';
                } else {
                    echo '<input class="themerex_options_input themerex_options_input_date' . (!empty($field['mask']) ? ' themerex_options_input_masked' : '') . '"' . ' name="' . $field['id'] . ($cloneable ? '[]' : '') . '"' . ' id="' . $field['id'] . '"' . ' type="text"' . ' value="' . htmlspecialchars(is_inherit_option($clone_val) ? '' : $clone_val) . '"' . ' data-format="' . (!empty($field['format']) ? $field['format'] : 'yy-mm-dd') . '"' . ' data-months="' . (!empty($field['months']) ? max(1, min(3, $field['months'])) : 1) . '"' . (!empty($field['action']) ? ' onchange="themerex_options_action_' . $field['action'] . '(this);return false;"' : '') . ' />' . $before . $after;
                }
                break;
            case 'text':
                echo '<input class="themerex_options_input themerex_options_input_text' . (!empty($field['mask']) ? ' themerex_options_input_masked' : '') . '"' . ' name="' . $field['id'] . ($cloneable ? '[]' : '') . '"' . ' id="' . $field['id'] . '"' . ' type="text"' . ' value="' . htmlspecialchars(is_inherit_option($clone_val) ? '' : $clone_val) . '"' . (!empty($field['mask']) ? ' data-mask="' . $field['mask'] . '"' : '') . (!empty($field['action']) ? ' onchange="themerex_options_action_' . $field['action'] . '(this);return false;"' : '') . ' />' . $before . $after;
                break;
            case 'textarea':
                $cols = isset($field['cols']) && $field['cols'] > 10 ? $field['cols'] : '40';
                $rows = isset($field['rows']) && $field['rows'] > 1 ? $field['rows'] : '8';
                echo '<textarea class="themerex_options_input themerex_options_input_textarea"' . ' name="' . $field['id'] . ($cloneable ? '[]' : '') . '"' . ' id="' . $field['id'] . '"' . ' cols="' . $cols . '"' . ' rows="' . $rows . '"' . (!empty($field['action']) ? ' onchange="themerex_options_action_' . $field['action'] . '(this);return false;"' : '') . '>' . htmlspecialchars(is_inherit_option($clone_val) ? '' : $clone_val) . '</textarea>';
                break;
            case 'editor':
                $cols = isset($field['cols']) && $field['cols'] > 10 ? $field['cols'] : '40';
                $rows = isset($field['rows']) && $field['rows'] > 1 ? $field['rows'] : '10';
                wp_editor(is_inherit_option($clone_val) ? '' : $clone_val, $field['id'] . ($cloneable ? '[]' : ''), array('wpautop' => false, 'textarea_rows' => $rows));
                break;
            case 'spinner':
                echo '<input class="themerex_options_input themerex_options_input_spinner' . (!empty($field['mask']) ? ' themerex_options_input_masked' : '') . '" name="' . $field['id'] . ($cloneable ? '[]' : '') . '"' . ' id="' . $field['id'] . '"' . ' type="text"' . ' value="' . htmlspecialchars(is_inherit_option($clone_val) ? '' : $clone_val) . '"' . (!empty($field['mask']) ? ' data-mask="' . $field['mask'] . '"' : '') . (isset($field['min']) ? ' data-min="' . $field['min'] . '"' : '') . (isset($field['max']) ? ' data-max="' . $field['max'] . '"' : '') . (!empty($field['increment']) ? ' data-increment="' . $field['increment'] . '"' : '') . (!empty($field['action']) ? ' onchange="themerex_options_action_' . $field['action'] . '(this);return false;"' : '') . ' />' . '<span class="themerex_options_arrows"><span class="themerex_options_arrow_up iconadmin-up-dir"></span><span class="themerex_options_arrow_down iconadmin-down-dir"></span></span>';
                break;
            case 'tags':
                if (!is_inherit_option($clone_val)) {
                    $tags = explode($themerex_options_delimiter, $clone_val);
                    if (count($tags) > 0) {
                        foreach ($tags as $tag) {
                            if (empty($tag)) {
                                continue;
                            }
                            echo '<span class="themerex_options_tag iconadmin-cancel">' . $tag . '</span>';
                        }
                    }
                }
                echo '<input class="themerex_options_input_tags"' . ' type="text"' . ' value=""' . ' />' . '<input name="' . $field['id'] . ($cloneable ? '[]' : '') . '"' . ' type="hidden"' . ' value="' . htmlspecialchars(is_inherit_option($clone_val) ? '' : $clone_val) . '"' . (!empty($field['action']) ? ' onchange="themerex_options_action_' . $field['action'] . '(this);return false;"' : '') . ' />';
                break;
            case "checkbox":
                echo '<input type="checkbox" class="themerex_options_input themerex_options_input_checkbox"' . ' name="' . $field['id'] . ($cloneable ? '[]' : '') . '"' . ' id="' . $field['id'] . '"' . ' value="true"' . ($clone_val == 'true' ? ' checked="checked"' : '') . (!empty($field['disabled']) ? ' readonly="readonly"' : '') . (!empty($field['action']) ? ' onchange="themerex_options_action_' . $field['action'] . '(this);return false;"' : '') . ' />' . '<label for="' . $field['id'] . '" class="' . (!empty($field['disabled']) ? 'themerex_options_state_disabled' : '') . ($clone_val == 'true' ? ' themerex_options_state_checked' : '') . '"><span class="themerex_options_input_checkbox_image iconadmin-check"></span>' . (!empty($field['label']) ? $field['label'] : $field['title']) . '</label>';
                break;
            case "radio":
                foreach ($field['options'] as $key => $title) {
                    echo '<span class="themerex_options_radioitem">' . '<input class="themerex_options_input themerex_options_input_radio" type="radio"' . ' name="' . $field['id'] . ($cloneable ? '[]' : '') . '"' . ' value="' . $key . '"' . ($clone_val == $key ? ' checked="checked"' : '') . ' id="' . $field['id'] . '_' . $key . '"' . (!empty($field['action']) ? ' onchange="themerex_options_action_' . $field['action'] . '(this);return false;"' : '') . ' />' . '<label for="' . $field['id'] . '_' . $key . '"' . ($clone_val == $key ? ' class="themerex_options_state_checked"' : '') . '><span class="themerex_options_input_radio_image iconadmin-circle-empty' . ($clone_val == $key ? ' iconadmin-dot-circled' : '') . '"></span>' . $title . '</label></span>';
                }
                break;
            case "switch":
                $opt = array();
                foreach ($field['options'] as $key => $title) {
                    $opt[] = array('key' => $key, 'title' => $title);
                    if (count($opt) == 2) {
                        break;
                    }
                }
                echo '<input name="' . $field['id'] . ($cloneable ? '[]' : '') . '"' . ' type="hidden"' . ' value="' . htmlspecialchars(is_inherit_option($clone_val) || empty($clone_val) ? $opt[0]['key'] : $clone_val) . '"' . (!empty($field['action']) ? ' onchange="themerex_options_action_' . $field['action'] . '(this);return false;"' : '') . ' />' . '<span class="themerex_options_switch' . ($clone_val == $opt[1]['key'] ? ' themerex_options_state_off' : '') . '"><span class="themerex_options_switch_inner iconadmin-circle"><span class="themerex_options_switch_val1" data-value="' . $opt[0]['key'] . '">' . $opt[0]['title'] . '</span><span class="themerex_options_switch_val2" data-value="' . $opt[1]['key'] . '">' . $opt[1]['title'] . '</span></span></span>';
                break;
            case 'media':
                echo '<input class="themerex_options_input themerex_options_input_text themerex_options_input_media"' . ' name="' . $field['id'] . ($cloneable ? '[]' : '') . '"' . ' id="' . $field['id'] . '"' . ' type="text"' . ' value="' . htmlspecialchars(is_inherit_option($clone_val) ? '' : $clone_val) . '"' . (!isset($field['readonly']) || $field['readonly'] ? ' readonly="readonly"' : '') . (!empty($field['action']) ? ' onchange="themerex_options_action_' . $field['action'] . '(this);return false;"' : '') . ' />' . $before . $after;
                if (!empty($clone_val) && !is_inherit_option($clone_val)) {
                    $info = pathinfo($clone_val);
                    echo '<a class="themerex_options_image_preview" target="_blank" href="' . $clone_val . '">' . (themerex_strpos('jpg,png,gif', $info['extension']) !== false ? '<img src="' . $clone_val . '" alt="" />' : '<span>' . $info['basename'] . '</span>') . '</a>';
                }
                break;
            case 'button':
                list($button, $class) = themerex_options_action_button($field, 'button');
                echo $button;
                break;
            case 'range':
                echo '<div class="themerex_options_input_range" data-step="' . (!empty($field['step']) ? $field['step'] : 1) . '">';
                echo '<span class="themerex_options_range_scale"><span class="themerex_options_range_scale_filled"></span></span>';
                if (themerex_strpos($clone_val, $themerex_options_delimiter) === false) {
                    $clone_val = max($field['min'], intval($clone_val));
                }
                if (themerex_strpos($field['std'], $themerex_options_delimiter) !== false && themerex_strpos($clone_val, $themerex_options_delimiter) === false) {
                    $clone_val = $field['min'] . ',' . $clone_val;
                }
                $sliders = explode($themerex_options_delimiter, $clone_val);
                foreach ($sliders as $s) {
                    echo '<span class="themerex_options_range_slider"><span class="themerex_options_range_slider_value">' . intval($s) . '</span><span class="themerex_options_range_slider_button"></span></span>';
                }
                echo '<span class="themerex_options_range_min">' . $field['min'] . '</span><span class="themerex_options_range_max">' . $field['max'] . '</span>';
                echo '<input name="' . $field['id'] . ($cloneable ? '[]' : '') . '"' . ' type="hidden"' . ' value="' . htmlspecialchars(is_inherit_option($clone_val) ? '' : $clone_val) . '"' . (!empty($field['action']) ? ' onchange="themerex_options_action_' . $field['action'] . '(this);return false;"' : '') . ' />';
                echo '</div>';
                break;
            case "checklist":
                foreach ($field['options'] as $key => $title) {
                    echo '<span class="themerex_options_listitem' . (themerex_strpos($themerex_options_delimiter . $clone_val . $themerex_options_delimiter, $themerex_options_delimiter . $key . $themerex_options_delimiter) !== false ? ' themerex_options_state_checked' : '') . '"' . ' data-value="' . $key . '"' . '>' . htmlspecialchars($title) . '</span>';
                }
                echo '<input name="' . $field['id'] . ($cloneable ? '[]' : '') . '"' . ' type="hidden"' . ' value="' . htmlspecialchars(is_inherit_option($clone_val) ? '' : $clone_val) . '"' . (!empty($field['action']) ? ' onchange="themerex_options_action_' . $field['action'] . '(this);return false;"' : '') . ' />';
                break;
            case 'fonts':
                foreach ($field['options'] as $key => $title) {
                    $field['options'][$key] = $key;
                }
            case 'list':
            case 'select':
                if (!isset($field['options']) && !empty($field['from']) && !empty($field['to'])) {
                    $field['options'] = array();
                    for ($i = $field['from']; $i <= $field['to']; $i += !empty($field['step']) ? $field['step'] : 1) {
                        $field['options'][$i] = $i;
                    }
                }
                list($list, $caption) = themerex_options_menu_list($field, $clone_val);
                if (empty($field['style']) || $field['style'] == 'select') {
                    echo '<input class="themerex_options_input themerex_options_input_select" type="text" value="' . $caption . '"' . ' readonly="readonly"' . ' />' . $before . '<span class="themerex_options_field_after themerex_options_with_action iconadmin-down-open" onclick="themerex_options_action_show_menu(this);return false;"></span>';
                }
                echo $list;
                echo '<input name="' . $field['id'] . ($cloneable ? '[]' : '') . '"' . ' type="hidden"' . ' value="' . htmlspecialchars(is_inherit_option($clone_val) ? '' : $clone_val) . '"' . (!empty($field['action']) ? ' onchange="themerex_options_action_' . $field['action'] . '(this);return false;"' : '') . ' />';
                break;
            case 'images':
                list($list, $caption) = themerex_options_menu_list($field, $clone_val);
                if (empty($field['style']) || $field['style'] == 'select') {
                    echo '<div class="themerex_options_caption_image iconadmin-down-open">' . '<span style="background-image: url(' . $caption . ')"></span>' . '</div>';
                }
                echo $list;
                echo '<input name="' . $field['id'] . ($cloneable ? '[]' : '') . '"' . ' type="hidden"' . ' value="' . htmlspecialchars(is_inherit_option($clone_val) ? '' : $clone_val) . '"' . (!empty($field['action']) ? ' onchange="themerex_options_action_' . $field['action'] . '(this);return false;"' : '') . ' />';
                break;
            case 'icons':
                if (isset($field['css']) && $field['css'] != '' && file_exists($field['css'])) {
                    $field['options'] = parseIconsClasses($field['css']);
                }
                list($list, $caption) = themerex_options_menu_list($field, $clone_val);
                if (empty($field['style']) || $field['style'] == 'select') {
                    echo '<div class="themerex_options_caption_icon iconadmin-down-open"><span class="' . $caption . '"></span></div>';
                }
                echo $list;
                echo '<input name="' . $field['id'] . ($cloneable ? '[]' : '') . '"' . ' type="hidden"' . ' value="' . htmlspecialchars(is_inherit_option($clone_val) ? '' : $clone_val) . '"' . (!empty($field['action']) ? ' onchange="themerex_options_action_' . $field['action'] . '(this);return false;"' : '') . ' />';
                break;
            case 'socials':
                if (!is_array($clone_val)) {
                    $clone_val = array('url' => '', 'icon' => '');
                }
                list($list, $caption) = themerex_options_menu_list($field, $clone_val);
                if (empty($field['style']) || $field['style'] == 'icons') {
                    list($after, $class) = themerex_options_action_button(array('action' => empty($field['style']) || $field['style'] == 'icons' ? 'select_icon' : '', 'icon' => (empty($field['style']) || $field['style'] == 'icons') && !empty($clone_val['icon']) ? $clone_val['icon'] : 'iconadmin-users-1'), 'after');
                } else {
                    $after = '';
                }
                echo '<input class="themerex_options_input themerex_options_input_text themerex_options_input_socials' . (!empty($field['mask']) ? ' themerex_options_input_masked' : '') . '"' . ' name="' . $field['id'] . ($cloneable ? '[]' : '') . '"' . ' id="' . $field['id'] . '"' . ' type="text" value="' . htmlspecialchars(is_inherit_option($clone_val['url']) ? '' : $clone_val['url']) . '"' . (!empty($field['mask']) ? ' data-mask="' . $field['mask'] . '"' : '') . (!empty($field['action']) ? ' onchange="themerex_options_action_' . $field['action'] . '(this);return false;"' : '') . ' />' . $after;
                if (!empty($field['style']) && $field['style'] == 'images') {
                    echo '<div class="themerex_options_caption_image iconadmin-down-open">' . '<span style="background-image: url(' . $caption . ')"></span>' . '</div>';
                }
                echo $list;
                echo '<input name="' . $field['id'] . '_icon' . ($cloneable ? '[]' : '') . '" type="hidden" value="' . htmlspecialchars(is_inherit_option($clone_val['icon']) ? '' : $clone_val['icon']) . '" />';
                break;
            case "color":
                echo '<input class="themerex_options_input themerex_options_input_color"' . ' name="' . $field['id'] . ($cloneable ? '[]' : '') . '"' . ' id="' . $field['id'] . '"' . ' type="text"' . ' value="' . (is_inherit_option($clone_val) ? '' : $clone_val) . '"' . (!empty($field['action']) ? ' onchange="themerex_options_action_' . $field['action'] . '(this);return false;"' : '') . ' />';
                break;
            default:
                if (function_exists('show_custom_field')) {
                    echo show_custom_field($field, $clone_val);
                }
        }
        if ($cloneable) {
            echo '<input type="hidden" name="' . $field['id'] . '_numbers[]" value="' . $clone_num . '" />' . '</div>';
        }
    }
    if (!themerex_options_is_group($field['type']) && $field['type'] != 'hidden') {
        if ($cloneable) {
            echo '<div class="themerex_options_input_button themerex_options_clone_button themerex_options_clone_button_add">' . __('+ Add item', 'themerex') . '</div>';
        }
        if (!empty($THEMEREX_flags['add_inherit']) && isset($field['std'])) {
            echo '<div class="themerex_options_content_inherit"' . ($inherit ? '' : ' style="display:none;"') . '><div>' . __('Inherit', 'themerex') . '</div><input type="hidden" name="' . $field['id'] . '_inherit" value="' . $inherit . '" /></div>';
        }
        echo '</div>';
        if (!empty($field['desc'])) {
            echo '<div class="themerex_options_desc">' . $field['desc'] . '</div>' . "\n";
        }
        echo '</div>' . "\n";
    }
}
function prepareThemeCustomStyles()
{
    // Custom font
    $fonts = getThemeFontsList(false);
    $theme_font = get_custom_option('theme_font');
    $header_font = get_custom_option('header_font');
    $theme_color = get_custom_option('theme_color');
    $theme_accent_color = get_custom_option('theme_accent_color');
    $background_color = get_custom_option('body_bg_color');
    $logo_widht = get_custom_option('logo_block_width');
    //theme fonts
    if (isset($fonts[$theme_font])) {
        addThemeCustomStyle('
			body, button, input, select, textarea { font-family: \'' . $theme_font . '\', ' . $fonts[$theme_font]['family'] . '; }');
    }
    // heading fonts
    if (isset($fonts[$header_font])) {
        addThemeCustomStyle((get_theme_option('show_theme_customizer') == 'yes' ? '.custom_options .co_label, .custom_options .co_header span, ' : '') . 'h1, h2, h3, h4, h5, h6,
			.h1,.h2,.h3,.h4,.h5,.h6,
			#header,
			.logoHeader, .subTitle,
			.widget_calendar table caption,
			.sc_button,
			.widget_calendar,
			.widget_search .searchFormWrap .searchSubmit,
			.sc_video_frame .sc_video_frame_info_wrap .sc_video_frame_info .sc_video_frame_player_title,
			.widget_popular_posts .ui-tabs-nav li a,
			.format-quote .sc_quote,
			.sc_tabs ul.sc_tabs_titles li a,
			.sc_testimonials_item_quote,
			.sc_testimonials_item_user,
			.sc_price_item,
			.sc_pricing_table .sc_pricing_item ul li.sc_pricing_title,
			.sc_skills_arc .sc_skills_legend li,
			.sc_skills_counter,
			.sc_countdown_flip .flip-clock-wrapper ul,
			.sc_countdown_round .countdown-amount{ font-family: \'' . $header_font . '\',\'' . $theme_font . '\', ' . $fonts[$header_font]['family'] . '; }');
    }
    //Custom heading H1-H6
    $hCounter = 1;
    while ($hCounter <= 6) {
        $heading_array = array();
        $heading_array[] = 'letter-spacing:' . (get_custom_option('header_font_spacing_h' . $hCounter) != '' ? get_custom_option('header_font_spacing_h' . $hCounter) : 0) . 'px;';
        $heading_array[] = 'font-size:' . get_custom_option('header_font_size_h' . $hCounter) . 'px;';
        $heading_array[] = get_custom_option('header_font_uppercase_h' . $hCounter) == 'yes' ? 'text-transform: uppercase;' : 'text-transform: capitalize;';
        $heading_array[] = 'font-style:' . get_custom_option('header_font_style_h' . $hCounter) . ';';
        $heading_array[] = 'font-weight:' . get_custom_option('header_font_weight_h' . $hCounter) . ';';
        $heading_array[] = 'line-height:' . round(get_custom_option('header_font_size_h' . $hCounter) * 1.2) . 'px;';
        $heading_array[] = 'margin: 0 0 ' . round(get_custom_option('header_font_size_h' . $hCounter) / 2) . 'px 0;';
        $extra_h2 = $hCounter == 2 ? ', .sc_video_frame .sc_video_frame_info_wrap .sc_video_frame_info .sc_video_frame_player_title' : '';
        addThemeCustomStyle('h' . $hCounter . $extra_h2 . '{ ' . (!empty($heading_array) ? join(' ', $heading_array) : '') . ' }');
        $hCounter++;
    }
    //Custom logo style
    if (get_custom_option('logo_type') == 'logoImage') {
        //images style
        addThemeCustomStyle('
			.wrap.logoImageStyle .logoHeader{ width:' . $logo_widht . 'px; }
			.wrap.logoImageStyle .logo_bg_size{ border-width: 45px ' . $logo_widht / 2 . 'px 0 ' . $logo_widht / 2 . 'px; }
			.menu-logo{ width:' . $logo_widht . 'px; }');
    } else {
        //logo text style
        $style_logo_array = array();
        $style_logo_array[] = 'font-family:"' . get_custom_option('logo_font') . '";';
        $style_logo_array[] = 'font-style:' . get_custom_option('logo_font_style') . ';';
        $style_logo_array[] = 'font-weight:' . get_custom_option('logo_font_weight') . ';';
        $style_logo_array[] = 'font-size:' . get_custom_option('logo_font_size') . 'px;';
        $style_logo_array[] = 'line-height:' . get_custom_option('logo_font_size') . 'px;';
        addThemeCustomStyle('
			.wrap.logoTextStyle .logoHeader{ width:' . $logo_widht . 'px; ' . (!empty($style_logo_array) ? join(' ', $style_logo_array) : '') . ' }
			.wrap.logoTextStyle .logo_bg_size{ border-width: 45px ' . $logo_widht / 2 . 'px 0 ' . $logo_widht / 2 . 'px; } 
			.menu-logo{ width:' . $logo_widht . 'px; }
			.wrapTopMenu .topMenu .logo a{' . (!empty($style_logo_array) ? join(' ', $style_logo_array) : '') . '}');
    }
    //background custom style
    if (get_custom_option('body_style') == 'boxed') {
        $style_custom_array = array();
        get_custom_option('bg_color') != '' ? $style_custom_array[] = get_custom_option('bg_color') : '';
        if (get_custom_option('bg_custom_image') != '') {
            $style_custom_array[] = 'url(' . get_custom_option('bg_custom_image') . ')';
            $style_custom_array[] = get_custom_option('bg_custom_image_position_x');
            $style_custom_array[] = get_custom_option('bg_custom_image_position_y');
            $style_custom_array[] = get_custom_option('bg_custom_image_repeat');
            $style_custom_array[] = get_custom_option('bg_custom_image_attachment');
        }
        addThemeCustomStyle('
			.wrap{ background-color: ' . (!empty($style_custom_array) ? join(' ', $style_custom_array) : '') . ';}');
        addThemeCustomStyle('
		 	.bodyStyleBoxed .wrapBox{background-color: ' . get_custom_option('body_bg_color') . ';}');
    }
    if ($theme_color == '') {
        $theme_color = '#5ea281';
    }
    if ($theme_accent_color == '') {
        $theme_accent_color = '#a7d692';
    }
    //theme color
    if ($theme_color != '') {
        addThemeCustomStyle('
		/*color*/
		a, h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover,
		.h1 a:hover,.h2 a:hover,.h3 a:hover,.h4 a:hover,.h5 a:hover,.h6 a:hover,
		.logoHeader a, .subTitle, 
		#header .rightTop a,
		.menuStyle2 .wrapTopMenu .topMenu > ul > li > ul li.sfHover > a,
		.menuStyle2 .wrapTopMenu .topMenu > ul > li > ul li a:hover,
		.menuStyle2 .wrapTopMenu .topMenu > ul > li > ul li.menu-item-has-children:after,
		.widget_twitter ul > li:before,
		.widget_twitter ul > li a,
		.widget_rss ul li a,
		.widget_trex_post .ui-tabs-nav li a,
		.nav_pages ul li a:hover,
		.postFormatIcon:before,
		.comments .commentModeration .icon,
		.sc_button.sc_button_skin_dark.sc_button_style_line:hover,
		.sc_button.sc_button_skin_global.sc_button_style_line,
		.sc_quote, blockquote,
		.sc_toggl.sc_toggl_style_1 .sc_toggl_item .sc_toggl_title:hover,
		.sc_toggl.sc_toggl_style_2 .sc_toggl_item .sc_toggl_title:hover,
		.sc_dropcaps.sc_dropcaps_style_3 .sc_dropcap,
		.sc_highlight.sc_highlight_style_2 ,
		.sc_tabs.sc_tabs_style_2 ul li a,
		.sc_tabs.sc_tabs_style_1 ul li.ui-tabs-active a,
		.sc_testimonials .sc_testimonials_item_author .sc_testimonials_item_user,
		ul.sc_list.sc_list_style_iconed li:before,
		ul.sc_list.sc_list_style_iconed.sc_list_marked_yes li,
		ul.sc_list.sc_list_style_iconed li.sc_list_marked_yes ,
		.sc_button.sc_button_skin_global.sc_button_style_line,
		.sc_quote, blockquote,
		.sc_dropcaps.sc_dropcaps_style_3 .sc_dropcap,
		.sc_team .sc_team_item:hover .sc_team_item_title,
		.sc_team .sc_team_item:hover .sc_team_item_position,
		.sc_countdown.sc_countdown_round .sc_countdown_counter .countdown-section .countdown-amount,
		.sc_countdown .flip-clock-wrapper ul li a div div.inn,
		.isotopeWrap .fullItemWrap .fullItemClosed:hover,
		.postInfo .postReview .revBlock .ratingValue,
		.reviewBlock .reviewTab .revTotalWrap .revTotal .revRating,
		.reviewBlock .reviewTab .revWrap .revBlock .ratingValue,
		.sc_countdown.sc_countdown_round .sc_countdown_counter .countdown-section:after,
		.isotopeWrap .isotopeItem .isotopeContent .isotopeTitle a:hover,
		.sc_toggl.sc_toggl_style_4.sc_toggl_icon_show .sc_toggl_item .sc_toggl_title:before,
		.sc_toggl.sc_toggl_style_4 .sc_toggl_item.sc_active .sc_toggl_title,
		.sc_table.sc_table_style_1 table tbody tr td.first,
		.sc_table.sc_table_style_1 table thead tr th.first,.sc_skills_counter .sc_skills_item.sc_skills_style_1 .sc_skills_count,
                .sc_skills_counter .sc_skills_item.sc_skills_style_2 .sc_skills_count,
		.sc_quote.sc_quote_style2 .icon-quote, blockquote.sc_quote_style2 .icon-quote,
		.author .authorInfo .authorTitle a, 
		.comments .commentInfo .commAuthor a,
		.comments .commentInfo .commReply a,
		.comments .commentInfo .commAuthor,
		.sc_slider_swiper .slides li .sc_slider_info a:hover,
		.sc_testimonials .sc_testimonials_item_author .sc_testimonials_item_user,
		.sc_testimonials.sc_testimonials_style_2 .sc_slider_swiper.sc_slider_controls .slider-control-nav li a:before,
		ul.sc_list.sc_list_style_iconed li:before,
		ul.sc_list.sc_list_style_iconed.sc_list_marked_yes li,
		ul.sc_list.sc_list_style_iconed li.sc_list_marked_yes,
		.sc_chat .sc_quote_title,
		.sc_aside_title,
		.post.type-post.format-link a p,
		.sc_button.sc_button_skin_dark.sc_button_style_line:hover,
		.sc_button.sc_button_skin_global.sc_button_style_line,
		.sc_quote, blockquote,
		.sc_quote .sc_quote_title, blockquote .sc_quote_title,
		.sc_toggl.sc_toggl_style_1 .sc_toggl_item .sc_toggl_title:hover,
		.sc_toggl.sc_toggl_style_1 .sc_toggl_item .sc_toggl_title:hover a,
		.sc_toggl.sc_toggl_style_2 .sc_toggl_item .sc_toggl_title:hover,
		.sc_toggl.sc_toggl_style_4 .sc_toggl_item .sc_toggl_title:hover,
		.sc_toggl.sc_toggl_style_4 .sc_toggl_item .sc_toggl_title:hover a,
		.sc_dropcaps.sc_dropcaps_style_3 .sc_dropcap,
		.sc_countdown.sc_countdown_round .sc_countdown_counter .countdown-section .countdown-amount,
		.sc_highlight.sc_highlight_style_2,
		.sc_highlight.sc_highlight_style_2 a,
		.sc_pricing_table:not(.sc_pricing_table_blue).sc_pricing_table_style_1 .sc_pricing_price,
		.sc_pricing_table:not(.sc_pricing_table_blue).sc_pricing_table_style_2 .sc_pricing_price,
		.sc_pricing_table:not(.sc_pricing_table_blue).sc_pricing_table_style_3  .sc_button.sc_button_skin_global,
		.sc_tabs.sc_tabs_style_2 ul li a,
		.logoHeader a,
		.subTitle,
		.wrapTopMenu .topMenu > ul > li > a:hover,
		.hideMenuDisplay .usermenuArea > ul > li > a,
		.menuStyle1 #header ul > li > ul li.sfHover > a,
		.menuStyle1 #header ul > li > ul li a:hover,
		.menuStyle2 #header ul > li > ul li.sfHover > a,
		.menuStyle2 #header ul > li > ul li a:hover,
		.widgetWrap ul > li,
		.widget_twitter ul > li:before,
		.widget_twitter ul > li a,
		.widget_rss ul li a,
		.widget_trex_post .ui-tabs-nav li a,
		.revItem .revBlock .ratingValue,
		.reviewBlock .reviewTab .revWrap .revBlock .ratingValue,
		.reviewBlock .reviewTab .revTotalWrap .revTotal .revRating,
		.nav_pages ul li a:hover,
		.hoverUnderline a:hover,
		.postFormatIcon:before,
		.page404 .title404,
		.comments .commentModeration .icon,
		.isotopeWrap .isotopeItem .isotopeContent .isotopeTitle a:hover,
		.isotopeWrap .fullItemWrap .fullItemClosed:hover,
		.isotopeWrap .fullItemWrap .isotopeNav:hover,
		.sc_pricing_table.sc_pricing_table_style_1 .sc_pricing_item ul li.sc_pricing_title,
		.sc_pricing_table.sc_pricing_table_style_1 .sc_pricing_item ul li.sc_pricing_price,
		.sc_pricing_table.sc_pricing_table_style_3 .sc_pricing_item ul li.sc_pricing_price,
		li.sc_list_item.sc_list_marked_yes,
		.isotopeWrap .isotopeItem .isotopeContent .isotopeCats a:hover,
		.sc_contact_info .sc_contact_info_name,
		.woocommerce .star-rating:before, .woocommerce .star-rating:before,
		.woocommerce .star-rating span, .woocommerce .star-rating span,
		.woocommerce #reviews #comments ol.commentlist li .comment-text p.meta strong ,
		table.shop_table.cart th, .wrapTopMenu .topMenu div > ul > li > a:hover,
		.sideBarWide .sc_button.sc_button_skin_dark.sc_button_style_bg:hover,
		.sideBarWide .postSharing .postSpan .revInfo:hover, .sc_required, q,
		.widget_trex_post .post_item .post_wrapper .post_title a:hover ,
		.widgetWrap ul > li a:hover,
		.sideBar a:hover{ color: ' . $theme_color . '; }
		
		.woocommerce div.product .woocommerce-tabs ul.tabs li.active a{color: ' . $theme_color . ' !important; }

		input[type="search"]::-webkit-search-cancel-button {color: ' . $theme_color . ';}
		
		/*border*/
		.isotopeWrap .isotopeItem .isotopeRating{ border-color: ' . $theme_color . ' transparent;}
		.woocommerce ul.products li.product a:hover img {border-bottom: 2px solid ' . $theme_color . ' !important;}

		.nav_pages ul li a:hover,
		.wrapTopMenu .topMenu > ul > li > ul,
		.menuStyle1 .wrapTopMenu .topMenu > ul > li > ul > li ul,
		.menuStyle2 .wrapTopMenu .topMenu > ul > li > ul > li ul,
		.widget_trex_post .ui-tabs-nav li a,
		.sc_button.sc_button_skin_dark.sc_button_style_line:hover,
		.sc_button.sc_button_skin_global.sc_button_style_line,
		.sc_tooltip,
		.sc_tooltip .sc_tooltip_item,
		.sc_tabs.sc_tabs_style_2 ul li a,
		.sc_tabs.sc_tabs_style_2 ul li + li a,
		.sc_tabs.sc_tabs_style_2 .sc_tabs_array,
		.sc_banner:before,
		.sc_button.sc_button_skin_global.sc_button_style_line,
		.sc_banner:before,
		.sc_button.sc_button_skin_dark.sc_button_style_line:hover,
		.sc_button.sc_button_skin_global.sc_button_style_line,
		.sc_tabs.sc_tabs_style_2 ul li a,
		.sc_tabs.sc_tabs_style_2 ul li + li a,
		.sc_tabs.sc_tabs_style_2 .sc_tabs_array,,
		.wrapTopMenu .topMenu > ul > li > ul,
		.usermenuArea > ul > li > ul,
		.menuStyle2 #header ul > li > ul > li ul,
		.widget_calendar table tbody td#today span,
		.widget_trex_post .ui-tabs-nav li a,
		.nav_pages ul li a:hover, .sc_tabs.sc_tabs_style_2 ul.sc_tabs_titles li.ui-tabs-active a{ border-color: ' . $theme_color . '; }

		.sc_tooltip .sc_tooltip_item:before,
		.logoStyleBG .logoHeader .logo_bg_size,
		.isotopeWrap .isotopeItem .isotopeRating:after,
		.sc_slider_swiper .sc_slider_info .sc_slider_reviews_short:after,
		.sc_tooltip .sc_tooltip_item:before,
		.logoStyleBG .logoHeader .logo_bg_size { border-color: ' . $theme_color . ' transparent transparent transparent; }

		.widget_recent_reviews .post_item .post_wrapper .post_info .post_review:after{ border-color: transparent transparent transparent ' . $theme_color . '; }
		.buttonScrollUp { border-color: transparent transparent ' . $theme_color . ' transparent; }
		.sc_testimonials.sc_testimonials_style_1 .sc_testimonials_item_author_show .sc_testimonials_item_quote:after { border-left-color: ' . $theme_color . '; }

		.widget_calendar table tbody td#today { outline: 1px solid ' . $theme_color . '; }
		.sc_testimonials.sc_testimonials_style_1 .sc_testimonials_item_author_show .sc_testimonials_item_quote:after{  border-left-color: ' . $theme_color . '; }
		.sc_pricing_table.sc_pricing_table_style_1 .sc_pricing_item ul li.sc_pricing_title,
		.sc_tooltip{border-bottom-color: ' . $theme_color . ';}
		.postInfo .stickyPost:after{ border-color: transparent transparent transparent ' . $theme_color . '; }


		/*background*/
		#header .openTopMenu,
		.menuStyle1 .wrapTopMenu .topMenu > ul > li > ul > li ul,
		.menuStyle2 .wrapTopMenu .topMenu > ul > li > ul li a:before,
		.widget_calendar table tbody td a:before,
		.widget_calendar table tbody td a:hover, 
		.widget_tag_cloud a:hover,
		.widget_trex_post .ui-tabs-nav li.ui-state-active a,
		.nav_pages ul li span,
		.sc_button.sc_button_skin_global.sc_button_style_bg,
		.sc_video_frame.sc_video_active:before,
		.sc_toggl.sc_toggl_style_2.sc_toggl_icon_show .sc_toggl_item .sc_toggl_title:after,
		.sc_toggl.sc_toggl_style_3 .sc_toggl_item .sc_toggl_title ,
		.sc_dropcaps.sc_dropcaps_style_1 .sc_dropcap,
		.sc_tooltip .sc_tooltip_item,
		.sc_table.sc_table_style_2 table thead tr th,
		.sc_pricing_table.sc_pricing_table_style_2 .sc_pricing_item ul li.sc_pricing_title,
		.sc_pricing_table.sc_pricing_table_style_3 .sc_pricing_item ul li.sc_pricing_title,
		.sc_scroll .sc_scroll_bar .swiper-scrollbar-drag,
		.sc_skills_bar .sc_skills_item .sc_skills_count ,
		.sc_skills_bar.sc_skills_vertical .sc_skills_item .sc_skills_count ,
		.sc_icon.sc_icon_box,
		.sc_icon.sc_icon_box_circle,
		.sc_icon.sc_icon_box_square,
		.sc_slider.sc_slider_dark .slider-pagination-nav span.swiper-active-switch ,
		.sc_slider.sc_slider_light .slider-pagination-nav span.swiper-active-switch,
		.sc_testimonials.sc_testimonials_style_1 .sc_testimonials_item_quote,
		.sc_testimonials.sc_testimonials_style_2 .sc_testimonials_title:after,
		.sc_testimonials.sc_testimonials_style_2 .sc_slider_swiper.sc_slider_pagination .slider-pagination-nav span.swiper-active-switch,
		.sc_button.sc_button_skin_global.sc_button_style_bg,
		.sc_video_frame.sc_video_active:before,
		.sc_loader_show:before,
		.sc_toggl.sc_toggl_style_2.sc_toggl_icon_show .sc_toggl_item .sc_toggl_title:after ,
		.sc_toggl.sc_toggl_style_3 .sc_toggl_item .sc_toggl_title ,
		.sc_dropcaps.sc_dropcaps_style_1 .sc_dropcap,
		.postInfo .postReview .revBlock.revStyle100 .ratingValue,
		.reviewBlock .reviewTab .revWrap .revBlock.revStyle100 .ratingValue,
		.post-password-required .post-password-form input[type="submit"]:hover,
		.sc_button.sc_button_skin_dark.sc_button_style_bg:hover, 
		.sc_button.sc_button_skin_global.sc_button_style_bg,
		.sc_skills_counter .sc_skills_item.sc_skills_style_3 .sc_skills_count,
		.sc_skills_counter .sc_skills_item.sc_skills_style_4 .sc_skills_count,
		.isotopeFiltr ul li.active a,
		.sc_slider.sc_slider_dark .slider-pagination-nav span.swiper-active-switch,
		.sc_slider.sc_slider_light .slider-pagination-nav span.swiper-active-switch,
		.sc_slider_swiper .sc_slider_info .sc_slider_reviews_short span.rInfo,
		.sc_testimonials.sc_testimonials_style_1 .sc_testimonials_item_quote,
		.sc_testimonials.sc_testimonials_style_2 .sc_testimonials_title:after,
		.sc_testimonials.sc_testimonials_style_2 .sc_slider_swiper.sc_slider_pagination .slider-pagination-nav span.swiper-active-switch,
		.sc_video_frame.sc_video_active:before,
		.sc_button.sc_button_skin_global.sc_button_style_bg,
		.sc_button.sc_button_style_regular:hover,
		.sc_toggl.sc_toggl_style_2.sc_toggl_icon_show .sc_toggl_item .sc_toggl_title:after,
		.sc_toggl.sc_toggl_style_3 .sc_toggl_item .sc_toggl_title,
		.sc_dropcaps.sc_dropcaps_style_1 .sc_dropcap,
		.sc_tooltip .sc_tooltip_item,
		.sc_table.sc_table_style_2 table thead tr th,
		.sc_pricing_table.sc_pricing_table_style_2 .sc_pricing_item ul li.sc_pricing_title,
		.sc_pricing_table.sc_pricing_table_style_3 .sc_pricing_item ul,
		.sc_pricing_table.sc_pricing_table_style_3 .sc_pricing_item ul li.sc_pricing_title,
		.sc_pricing_table.sc_pricing_table_style_2 .sc_pricing_item ul,
		.sc_scroll .sc_scroll_bar .swiper-scrollbar-drag,
		.sc_skills_bar .sc_skills_item .sc_skills_count,
		.sc_skills_bar.sc_skills_vertical .sc_skills_item .sc_skills_count,
		.sc_icon.sc_icon_box,
		.sc_icon.sc_icon_box_square,
		.sc_icon.sc_icon_box_circle,
		.sc_tabs.sc_tabs_style_2 ul.sc_tabs_titles li.ui-tabs-active a,
		#header .openTopMenu,
		.openMobileMenu,
		.hideMenuDisplay .usermenuArea > ul > li > a:before,
		.menuStyle2 #header ul > li > ul li a:before,
		.widget_calendar table tbody td a:before,
		.widget_calendar table tbody td a:hover,
		.widget_tag_cloud a:hover,
		.widget_recent_reviews .post_item .post_wrapper .post_info .post_review,
		.widget_trex_post .ui-tabs-nav li.ui-state-active a,
		.postInfo .stickyPost .postSticky,
		.revItem .revBlock.revStyle100 .ratingValue,
		.reviewBlock .reviewTab .revWrap .revBlock.revStyle100 .ratingValue,
		.nav_pages ul li span,
		.subCategory,
		.sc_highlight.sc_highlight_style_1,
		.sc_tooltip .sc_tooltip_item,
		.widget_search .searchFormWrap .searchSubmit input,
		#header .usermenuArea ul.usermenuList .usermenuCart .widget_area p.buttons a:hover{ background-color: ' . $theme_color . '; }

		.woocommerce ul.products li.product a.button:hover,
		.woocommerce div.product form.cart .button:hover,
		.woocommerce input.button:hover{ background-color: ' . $theme_color . ' !important;} 

		.sc_button.sc_button_style_regular:hover, .woocommerce #review_form #respond .form-submit input:hover{ background-color: ' . $theme_color . ' !important; }

		::selection { color: #fff; background-color:' . $theme_color . ';}
		::-moz-selection { color: #fff; background-color:' . $theme_color . ';}');
    }
    //theme accent color
    if ($theme_accent_color != '') {
        addThemeCustomStyle('
		.sc_pricing_table.sc_pricing_table_style_1 .sc_pricing_item ul,
		.sc_pricing_table.sc_pricing_table_style_1 .sc_pricing_item ul li.sc_pricing_title,
		.sc_pricing_table.sc_pricing_table_style_2  .sc_button.sc_button_skin_global.sc_button_style_bg ,
		.sc_pricing_table.sc_pricing_table_style_3 .sc_pricing_item ul,
		.sc_skills_bar .sc_skills_item ,
		.sc_skills_counter .sc_skills_item.sc_skills_style_4 .sc_skills_info,
		.sc_tabs.sc_tabs_style_3 ul.sc_tabs_titles li,
		.sc_testimonials.sc_testimonials_style_2 .sc_slider_swiper.sc_slider_pagination .slider-pagination-nav span,
		footer.footer_style_green .widget_tag_cloud a,
		.widget_tag_cloud a,
		.isotopeFiltr ul li a ,
		.themeDark .isotopeFiltr ul li.active a,
		.isotopeFiltr ul li a:hover{ background-color: ' . $theme_accent_color . ';}

		.woocommerce ul.products li.product a.button,
		.woocommerce div.product form.cart .button,
		.woocommerce #content .quantity .plus:hover, 
		.woocommerce #content .quantity .minus:hover,
		.woocommerce input.button  { background-color: ' . $theme_accent_color . ' !important; background: ' . $theme_accent_color . ' !important;}

		.sc_pricing_table.sc_pricing_table_style_2 .sc_pricing_item ul li.sc_pricing_title,
		.sc_pricing_table.sc_pricing_table_style_3 .sc_pricing_item ul li.sc_pricing_title{border-bottom-color: ' . $theme_accent_color . ';}

		.sc_team .sc_team_item .sc_team_item_border,
		.woocommerce .quantity input.qty, 
		.woocommerce #content .quantity input.qty, 
		.woocommerce .quantity input.qty, 
		.woocommerce #content .quantity input.qty,
		.woocommerce #content .quantity .plus, 
		.woocommerce #content .quantity .minus,
		.woocommerce .quantity .plus, 
		.woocommerce .quantity .minus{border-color: ' . $theme_accent_color . ';}

		.sc_team .sc_team_item .sc_team_item_socials ul li a:hover span,
		footer.footer_style_green .widgetWrap ul > li a,
		.sc_icons_widget .sc_icons_item{ color: ' . $theme_accent_color . '; }

		.woocommerce #content div.product div.images a {border: 2px solid ' . $theme_accent_color . ' !important;}
		');
    }
    if ($background_color != '') {
        addThemeCustomStyle('
			
			body{ background-color: ' . $background_color . '; }
			.rsUni, .rsUni .rsOverflow, .rsUni .rsSlide, .rsUni .rsVideoFrameHolder, .rsUni .rsThumbs{ background-color: ' . $background_color . ' !important; }
			.woocommerce #content div.product .woocommerce-tabs ul.tabs li.active{border-bottom: 1px solid ' . $background_color . '; }
		');
    }
    // Custom menu
    if (get_theme_option('menu_colored') == 'yes') {
        $menu_name = 'mainmenu';
        if (($locations = get_nav_menu_locations()) && isset($locations[$menu_name])) {
            $menu = wp_get_nav_menu_object($locations[$menu_name]);
            if (is_object($menu) && $menu) {
                $menu_items = wp_get_nav_menu_items($menu->term_id);
                $menu_styles = '';
                $menu_slider = get_theme_option('menu_slider') == 'yes';
                if (count($menu_items) > 0) {
                    foreach ($menu_items as $k => $item) {
                        //				if ($item->menu_item_parent==0) {
                        $cur_accent_color = '';
                        if ($item->type == 'taxonomy' && $item->object == 'category') {
                            $cur_accent_color = get_category_inherited_property($item->object_id, 'theme_accent_color');
                        }
                        if ((empty($cur_accent_color) || is_inherit_option($cur_accent_color)) && isset($item->classes[0]) && !empty($item->classes[0])) {
                            $cur_accent_color = (themerex_substr($item->classes[0], 0, 1) != '#' ? '#' : '') . $item->classes[0];
                        }
                        if (!empty($cur_accent_color) && !is_inherit_option($cur_accent_color)) {
                            $menu_styles .= ($item->menu_item_parent == 0 ? "#header_middle_inner #mainmenu li.menu-item-{$item->ID}.current-menu-item > a," : '') . "\r\n\t\t\t\t\t\t\t\t\t#header_middle_inner #mainmenu li.menu-item-{$item->ID} > a:hover,\r\n\t\t\t\t\t\t\t\t\t#header_middle_inner #mainmenu li.menu-item-{$item->ID}.sfHover > a { background-color: {$cur_accent_color} !important; }\r\n\t\t\t\t\t\t\t\t\t#header_middle_inner #mainmenu li.menu-item-{$item->ID} ul { background-color: {$cur_accent_color} !important; } ";
                        }
                        if ($menu_slider && $item->menu_item_parent == 0) {
                            $menu_styles .= "\r\n\t\t\t\t\t\t\t\t\t#header_middle_inner #mainmenu li.menu-item-{$item->ID}.blob_over:not(.current-menu-item) > a:hover,\r\n\t\t\t\t\t\t\t\t\t#header_middle_inner #mainmenu li.menu-item-{$item->ID}.blob_over.sfHover > a { background-color: transparent !important; } ";
                        }
                        //				}
                    }
                }
                if (!empty($menu_styles)) {
                    addThemeCustomStyle($menu_styles);
                }
            }
        }
    }
    //main menu responsive width
    //
    $menu_responsive = get_theme_option('responsive_menu_width') . 'px';
    addThemeCustomStyle("\r\n\t\t@media (min-width: {$menu_responsive}) { \r\n\t\t\t.logo_center .logoHeader, .logo_center #mainmenu{display: none;}\r\n\t\t}\r\n\r\n\t\t@media (max-width: {$menu_responsive}) { \r\n\t\t\t.openMobileMenu{ display: block; }\r\n\t\t\t.menuStyleFixed #header.fixedTopMenuShow .menuFixedWrap{ position: static !important; }\r\n\t\t\t.wrapTopMenu .topMenu { width: 100%;  }\r\n\t\t\t.wrapTopMenu .topMenu > ul{ display: none;  clear:both; }\r\n\t\t\t.wrapTopMenu .topMenu > ul li{ display: block; clear:both;  border-top: 1px solid #ddd; padding: 10px 0; text-align: center !important;}\r\n\t\t\t.wrapTopMenu .topMenu > ul li a{ }\r\n\t\t\t.wrapTopMenu .topMenu > ul li ul{ position: static !important; width:auto !important; margin:0 !important; border: none !important; text-align:center; background-color: transparent !important; }\r\n\t\t\t.wrapTopMenu .topMenu > ul > li > ul:before{ display:none;}\r\n\t\t\t.openTopMenu{ display: none; }\r\n\t\t\t.wrapTopMenu .topMenu > ul > li.sfHover > a:before,\r\n\t\t\t.wrapTopMenu .topMenu > ul > li > a{ line-height: 30px !important;  opacity:1 !important; height: auto !important; }\r\n\t\t\t.wrapTopMenu .topMenu > ul > li > a:hover:before{ left:10px; right:10px; }\r\n\t\t\t.hideMenuDisplay .wrapTopMenu{ min-height: 45px !important; height: auto !important;}\r\n\t\t\t.hideMenuDisplay .usermenuArea > ul li a{ color: #fff !important; }\r\n\t\t\t.wrapTopMenu .topMenu > ul > li > ul:after{content: none;}\r\n\t\t\t.wrapTopMenu .topMenu > ul > li > ul li:last-child {padding-bottom: 0 !important; }\r\n\t\t\t.wrapTopMenu .topMenu > ul > li > ul li.menu-item-has-children {padding: 10px 0; }\r\n\t\t\t.menuStyle1 #header ul > li > ul > li ul:before, .menuStyle1 #header ul > li > ul > li ul:after, .menuStyle1 #header ul > li > ul li.menu-item-has-children:after{display: none;}\r\n\t\t\t.logo_center .topMenu .newMenu, .logo_center .topMenu .logo {display: none !important;}\r\n\t\t\t.wrap.logoImageStyle .logoHeader {padding-top: 20px;}\r\n\t\t}\r\n\t");
    // Main menu height
    $menu_height = (int) get_theme_option('menu_height');
    if ($menu_height > 20) {
        addThemeCustomStyle("\r\n\t\t\t#mainmenu > li > a { height: {$menu_height}px !important; line-height: {$menu_height}px !important; }\r\n\t\t\t#mainmenu > li ul { top: {$menu_height}px !important; }\r\n\t\t\t#header_middle { min-height: {$menu_height}px !important; } ");
    }
    // Submenu width
    $menu_width = (int) get_custom_option('menu_width');
    if ($menu_width > 50) {
        addThemeCustomStyle('
			.wrapTopMenu .topMenu > ul > li > ul { width: ' . $menu_width . 'px; margin: 0 0 0 -' . ($menu_width + 30) / 2 . 'px; }
			#mainmenu > li:nth-child(n+6) ul li ul { left: -' . $menu_width . 'px; } ');
    }
    // Custom css from theme options
    $css = get_theme_option('custom_css');
    if (!empty($css)) {
        addThemeCustomStyle($css);
    }
    return getThemeCustomStyles();
}
function themerex_options_merge_new_values(&$post_options, &$custom_options, &$post_data, $mode, $override)
{
    $need_save = false;
    foreach ($post_options as $field) {
        if ($override != 'general' && (!isset($field['override']) || !in_array($override, explode(',', $field['override'])))) {
            continue;
        }
        if (!isset($field['std'])) {
            continue;
        }
        $id = $field['id'];
        if ($override != 'general' && !isset($post_data[$id . '_inherit'])) {
            continue;
        }
        if ($id == 'reviews_marks' && $mode == 'export') {
            continue;
        }
        $need_save = true;
        if ($mode == 'save' || $mode == 'export') {
            if ($override != 'general' && is_inherit_option($post_data[$id . '_inherit'])) {
                $new = '';
            } else {
                if (isset($post_data[$id])) {
                    // Prepare specific (combined) fields
                    if (!empty($field['subset'])) {
                        $sbs = $post_data[$field['subset']];
                        $field['val'][$sbs] = $post_data[$id];
                        $post_data[$id] = $field['val'];
                    }
                    if ($field['type'] == 'socials') {
                        if (!empty($field['cloneable'])) {
                            foreach ($post_data[$id] as $k => $v) {
                                $post_data[$id][$k] = array('url' => stripslashes($v), 'icon' => stripslashes($post_data[$id . '_icon'][$k]));
                            }
                        } else {
                            $post_data[$id] = array('url' => stripslashes($post_data[$id]), 'icon' => stripslashes($post_data[$id . '_icon']));
                        }
                    } else {
                        if (is_array($post_data[$id])) {
                            foreach ($post_data[$id] as $k => $v) {
                                $post_data[$id][$k] = stripslashes($v);
                            }
                        } else {
                            $post_data[$id] = stripslashes($post_data[$id]);
                        }
                    }
                    // Add cloneable index
                    if (!empty($field['cloneable'])) {
                        $rez = array();
                        foreach ($post_data[$id] as $k => $v) {
                            $rez[$post_data[$id . '_numbers'][$k]] = $v;
                        }
                        $post_data[$id] = $rez;
                    }
                    $new = $post_data[$id];
                    // Post type specific data handling
                    if ($id == 'reviews_marks') {
                        $new = join(',', $new);
                        if (($avg = getReviewsRatingAverage($new)) > 0) {
                            $new = marksToSave($new);
                        }
                    }
                } else {
                    $new = $field['type'] == 'checkbox' ? 'false' : '';
                }
            }
        } else {
            $new = $field['std'];
        }
        $custom_options[$id] = $new || $override == 'general' ? $new : 'inherit';
    }
    return $need_save;
}
function get_custom_option($name, $defa = null, $post_id = 0, $cat_id = 0)
{
    if (isset($_GET[$name])) {
        $rez = $_GET[$name];
    } else {
        if ($cat_id > 0) {
            $rez = get_category_inherited_property($cat_id, $name);
            if ($rez == '') {
                $rez = get_theme_option($name, $defa);
            }
        } else {
            if ($post_id > 0) {
                $rez = get_theme_option($name, $defa);
                $custom_options = get_post_meta($post_id, 'post_custom_options', true);
                if (isset($custom_options[$name]) && !is_inherit_option($custom_options[$name])) {
                    $rez = $custom_options[$name];
                } else {
                    if (is_category()) {
                        $categories = array();
                        $categories[] = get_queried_object();
                    } else {
                        $categories = getCategoriesByPostId($post_id);
                    }
                    $tmp = '';
                    for ($cc = 0; $cc < count($categories) && (empty($tmp) || is_inherit_option($tmp)); $cc++) {
                        $tmp = get_category_inherited_property(is_object($categories[$cc]) ? $categories[$cc]->term_id : $categories[$cc]['term_id'], $name);
                    }
                    if ($tmp != '') {
                        $rez = $tmp;
                    }
                }
            } else {
                global $THEMEREX_post_options, $THEMEREX_cat_options, $THEMEREX_custom_options, $THEMEREX_shop_options;
                if (isset($THEMEREX_custom_options[$name])) {
                    $rez = $THEMEREX_custom_options[$name];
                } else {
                    $rez = get_theme_option($name, $defa);
                    if (is_woocommerce_page() && isset($THEMEREX_shop_options[$name]) && !is_inherit_option($THEMEREX_shop_options[$name])) {
                        $rez = is_array($THEMEREX_shop_options[$name]) ? $THEMEREX_shop_options[$name][0] : $THEMEREX_shop_options[$name];
                    }
                    if (!is_single() && isset($THEMEREX_post_options[$name]) && !is_inherit_option($THEMEREX_post_options[$name])) {
                        $rez = is_array($THEMEREX_post_options[$name]) ? $THEMEREX_post_options[$name][0] : $THEMEREX_post_options[$name];
                    }
                    if (isset($THEMEREX_cat_options[$name]) && !is_inherit_option($THEMEREX_cat_options[$name])) {
                        $rez = $THEMEREX_cat_options[$name];
                    }
                    if (is_single() && isset($THEMEREX_post_options[$name]) && !is_inherit_option($THEMEREX_post_options[$name])) {
                        $rez = is_array($THEMEREX_post_options[$name]) ? $THEMEREX_post_options[$name][0] : $THEMEREX_post_options[$name];
                    }
                    if (get_theme_option('show_theme_customizer') == 'yes') {
                        $tmp = getValueGPC($name, $rez);
                        if (!is_inherit_option($tmp)) {
                            $rez = $tmp;
                        }
                    }
                    $THEMEREX_custom_options[$name] = $rez;
                }
            }
        }
    }
    return $rez;
}
Beispiel #11
0
function sc_slider($atts, $content = null)
{
    if (in_shortcode_blogger()) {
        return '';
    }
    extract(shortcode_atts(array("id" => "", "engine" => "flex", "alias" => "", "ids" => "", "theme" => "dark", "cat" => "", "count" => "0", "offset" => "", "orderby" => "date", "order" => 'desc', "controls" => "no", "pagination" => "no", "titles" => "no", "links" => "no", "rev_style" => "rev_full", "align" => "", "width" => "100%", "height" => "400", "top" => "", "bottom" => "", "left" => "", "right" => ""), $atts));
    /*scripts & styles*/
    themerex_enqueue_style('swiperslider-style', get_template_directory_uri() . '/js/swiper/idangerous.swiper.css', array(), null);
    themerex_enqueue_script('swiperslider', get_template_directory_uri() . '/js/swiper/idangerous.swiper-2.1.js', array('jquery'), null, true);
    themerex_enqueue_style('swiperslider-scrollbar-style', get_template_directory_uri() . '/js/swiper/idangerous.swiper.scrollbar.css', array(), null);
    themerex_enqueue_script('swiperslider-scrollbar', get_template_directory_uri() . '/js/swiper/idangerous.swiper.scrollbar-2.1.js', array('jquery'), null, true);
    themerex_enqueue_script('hover-dir', get_template_directory_uri() . '/js/hover/jquery.hoverdir.js', array(), null, true);
    themerex_enqueue_style('hover-intent', get_template_directory_uri() . '/js/hover/hoverIntent.js', array(), null);
    global $THEMEREX_sc_slider_engine, $THEMEREX_sc_slider_width, $THEMEREX_sc_slider_height, $THEMEREX_sc_slider_links;
    $THEMEREX_sc_slider_engine = $engine;
    $THEMEREX_sc_slider_width = $width;
    $THEMEREX_sc_slider_height = $height;
    $THEMEREX_sc_slider_links = sc_param_is_on($links);
    $s = ($top !== '' ? 'margin-top:' . $top . 'px;' : '') . ($bottom !== '' ? 'margin-bottom:' . $bottom . 'px;' : '') . ($left !== '' ? 'margin-left:' . $left . ((int) $left > 0 || (int) $left < 0 ? 'px' : '') . ';' : '') . ($right !== '' ? 'margin-right:' . $right . ((int) $right > 0 || (int) $right < 0 ? 'px' : '') . ';' : '') . (!empty($width) ? 'width:' . $width . (themerex_strpos($width, '%') !== false ? '' : 'px') . ';' : '') . (!empty($height) ? 'height:' . $height . (themerex_strpos($height, '%') !== false ? '' : 'px') . ';' : '');
    $c = ' sc_slider_' . $engine . (sc_param_is_on($controls) ? ' sc_slider_controls' : '') . (sc_param_is_on($pagination) ? ' sc_slider_pagination' : '') . ($align != '' && $align != 'none' ? ' sc_float_' . $align : '') . ($engine == 'swiper' ? ' swiper-container' : '');
    $output = '<div' . ($id ? ' id="sc_slider_' . $id . '"' : '') . ' class="sc_slider ' . $c . '" ' . ($s != '' ? ' style="' . $s . '"' : '') . ' data-settings="horizontal">';
    if ($engine == 'revo') {
        if (revslider_exists() && !empty($alias)) {
            $output .= do_shortcode('[rev_slider ' . $alias . ']');
        } else {
            $output = '';
        }
    } else {
        if ($engine == 'royal') {
            if (royalslider_exists() && !empty($alias)) {
                $output .= do_shortcode('[[new_royalslider id="' . $alias . '"]');
            } else {
                $output = '';
            }
        } else {
            if ($engine == 'flex' || $engine == 'swiper') {
                $output .= '<ul class="slides' . ($engine == 'swiper' ? ' swiper-wrapper' : '') . '">';
                $content = do_shortcode($content);
                if ($content) {
                    $output .= $content;
                } else {
                    global $post;
                    if (!empty($ids)) {
                        $posts = explode(',', $ids);
                        $count = count($posts);
                    }
                    $args = array('post_type' => 'post', 'post_status' => 'publish', 'posts_per_page' => $count, 'ignore_sticky_posts' => 1, 'order' => $order == 'asc' ? 'asc' : 'desc');
                    if ($offset > 0 && empty($ids)) {
                        $args['offset'] = $offset;
                    }
                    $args = addSortOrderInQuery($args, $orderby, $order, true);
                    $args = addPostsAndCatsInQuery($args, $ids, $cat);
                    $query = new WP_Query($args);
                    while ($query->have_posts()) {
                        $query->the_post();
                        $post_id = get_the_ID();
                        $post_link = get_permalink();
                        $post_attachment = wp_get_attachment_url(get_post_thumbnail_id($post_id));
                        $post_accent_color = '';
                        $post_category = '';
                        $post_category_link = '';
                        $post_title = getPostTitle($post_id);
                        $avg_author = 0;
                        $ed = themerex_substr($width, -1) == '%' ? '%' : 'px';
                        //image crop
                        $no_crop = getThumbSizes(array('thumb_size' => 'image_large', 'thumb_crop' => true, 'sidebar' => false));
                        $crop = array("w" => $width != '' && $ed != '%' ? $width : $no_crop['w'], "h" => $height != '' && $ed != '%' ? $height : null);
                        $post_attachment = getResizedImageURL($post_attachment, $crop['w'], $crop['h']);
                        $output .= '<li' . ($engine == 'swiper' ? ' class="swiper-slide"' : '') . ' data-theme="' . ($theme != '' ? $theme : 'dark') . '" style="background-image:url(' . $post_attachment . ');' . (!empty($width) ? ' width:' . $width . (themerex_strpos($width, '%') !== false ? '' : 'px') . ';' : '') . (!empty($height) ? ' height:' . $height . (themerex_strpos($height, '%') !== false ? '' : 'px') . ';' : '') . '">' . (sc_param_is_on($links) ? '<a href="' . $post_attachment . '" title="' . htmlspecialchars($post_title) . '">' : '');
                        if (!sc_param_is_off($titles)) {
                            $post_hover_bg = get_custom_option('theme_color', null, $post_id);
                            $post_bg = '';
                            if ($post_hover_bg != '' && !is_inherit_option($post_hover_bg)) {
                                $rgb = Hex2RGB_1($post_hover_bg);
                                $post_hover_ie = str_replace('#', '', $post_hover_bg);
                                $post_bg = "background-color: rgba({$rgb['r']},{$rgb['g']},{$rgb['b']},0.8);";
                            }
                            $output .= '<div class="sc_slider_info' . ($titles == 'fixed' ? ' sc_slider_info_fixed' : ' sc_slider_info_slide') . ($engine == 'swiper' ? ' content-slide' : '') . '"><div class="main">';
                            $post_descr = getPostDescription();
                            //reviews
                            if (get_custom_option('show_reviews') == 'yes' && get_custom_option('slider_reviews') == 'yes') {
                                $output_reviews = '';
                                $rating_max = get_custom_option('reviews_max_level');
                                $review_title = sprintf($rating_max < 100 ? __('Rating: %s from %s', 'themerex') : __('Rating: %s', 'themerex'), number_format($avg_author, 1) . ($rating_max < 100 ? '' : '%'), $rating_max . ($rating_max < 100 ? '' : '%'));
                                $avg_author = marksToDisplay(get_post_meta($post_id, 'reviews_avg' . (get_theme_option('reviews_first') == 'author' && $orderby != 'users_rating' || $orderby == 'author_rating' ? '' : '2'), true));
                                if ($avg_author > 0 && get_custom_option('slider_reviews_style') == 'rev_short') {
                                    $output .= '<div class="sc_slider_reviews_short" title="' . $review_title . '"><span class="rInfo">' . $avg_author . '</span><span class="rDelta">' . ($rating_max < 100 ? '<span class="icon-star"></span>' : '%') . '</span></div>';
                                } else {
                                    if ($avg_author > 0 && get_custom_option('slider_reviews_style') == 'rev_full') {
                                        $output_reviews .= '<div class="sc_slider_reviews reviews_summary blog_reviews" title="' . $review_title . '">' . '<div class="criteria_summary criteria_row">' . getReviewsSummaryStars($avg_author) . '</div>' . '</div>';
                                    }
                                }
                                $output .= $output_reviews;
                            }
                            //category
                            if (get_custom_option("slider_info_category") == 'yes') {
                                // || empty($cat)) {
                                // Get all post's categories
                                $post_categories = getCategoriesByPostId($post_id);
                                $post_categories_str = '';
                                for ($i = 0; $i < count($post_categories); $i++) {
                                    if ($post_category == '') {
                                        if (get_theme_option('close_category') == 'parental') {
                                            $parent_cat_id = 0;
                                            //(int) get_custom_option('category_id');
                                            $parent_cat = getParentCategory($post_categories[$i]['term_id'], $parent_cat_id);
                                            if ($parent_cat) {
                                                $post_category = $parent_cat['name'];
                                                $post_category_link = $parent_cat['link'];
                                                if ($post_accent_color == '') {
                                                    $post_accent_color = get_category_inherited_property($parent_cat['term_id'], 'theme_color');
                                                }
                                            }
                                        } else {
                                            $post_category = $post_categories[$i]['name'];
                                            $post_category_link = $post_categories[$i]['link'];
                                            if ($post_accent_color == '') {
                                                $post_accent_color = get_category_inherited_property($post_categories[$i]['term_id'], 'theme_color');
                                            }
                                        }
                                    }
                                    if ($post_category != '' && $post_accent_color != '') {
                                        break;
                                    }
                                }
                                if ($post_category == '' && count($post_categories) > 0) {
                                    $post_category = $post_categories[0]['name'];
                                    $post_category_link = $post_categories[0]['link'];
                                    if ($post_accent_color == '') {
                                        $post_accent_color = get_category_inherited_property($post_categories[0]['term_id'], 'theme_color');
                                    }
                                }
                                if ($post_category != '') {
                                    $output .= '<div class="sc_slider_category"' . (themerex_substr($post_accent_color, 0, 1) == '#' ? ' style="background-color: ' . $post_accent_color . '"' : '') . '><a href="' . $post_category_link . '">' . $post_category . '</a></div>';
                                }
                            }
                            //title
                            if (strlen($post_title) > 25) {
                                $post_title = substr($post_title, 0, 25) . '...';
                            }
                            $output .= '<h2 class="sc_slider_subtitle"><a href="' . $post_link . '">' . $post_title . '</a></h2>';
                            //descriptions
                            if (get_custom_option('slider_descriptions') == 'yes') {
                                $output .= '<div class="sc_slider_descr">' . $post_descr . '</div>';
                            }
                            $output .= '</div></div>';
                        }
                        $output .= (sc_param_is_on($links) ? '</a>' : '') . '</li>';
                    }
                    wp_reset_postdata();
                }
                $output .= '</ul>';
                if ($engine == 'swiper') {
                    if (sc_param_is_on($controls)) {
                        $output .= '
					<ul class="slider-control-nav">
						<li class="slide-prev"><a class="icon-left-open-big" href="#"></a></li>
						<li class="slide-next"><a class="icon-right-open-big" href="#"></a></li>
					</ul>';
                    }
                    if (sc_param_is_on($pagination)) {
                        $output .= '
					<div class="slider-pagination-nav"></div>
				';
                    }
                }
            } else {
                $output = '';
            }
        }
    }
    $output .= !empty($output) ? '</div>' : '';
    return $output;
}
    function getReviewsMarkup($field, $value, $editable = false, $clear = false, $snippets = false)
    {
        $maxLevel = max(5, (int) get_custom_option('reviews_max_level'));
        $output = '';
        $criterias = $field['options'];
        $marks = explode(',', $value);
        if (is_array($criterias) && count($criterias) > 0) {
            $i = 0;
            foreach ($criterias as $num => $sb) {
                if (empty($sb)) {
                    continue;
                }
                if ($clear || !isset($marks[$i]) || $marks[$i] == '' || is_inherit_option($marks[$i])) {
                    $marks[$i] = 0;
                }
                $output .= '<div class="ratBody">' . getReviewsSummaryStars($marks[$i], $editable) . '<span class="name">' . $sb . '</span>' . '</div>';
                $i++;
            }
        }
        $output .= isset($field['accept']) && $field['accept'] ? '<div class="accept"><div class="squareButton global"><a href="#" title="' . __('Accept your votes', 'themerex') . '">' . __('Accept', 'themerex') . '</a></div></div>' : '';
        $avg = getReviewsRatingAverage($value);
        $output .= '
            <div class="infoTotal">
                <div class="infoRat">' . (isset($field['descr']) ? $field['descr'] : '') . '</div>
                <div class="totalWrap">
                    <div class="totalStar">
						' . getReviewsSummaryStars($avg, false, $snippets) . '
                    </div>
                    <div class="totalRating" data-mark="' . $avg . '">' . $avg . (themerex_strlen($avg) == 1 ? '.0' : '') . '</div>
                </div>
            </div>
		';
        return $output;
    }
function prepareThemeCustomStyles()
{
    // Custom font
    $fonts = getThemeFontsList(false);
    $font = get_custom_option('theme_font');
    $body_bg = get_custom_option('bg_color');
    $theme_color = get_custom_option('theme_color');
    if (isset($fonts[$font])) {
        addThemeCustomStyle("\n\t\t\tbody, button, input, select, textarea {\n\t\t\t\tfont-family: '" . $font . "', " . $fonts[$font]['family'] . ";\n\t\t\t}\n\t\t\tbody {\n\t\t\t\tbackground: " . $body_bg . "\n\t\t\t}\n\t\t");
    }
    // Custom menu
    if (get_custom_option('menu_colored') == 'yes') {
        $menu_name = 'mainmenu';
        if (($locations = get_nav_menu_locations()) && isset($locations[$menu_name])) {
            $menu = wp_get_nav_menu_object($locations[$menu_name]);
            if (is_object($menu) && $menu) {
                $menu_items = wp_get_nav_menu_items($menu->term_id);
                $menu_styles = '';
                $menu_slider = get_custom_option('menu_slider') == 'yes';
                if (count($menu_items) > 0) {
                    foreach ($menu_items as $k => $item) {
                        //				if ($item->menu_item_parent==0) {
                        $cur_accent_color = '';
                        if ($item->type == 'taxonomy' && $item->object == 'category') {
                            $cur_accent_color = get_category_inherited_property($item->object_id, 'theme_accent_color');
                        }
                        if ((empty($cur_accent_color) || is_inherit_option($cur_accent_color)) && isset($item->classes[0]) && !empty($item->classes[0])) {
                            $cur_accent_color = (themerex_substr($item->classes[0], 0, 1) != '#' ? '#' : '') . $item->classes[0];
                        }
                        if (!empty($cur_accent_color) && !is_inherit_option($cur_accent_color)) {
                            $menu_styles .= ($item->menu_item_parent == 0 ? "#header_middle_inner #mainmenu li.menu-item-{$item->ID}.current-menu-item > a," : '') . "\n\t\t\t\t\t\t\t\t\t#header_middle_inner #mainmenu li.menu-item-{$item->ID} > a:hover,\n\t\t\t\t\t\t\t\t\t#header_middle_inner #mainmenu li.menu-item-{$item->ID}.sfHover > a {\n\t\t\t\t\t\t\t\t\t\tbackground-color: {$cur_accent_color} !important;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t#header_middle_inner #mainmenu li.menu-item-{$item->ID} ul {\n\t\t\t\t\t\t\t\t\t\tbackground-color: {$cur_accent_color} !important;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t";
                        }
                        if ($menu_slider && $item->menu_item_parent == 0) {
                            $menu_styles .= "\n\t\t\t\t\t\t\t\t\t#header_middle_inner #mainmenu li.menu-item-{$item->ID}.blob_over:not(.current-menu-item) > a:hover,\n\t\t\t\t\t\t\t\t\t#header_middle_inner #mainmenu li.menu-item-{$item->ID}.blob_over.sfHover > a {\n\t\t\t\t\t\t\t\t\t\tbackground-color: transparent !important;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t";
                        }
                        //				}
                    }
                }
                if (!empty($menu_styles)) {
                    addThemeCustomStyle($menu_styles);
                }
            }
        }
    }
    // Main menu height
    $menu_height = (int) get_custom_option('menu_height');
    if ($menu_height > 20) {
        addThemeCustomStyle("\n\t\t\t#mainmenu > li > a {\n\t\t\t\theight: {$menu_height}px !important;\n\t\t\t\tline-height: {$menu_height}px !important;\n\t\t\t}\n\t\t\t#mainmenu > li ul {\n\t\t\t\ttop: {$menu_height}px !important;\n\t\t\t}\n\t\t\t#header_middle {\n\t\t\t\tmin-height: {$menu_height}px !important;\n\t\t\t}\n\t\t");
    }
    // Submenu width
    $menu_width = (int) get_custom_option('menu_width');
    if ($menu_width > 50) {
        addThemeCustomStyle("\n\t\t\t#mainmenu > li ul {\n\t\t\t\twidth: {$menu_width}px;\n\t\t\t}\n\t\t\t#mainmenu > li ul li ul {\n\t\t\t\tleft: " . ($menu_width + 1) . "px;\n\t\t\t}\n\t\t\t#mainmenu > li:nth-child(n+6) ul li ul {\n\t\t\t\tleft: -" . ($menu_width + 1) . "px;\n\t\t\t}\n\t\t");
    }
    if (!empty($theme_color)) {
        addThemeCustomStyle('
			#sidebar_main .popular_and_commented_tabs .tab_content:not(.style_post_format) .post_item .post_title a:hover, 
			.wp-calendar thead th.prevMonth a:hover,
			.wp-calendar thead th.nextMonth a:hover,
			.wp-calendar tbody td.dayWithPost a:hover,
			.widget_twitter .theme_text a,
			.top_news_section .top_news_term a:hover,
			a:hover,
			.trex_accent_color,
			.post_info .post_title a:hover,
			.link_text_wrap a,
			.sc_quote_icon,
			article.format-link > .icon,
			blockquote.sc_quote,
			article.format-aside > .icon,
			article.format-chat > .icon,
			article.format-status > .icon,
			#nav_pages ul li:hover a,
			#nav_pages ul li:hover span,
			#nav_pages ul li.pager_current span,
			#nav_pages .pager_prev a:hover,
			#nav_pages .pager_next a:hover,
			.isotopeFiltr ul li a:hover,
			section.author .user_links ul li span:hover,
			.comment_content .review .label i,
			.popularFiltr ul li.ui-state-active a span,
			.prev_next_posts .prev_post_icon,
			.prev_next_posts .next_post_icon,
			.prev_next_posts .prev_post_link a:hover,
			.prev_next_posts .next_post_link a:hover,
			.link_pages a:hover,
			.itemscope .post_tags a:hover,
			.article_services section.comments li.comment .comment_header .comment_reply a,
			.swpRightPos .sc_tabs .tabsMenuHead li.ui-tabs-active a,
			.swpRightPos .sc_tabs .tabsMenuHead li a:hover,
			.swpRightPos .addBookmark:hover i,
			.swpRightPos .listBookmarks li:hover a,
			#panelmenu li a:hover,
			.popular_and_commented_tabs ul.tabs li a:hover,
			.popular_and_commented_tabs .tab_content .post_item a:hover,
			.popular_and_commented_tabs .tab_content .post_item i.format-icon.hover:before,
			.footerWidget .popular_and_commented_tabs .tab_content h5.post_title a:hover,
			#sidebar_main .widget ul li a:hover,
			.sc_accordion.sc_accordion_style_1 .sc_accordion_item h4.sc_accordion_title i.icon,
			.sc_dropcaps .sc_dropcap,
			.sc_tooltip_parent,
			.sc_skills.sc_skills_type_counter .sc_skills_item_progress,
			.sc_title_icon,
			.sc_title_bg.sc_title_without_bg,
			.sc_icon,
			.sc_tabs ul.sc_tabs_titles li a .icon,
			.slider_wrap .sc_slider_swiper + .flex-control-nav ul li.current .post_icon,
			.sc_testimonials .flex-direction-nav li a,
			.sc_testimonials.sc_testimonials_style_2 .flex-direction-nav li a:hover,
			.sc_blogger .sc_blogger_item .sc_blogger_title a:hover,
			.sc_blogger.style_list .sc_blogger_item > .icon,
			.sc_blogger.style_carousel .sc_blogger_item .post_links a:hover,
			.sc_blogger.style_carousel .prev_slide:hover,
			.sc_blogger.style_carousel .next_slide:hover,
			.sc_review_panel .sc_review_title,
			.sc_team .sc_team_item .sc_team_item_position,
			.sc_list.sc_list_style_ol li .sc_list_num,
			.sc_list.sc_list_style_ol_filled li .sc_list_num,
			.sc_list.sc_list_style_iconed li:before {
				color: ' . $theme_color . ';
			}
			#nav_pages .pager_prev a:hover,
			#nav_pages .pager_next a:hover,
			.isotopeFiltr ul li.active a,
			.pagination_viewmore .view_more_button:hover,
			.popular_and_commented_tabs ul.tabs li.ui-tabs-active a,
			.link_pages a:hover,
			.popular_and_commented_tabs ul.tabs li a:hover,
			.wp-calendar thead th.prevMonth a:hover,
			.wp-calendar thead th.nextMonth a:hover,
			.wp-calendar tbody td.dayWithPost,
			.sc_dropcaps.sc_dropcaps_style_1 .sc_dropcap,
			.sc_dropcaps.sc_dropcaps_style_2 .sc_dropcap,
			.sc_dropcaps .sc_dropcap,
			.sc_tooltip_parent,
			.sc_blogger .sc_blogger_block_link:hover,
			.sc_blogger.style_carousel .prev_slide:hover,
			input[type="submit"]:hover,
			.sc_blogger.style_carousel .next_slide:hover {
				border-color: ' . $theme_color . ';
			}
			article.format-aside > .article_wrap,
			.isotopeFiltr ul li.active a,
			section.author .user_links span.tooltip,
			.vote_criterias li a:hover:before,
			.vote_criterias li a:active:before,
			.link_pages .pages_popup .popup_inner,
			.popular_and_commented_tabs ul.tabs li.ui-tabs-active a,
			#sidebar_main .widget.widget_recent_entries ul li a:before,
			.widget.widget_flickr .flickr_images a,
			.widget_contact_social .tooltip,
			.sc_dropcaps.sc_dropcaps_style_1 .sc_dropcap,
			.sc_dropcaps.sc_dropcaps_style_2 .sc_dropcap,
			.sc_skills.sc_skills_type_bar .sc_skills_item .sc_skills_item_progress,
			.sc_skills.sc_skills_type_bar .sc_skills_item .sc_skills_item_progress .progress_inner,
			.sc_slider_swiper .progress,
			.sc_testimonials .flex-direction-nav li a:hover,
			.sc_blogger_item .thumb a,
			.sc_blogger_item .thumb a .hover_plus,
			.sc_blogger.style_accordion .sc_blogger_item .sc_blogger_title a:hover,
			.sc_blogger.style_date .sc_blogger_item .post_date_info .month,
			.sc_blogger.style_carousel .sc_blogger_item .overlay_mask,
			.sc_blogger.style_carousel .swiper_scrollbar .swiper-scrollbar-drag,
			.sc_button,
			.sc_blogger .sc_blogger_block_link:hover,
			.sc_list.sc_list_style_ul li:before,
			input[type="submit"]:hover,
			a:hover .sc_title_icon,
			.sc_list.sc_list_style_ol_filled li .sc_list_num {
				background: ' . $theme_color . ';
			}
		');
    }
    // Custom css from theme options
    $css = get_custom_option('custom_css');
    $section1_bg = get_custom_option('section_1_bg');
    $section2_bg = get_custom_option('section_2_bg');
    $section1_font = get_custom_option('section_1_font');
    $section2_font = get_custom_option('section_2_font');
    $section2_top_margin = get_custom_option('section2_margin_top');
    $section2_bottom_margin = get_custom_option('section2_margin_bottom');
    $css .= !empty($section1_font) ? '.section_2 { color: ' . $section2_font . '}' : '';
    $css .= !empty($section1_font) ? '.section_1,#topmenu li a, header .section_1 .login_loguout_link { color: ' . $section1_font . '}' : '';
    $css .= !empty($section1_bg) ? 'header .section_1 { background: ' . $section1_bg . '}' : '';
    $sect2_style = '.section_2 {';
    $sect2_style .= !empty($section2_bg) ? ' background: ' . $section2_bg . ';' : '';
    $sect2_style .= !empty($section2_top_margin) ? ' padding-top: ' . $section2_top_margin . 'px; ' : '';
    $sect2_style .= !empty($section2_bottom_margin) ? ' padding-bottom: ' . $section2_bottom_margin . 'px; ' : '';
    $sect2_style .= '}';
    $css .= !empty($sect2_style) ? $sect2_style : '';
    $constructId = getTemplatePageId('under-construction');
    if (!empty($constructId) && get_the_ID() == $constructId) {
        $construct_thumb = wp_get_attachment_url(get_post_thumbnail_id($constructId));
        $css .= !empty($construct_thumb) ? '#page { background-image: url( ' . $construct_thumb . ' ) }' : '';
    }
    if (!empty($css)) {
        addThemeCustomStyle($css);
    }
    return getThemeCustomStyles();
}
 $maxLevel = max(5, (int) get_custom_option('reviews_max_level'));
 $allowUserReviews = (!$reviews_first_author || !$reviews_second_hide) && (!isset($_COOKIE['reviews_vote']) || themerex_strpos($_COOKIE['reviews_vote'], ',' . $post_data['post_id'] . ',') === false) && (get_theme_option('reviews_can_vote') == 'all' || is_user_logged_in());
 $THEMEREX_REVIEWS_RATING = '<div class="reviewBlock' . ($use_tabs ? ' sc_tabs sc_tabs_style_1 sc_tabs_effects' : '') . '">';
 $output = $marks = $users = '';
 if ($use_tabs) {
     $author_tab = '<li><a href="#author-tabs">' . __('Author', 'themerex') . '</a></li>';
     $users_tab = '<li><a href="#users-tabs">' . __('Users', 'themerex') . '</a></li>';
     $output .= '<ul class="sc_tabs_titles">' . ($reviews_first_author ? $author_tab . $users_tab : $users_tab . $author_tab) . '</ul>';
 }
 // Criterias list
 $field = array("options" => get_theme_option('reviews_criterias'));
 if (count($post_data['post_categories_list']) > 0) {
     foreach ($post_data['post_categories_list'] as $cat) {
         $id = (int) $cat['term_id'];
         $prop = get_category_inherited_property($id, 'reviews_criterias');
         if (!empty($prop) && !is_inherit_option($prop)) {
             $field['options'] = $prop;
             break;
         }
     }
 }
 // Author marks
 $output .= '<div class="sc_tabs_array">';
 if ($reviews_first_author || !$reviews_second_hide) {
     $field["id"] = "reviews_marks_author";
     $field["descr"] = strip_tags($post_data['post_excerpt']);
     $field["accept"] = false;
     $marks = marksToDisplay(marksPrepare(get_custom_option('reviews_marks'), count($field['options'])));
     $output .= '<div class="reviewTab" id="author-tabs">' . getReviewsMarkup($field, $marks, false, false, $reviews_first_author) . '</div>';
 }
 // Users marks
function category_custom_fields_save($term_id = 0)
{
    global $THEMEREX_options;
    // verify nonce
    if (!isset($_POST['meta_box_category_nonce']) || !wp_verify_nonce($_POST['meta_box_category_nonce'], basename(__FILE__))) {
        return $term_id;
    }
    $custom_options = category_custom_fields_get($term_id);
    $need_save = false;
    foreach ($THEMEREX_options as $field) {
        if (!isset($field['override']) || !in_array('category', explode(',', $field['override']))) {
            continue;
        }
        if (!isset($field['std'])) {
            continue;
        }
        $id = $field['id'];
        if (!isset($_POST[$id . '_inherit'])) {
            continue;
        }
        $need_save = true;
        if (is_inherit_option($_POST[$id . '_inherit'])) {
            $new = '';
        } else {
            if (isset($_POST[$id])) {
                if ($field['type'] == 'socials') {
                    if (!empty($field['cloneable'])) {
                        foreach ($_POST[$id] as $k => $v) {
                            $_POST[$id][$k] = array('url' => stripslashes($v), 'icon' => stripslashes($_POST[$id . '_icon'][$k]));
                        }
                    } else {
                        $_POST[$id] = array('url' => stripslashes($_POST[$id]), 'icon' => stripslashes($_POST[$id . '_icon']));
                    }
                } else {
                    if (is_array($_POST[$id])) {
                        foreach ($_POST[$id] as $k => $v) {
                            $_POST[$id][$k] = stripslashes($v);
                        }
                    } else {
                        $_POST[$id] = stripslashes($_POST[$id]);
                    }
                }
                // Add cloneable index
                if (!empty($field['cloneable'])) {
                    $rez = array();
                    foreach ($_POST[$id] as $k => $v) {
                        $rez[$_POST[$id . '_numbers'][$k]] = $v;
                    }
                    $_POST[$id] = $rez;
                }
                $new = $_POST[$id];
            } else {
                $new = $field['type'] == 'checkbox' ? 'false' : '';
            }
        }
        $custom_options[$id] = $new ? $new : 'inherit';
    }
    if ($need_save) {
        category_custom_fields_set($term_id, $custom_options);
    }
}