<?php

if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
// Bottom Widget Area
$l_area = 'l-sb-right';
if (weaverx_getopt('primary_smartmargin') || weaverx_getopt('secondary_smartmargin')) {
    $l_area .= '-lm';
}
$class = $l_area . ' m-full s-full sb-float-right ' . weaverx_area_class('secondary', 'pad', '', 'margin-bottom');
echo '<div style="clear:right;"></div>';
weaverx_put_widgetarea('secondary-widget-area', $class);
weaverx_clear_both('secondary-widget-area');
if ($extra == '' && is_customize_preview()) {
    echo '<div id="header-html" style="display:inline;"></div>';
    // need the area there for customizer live preview
} else {
    if ($extra != '' && $hide != 'hide') {
        $c_class = weaverx_area_class('header_html', 'not-pad', '-none', 'margin-none');
        ?>
		<div id="header-html" class="<?php 
        echo $c_class;
        ?>
">
			<?php 
        echo do_shortcode($extra);
        ?>
		</div> <!-- #header-html -->
	<?php 
    }
}
weaverx_header_widget_area('after_html');
// show header widget area if set to this position
do_action('weaverxplus_action', 'header_area_bottom');
weaverx_clear_both('branding');
?>
</header><!-- #branding -->
<?php 
/* ======== BOTTOM MENU ======== */
do_action('weaverx_nav', 'bottom');
weaverx_header_widget_area('after_menu');
// show header widget area if set to this position
echo "\n</div><div class='clear-header-end' style='clear:both;'></div><!-- #header -->\n";
do_action('weaverx_post_header');
function weaverx_put_widgetarea($area_name, $class = '', $area_class_name = '')
{
    $area = apply_filters('weaverx_replace_widget_area', $area_name);
    if (weaverx_is_checked_page_opt('_pp_' . $area_name)) {
        return;
    }
    // hide area option checked
    unset($GLOBALS['wvr_widget_number']);
    // clear for each widget
    $GLOBALS['wvr_widget_number'] = false;
    if ($area != $area_name) {
        // replacement area?
        $class .= ' ' . $area;
        weaverx_t_set('use_widget_area', $area_name);
        // save state for weaverx_add_widget_classes to use later
    }
    if ($area_class_name) {
        $class .= ' widget-area-' . $area_class_name;
    }
    $class = ' ' . $class;
    if (is_active_sidebar($area)) {
        /* add top and bottom widget areas */
        ob_start();
        /* let's use output buffering to allow use of Dynamic Widgets plugin and not have empty sidebar */
        $success = dynamic_sidebar($area);
        $content = ob_get_clean();
        if ($success && $content) {
            ?>

	<div id="<?php 
            echo $area_name;
            ?>
" class="widget-area<?php 
            echo $class;
            ?>
" role="complementary">
		<?php 
            if ($area_name == 'primary-widget-area') {
                weaverx_inject_area('presidebar');
            }
            echo $content;
            weaverx_clear_both($area_name);
            ?>
	</div><!-- <?php 
            echo $area_name;
            ?>
 -->
	<?php 
            if ($area_class_name == 'top') {
                weaverx_clear_both($area_name);
            }
        }
    }
    weaverx_t_clear('use_widget_area');
    // gotta do this
}
function weaverx_st_pick_theme($list_in)
{
    // output the form to select a file list from weaverx-subthemes directory
    $list = $list_in;
    natcasesort($list);
    $cur_theme = weaverx_getopt('theme_filename');
    if (!$cur_theme) {
        $cur_theme = WEAVERX_DEFAULT_THEME;
    }
    // the default theme
    ?>
<form enctype="multipart/form-data" name='pick_theme' method='post'>
	&nbsp;&nbsp;<strong><?php 
    _e('Click a Radio Button below to select a subtheme:', 'weaver-xtreme');
    ?>
 &nbsp;</strong>
	<span style="padding-left:100px;"><?php 
    _e('Current theme:', 'weaver-xtreme');
    ?>
 <strong>
<?php 
    $cur_addon = weaverx_getopt('addon_name');
    if ($cur_addon == '') {
        echo ucwords(str_replace('-', ' ', $cur_theme));
    } else {
        echo __('Add-on Subtheme: ', 'weaver-xtreme') . ucwords(str_replace('-', ' ', $cur_addon));
        $cur_theme = '';
    }
    ?>
	</strong></span>

	<br /><br /><span class='submit'><input name="set_subtheme" type="submit" value="<?php 
    _e('Set to Selected Subtheme', 'weaver-xtreme');
    ?>
" /></span>
	<small style="color:#b00;"><br /><?php 
    _e('<strong>Note:</strong> Selecting a <em>non-Demo</em> subtheme will change only theme related settings.
	Options labelled with (&diams;) will be retained. You can use the Save/Restore tab to save a copy of all your current settings first.', 'weaver-xtreme');
    ?>
</small><br /><br />
<?php 
    weaverx_nonce_field('set_subtheme');
    $thumbs = weaverx_relative_url('/subthemes/');
    foreach ($list as $addon) {
        $name = ucwords(str_replace('-', ' ', $addon));
        ?>
	<div style="float:left; width:200px;">
		<label><input type="radio" name="theme_picked"
<?php 
        echo 'value="' . $addon . '" ' . ($cur_theme == $addon ? 'checked' : '') . '/> <strong>' . $name . '</strong><br />';
        if (!weaverx_getopt('_hide_theme_thumbs')) {
            echo '<img style="border: 1px solid gray; margin: 5px 0px 10px 0px;" src="' . esc_url($thumbs . $addon . '.jpg') . '" width="150px" height="113px" alt="thumb" /></label></div>' . "\n";
        } else {
            echo "</label></div>\n";
        }
    }
    if (!weaverx_getopt_checked('_hide_theme_thumbs')) {
        weaverx_clear_both();
        ?>
	<span class='submit' style='padding-top:6px;'><input name="set_subtheme" type="submit" value="<?php 
        _e('Set to Selected Subtheme', 'weaver-xtreme');
        ?>
" /></span>
<?php 
    }
    ?>

	</form>
	<div style="clear:both;padding-top:6px;"></div>

	<form enctype="multipart/form-data" name='hide_thumbs_form' method='post'>
<?php 
    $hide_msg = weaverx_getopt('_hide_theme_thumbs') ? __('Show Subtheme Thumbnails', 'weaver-xtreme') : __('Hide Subtheme Thumbnails', 'weaver-xtreme');
    ?>
	<input name="hide_thumbs" type="submit" value="<?php 
    echo $hide_msg;
    ?>
" />
<?php 
    weaverx_nonce_field('hide_thumbs');
    ?>
	</form>
	<div style="clear:both;"></div>
	<hr />
<?php 
    do_action('weaverx_child_show_extrathemes');
    do_action('weaverxplus_admin', 'show_subthemes');
}
<?php

if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
$menu = apply_filters('weaverx_menu_name', 'primary');
if (weaverx_getopt('m_primary_hide') != 'hide' && !weaverx_is_checked_page_opt('_pp_hide_menus')) {
    $use_smart = weaverx_getopt('use_smartmenus') && function_exists('weaverxplus_plugin_installed');
    weaverx_clear_both('menu-primary');
    $class = weaverx_menu_class('m_primary');
    $align = weaverx_getopt('m_primary_align');
    $left = weaverx_getopt('m_primary_html_left');
    $right = weaverx_getopt('m_primary_html_right');
    if ($left) {
        $hide = ' ' . weaverx_getopt('m_primary_hide_left');
        $left = '<span class="wvrx-menu-html wvrx-menu-left' . $hide . '">' . do_shortcode($left) . '</span>';
        $left = str_replace('%', '%%', $left);
        // wp_nav_menu uses sprintf! This will almost always fix the issue.
    } elseif (is_customize_preview()) {
        $hide = ' ' . weaverx_getopt('m_primary_hide_left');
        $left = '<span class="wvrx-menu-html wvrx-menu-left' . $hide . '"></span>';
    }
    if ($right) {
        $hide = ' ' . weaverx_getopt('m_primary_hide_right');
        $right = '<span class="wvrx-menu-html wvrx-menu-right ' . $hide . '">' . do_shortcode($right) . '</span>';
        $right = str_replace('%', '%%', $right);
        // wp_nav_menu uses sprintf!
    } elseif (is_customize_preview()) {
        $hide = ' ' . weaverx_getopt('m_primary_hide_right');
        $right = '<span class="wvrx-menu-html wvrx-menu-right ' . $hide . '"></span>';
            // really leave nothing if specify blank
            echo do_shortcode($cp);
        }
    } else {
        echo '&copy;' . $year . ' - <a href="' . esc_url(home_url('/')) . '" title="' . esc_attr(get_bloginfo('name', 'display')) . '" rel="home">';
        bloginfo('name');
        echo '</a>';
    }
    ?>
		</span> <!-- #site-info -->
		<div>
			<p style = "text-align : right"><B>Réalisé</B> par Mélanie Gourpil, Manuel Martinez et Quentin Gallois</p>
		</div>
</footer><!-- #colophon -->
<?php 
    weaverx_clear_both('colophon');
}
// end if !hide_footer
do_action('weaverxplus_action', 'footer');
weaverx_inject_area('fixedbottom');
echo "</div><!-- /#wrapper --><div class='clear-wrapper-end' style='clear:both;'></div>\n";
weaverx_inject_area('postfooter');
// and this is the end options insertion
do_action('weaverxplus_action', 'postfooter');
echo "\n<a href=\"#page-top\" id=\"page-bottom\">&uarr;</a>\n";
if (!($content_h_ff = weaverx_getopt('content_h_font_family'))) {
    $content_h_ff = '0';
}
$font_size = weaverx_getopt_default('content_h_font_size', 'default');
switch ($font_size) {
    case 'xxs-font-size':
        $image = array_shift($images);
        $image_img_tag = wp_get_attachment_image($image->ID, 'thumbnail');
        ?>
		<figure class="gallery-thumb">
			<a href="<?php 
        esc_url(the_permalink());
        ?>
"><?php 
        echo $image_img_tag;
        ?>
</a>
		</figure><!-- .gallery-thumb -->
<?php 
        $linked = true;
        if (weaverx_compact_post()) {
            weaverx_clear_both('compact-poat');
        }
        ?>
		<p><em> <?php 
        echo '<a href="' . esc_url(get_permalink()) . '" title="' . sprintf(esc_attr__('Permalink to %s', 'weaver-xtreme'), the_title_attribute('echo=0')) . '" rel="bookmark"' . '>' . __('Gallery', 'weaver-xtreme') . '</a></em></p>';
    } else {
        // did not find any images from the content.
        // using get_children failed to find any gallery image, so let's do it ourselves.
        $content = do_shortcode(apply_filters('the_content', get_the_content('')));
        // pick up wp 3.6 post format
        if (preg_match('/<img[^>]+>/i', $content, $images)) {
            // grab <img>s
            $src = '';
            if (preg_match('/src="([^"]*)"/', $images[0], $srcs)) {
                $src = $srcs[0];
            } else {
function weaverx_do_admin()
{
    /* theme admin page */
    /* This generates the startup script calls, etc, for the admin page */
    global $weaverx_opts_cache, $weaverx_main_options, $weaverx_main_opts_list;
    if (!current_user_can('edit_theme_options')) {
        wp_die(__('No permission to access that page.', 'weaver-xtreme'));
    }
    weaverx_admin_page_process_options();
    // Process non-sapi options
    echo '<div class="wrap">';
    ?>
<div style="float:left;"><h2><?php 
    echo WEAVERX_THEMEVERSION;
    ?>
 Options
<?php 
    if (function_exists('weaverxplus_plugin_installed')) {
        echo '<span style="font-size:smaller;"> - ' . __('Plus', 'weaver-xtreme') . '</span><span style="font-size:small;"> (';
        echo WEAVER_XPLUS_VERSION;
        echo ')</span>';
    }
    ?>

<?php 
    if (is_child_theme()) {
        echo " &mdash; " . wp_get_theme();
    }
    ?>


</h2>
	<a name="top_main" id="top_main"></a></div>
<?php 
    weaverx_donate_button();
    //weaverx_check_theme();
    weaverx_clear_messages();
    weaverx_check_version();
    // check version RSS
    weaverx_clear_both();
    $site_url = get_admin_url();
    $site_url = str_replace('http://', '//', $site_url);
    $site_url = str_replace('https://', '//', $site_url);
    //$site_url = '';
    $ret_url = str_replace('/', '%2F', $site_url);
    $customizer_link = $site_url . '/customize.php?return=' . $ret_url . 'themes.php%3Fpage%3DWeaverX';
    if (!weaverx_getopt('_disable_customizer')) {
        ?>
<a href="<?php 
        echo $customizer_link;
        ?>
" title="Switch to Customizer" style="text-decoration:none;font-weight:bold; border:1px solid blue;padding-left:5px; padding-right:5px; background-color:yellow;">Switch to Customizer</a>
<?php 
    }
    ?>

<div id="tabwrap">
  <div id="taba-admin" class='yetii'>
	<ul id="taba-admin-nav" class='yetii'>
	<?php 
    weaverx_elink('#tab_help', __('Table of Content links to Weaver Xtreme Help files', 'weaver-xtreme'), __('Theme Help', 'weaver-xtreme'), $before = '<li>', $after = '</li>');
    weaverx_elink('#tab_themes', __('Select from pre-defined subthemes', 'weaver-xtreme'), __('Weaver Xtreme Subthemes', 'weaver-xtreme'), $before = '<li>', $after = '</li>');
    weaverx_elink('#tab_main', __('Main options for most theme elements: site appearance, layout, header, menus, content, footer, fonts, more', 'weaver-xtreme'), __('Main Options', 'weaver-xtreme'), $before = '<li>', $after = '</li>');
    if (has_action('weaverx_admin_advancedopts')) {
        weaverx_elink('#tab_advanced', __('Advanced options: HTML, code, CSS insertion; page templates, background images, SEO, site options', 'weaver-xtreme'), __('Advanced Options', 'weaver-xtreme'), $before = '<li>', $after = '</li>');
    }
    weaverx_elink('#tab_pro', __('Weaver Xtreme Theme Add-ons', 'weaver-xtreme'), __('Add-ons', 'weaver-xtreme'), $before = '<li>', $after = '</li>');
    weaverx_elink('#tab_saverestore', __('Save and Restore theme settings', 'weaver-xtreme'), __('Save/Restore', 'weaver-xtreme'), $before = '<li>', $after = '</li>');
    ?>
	</ul>

<?php 
    //  list is order specific - above and below must match
    ?>

	<div id="tab_help" class="tab" >
	<?php 
    weaverx_admin_help();
    ?>
	</div>


	<div id="tab_themes" class="tab" >
	<?php 
    do_weaverx_admin_subthemes();
    ?>
	</div>

<?php 
    // ====================== Begin the big form here =====================
    weaverx_sapi_form_top('weaverx_settings_group', 'weaverx_options_form');
    ?>
	<div id="tab_main" class="tab" >
<?php 
    do_weaverx_admin_mainopts();
    ?>
	</div>

	<?php 
    if (has_action('weaverx_admin_advancedopts')) {
        ?>

	<div id="tab_advanced" class="tab" >
<?php 
        do_weaverx_admin_advancedopts();
        ?>
	</div>
<?php 
    }
    weaverx_sapi_form_bottom();
    // end of SAPI opts here. Can't cross <div>s! Non-sapi forms follow
    // ===================== end of big form  =====================
    ?>

	  <div id="tab_pro" class="tab" >
<?php 
    weaverx_admin_pro();
    ?>
	  </div>

	<div id="tab_saverestore" class="tab" >
	<?php 
    do_weaverx_admin_saverestore();
    ?>
	</div>

   </div> <!-- #tab-saverestore -->
</div> <!-- #tabwrap -->

<?php 
    weaverx_end_of_section('Options');
    ?>

<script type="text/javascript">
	var tabberAdmin = new Yetii({
	id: 'taba-admin',
	tabclass: 'tab',
	persist: true
	});
</script>

<?php 
}
<?php

if (!defined('ABSPATH')) {
    exit;
}
// Exit if accessed directly
/**
 * @package WordPress
 * @subpackage weaverx
 */
if (has_nav_menu('header-mini')) {
    // weaverx_getopt( 'm_header_mini_hide') != 'hide' &&
    $class = weaverx_menu_class('m_header_mini');
    echo "\n\n<div id=\"nav-header-mini\" class=\"menu-horizontal {$class}\">\n";
    // echo '<span style="display:inline;float:left;color:yellow;padding-top:.2em;">LEFT</span>';
    wp_nav_menu(array('fallback_cb' => '', 'theme_location' => 'header-mini', 'menu_class' => 'wvrx-header-mini-menu', 'container' => 'div', 'container_class' => ''));
    // echo '<span style="display:inline;float:right;">RIGHT</span>';
    weaverx_clear_both('header-mini');
    echo "\n</div><!-- /#nav-header-mini -->\n";
    weaverx_clear_both('nav-header-mini');
}
function weaverx_st_pick_theme($list_in)
{
    // output the form to select a file list from weaverx-subthemes directory
    $list = $list_in;
    natcasesort($list);
    $cur_theme = weaverx_getopt('theme_filename');
    if (!$cur_theme) {
        $cur_theme = WEAVERX_DEFAULT_THEME;
    }
    // the default theme
    ?>
<form enctype="multipart/form-data" name='pick_theme' method='post' onSubmit="return confirm('<?php 
    _e('Are you sure you want select a new theme?\\r\\n\\r\\nSelecting a new subtheme will overwrite your existing theme settings. You should save your existing settings on the Save/Restore menu if you have made changes.', 'weaver-xtreme');
    ?>
');" >
	&nbsp;&nbsp;<strong><?php 
    _e('Click a Radio Button below to select a subtheme:', 'weaver-xtreme');
    ?>
 &nbsp;</strong>
	<span style="padding-left:100px;"><?php 
    _e('Current theme:', 'weaver-xtreme');
    ?>
 <strong>
<?php 
    $cur_addon = weaverx_getopt('addon_name');
    if ($cur_addon == '') {
        echo ucwords(str_replace('-', ' ', $cur_theme));
    } else {
        echo __('Add-on Subtheme: ', 'weaver-xtreme') . ucwords(str_replace('-', ' ', $cur_addon));
        $cur_theme = '';
    }
    ?>
	</strong></span>

	<br /><br />
<?php 
    //weaverx_confirm_select_theme();
    ?>
	<input class="button-primary" name="set_subtheme" type="submit" value="<?php 
    _e('Set to Selected Subtheme', 'weaver-xtreme');
    ?>
" />

	<p style="color:#b00;font-weight:bold;font-size:120%"><br /><?php 
    _e('<em>Note:</em> Before switching to any subtheme, you must Save and download a copy of your settings using the Save / Restore page, in order to be able to go back to them if required.', 'weaver-xtreme');
    ?>
</p>
<?php 
    weaverx_nonce_field('set_subtheme');
    $thumbs = weaverx_relative_url('subthemes/');
    foreach ($list as $addon) {
        $name = ucwords(str_replace('-', ' ', $addon));
        ?>
	<div style="float:left; width:200px;">
		<label><input type="radio" name="theme_picked"
<?php 
        echo 'value="' . $addon . '" ' . ($cur_theme == $addon ? 'checked' : '') . '/> <strong>' . $name . '</strong><br />';
        if (!weaverx_getopt('_hide_theme_thumbs')) {
            echo '<img style="border: 1px solid gray; margin: 5px 0px 10px 0px;" src="' . esc_url($thumbs . $addon . '.jpg') . '" width="150px" height="113px" alt="thumb" /></label></div>' . "\n";
        } else {
            echo "</label></div>\n";
        }
    }
    if (!weaverx_getopt_checked('_hide_theme_thumbs')) {
        weaverx_clear_both();
        ?>
	<span class='submit' style='padding-top:6px;'><input class="button-primary" name="set_subtheme" type="submit" value="<?php 
        _e('Set to Selected Subtheme', 'weaver-xtreme');
        ?>
" /></span>
<?php 
    }
    ?>

	</form>
	<div style="clear:both;padding-top:6px;"></div>

	<form enctype="multipart/form-data" name='hide_thumbs_form' method='post'>
<?php 
    $hide_msg = weaverx_getopt('_hide_theme_thumbs') ? __('Show Subtheme Thumbnails', 'weaver-xtreme') : __('Hide Subtheme Thumbnails', 'weaver-xtreme');
    ?>
	<input class="button-primary" name="hide_thumbs" type="submit" value="<?php 
    echo $hide_msg;
    ?>
" />
<?php 
    weaverx_nonce_field('hide_thumbs');
    ?>
	</form>
	<div style="clear:both;"></div>
	<hr />
<?php 
    do_action('weaverx_child_show_extrathemes');
    do_action('weaverxplus_admin', 'show_subthemes');
}
function weaverx_header_widget_area($where_now)
{
    // header.php support
    // 'top' => 'Top of Header'
    // 'after_header' => 'After Header Image'
    // 'after_html' => 'After HTML Block'
    // 'after_menu' => 'After Main Menu'
    $sb_position = weaverx_getopt_default('header_sb_position', 'top');
    if ($sb_position == $where_now && weaverx_has_widgetarea('header-widget-area')) {
        $p_class = weaverx_area_class('header_sb', 'notpad', '-none', 'margin-none');
        //weaverx_clear_both('header_sb');
        weaverx_put_widgetarea('header-widget-area', $p_class, 'header');
        if (weaverx_getopt('header_sb_align') == 'float-right') {
            weaverx_clear_both('header-widget-area');
        }
    }
}