function mltlngg_get_switcher_block($mltlngg_language_switcher = false)
    {
        global $mltlngg_current_language, $mltlngg_enabled_languages, $current_blog, $mltlngg_options;
        $switcher = '<div class="mltlngg_switcher">';
        if (!$mltlngg_language_switcher) {
            $mltlngg_language_switcher = $mltlngg_options['language_switcher'];
        }
        /* Language switcher style */
        switch ($mltlngg_language_switcher) {
            case 'drop-down-list':
                $switcher .= '<select style="background-image: url(' . plugins_url('images/flags/', __FILE__) . $mltlngg_current_language . '.png ); background-repeat: no-repeat; background-position: left center; padding-left: 20px; display: block !important;" name="mltlngg_change_display_lang" onchange="document.location.href=this.options[this.selectedIndex].value;">';
                foreach ($mltlngg_enabled_languages as $mltlngg_one_language) {
                    $mltlngg_selected = $mltlngg_one_language['locale'] == $mltlngg_current_language ? 'selected="selected"' : '';
                    $mltlngg_option_display = $mltlngg_one_language['locale'] == $mltlngg_current_language && count($mltlngg_enabled_languages) > 1 ? ' display: none;' : '';
                    $home = get_option('home');
                    $mltlngg_is_subfolder = mltlngg_is_subfolder();
                    if (is_multisite() && !is_subdomain_install() || $mltlngg_is_subfolder) {
                        if (!$mltlngg_is_subfolder) {
                            if ($current_blog) {
                                $home_main = (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on" ? "https://" : "http://") . $current_blog->domain;
                                $home_main = esc_url($home_main);
                            }
                        } else {
                            $home_dir = str_replace('http://www.', '', $home);
                            $home_dir = str_replace('https://www.', '', $home_dir);
                            $home_dir = str_replace('http://', '', $home_dir);
                            $home_dir = str_replace('https://', '', $home_dir);
                            $server_name = $_SERVER['SERVER_NAME'];
                            if ('www.' == substr($server_name, 0, 4)) {
                                $server_name = substr($server_name, 4);
                            }
                            $home_dir = str_replace($server_name . ':' . $_SERVER['SERVER_PORT'], '', $home_dir);
                            $home_dir = str_replace($server_name, '', $home_dir);
                            $home_dir = rtrim($home_dir, '/ ');
                            $home_dir_count = strlen($home_dir);
                            $home_main = substr($home, 0, -$home_dir_count);
                        }
                        $language_link = $home_main . str_replace_once($mltlngg_current_language, $mltlngg_one_language['locale'], $_SERVER['REQUEST_URI']);
                    } else {
                        $language_link = $home . str_replace_once($mltlngg_current_language, $mltlngg_one_language['locale'], $_SERVER['REQUEST_URI']);
                    }
                    $switcher .= '<option ' . $mltlngg_selected . ' value="' . $language_link . '" style="background-image: url(' . plugins_url('images/flags/', __FILE__) . $mltlngg_one_language['locale'] . '.png); background-repeat: no-repeat; background-position: left center; padding-left: 20px;' . $mltlngg_option_display . '">' . $mltlngg_one_language['name'] . '</option>';
                }
                $switcher .= '</select>';
                break;
            case 'drop-down-icons':
                $switcher .= '<form name="mltlngg_change_language" method="post" action="">
					<ul class="mltlngg-lang-switch">
						<li>
							<img src="' . plugins_url('images/flags/', __FILE__) . $mltlngg_current_language . '.png">
							<ul>';
                foreach ($mltlngg_enabled_languages as $mltlngg_one_lang) {
                    if ($mltlngg_one_lang['locale'] != $mltlngg_current_language) {
                        $switcher .= '<li>
											<button class="mltlngg-lang-button" name="mltlngg_change_display_lang" value="' . $mltlngg_one_lang['locale'] . '" title="' . $mltlngg_one_lang['name'] . '">
												<img class="mltlngg-lang" src="' . plugins_url('images/flags/', __FILE__) . $mltlngg_one_lang['locale'] . '.png" alt="' . $mltlngg_one_lang['name'] . '">
											</button>
										</li>';
                    }
                }
                $switcher .= '</ul>
						</li>
					</ul>
				</form>';
                break;
            case 'flags-icons':
                $switcher .= '<form name="mltlngg_change_language" method="post" action="">';
                foreach ($mltlngg_enabled_languages as $mltlngg_one_lang) {
                    $switcher .= '<button class="mltlngg-lang-button-icons" name="mltlngg_change_display_lang" value="' . $mltlngg_one_lang['locale'] . '" title="' . $mltlngg_one_lang['name'] . '">
							<img class="';
                    $switcher .= $mltlngg_one_lang['locale'] == $mltlngg_current_language ? 'mltlngg-current-lang' : 'mltlngg-lang';
                    $switcher .= '" src="' . plugins_url('images/flags/', __FILE__) . $mltlngg_one_lang['locale'] . '.png" alt="' . $mltlngg_one_lang['name'] . '">
						</button>';
                }
                $switcher .= '</form>';
                break;
        }
        $switcher .= '</div>';
        return $switcher;
    }
 function mltlngg_home_url()
 {
     /* for multisites based on subdomains */
     if (is_multisite() && !is_subdomain_install()) {
         global $current_blog;
         $home_url = (is_ssl() ? "https://" : "http://") . $current_blog->domain;
         $home_url = array(esc_url($home_url), true);
         /* if WP have been installed in subfolder */
     } elseif (mltlngg_is_subfolder()) {
         $home_url = get_option('home');
         $home_dir = str_replace('http://www.', '', $home_url);
         $home_dir = str_replace('https://www.', '', $home_dir);
         $home_dir = str_replace('http://', '', $home_dir);
         $home_dir = str_replace('https://', '', $home_dir);
         $server_name = $_SERVER['SERVER_NAME'];
         if ('www.' == substr($server_name, 0, 4)) {
             $server_name = substr($server_name, 4);
         }
         $home_dir = str_replace($server_name . ':' . $_SERVER['SERVER_PORT'], '', $home_dir);
         $home_dir = str_replace($server_name, '', $home_dir);
         $home_dir = rtrim($home_dir, '/ ');
         $home_dir_count = strlen($home_dir);
         $home_url = array(substr($home_url, 0, -$home_dir_count), true);
         /* in other cases */
     } else {
         $home_url = get_option('home');
     }
     return $home_url;
 }