/**
  * Checks whether to show a certain layout area or not.
  *
  * @param string $area
  *
  * @return bool
  */
 function themify_theme_show_area($area = '')
 {
     switch ($area) {
         case 'header':
             return 'none' == themify_area_design($area, array('values' => wp_list_pluck(themify_theme_header_design_options(), 'value'))) ? false : true;
             break;
         case 'footer':
             return 'none' == themify_area_design($area, array('values' => wp_list_pluck(themify_theme_footer_design_options(), 'value'))) ? false : true;
             break;
         default:
             if (is_singular() && !is_attachment()) {
                 $exclude = themify_get('exclude_' . $area);
                 if ('yes' == $exclude) {
                     return false;
                 } elseif ('no' == $exclude) {
                     return true;
                 } else {
                     return themify_check('setting-exclude_' . $area) ? false : true;
                 }
             } elseif (themify_check('setting-exclude_' . $area)) {
                 return false;
             }
             break;
     }
     return true;
 }
/**
 * Markup for theme design options
 * @param array $data
 * @return string
 */
function themify_theme_design_controls($data = array())
{
    /**
     * Module markup
     * @var string
     */
    $html = '';
    /**
     * Theme Color
     * @var array
     */
    $design_options = themify_theme_color_design_options();
    /**
     * Prefix for theme settings
     * @var string
     */
    $pre = 'setting-color_design';
    /**
     * Theme Color
     */
    $html .= '<p>
					<span class="label">' . __('Theme Color', 'themify') . '</span>';
    $val = themify_check($pre) ? themify_get($pre) : '';
    foreach ($design_options as $option) {
        if (('' == $val || !$val) && $option['selected']) {
            $val = $option['value'];
        }
        $class = $val == $option['value'] ? 'selected' : '';
        $html .= '<a href="#" class="preview-icon ' . esc_attr($class) . '" title="' . esc_attr($option['title']) . '"><img src="' . esc_url(THEME_URI . '/' . $option['img']) . '" alt="' . esc_attr($option['value']) . '"  /></a>';
    }
    $html .= '	<input type="hidden" name="' . esc_attr($pre) . '" class="val" value="' . esc_attr($val) . '" />
				</p>';
    /**
     * Typography
     * @var array
     */
    $design_options = themify_theme_font_design_options();
    /**
     * Prefix for theme settings
     * @var string
     */
    $pre = 'setting-font_design';
    /**
     * Typography
     */
    $html .= '<p>
					<span class="label">' . __('Typography', 'themify') . '</span>';
    $val = themify_check($pre) ? themify_get($pre) : '';
    foreach ($design_options as $option) {
        if (('' == $val || !$val) && $option['selected']) {
            $val = $option['value'];
        }
        $class = $val == $option['value'] ? 'selected' : '';
        $html .= '<a href="#" class="preview-icon ' . esc_attr($class) . '" title="' . esc_attr($option['title']) . '"><img src="' . esc_url(THEME_URI . '/' . $option['img']) . '" alt="' . esc_attr($option['value']) . '"  /></a>';
    }
    $html .= '	<input type="hidden" name="' . esc_attr($pre) . '" class="val" value="' . esc_attr($val) . '" />
				</p>';
    /**
     * Header Design
     * @var array
     */
    $design_options = themify_theme_header_design_options();
    /**
     * Prefix for theme settings
     * @var string
     */
    $pre = 'setting-header_design';
    // Store items to hide
    $html .= '<div class="group-hide" data-hide="none header-leftpane header-minbar boxed-content">';
    /**
     * Header Design
     */
    $html .= '<p>
						<span class="label">' . __('Header Design', 'themify') . '</span>';
    $val = themify_check($pre) ? themify_get($pre) : '';
    foreach ($design_options as $option) {
        if (('' == $val || !$val) && isset($option['selected']) && $option['selected']) {
            $val = $option['value'];
        }
        $class = $val == $option['value'] ? 'selected' : '';
        $html .= '<a href="#" class="preview-icon ' . esc_attr($class) . '" title="' . esc_attr($option['title']) . '"><img src="' . esc_url(THEME_URI . '/' . $option['img']) . '" alt="' . esc_attr($option['value']) . '"  /></a>';
    }
    $html .= '	<input type="hidden" name="' . esc_attr($pre) . '" class="val" value="' . esc_attr($val) . '" />
					</p>';
    /**
     * Fixed header
     */
    $html .= sprintf('<p class="hide-if none header-leftpane header-minbar boxed-content pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', 'setting-fixed_header_disabled', checked(themify_get('setting-fixed_header_disabled'), 'on', false), __('Disable Sticky Header.', 'themify'));
    /**
     * Full height header
     */
    $key = 'setting-full_height_header';
    $html .= sprintf('<p class="hide-if none header-horizontal header-leftpane header-minbar boxed-layout boxed-content pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s value="yes"/> %3$s</label>
			<br><small>%4$s</small>
			</p>', $key, checked(themify_get($key), 'yes', false), __('Full Height Header.', 'themify'), __('Full height will display the container in 100% viewport height', 'themify'));
    /**
     * Exclude Site Logo
     */
    $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', 'setting-exclude_site_logo', checked(themify_get('setting-exclude_site_logo'), 'on', false), __('Exclude Site Logo.', 'themify'));
    /**
     * Exclude Site Tagline
     */
    $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', 'setting-exclude_site_tagline', checked(themify_get('setting-exclude_site_tagline'), 'on', false), __('Exclude Site Tagline.', 'themify'));
    /**
     * Exclude Search Form
     */
    $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', 'setting-exclude_search_form', checked(themify_get('setting-exclude_search_form'), 'on', false), __('Exclude Search Form.', 'themify'));
    /**
     * Exclude RSS Link
     */
    $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', 'setting-exclude_rss', checked(themify_get('setting-exclude_rss'), 'on', false), __('Exclude RSS Link.', 'themify'));
    /**
     * Exclude Header Widgets
     */
    $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', 'setting-exclude_header_widgets', checked(themify_get('setting-exclude_header_widgets'), 'on', false), __('Exclude Header Widgets.', 'themify'));
    /**
     * Exclude Social Widgets
     */
    $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', 'setting-exclude_social_widget', checked(themify_get('setting-exclude_social_widget'), 'on', false), __('Exclude Social Widgets.', 'themify'));
    /**
     * Exclude Menu Navigation
     */
    $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', 'setting-exclude_menu_navigation', checked(themify_get('setting-exclude_menu_navigation'), 'on', false), __('Exclude Menu Navigation.', 'themify'));
    // End group of elements to hide
    $html .= '</div><!-- /.group-hide -->';
    /**
     * Header Widgets
     */
    $options = array(array('value' => 'headerwidget-4col', 'img' => 'themify/img/sidebars/4col.png', 'title' => __('Widgets 4 Columns', 'themify')), array('value' => 'headerwidget-3col', 'img' => 'themify/img/sidebars/3col.png', 'title' => __('Widgets 3 Columns', 'themify'), 'selected' => true), array('value' => 'headerwidget-2col', 'img' => 'themify/img/sidebars/2col.png', 'title' => __('Widgets 2 Columns', 'themify')), array('value' => 'headerwidget-1col', 'img' => 'themify/img/sidebars/1col.png', 'title' => __('Widgets 1 Column', 'themify')), array('value' => 'none', 'img' => 'themify/img/sidebars/none.png', 'title' => __('No Widgets', 'themify')));
    $val = themify_get('setting-header_widgets');
    $html .= '<p>
				<span class="label">' . __('Header Widgets', 'themify') . '</span>';
    foreach ($options as $option) {
        if (('' == $val || !$val || !isset($val)) && isset($option['selected']) && $option['selected']) {
            $val = $option['value'];
        }
        if ($val == $option['value']) {
            $class = 'selected';
        } else {
            $class = '';
        }
        $html .= '<a href="#" class="' . esc_attr('preview-icon ' . $class) . '" title="' . esc_attr($option['title']) . '"><img src="' . esc_url(THEME_URI . '/' . $option['img']) . '" alt="' . esc_attr($option['value']) . '"  /></a>';
    }
    $html .= '<input type="hidden" name="setting-header_widgets" class="val" value="' . esc_attr($val) . '" />';
    $html .= '</p>';
    /**
     * Footer Design
     * @var array
     */
    $design_options = themify_theme_footer_design_options();
    /**
     * Prefix for theme settings
     * @var string
     */
    $key = 'setting-footer_design';
    // Store items to hide
    $html .= '<div class="group-hide" data-hide="none">';
    /**
     * Footer Design
     */
    $html .= '<p>
						<span class="label">' . __('Footer Design', 'themify') . '</span>';
    $val = themify_check($key) ? themify_get($key) : '';
    foreach ($design_options as $option) {
        if (('' == $val || !$val) && $option['selected']) {
            $val = $option['value'];
        }
        $class = $val == $option['value'] ? 'selected' : '';
        $html .= '<a href="#" class="preview-icon ' . esc_attr($class) . '" title="' . esc_attr($option['title']) . '"><img src="' . esc_url(THEME_URI . '/' . $option['img']) . '" alt="' . esc_attr($option['value']) . '"  /></a>';
    }
    $html .= '	<input type="hidden" name="' . esc_attr($key) . '" class="val" value="' . esc_attr($val) . '" />
					</p>';
    // Exclusions
    $key = 'setting-exclude_';
    /**
     * Exclude Site Logo
     */
    $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', $key . 'footer_site_logo', checked(themify_get($key . 'footer_site_logo'), 'on', false), __('Exclude Site Logo.', 'themify'));
    /**
     * Exclude Footer Widgets
     */
    $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', $key . 'footer_widgets', checked(themify_get($key . 'footer_widgets'), 'on', false), __('Exclude Footer Widgets.', 'themify'));
    /**
     * Exclude Menu Navigation
     */
    $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', $key . 'footer_menu_navigation', checked(themify_get($key . 'footer_menu_navigation'), 'on', false), __('Exclude Menu Navigation.', 'themify'));
    /**
     * Exclude Footer Texts
     */
    $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', $key . 'footer_texts', checked(themify_get($key . 'footer_texts'), 'on', false), __('Exclude Footer Text', 'themify'));
    /**
     * Exclude Footer Back to Top
     */
    $html .= sprintf('<p class="hide-if none pushlabel"><label for="%1$s"><input type="checkbox" id="%1$s" name="%1$s" %2$s /> %3$s</label></p>', $key . 'footer_back', checked(themify_get($key . 'footer_back'), 'on', false), __('Exclude Back to Top button', 'themify'));
    // End group of elements to hide
    $html .= '</div><!-- /.group-hide -->';
    $options = array(array('value' => 'footerwidget-4col', 'img' => 'themify/img/sidebars/4col.png', 'title' => __('Widgets 4 Columns', 'themify')), array('value' => 'footerwidget-3col', 'img' => 'themify/img/sidebars/3col.png', 'title' => __('Widgets 3 Columns', 'themify'), 'selected' => true), array('value' => 'footerwidget-2col', 'img' => 'themify/img/sidebars/2col.png', 'title' => __('Widgets 2 Columns', 'themify')), array('value' => 'footerwidget-1col', 'img' => 'themify/img/sidebars/1col.png', 'title' => __('Widgets 1 Column', 'themify')), array('value' => 'none', 'img' => 'themify/img/sidebars/none.png', 'title' => __('No Widgets', 'themify')));
    $val = themify_get('setting-footer_widgets');
    $html .= '<p>
				<span class="label">' . __('Footer Widgets', 'themify') . '</span>';
    foreach ($options as $option) {
        if (('' == $val || !$val || !isset($val)) && isset($option['selected']) && $option['selected']) {
            $val = $option['value'];
        }
        if ($val == $option['value']) {
            $class = 'selected';
        } else {
            $class = '';
        }
        $html .= '<a href="#" class="' . esc_attr('preview-icon ' . $class) . '" title="' . esc_attr($option['title']) . '"><img src="' . esc_url(THEME_URI . '/' . $option['img']) . '" alt="' . esc_attr($option['value']) . '"  /></a>';
    }
    $html .= '<input type="hidden" name="setting-footer_widgets" class="val" value="' . esc_attr($val) . '" />';
    $html .= '</p>';
    return $html;
}