<?php

/**
 * DokuWiki Bootstrap3 Template: Theme Switcher
 *
 * @link     http://dokuwiki.org/template:bootstrap3
 * @author   Giuseppe Di Terlizzi <*****@*****.**>
 * @license  GPL 2 (http://www.gnu.org/licenses/gpl.html)
 */
// must be run from within DokuWiki
if (!defined('DOKU_INC')) {
    die;
}
if (bootstrap3_conf('showThemeSwitcher') && bootstrap3_conf('bootstrapTheme') == 'bootswatch' && ($available_themes = array_diff(bootstrap3_bootswatch_theme_list(), bootstrap3_conf('hideInThemeSwitcher')))) {
    ?>
<!-- theme-switcher -->
<ul class="nav navbar-nav" id="dw__themes">
  <li class="dropdown">

    <a class="dropdown-toggle" data-toggle="dropdown" href="#"><i class="fa fa-fw fa-tint"></i> <span class="hidden-lg hidden-md hidden-sm"><?php 
    echo tpl_getLang('themes');
    ?>
</span> <span class="caret"></span></a>

    <ul class="dropdown-menu" aria-labelledby="themes">
      <li class="dropdown-header"><i class="fa fa-fw fa-tint"></i> Bootswatch Themes</li>
      <?php 
    foreach ($available_themes as $theme) {
        ?>
      <li<?php 
        echo $bootswatchTheme == $theme ? ' class="active"' : '';
/**
 * Return only the available Bootswatch.com themes
 *
 * @author  Giuseppe Di Terlizzi <*****@*****.**>
 *
 * @return  array
 */
function bootstrap3_bootswatch_themes_available()
{
    return array_diff(bootstrap3_bootswatch_theme_list(), bootstrap3_conf('hideInThemeSwitcher'));
}