/**
 * Looks up a translation in domain 'qtranslate', and if it is not there, uses the default WordPress domain to translate.
 * @since 3.4.5.5
*/
function qtranxf_translate($s)
{
    $t = get_translations_for_domain('qtranslate');
    if (isset($t->entries[$s]) && !empty($t->entries[$s]->translations)) {
        return $t->entries[$s]->translations[0];
    }
    return qtranxf_translate_wp($s);
}
function qtranxf_admin_notices_errors()
{
    //qtranxf_dbg_log('"admin_notices": qtranxf_admin_notices_errors: REQUEST_TIME_FLOAT: ', $_SERVER['REQUEST_TIME_FLOAT']);
    $msgs = get_option('qtranslate_config_errors');
    if (!is_array($msgs)) {
        return;
    }
    foreach ($msgs as $key => $msg) {
        echo '<div class="error notice is-dismissible" id="qtranxs_config_error_' . $key . '"><p><a href="' . admin_url('options-general.php?page=qtranslate-x') . '" style="color:magenta">qTranslate&#8209;X</a>:&nbsp;<strong><span style="color: red;">' . qtranxf_translate_wp('Error') . '</span></strong>:&nbsp;' . $msg . '</p></div>';
    }
}
Esempio n. 3
0
function qtranxf_conf()
{
    global $q_config, $wpdb;
    //qtranxf_dbg_log('qtranxf_conf: POST: ',$_POST);
    // do redirection for dashboard
    if (isset($_GET['godashboard'])) {
        echo '<h2>' . __('Switching Language', 'qtranslate') . '</h2>' . sprintf(__('Switching language to %1$s... If the Dashboard isn\'t loading, use this <a href="%2$s" title="Dashboard">link</a>.', 'qtranslate'), $q_config['language_name'][qtranxf_getLanguage()], admin_url()) . '<script type="text/javascript">document.location="' . admin_url() . '";</script>';
        exit;
    }
    // init some needed variables
    $error = '';
    $original_lang = '';
    $language_code = '';
    $language_name = '';
    $language_locale = '';
    $language_date_format = '';
    $language_time_format = '';
    $language_na_message = '';
    $language_flag = '';
    $language_default = '';
    $altered_table = false;
    $message = apply_filters('qtranslate_configuration_pre', array());
    // check for action
    if (isset($_POST['qtranslate_reset']) && isset($_POST['qtranslate_reset2'])) {
        $message[] = __('qTranslate has been reset.', 'qtranslate');
    } elseif (isset($_POST['default_language'])) {
        qtranxf_updateSettings();
        //execute actions
        if (isset($_POST['update_mo_now']) && $_POST['update_mo_now'] == '1') {
            $result = qtranxf_updateGettextDatabases(true);
            if ($result === true) {
                $message[] = __('Gettext databases updated.', 'qtranslate');
            } elseif (is_wp_error($result)) {
                $message[] = __('Gettext databases <strong>not</strong> updated:', 'qtranslate') . ' ' . $result->get_error_message();
            }
        }
        foreach ($_POST as $key => $value) {
            if (!is_string($value)) {
                continue;
            }
            if (!qtranxf_endsWith($key, '-migration')) {
                continue;
            }
            $plugin = substr($key, 0, -strlen('-migration'));
            if ($value == 'import') {
                $nm = '<span style="color:blue"><strong>' . qtranxf_get_plugin_name($plugin) . '</strong></span>';
                $message[] = sprintf(__('Applicable options and taxonomy names from plugin %s have been imported. Note that the multilingual content of posts, pages and other objects has not been altered during this operation. There is no additional operation needed to import content, since its format is compatible with %s.', 'qtranslate'), $nm, 'qTranslate&#8209;X') . ' ' . sprintf(__('It might be a good idea to review %smigration instructions%s, if you have not yet done so.', 'qtranslate'), '<a href="https://qtranslatexteam.wordpress.com/2015/02/24/migration-from-other-multilingual-plugins/" target="_blank">', '</a>');
                $message[] = sprintf(__('%sImportant%s: Before you start making edits to post and pages, please, make sure that both, your front site and admin back-end, work under this configuration. It may help to review "%s" and see if any of conflicting plugins mentioned there are used here. While the current content, coming from %s, is compatible with this plugin, the newly modified posts and pages will be saved with a new square-bracket-only encoding, which has a number of advantages comparing to former %s encoding. However, the new encoding is not straightforwardly compatible with %s and you will need an additional step available under "%s" option if you ever decide to go back to %s. Even with this additional conversion step, the 3rd-party plugins custom-stored data will not be auto-converted, but manual editing will still work. That is why it is advisable to create a test-copy of your site before making any further changes. In case you encounter a problem, please give us a chance to improve %s, send the login information to the test-copy of your site to %s along with a detailed step-by-step description of what is not working, and continue using your main site with %s meanwhile. It would also help, if you share a success story as well, either on %sthe forum%s, or via the same e-mail as mentioned above. Thank you very much for trying %s.', 'qtranslate'), '<span style="color:red">', '</span>', '<a href="https://wordpress.org/plugins/qtranslate-x/other_notes/" target="_blank">' . 'Known Issues' . '</a>', $nm, 'qTranslate', $nm, '<span style="color:magenta">' . __('Convert Database', 'qtranslate') . '</span>', $nm, 'qTranslate&#8209;X', '<a href="mailto:qtranslateteam@gmail.com">qtranslateteam@gmail.com</a>', $nm, '<a href="https://wordpress.org/support/plugin/qtranslate-x">', '</a>', 'qTranslate&#8209;X') . '<br/><small>' . __('This is a one-time message, which you will not see again, unless the same import is repeated.', 'qtranslate') . '</small>';
                if ($plugin == 'mqtranslate') {
                    $message[] = sprintf(__('Option "%s" has also been turned on, as the most common case for importing configuration from %s. You may turn it off manually if your setup does not require it. Refer to %sFAQ%s for more information.', 'qtranslate'), '<span style="color:magenta">' . __('Compatibility Functions', 'qtranslate') . '</span>', $nm, '<a href="https://wordpress.org/plugins/qtranslate-x/faq/" target="_blank">', '</a>');
                }
            } elseif ($value == 'export') {
                $nm = '<span style="color:blue"><strong>' . qtranxf_get_plugin_name($plugin) . '</strong></span>';
                $message[] = sprintf(__('Applicable options have been exported to plugin %s. If you have done some post or page updates after migrating from %s, then "%s" operation is also required to convert the content to "dual language tag" style in order for plugin %s to function.', 'qtranslate'), $nm, $nm, '<span style="color:magenta">' . __('Convert Database', 'qtranslate') . '</span>', $nm);
            }
        }
        if (isset($_POST['convert_database'])) {
            $msg = qtranxf_convert_database($_POST['convert_database']);
            if ($msg) {
                $message[] = $msg;
            }
        }
    }
    if (isset($_POST['original_lang'])) {
        // validate form input
        $lang = sanitize_text_field($_POST['language_code']);
        if ($_POST['language_na_message'] == '') {
            $error = __('The Language must have a Not-Available Message!', 'qtranslate');
        }
        if (strlen($_POST['language_locale']) < 2) {
            $error = __('The Language must have a Locale!', 'qtranslate');
        }
        if ($_POST['language_name'] == '') {
            $error = __('The Language must have a name!', 'qtranslate');
        }
        if (strlen($lang) != 2) {
            $error = __('Language Code has to be 2 characters long!', 'qtranslate');
        }
        //$lang = strtolower($lang);
        //$language_names = qtranxf_language_configured('language_name');
        $langs = array();
        qtranxf_load_languages($langs);
        $language_names = $langs['language_name'];
        if ($_POST['original_lang'] == '' && $error == '') {
            // new language
            if (isset($language_names[$lang])) {
                $error = __('There is already a language with the same Language Code!', 'qtranslate');
            }
        }
        if ($_POST['original_lang'] != '' && $error == '') {
            // language update
            if ($lang != $_POST['original_lang'] && isset($language_names[$lang])) {
                $error = __('There is already a language with the same Language Code!', 'qtranslate');
            } else {
                if ($lang != $_POST['original_lang']) {
                    // remove old language
                    qtranxf_unsetLanguage($langs, $_POST['original_lang']);
                    qtranxf_unsetLanguage($q_config, $_POST['original_lang']);
                }
                if (in_array($_POST['original_lang'], $q_config['enabled_languages'])) {
                    // was enabled, so set modified one to enabled too
                    for ($i = 0; $i < sizeof($q_config['enabled_languages']); $i++) {
                        if ($q_config['enabled_languages'][$i] == $_POST['original_lang']) {
                            $q_config['enabled_languages'][$i] = $lang;
                        }
                    }
                }
                if ($_POST['original_lang'] == $q_config['default_language']) {
                    // was default, so set modified the default
                    $q_config['default_language'] = $lang;
                }
            }
        }
        /**
        	@since 3.2.9.5
        	In earlier versions the 'if' below used to work correctly, but magic_quotes has been removed from PHP for a while, and 'if(get_magic_quotes_gpc())' is now always 'false'.
        	However, WP adds magic quotes anyway via call to add_magic_quotes() in
        	./wp-includes/load.php:function wp_magic_quotes()
        	called from
        	./wp-settings.php: wp_magic_quotes()
        	Then it looks like we have to always 'stripslashes' now, although it is dangerous, since applying 'stripslashes' twice messes it up.
        	This problem reveals when, for example, '\a' format is in use.
        	Possible test for '\' character, instead of 'get_magic_quotes_gpc()' can be 'strpos($_POST['language_date_format'],'\\\\')' for this particular case.
        	If Wordpress ever decides to remove calls to wp_magic_quotes, then this place will be in trouble again.
        	Discussions:
        	http://wordpress.stackexchange.com/questions/21693/wordpress-and-magic-quotes
        */
        //if(get_magic_quotes_gpc()) {
        //qtranxf_dbg_log('get_magic_quotes_gpc: before REQUEST[language_date_format]=',$_REQUEST['language_date_format']);
        //qtranxf_dbg_log('get_magic_quotes_gpc: before POST[language_date_format]=',$_POST['language_date_format']);
        //qtranxf_dbg_log('pos=',strpos($_POST['language_date_format'],'\\\\'));//shows a number
        if (isset($_POST['language_date_format'])) {
            $_POST['language_date_format'] = stripslashes($_POST['language_date_format']);
        }
        if (isset($_POST['language_time_format'])) {
            $_POST['language_time_format'] = stripslashes($_POST['language_time_format']);
        }
        //qtranxf_dbg_log('pos=',strpos($_POST['language_date_format'],'\\\\'));//shows false
        //qtranxf_dbg_log('get_magic_quotes_gpc: after REQUEST[language_date_format]=',$_REQUEST['language_date_format']);
        //qtranxf_dbg_log('get_magic_quotes_gpc: after POST[language_date_format]=',$_POST['language_date_format']);
        //}
        if ($error == '') {
            // everything is fine, insert language
            $q_config['language_name'][$lang] = sanitize_text_field($_POST['language_name']);
            $q_config['flag'][$lang] = sanitize_text_field($_POST['language_flag']);
            $q_config['locale'][$lang] = sanitize_text_field($_POST['language_locale']);
            $q_config['date_format'][$lang] = sanitize_text_field($_POST['language_date_format']);
            $q_config['time_format'][$lang] = sanitize_text_field($_POST['language_time_format']);
            $q_config['not_available'][$lang] = wp_kses_data($_POST['language_na_message']);
            qtranxf_copyLanguage($langs, $q_config, $lang);
            qtranxf_save_languages($langs);
        }
        if ($error != '' || isset($_GET['edit'])) {
            // get old values in the form
            $original_lang = sanitize_text_field($_POST['original_lang']);
            $language_code = $lang;
            $language_name = sanitize_text_field($_POST['language_name']);
            $language_locale = sanitize_text_field($_POST['language_locale']);
            $language_date_format = sanitize_text_field($_POST['language_date_format']);
            $language_time_format = sanitize_text_field($_POST['language_time_format']);
            $language_na_message = wp_kses_data($_POST['language_na_message']);
            $language_flag = sanitize_text_field($_POST['language_flag']);
            $language_default = isset($_POST['language_default']) ? sanitize_text_field($_POST['language_default']) : $q_config['default_language'];
        }
    } elseif (isset($_GET['convert'])) {
        // update language tags
        global $wpdb;
        $wpdb->show_errors();
        $cnt = 0;
        //this will not work correctly if set of languages is different
        foreach ($q_config['enabled_languages'] as $lang) {
            $cnt += $wpdb->query('UPDATE ' . $wpdb->posts . ' set post_title = REPLACE(post_title, "[lang_' . $lang . ']","[:' . $lang . ']"),  post_content = REPLACE(post_content, "[lang_' . $lang . ']","[:' . $lang . ']")');
            $wpdb->query('UPDATE ' . $wpdb->posts . ' set post_title = REPLACE(post_title, "[/lang_' . $lang . ']","[:]"),  post_content = REPLACE(post_content, "[/lang_' . $lang . ']","[:]")');
        }
        if ($cnt > 0) {
            $message[] = sprintf(__('%d database entries have been converted.', 'qtranslate'), $cnt);
        } else {
            $message[] = __('No database entry has been affected while processing the conversion request.', 'qtranslate');
        }
    } elseif (isset($_GET['markdefault'])) {
        // update language tags
        global $wpdb;
        $wpdb->show_errors();
        $result = $wpdb->get_results('SELECT ID, post_content, post_title, post_excerpt, post_type FROM ' . $wpdb->posts . ' WHERE post_status = \'publish\' AND  (post_type = \'post\' OR post_type = \'page\') AND NOT (post_content LIKE \'%<!--:-->%\' OR post_title LIKE \'%<!--:-->%\' OR post_content LIKE \'%![:!]%\' ESCAPE \'!\' OR post_title LIKE \'%![:!]%\' ESCAPE \'!\')');
        if (is_array($result)) {
            $cnt_page = 0;
            $cnt_post = 0;
            foreach ($result as $post) {
                $title = qtranxf_mark_default($post->post_title);
                $content = qtranxf_mark_default($post->post_content);
                $excerpt = qtranxf_mark_default($post->post_excerpt);
                if ($title == $post->post_title && $content == $post->post_content && $excerpt == $post->post_excerpt) {
                    continue;
                }
                switch ($post->post_type) {
                    case 'post':
                        ++$cnt_post;
                        break;
                    case 'page':
                        ++$cnt_page;
                        break;
                }
                //qtranxf_dbg_log('markdefault:'. PHP_EOL .'title old: '.$post->post_title. PHP_EOL .'title new: '.$title. PHP_EOL .'content old: '.$post->post_content. PHP_EOL .'content new: '.$content); continue;
                $wpdb->query($wpdb->prepare('UPDATE ' . $wpdb->posts . ' set post_content = %s, post_title = %s, post_excerpt = %s WHERE ID = %d', $content, $title, $excerpt, $post->ID));
            }
            if ($cnt_page > 0) {
                $message[] = sprintf(__('%d pages have been processed to set the default language.', 'qtranslate'), $cnt_page);
            } else {
                $message[] = __('No initially untranslated pages found to set the default language', 'qtranslate');
            }
            if ($cnt_post > 0) {
                $message[] = sprintf(__('%d posts have been processed to set the default language.', 'qtranslate'), $cnt_post);
            } else {
                $message[] = __('No initially untranslated posts found to set the default language.', 'qtranslate');
            }
            $message[] = sprintf(__('Post types other than "post" or "page", as well as unpublished entries, will have to be adjusted manually as needed, since there is no common way to automate setting the default language otherwise. It can be done with a custom script though. You may request a %spaid support%s for this.', 'qtranslate'), '<a href="https://qtranslatexteam.wordpress.com/contact-us/">', '</a>');
        }
    } elseif (isset($_GET['edit'])) {
        $lang = $_GET['edit'];
        $original_lang = $lang;
        $language_code = $lang;
        //$langs = $q_config;
        $langs = array();
        qtranxf_languages_configured($langs);
        $language_name = isset($langs['language_name'][$lang]) ? $langs['language_name'][$lang] : '';
        $language_locale = isset($langs['locale'][$lang]) ? $langs['locale'][$lang] : '';
        $language_date_format = isset($langs['date_format'][$lang]) ? $langs['date_format'][$lang] : '';
        $language_time_format = isset($langs['time_format'][$lang]) ? $langs['time_format'][$lang] : '';
        $language_na_message = isset($langs['not_available'][$lang]) ? $langs['not_available'][$lang] : '';
        $language_flag = isset($langs['flag'][$lang]) ? $langs['flag'][$lang] : '';
    } elseif (isset($_GET['delete'])) {
        $lang = $_GET['delete'];
        // validate delete (protect code)
        //if($q_config['default_language']==$lang) $error = 'Cannot delete Default Language!';
        //if(!isset($q_config['language_name'][$lang])||strtolower($lang)=='code') $error = __('No such language!', 'qtranslate');
        if (empty($error)) {
            // everything seems fine, delete language
            $error = qtranxf_deleteLanguage($lang);
        }
    } elseif (isset($_GET['enable'])) {
        $lang = $_GET['enable'];
        // enable validate
        if (!qtranxf_enableLanguage($lang)) {
            $error = __('Language is already enabled or invalid!', 'qtranslate');
        }
    } elseif (isset($_GET['disable'])) {
        $lang = $_GET['disable'];
        // enable validate
        if ($lang == $q_config['default_language']) {
            $error = __('Cannot disable Default Language!', 'qtranslate');
        }
        if (!qtranxf_isEnabled($lang)) {
            if (!isset($q_config['language_name'][$lang])) {
                $error = __('No such language!', 'qtranslate');
            }
        }
        // everything seems fine, disable language
        if ($error == '' && !qtranxf_disableLanguage($lang)) {
            $error = __('Language is already disabled!', 'qtranslate');
        }
    } elseif (isset($_GET['moveup'])) {
        $languages = qtranxf_getSortedLanguages();
        $msg = __('No such language!', 'qtranslate');
        foreach ($languages as $key => $language) {
            if ($language != $_GET['moveup']) {
                continue;
            }
            if ($key == 0) {
                $msg = __('Language is already first!', 'qtranslate');
                break;
            }
            $languages[$key] = $languages[$key - 1];
            $languages[$key - 1] = $language;
            $q_config['enabled_languages'] = $languages;
            $msg = __('New order saved.', 'qtranslate');
            break;
        }
        $message[] = $msg;
    } elseif (isset($_GET['movedown'])) {
        $languages = qtranxf_getSortedLanguages();
        $msg = __('No such language!', 'qtranslate');
        foreach ($languages as $key => $language) {
            if ($language != $_GET['movedown']) {
                continue;
            }
            if ($key == sizeof($languages) - 1) {
                $msg = __('Language is already last!', 'qtranslate');
                break;
            }
            $languages[$key] = $languages[$key + 1];
            $languages[$key + 1] = $language;
            $q_config['enabled_languages'] = $languages;
            $msg = __('New order saved.', 'qtranslate');
            break;
        }
        $message[] = $msg;
    }
    $everything_fine = (isset($_POST['submit']) || isset($_GET['delete']) || isset($_GET['enable']) || isset($_GET['disable']) || isset($_GET['moveup']) || isset($_GET['movedown'])) && $error == '';
    if ($everything_fine) {
        // settings might have changed, so save
        qtranxf_saveConfig();
        if (empty($message)) {
            $message[] = __('Options saved.', 'qtranslate');
        }
    }
    if ($q_config['auto_update_mo']) {
        if (!is_dir(WP_LANG_DIR) || !($ll = @fopen(trailingslashit(WP_LANG_DIR) . 'qtranslate.test', 'a'))) {
            $error = sprintf(__('Could not write to "%s", Gettext Databases could not be downloaded!', 'qtranslate'), WP_LANG_DIR);
        } else {
            @fclose($ll);
            @unlink(trailingslashit(WP_LANG_DIR) . 'qtranslate.test');
        }
    }
    // don't accidentally delete/enable/disable twice
    $clean_uri = preg_replace("/&(delete|enable|disable|convert|markdefault|moveup|movedown)=[^&#]*/i", "", $_SERVER['REQUEST_URI']);
    $clean_uri = apply_filters('qtranslate_clean_uri', $clean_uri);
    // Generate XHTML
    $plugindir = dirname(plugin_basename(QTRANSLATE_FILE));
    $pluginurl = WP_PLUGIN_URL . '/' . $plugindir;
    if (!empty($message)) {
        foreach ($message as $msg) {
            ?>
<div id="message" class="updated fade"><p><strong><?php 
            echo $msg;
            ?>
</strong></p></div>
<?php 
        }
    }
    if ($error != '') {
        ?>
<div id="message" class="error fade"><p><strong><?php 
        echo $error;
        ?>
</strong></p></div>
<?php 
    }
    ?>

<?php 
    if (isset($_GET['edit'])) {
        ?>
<div class="wrap">
<h2><?php 
        _e('Edit Language', 'qtranslate');
        ?>
</h2>
<form action="" method="post" id="qtranxs-edit-language">
<?php 
        qtranxf_language_form($language_code, $language_code, $language_name, $language_locale, $language_date_format, $language_time_format, $language_flag, $language_na_message, $language_default, $original_lang);
        ?>
<p class="submit"><input type="submit" name="submit" value="<?php 
        _e('Save Changes &raquo;', 'qtranslate');
        ?>
" /></p>
</form>
<p><small><a href="<?php 
        echo admin_url('options-general.php?page=qtranslate-x');
        ?>
"><?php 
        _e('back to configuration page', 'qtranslate');
        ?>
</a></small></p>
</div>
<?php 
    } else {
        ?>
<div class="wrap">
<h2><?php 
        _e('Language Management (qTranslate Configuration)', 'qtranslate');
        ?>
</h2>
<small><?php 
        printf(__('For help on how to configure qTranslate correctly, take a look at the <a href="%1$s">qTranslate FAQ</a> and the <a href="%2$s">Support Forum</a>.', 'qtranslate'), 'https://qtranslatexteam.wordpress.com/faq/', 'https://wordpress.org/support/plugin/qtranslate-x');
        ?>
</small>
	<form action="<?php 
        echo $clean_uri;
        ?>
" method="post">
	<?php 
        qtranxf_admin_section_start(__('General Settings', 'qtranslate'), 'general');
        //id="qtranslate-admin-general"
        ?>
		<table class="form-table">
			<tr>
				<th scope="row"><?php 
        _e('Default Language / Order', 'qtranslate');
        ?>
</th>
				<td>
					<fieldset id="qtranxs-languages-menu"><legend class="hidden"><?php 
        _e('Default Language', 'qtranslate');
        ?>
</legend>
				<?php 
        $flag_location = qtranxf_flag_location();
        foreach (qtranxf_getSortedLanguages() as $key => $language) {
            echo '<label title="' . $q_config['language_name'][$language] . '"><input type="radio" name="default_language" value="' . $language . '"';
            checked($language, $q_config['default_language']);
            echo ' />';
            echo ' <a href="' . add_query_arg('moveup', $language, $clean_uri) . '"><img src="' . $pluginurl . '/arrowup.png" alt="up" /></a>';
            echo ' <a href="' . add_query_arg('movedown', $language, $clean_uri) . '"><img src="' . $pluginurl . '/arrowdown.png" alt="down" /></a>';
            echo ' <img src="' . $flag_location . $q_config['flag'][$language] . '" alt="' . $q_config['language_name'][$language] . '" /> ';
            echo ' ' . $q_config['language_name'][$language] . '</label><br/>' . PHP_EOL;
        }
        ?>
					<small><?php 
        printf(__('Choose the default language of your blog. This is the language which will be shown on %s. You can also change the order the languages by clicking on the arrows above.', 'qtranslate'), get_bloginfo('url'));
        ?>
</small>
					</fieldset>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
        _e('Untranslated Content', 'qtranslate');
        ?>
</th>
				<td>
					<p><?php 
        printf(__('The choices below define how to handle untranslated content at front-end of the site. A content of a page or a post is considered untranslated if the main text (%s) is empty for a given language, regardless of other fields like title, excerpt, etc. All three options are independent of each other.', 'qtranslate'), 'post_content');
        ?>
</p>
					<br/>
					<label for="hide_untranslated"><input type="checkbox" name="hide_untranslated" id="hide_untranslated" value="1"<?php 
        checked($q_config['hide_untranslated']);
        ?>
/> <?php 
        _e('Hide Content which is not available for the selected language.', 'qtranslate');
        ?>
</label>
					<br/>
					<small><?php 
        _e('When checked, posts will be hidden if the content is not available for the selected language. If unchecked, a message will appear showing all the languages the content is available in.', 'qtranslate');
        ?>
					<?php 
        _e('The message about available languages for the content of a post or a page may also appear if a single post display with an untranslated content if viewed directly.', 'qtranslate');
        ?>
					<?php 
        printf(__('This function will not work correctly if you installed %s on a blog with existing entries. In this case you will need to take a look at option "%s" under "%s" section.', 'qtranslate'), 'qTranslate', __('Convert Database', 'qtranslate'), __('Import', 'qtranslate') . '/' . __('Export', 'qtranslate'));
        ?>
</small>
					<br/><br/>
					<label for="show_displayed_language_prefix"><input type="checkbox" name="show_displayed_language_prefix" id="show_displayed_language_prefix" value="1"<?php 
        checked($q_config['show_displayed_language_prefix']);
        ?>
/> <?php 
        _e('Show displayed language prefix when content is not available for the selected language.', 'qtranslate');
        ?>
</label>
					<br/>
					<small><?php 
        _e('This is relevant to all fields other than the main content of posts and pages. Such untranslated fields are always shown in an alternative available language, and will be prefixed with the language name in parentheses, if this option is on.', 'qtranslate');
        ?>
</small>
					<br/><br/>
					<label for="show_alternative_content"><input type="checkbox" name="show_alternative_content" id="show_alternative_content" value="1"<?php 
        checked($q_config['show_alternative_content']);
        ?>
/> <?php 
        _e('Show content in an alternative language when translation is not available for the selected language.', 'qtranslate');
        ?>
</label>
					<br/>
					<small><?php 
        printf(__('When a page or a post with an untranslated content is viewed, a message with a list of other available languages is displayed, in which languages are ordered as defined by option "%s". If this option is on, then the content in default language will also be shown, instead of the expected language, for the sake of user convenience. If default language is not available for the content, then the content in the first available language is shown.', 'qtranslate'), __('Default Language / Order', 'qtranslate'));
        ?>
</small>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
        _e('Detect Browser Language', 'qtranslate');
        ?>
</th>
				<td>
					<label for="detect_browser_language"><input type="checkbox" name="detect_browser_language" id="detect_browser_language" value="1"<?php 
        checked($q_config['detect_browser_language']);
        ?>
/> <?php 
        _e('Detect the language of the browser and redirect accordingly.', 'qtranslate');
        ?>
</label>
					<br/>
					<small><?php 
        _e('When the frontpage is visited via bookmark/external link/type-in, the visitor will be forwarded to the correct URL for the language specified by his browser.', 'qtranslate');
        ?>
</small>
				</td>
			</tr>
		</table>
	<?php 
        qtranxf_admin_section_end('general');
        ?>
	<?php 
        qtranxf_admin_section_start(__('Advanced Settings', 'qtranslate'), 'advanced');
        //id="qtranslate-admin-advanced"
        $permalink_is_query = qtranxf_is_permalink_structure_query();
        //qtranxf_dbg_echo('$permalink_is_query: ',$permalink_is_query);
        $url_mode = $q_config['url_mode'];
        ?>
		<table class="form-table">
			<tr>
				<th scope="row"><?php 
        _e('URL Modification Mode', 'qtranslate');
        ?>
</th>
				<td>
					<fieldset><legend class="hidden"><?php 
        _e('URL Modification Mode', 'qtranslate');
        ?>
</legend>
						<label title="Query Mode"><input type="radio" name="url_mode" value="<?php 
        echo QTX_URL_QUERY;
        ?>
" <?php 
        checked($url_mode, QTX_URL_QUERY);
        ?>
 /> <?php 
        echo __('Use Query Mode (?lang=en)', 'qtranslate') . '. ' . __('Most SEO unfriendly, not recommended.', 'qtranslate');
        ?>
</label><br/>
					<?php 
        /*
        							if($permalink_is_query) {
        								echo '<br/>'.PHP_EOL;
        								printf(__('No other URL Modification Modes are available if permalink structure is set to "Default" on configuration page %sPermalink Setting%s. It is SEO advantageous to use some other permalink mode, which will enable more URL Modification Modes here as well.', 'qtranslate'),'<a href="'.admin_url('options-permalink.php').'">', '</a>');
        								echo PHP_EOL.'<br/><br/>'.PHP_EOL;
        							}else{ */
        ?>
						<label title="Pre-Path Mode"><input type="radio" name="url_mode" value="<?php 
        echo QTX_URL_PATH;
        ?>
" <?php 
        checked($url_mode, QTX_URL_PATH);
        disabled($permalink_is_query);
        ?>
 /> <?php 
        echo __('Use Pre-Path Mode (Default, puts /en/ in front of URL)', 'qtranslate') . '. ' . __('SEO friendly.', 'qtranslate');
        ?>
</label><br/>
						<label title="Pre-Domain Mode"><input type="radio" name="url_mode" value="<?php 
        echo QTX_URL_DOMAIN;
        ?>
" <?php 
        checked($url_mode, QTX_URL_DOMAIN);
        ?>
 /> <?php 
        echo __('Use Pre-Domain Mode (uses http://en.yoursite.com)', 'qtranslate') . '. ' . __('You will need to configure DNS sub-domains on your site.', 'qtranslate');
        ?>
</label><br/>
					<?php 
        /*
        						<small><?php _e('Pre-Path and Pre-Domain mode will only work with mod_rewrite/pretty permalinks. Additional Configuration is needed for Pre-Domain mode or Per-Domain mode.', 'qtranslate'); ?></small><br/><br/>
        							} */
        ?>
						<label for="hide_default_language"><input type="checkbox" name="hide_default_language" id="hide_default_language" value="1"<?php 
        checked($q_config['hide_default_language']);
        ?>
/> <?php 
        _e('Hide URL language information for default language.', 'qtranslate');
        ?>
</label><br/>
						<small><?php 
        _e('This is only applicable to Pre-Path and Pre-Domain mode.', 'qtranslate');
        ?>
</small><br/><br/>
					<?php 
        //if(!$permalink_is_query) {
        do_action('qtranslate_url_mode_choices', $permalink_is_query);
        ?>
						<label title="Per-Domain Mode"><input type="radio" name="url_mode" value="<?php 
        echo QTX_URL_DOMAINS;
        ?>
" <?php 
        checked($url_mode, QTX_URL_DOMAINS);
        ?>
 /> <?php 
        echo __('Use Per-Domain mode: specify separate user-defined domain for each language.', 'qtranslate');
        ?>
</label>
					<?php 
        //}
        ?>
					</fieldset>
				</td>
			</tr>
	<?php 
        /*
        			<tr valign="top">
        				<td style="text-align: right"><?php echo __('Hide Default Language', 'qtranslate').':'; ?></td>
        				<td>
        				</td>
        			</tr>
        */
        if ($url_mode == QTX_URL_DOMAINS) {
            $homeinfo = qtranxf_get_home_info();
            $home_host = $homeinfo['host'];
            //parse_url(get_option('home'),PHP_URL_HOST);
            foreach ($q_config['enabled_languages'] as $lang) {
                $id = 'language_domain_' . $lang;
                $domain = isset($q_config['domains'][$lang]) ? $q_config['domains'][$lang] : $lang . '.' . $home_host;
                echo '<tr><td style="text-align: right">' . __('Domain for', 'qtranslate') . ' <a href="' . $clean_uri . '&edit=' . $lang . '">' . $q_config['language_name'][$lang] . '</a>&nbsp;(' . $lang . '):</td><td><input type="text" name="' . $id . '" id="' . $id . '" value="' . $domain . '" style="width:100%"/></td></tr>' . PHP_EOL;
            }
        }
        ?>
			<tr valign="top">
				<th scope="row"><?php 
        _e('Post Types', 'qtranslate');
        ?>
</th>
				<td>
					<label for="post_types"><?php 
        _e('Post types enabled for translation:', 'qtranslate');
        ?>
</label><p>
					<?php 
        $post_types = get_post_types();
        foreach ($post_types as $post_type) {
            if (!qtranxf_post_type_optional($post_type)) {
                continue;
            }
            $post_type_off = isset($q_config['post_type_excluded']) && in_array($post_type, $q_config['post_type_excluded']);
            ?>
					<span style="margin-right: 12pt"><input type="checkbox" name="post_types[<?php 
            echo $post_type;
            ?>
]" id="post_type_<?php 
            echo $post_type;
            ?>
" value="1"<?php 
            checked(!$post_type_off);
            ?>
 />&nbsp;<?php 
            echo $post_type;
            ?>
</span>
					<?php 
        }
        ?>
					</p><p><small><?php 
        _e('If a post type unchecked, no fields in a post of that type are treated as translatable on editing pages. However, the manual raw multilingual entries with language tags may still get translated in a usual way at front-end.', 'qtranslate');
        ?>
</small></p>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
        _e('Flag Image Path', 'qtranslate');
        ?>
</th>
				<td>
					<?php 
        echo trailingslashit(WP_CONTENT_URL);
        ?>
<input type="text" name="flag_location" id="flag_location" value="<?php 
        echo $q_config['flag_location'];
        ?>
" style="width:100%"/>
					<br/>
					<small><?php 
        printf(__('Path to the flag images under wp-content, with trailing slash. (Default: %s, clear the value above to reset it to the default)', 'qtranslate'), qtranxf_flag_location_default());
        ?>
</small>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
        _e('Ignore Links', 'qtranslate');
        ?>
</th>
				<td>
					<input type="text" name="ignore_file_types" id="ignore_file_types" value="<?php 
        echo implode(',', array_diff($q_config['ignore_file_types'], explode(',', QTX_IGNORE_FILE_TYPES)));
        ?>
" style="width:100%"/>
					<br/>
					<small><?php 
        printf(__('Don\'t convert links to files of the given file types. (Always included: %s)', 'qtranslate'), implode(', ', explode(',', QTX_IGNORE_FILE_TYPES)));
        ?>
</small>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
        _e('Head inline CSS', 'qtranslate');
        ?>
</th>
				<td>
					<label for="header_css_on"><input type="checkbox" name="header_css_on" id="header_css_on" value="1"<?php 
        checked($q_config['header_css_on']);
        ?>
 />&nbsp;<?php 
        _e('CSS code added by plugin in the head of front-end pages:', 'qtranslate');
        ?>
</label>
					<br />
					<textarea id="header_css" name="header_css" style="width:100%"><?php 
        echo esc_textarea($q_config['header_css']);
        ?>
</textarea>
					<br />
					<small><?php 
        echo __('To reset to default, clear the text.', 'qtranslate') . ' ' . __('To disable this inline CSS, clear the check box.', 'qtranslate');
        ?>
</small>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
        _e('Cookie Settings', 'qtranslate');
        ?>
</th>
				<td>
					<label for="disable_client_cookies"><input type="checkbox" name="disable_client_cookies" id="disable_client_cookies" value="1"<?php 
        checked($q_config['disable_client_cookies']);
        disabled($url_mode == QTX_URL_DOMAIN || $url_mode == QTX_URL_DOMAINS);
        ?>
 /> <?php 
        printf(__('Disable language client cookie "%s" (not recommended).', 'qtranslate'), QTX_COOKIE_NAME_FRONT);
        ?>
</label>
					<br />
					<small><?php 
        echo sprintf(__('Language cookie is auto-disabled for "%s" "Pre-Domain" and "Per-Domain", as language is always unambiguously defined by a url in those modes.', 'qtranslate'), __('URL Modification Mode', 'qtranslate')) . ' ' . sprintf(__('Otherwise, use this option with a caution, for simple enough sites only. If checked, the user choice of browsing language will not be saved between sessions and some AJAX calls may deliver unexpected language, as well as some undesired language switching during browsing may occur under certain themes (%sRead More%s).', 'qtranslate'), '<a href="https://qtranslatexteam.wordpress.com/2015/02/26/browser-redirection-based-on-language/" target="_blank">', '</a>');
        ?>
</small>
					<br /><br />
					<label for="use_secure_cookie"><input type="checkbox" name="use_secure_cookie" id="use_secure_cookie" value="1"<?php 
        checked($q_config['use_secure_cookie']);
        ?>
 /><?php 
        printf(__('Make %s cookies available only through HTTPS connections.', 'qtranslate'), 'qTranslate&#8209;X');
        ?>
</label>
					<br />
					<small><?php 
        _e("Don't check this if you don't know what you're doing!", 'qtranslate');
        ?>
</small>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
        _e('Update Gettext Databases', 'qtranslate');
        ?>
</th>
				<td>
					<label for="auto_update_mo"><input type="checkbox" name="auto_update_mo" id="auto_update_mo" value="1"<?php 
        checked($q_config['auto_update_mo']);
        ?>
/> <?php 
        _e('Automatically check for .mo-Database Updates of installed languages.', 'qtranslate');
        ?>
</label>
					<br/>
					<label for="update_mo_now"><input type="checkbox" name="update_mo_now" id="update_mo_now" value="1" /> <?php 
        _e('Update Gettext databases now.', 'qtranslate');
        ?>
</label>
					<br/>
					<small><?php 
        _e('qTranslate will query the Wordpress Localisation Repository every week and download the latest Gettext Databases (.mo Files).', 'qtranslate');
        ?>
</small>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
        _e('Date / Time Conversion', 'qtranslate');
        ?>
</th>
				<td>
					<label><input type="radio" name="use_strftime" value="<?php 
        echo QTX_DATE;
        ?>
" <?php 
        checked($q_config['use_strftime'], QTX_DATE);
        ?>
/> <?php 
        _e('Use emulated date function.', 'qtranslate');
        ?>
</label><br/>
					<label><input type="radio" name="use_strftime" value="<?php 
        echo QTX_DATE_OVERRIDE;
        ?>
" <?php 
        checked($q_config['use_strftime'], QTX_DATE_OVERRIDE);
        ?>
/> <?php 
        _e('Use emulated date function and replace formats with the predefined formats for each language.', 'qtranslate');
        ?>
</label><br/>
					<label><input type="radio" name="use_strftime" value="<?php 
        echo QTX_STRFTIME;
        ?>
" <?php 
        checked($q_config['use_strftime'], QTX_STRFTIME);
        ?>
/> <?php 
        _e('Use strftime instead of date.', 'qtranslate');
        ?>
</label><br/>
					<label><input type="radio" name="use_strftime" value="<?php 
        echo QTX_STRFTIME_OVERRIDE;
        ?>
" <?php 
        checked($q_config['use_strftime'], QTX_STRFTIME_OVERRIDE);
        ?>
/> <?php 
        _e('Use strftime instead of date and replace formats with the predefined formats for each language.', 'qtranslate');
        ?>
</label><br/>
					<small><?php 
        _e('Depending on the mode selected, additional customizations of the theme may be needed.', 'qtranslate');
        ?>
</small>
					<?php 
        /*
        <br/><br/>
        <label><?php _e('If one of the above options "... replace formats with the predefined formats for each language" is in use, then exclude the following formats from being overridden:', 'qtranslate'); ?></label><br/>
        <input type="text" name="ex_date_formats" id="qtranxs_ex_date_formats" value="<?php echo isset($q_config['ex_date_formats']) ? implode(' ',$q_config['ex_date_formats']) : QTX_EX_DATE_FORMATS_DEFAULT; ?>" style="width:100%"><br/>
        */
        ?>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
        _e('Translation of options', 'qtranslate');
        ?>
</th>
				<td>
					<label for="filter_options_mode_all"><input type="radio" name="filter_options_mode" id="filter_options_mode_all" value=<?php 
        echo '"' . QTX_FILTER_OPTIONS_ALL . '"';
        checked($q_config['filter_options_mode'], QTX_FILTER_OPTIONS_ALL);
        ?>
 /> <?php 
        _e('Filter all WordPress options for translation at front-end. It may hurt performance of the site, but ensures that all options are translated.', 'qtranslate');
        ?>
 <?php 
        _e('Starting from version 3.2.5, only options with multilingual content get filtered, which should help on performance issues.', 'qtranslate');
        ?>
</label>
					<br />
					<label for="filter_options_mode_list"><input type="radio" name="filter_options_mode" id="filter_options_mode_list" value=<?php 
        echo '"' . QTX_FILTER_OPTIONS_LIST . '"';
        checked($q_config['filter_options_mode'], QTX_FILTER_OPTIONS_LIST);
        ?>
 /> <?php 
        _e('Translate only options listed below (for experts only):', 'qtranslate');
        ?>
 </label>
					<br />
					<input type="text" name="filter_options" id="qtranxs_filter_options" value="<?php 
        echo isset($q_config['filter_options']) ? implode(' ', $q_config['filter_options']) : QTX_FILTER_OPTIONS_DEFAULT;
        ?>
" style="width:100%"><br/>
					<small><?php 
        printf(__('By default, all options are filtered to be translated at front-end for the sake of simplicity of configuration. However, for a developed site, this may cause a considerable performance degradation. Normally, there are very few options, which actually need a translation. You may simply list them above to minimize the performance impact, while still getting translations needed. Options names must match the field "%s" of table "%s" of WordPress database. A minimum common set of option, normally needed a translation, is already entered in the list above as a default example. Option names in the list may contain wildcard with symbol "%s".', 'qtranslate'), 'option_name', 'options', '%');
        ?>
</small>
				</td>
			</tr>
			<tr valign="top" id="option_editor_mode">
				<th scope="row"><?php 
        _e('Editor Mode', 'qtranslate');
        ?>
</th>
				<td>
					<label for="qtranxs_editor_mode_lsb"><input type="radio" name="editor_mode" id="qtranxs_editor_mode_lsb" value="<?php 
        echo QTX_EDITOR_MODE_LSB;
        ?>
"<?php 
        checked($q_config['editor_mode'], QTX_EDITOR_MODE_LSB);
        ?>
/>&nbsp;<?php 
        _e('Use Language Switching Buttons (LSB).', 'qtranslate');
        ?>
</label><br/>
					<small><?php 
        echo __('This is the default mode.', 'qtranslate') . ' ' . __('Pages with translatable fields have Language Switching Buttons, which control what language is being edited, while admin language stays the same.', 'qtranslate');
        ?>
</small><br/><br/>
					<label for="qtranxs_editor_mode_raw"><input type="radio" name="editor_mode" id="qtranxs_editor_mode_raw" value="<?php 
        echo QTX_EDITOR_MODE_RAW;
        ?>
"<?php 
        checked($q_config['editor_mode'], QTX_EDITOR_MODE_RAW);
        ?>
/>&nbsp;<?php 
        _e('Editor Raw Mode', 'qtranslate');
        ?>
. <?php 
        _e('Do not use Language Switching Buttons to edit multi-language text entries.', 'qtranslate');
        ?>
</label><br/>
					<small><?php 
        _e('Some people prefer to edit the raw entries containing all languages together separated by language defining tags, as they are stored in database.', 'qtranslate');
        ?>
</small><br/><br/>
					<label for="qtranxs_editor_mode_single"><input type="radio" name="editor_mode" id="qtranxs_editor_mode_single" value="<?php 
        echo QTX_EDITOR_MODE_SINGLGE;
        ?>
"<?php 
        checked($q_config['editor_mode'], QTX_EDITOR_MODE_SINGLGE);
        ?>
/>&nbsp;<?php 
        echo __('Single Language Mode.', 'qtranslate') . ' ' . __('The language edited is the same as admin language.', 'qtranslate');
        ?>
</label><br/>
					<small><?php 
        echo __('Edit language cannot be switched without page re-loading. Try this mode, if some of the advanced translatable fields do not properly respond to the Language Switching Buttons due to incompatibility with a plugin, which severely alters the default WP behaviour. This mode is the most compatible with other themes and plugins.', 'qtranslate') . ' ' . __('One may find convenient to use the default Editor Mode, while remembering not to switch edit languages on custom advanced translatable fields, where LSB do not work.', 'qtranslate');
        ?>
</small>
				</td>
			</tr>
			<?php 
        $options = qtranxf_fetch_file_selection(dirname(__FILE__) . '/css/opLSBStyle');
        if ($options) {
            ?>
			<tr valign="top" id="option_lsb_style">
				<th scope="row"><?php 
            _e('LSB Style', 'qtranslate');
            ?>
</th>
				<td>
					<fieldset>
						<legend class="hidden"><?php 
            _e('LSB Style', 'qtranslate');
            ?>
</legend>
						<label><?php 
            printf(__('Choose CSS style for how Language Switching Buttons are rendered:', 'qtranslate'));
            ?>
</label>
						<br/><?php 
            printf(__('LSB %s-wrap classes:', 'qtranslate'), 'ul');
            ?>
&nbsp;<input type="text" name="lsb_style_wrap_class" id="lsb_style_wrap_class" value="<?php 
            echo $q_config['lsb_style_wrap_class'];
            ?>
" size="50" >
						<br/><?php 
            _e('Active button class:', 'qtranslate');
            ?>
&nbsp;<input type="text" name="lsb_style_active_class" id="lsb_style_active_class" value="<?php 
            echo $q_config['lsb_style_active_class'];
            ?>
" size="40" >
						<br/><small><?php 
            _e('The above is reset to an appropriate default, if the below is changed.', 'qtranslate');
            ?>
</small>
						<br/><?php 
            _e('CSS set:', 'qtranslate');
            ?>
&nbsp;<select name="lsb_style" id="lsb_style"><?php 
            foreach ($options as $nm => $val) {
                echo '<option value="' . $val . '"' . selected($val, $q_config['lsb_style']) . '>' . $nm . '</option>';
            }
            echo '<option value="custom"' . selected('custom', $q_config['lsb_style']) . '>' . __('Use custom CSS', 'qtranslate') . '</option>';
            ?>
</select>
						<br/><small><?php 
            printf(__('Choice "%s" disables this option and allows one to use its own custom CSS provided by other means.', 'qtranslate'), __('Use custom CSS', 'qtranslate'));
            ?>
</small>
					</fieldset>
				</td>
			</tr>
			<?php 
        }
        ?>
			<tr valign="top" id="option_highlight_mode">
				<?php 
        $highlight_mode = $q_config['highlight_mode'];
        // reset default custom CSS when the field is empty, or when the "custom" option is not checked
        if (empty($q_config['highlight_mode_custom_css']) || $highlight_mode != QTX_HIGHLIGHT_MODE_CUSTOM_CSS) {
            $highlight_mode_custom_css = qtranxf_get_admin_highlight_css($highlight_mode);
        } else {
            $highlight_mode_custom_css = $q_config['highlight_mode_custom_css'];
        }
        ?>
				<th scope="row"><?php 
        _e('Highlight Style', 'qtranslate');
        ?>
</th>
				<td>
					<p><?php 
        _e('When there are many integrated or customized translatable fields, it may become confusing to know which field has multilingual value. The highlighting of translatable fields may come handy then:', 'qtranslate');
        ?>
</p>
					<fieldset>
						<legend class="hidden"><?php 
        _e('Highlight Style', 'qtranslate');
        ?>
</legend>
						<label title="<?php 
        _e('Do not highlight the translatable fields.', 'qtranslate');
        ?>
">
							<input type="radio" name="highlight_mode" value="<?php 
        echo QTX_HIGHLIGHT_MODE_NONE;
        ?>
" <?php 
        checked($highlight_mode, QTX_HIGHLIGHT_MODE_NONE);
        ?>
 />
							<?php 
        _e('Do not highlight the translatable fields.', 'qtranslate');
        ?>
						</label><br/>
						<label title="<?php 
        _e('Show a line on the left border of translatable fields.', 'qtranslate');
        ?>
">
							<input type="radio" name="highlight_mode" value="<?php 
        echo QTX_HIGHLIGHT_MODE_LEFT_BORDER;
        ?>
" <?php 
        checked($highlight_mode, QTX_HIGHLIGHT_MODE_LEFT_BORDER);
        ?>
 />
							<?php 
        _e('Show a line on the left border of translatable fields.', 'qtranslate');
        ?>
						</label><br/>
						<label title="<?php 
        _e('Draw a border around translatable fields.', 'qtranslate');
        ?>
">
							<input type="radio" name="highlight_mode" value="<?php 
        echo QTX_HIGHLIGHT_MODE_BORDER;
        ?>
" <?php 
        checked($highlight_mode, QTX_HIGHLIGHT_MODE_BORDER);
        ?>
 />
							<?php 
        _e('Draw a border around translatable fields.', 'qtranslate');
        ?>
						</label><br/>
						<label title="<?php 
        _e('Use custom CSS', 'qtranslate');
        ?>
">
							<input type="radio" name="highlight_mode" value="<?php 
        echo QTX_HIGHLIGHT_MODE_CUSTOM_CSS;
        ?>
" <?php 
        checked($highlight_mode, QTX_HIGHLIGHT_MODE_CUSTOM_CSS);
        ?>
/>
							<?php 
        echo __('Use custom CSS', 'qtranslate') . ':';
        ?>
						</label><br/>
					</fieldset><br />
					<textarea id="highlight_mode_custom_css" name="highlight_mode_custom_css" style="width:100%"><?php 
        echo esc_textarea($highlight_mode_custom_css);
        ?>
</textarea>
					<br />
					<small><?php 
        echo __('To reset to default, clear the text.', 'qtranslate') . ' ';
        printf(__('The color in use is taken from your profile option %s, the third color.', 'qtranslate'), '"<a href="' . admin_url('/profile.php') . '">' . qtranxf_translate_wp('Admin Color Scheme') . '</a>"');
        ?>
</small>
				</td>
			</tr>
<?php 
        /*
        			<tr>
        				<th scope="row"><?php _e('Debugging Information', 'qtranslate');?></th>
        				<td>
        					<p><?php printf(__('If you encounter any problems and you are unable to solve them yourself, you can visit the <a href="%s">Support Forum</a>. Posting the following Content will help other detect any misconfigurations.', 'qtranslate'), 'https://wordpress.org/support/plugin/qtranslate-x'); ?></p>
        					<textarea readonly="readonly" id="qtranxs_debug"><?php
        						$q_config_copy = $q_config;
        						// remove information to keep data anonymous and other not needed things
        						unset($q_config_copy['url_info']);
        						unset($q_config_copy['js']);
        						unset($q_config_copy['windows_locale']);
        						//unset($q_config_copy['pre_domain']);
        						unset($q_config_copy['term_name']);
        						echo htmlspecialchars(print_r($q_config_copy, true));
        					?></textarea>
        				</td>
        			</tr>
        */
        ?>
		</table>
	<?php 
        qtranxf_admin_section_end('advanced');
        ?>
	<?php 
        qtranxf_admin_section_start(__('Custom Integration', 'qtranslate'), 'integration');
        ?>
		<table class="form-table">
			<tr valign="top">
				<th scope="row"><?php 
        echo __('Custom Fields', 'qtranslate');
        ?>
</th>
				<td>
					<?php 
        printf(__('Enter "%s" or "%s" attribute of text fields from your theme, which you wish to translate. This applies to post, page and media editors (%s). To lookup "%s" or "%s", right-click on the field in the post or the page editor and choose "%s". Look for an attribute of the field named "%s" or "%s". Enter it below, as many as you need, space- or comma-separated. After saving configuration, these fields will start responding to the language switching buttons, and you can enter different text for each language. The input fields of type %s will be parsed using %s syntax, while single line text fields will use %s syntax. If you need to override this behaviour, prepend prefix %s or %s to the name of the field to specify which syntax to use. For more information, read %sFAQ%s.', 'qtranslate'), 'id', 'class', '/wp-admin/post*', 'id', 'class', _x('Inspect Element', 'browser option', 'qtranslate'), 'id', 'class', '\'textarea\'', esc_html('<!--:-->'), '[:]', '\'<\'', '\'[\'', '<a href="https://wordpress.org/plugins/qtranslate-x/faq/">', '</a>');
        ?>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row" style="text-align: right">id</th>
				<td>
					<input type="text" name="custom_fields" id="qtranxs_custom_fields" value="<?php 
        echo implode(' ', $q_config['custom_fields']);
        ?>
" style="width:100%"><br/>
					<small><?php 
        _e('The value of "id" attribute is normally unique within one page, otherwise the first field found, having an id specified, is picked up.', 'qtranslate');
        ?>
</small>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row" style="text-align: right">class</th>
				<td>
					<input type="text" name="custom_field_classes" id="qtranxs_custom_field_classes" value="<?php 
        echo implode(' ', $q_config['custom_field_classes']);
        ?>
" style="width:100%"><br/>
					<small><?php 
        printf(__('All the fields of specified classes will respond to Language Switching Buttons. Be careful not to include a class, which would affect language-neutral fields. If you cannot uniquely identify a field needed neither by %s, nor by %s attribute, report the issue on %sSupport Forum%s', 'qtranslate'), '"id"', '"class"', '<a href="https://wordpress.org/support/plugin/qtranslate-x">', '</a>');
        ?>
</small>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
        echo __('Custom Filters', 'qtranslate');
        ?>
</th>
				<td>
					<input type="text" name="text_field_filters" id="qtranxs_text_field_filters" value="<?php 
        echo implode(' ', $q_config['text_field_filters']);
        ?>
" style="width:100%"><br/>
					<small><?php 
        printf(__('Names of filters (which are enabled on theme or other plugins via %s function) to add translation to. For more information, read %sFAQ%s.', 'qtranslate'), 'apply_filters()', '<a href="https://wordpress.org/plugins/qtranslate-x/faq/">', '</a>');
        ?>
</small>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
        echo __('Custom Admin Pages', 'qtranslate');
        ?>
</th>
				<td><input type="text" name="custom_pages" id="qtranxs_custom_pages" value="<?php 
        echo implode(' ', $q_config['custom_pages']);
        ?>
" style="width:100%"><br/>
					<small><?php 
        printf(__('List the custom admin page paths for which you wish Language Switching Buttons to show up. The Buttons will then control fields configured in "Custom Fields" section. You may only include part of the full URL after %s, including a distinctive query string if needed. As many as desired pages can be listed space/comma separated. For more information, read %sFAQ%s.', 'qtranslate'), '/wp-admin/', '<a href="https://wordpress.org/plugins/qtranslate-x/faq/">', '</a>');
        ?>
</small>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
        _e('Compatibility Functions', 'qtranslate');
        ?>
</th>
				<td>
					<label for="qtranxs_qtrans_compatibility"><input type="checkbox" name="qtrans_compatibility" id="qtranxs_qtrans_compatibility" value="1"<?php 
        checked($q_config['qtrans_compatibility']);
        ?>
/>&nbsp;<?php 
        printf(__('Enable function name compatibility (%s).', 'qtranslate'), 'qtrans_convertURL, qtrans_generateLanguageSelectCode, qtrans_getLanguage, qtrans_getLanguageName, qtrans_getSortedLanguages, qtrans_join, qtrans_split, qtrans_use, qtrans_useCurrentLanguageIfNotFoundShowAvailable, qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage, qtrans_useDefaultLanguage, qtrans_useTermLib');
        ?>
</label><br/>
					<small><?php 
        printf(__('Some plugins and themes use direct calls to the functions listed, which are defined in former %s plugin and some of its forks. Turning this flag on will enable those function to exists, which will make the dependent plugins and themes to work. WordPress policy prohibits to define functions with the same names as in other plugins, since it generates user-unfriendly fatal errors, when two conflicting plugins are activated simultaneously. Before turning this option on, you have to make sure that there are no other plugins active, which define those functions.', 'qtranslate'), '<a href="https://wordpress.org/plugins/qtranslate/" target="_blank">qTranslate</a>');
        ?>
</small>
				</td>
			</tr>
			<?php 
        /* if ( defined( 'WPB_VC_VERSION' ) ) { ?>
        			<tr valign="top">
        				<th scope="row"><?php _e('3rd-party plugins', 'qtranslate') ?></th>
        				<td><?php _e('Below is a list of plugins which have a way to auto-integrate with qTranslate-X.', 'qtranslate') ?>
        				</td>
        			</tr>
        			<tr valign="top">
        				<th scope="row" style="text-align: right"><a href="http://vc.wpbakery.com/" target="_blank">WPBakery Visual Composer</a></th>
        				<td>
        					<label for="plugin_js_composer"><input type="checkbox" name="plugin_js_composer" id="plugin_js_composer" value="1"<?php checked(!(isset($q_config['plugin_js_composer_off']) && $q_config['plugin_js_composer_off'])); ?>/>&nbsp;<?php printf(__('Enable built-in integration for "%s".', 'qtranslate'), 'WPBakery Visual Composer'); echo ' '.__('Experimental feature.', 'qtranslate'); ?></label>
        					<p><small><?php printf(__('If %s implements its own integration, this will need to be turned off.', 'qtranslate'), 'WPBakery'); ?></small></p>
        				</td>
        			</tr>
        			<?php } */
        ?>
		</table>
	<?php 
        qtranxf_admin_section_end('integration');
        do_action('qtranslate_configuration', $clean_uri);
        ?>
	</form>

</div>
<div class="wrap">

<?php 
        qtranxf_admin_section_start(__('Languages', 'qtranslate'), 'languages');
        //id="qtranslate-admin-languages"
        ?>
<div id="col-container">

<div id="col-right">
<div class="col-wrap">
<h3><?php 
        _e('List of Configured Languages', 'qtranslate');
        ?>
</h3>
<p><small><?php 
        $language_names = qtranxf_language_configured('language_name');
        $flags = qtranxf_language_configured('flag');
        //$windows_locales = qtranxf_language_configured('windows_locale');
        printf(__('Only enabled languages are loaded at front-end, while all %d configured languages are listed here.', 'qtranslate'), count($language_names));
        echo ' ';
        _e('The table below contains both pre-defined and manually added or modified languages.', 'qtranslate');
        echo ' ';
        printf(__('You may %s or %s a language, or %s manually added language, or %s previous modifications of a pre-defined language.', 'qtranslate'), '"' . __('Enable', 'qtranslate') . '"', '"' . __('Disable', 'qtranslate') . '"', '"' . __('Delete', 'qtranslate') . '"', '"' . __('Reset', 'qtranslate') . '"');
        echo ' ';
        printf(__('Click %s to modify language properties.', 'qtranslate'), '"' . __('Edit', 'qtranslate') . '"');
        ?>
</small></p>
<table class="widefat">
	<thead>
	<tr>
<?php 
        print_column_headers('language');
        ?>
	</tr>
	</thead>

	<tfoot>
	<tr>
<?php 
        print_column_headers('language', false);
        ?>
	</tr>
	</tfoot>

	<tbody id="the-list" class="qtranxs-language-list" class="list:cat">
<?php 
        $languages_stored = get_option('qtranslate_language_names', array());
        $languages_predef = qtranxf_default_language_name();
        $flag_location_url = qtranxf_flag_location();
        $flag_location_dir = trailingslashit(WP_CONTENT_DIR) . $q_config['flag_location'];
        $flag_location_dir_def = dirname(QTRANSLATE_FILE) . '/flags/';
        $flag_location_url_def = trailingslashit(WP_CONTENT_URL) . '/plugins/' . basename(dirname(QTRANSLATE_FILE)) . '/flags/';
        foreach ($language_names as $lang => $language) {
            if ($lang == 'code') {
                continue;
            }
            $flag = $flags[$lang];
            if (file_exists($flag_location_dir . $flag)) {
                $flag_url = $flag_location_url . $flag;
            } else {
                $flag_url = $flag_location_url_def . $flag;
            }
            ?>
	<tr>
		<td><?php 
            echo $lang;
            ?>
</td>
		<td><img src="<?php 
            echo $flag_url;
            ?>
" alt="<?php 
            echo sprintf(__('%s Flag', 'qtranslate'), $language);
            ?>
"></td>
		<td><?php 
            echo $language;
            ?>
</td>
		<td><?php 
            if (in_array($lang, $q_config['enabled_languages'])) {
                if ($q_config['default_language'] == $lang) {
                    _e('Default', 'qtranslate');
                } else {
                    ?>
<a class="edit" href="<?php 
                    echo $clean_uri;
                    ?>
&disable=<?php 
                    echo $lang;
                    ?>
"><?php 
                    _e('Disable', 'qtranslate');
                    ?>
</a><?php 
                }
            } else {
                ?>
<a class="edit" href="<?php 
                echo $clean_uri;
                ?>
&enable=<?php 
                echo $lang;
                ?>
"><?php 
                _e('Enable', 'qtranslate');
                ?>
</a><?php 
            }
            ?>
</td>
		<td><a class="edit" href="<?php 
            echo $clean_uri;
            ?>
&edit=<?php 
            echo $lang;
            ?>
"><?php 
            _e('Edit', 'qtranslate');
            ?>
</a></td>
		<td><?php 
            if (!isset($languages_stored[$lang])) {
                _e('Pre-Defined', 'qtranslate');
            } else {
                ?>
<a class="delete" href="<?php 
                echo $clean_uri;
                ?>
&delete=<?php 
                echo $lang;
                ?>
"><?php 
                if (isset($languages_predef[$lang])) {
                    _e('Reset', 'qtranslate');
                } else {
                    _e('Delete', 'qtranslate');
                }
                ?>
</a><?php 
            }
            ?>
</td>
	</tr>
<?php 
        }
        /*
        <td><?php if($q_config['default_language']==$lang){ _e('Default', 'qtranslate'); } else { ?><a class="delete" href="<?php echo $clean_uri; ?>&delete=<?php echo $lang; ?>"><?php _e('Delete', 'qtranslate'); ?></a><?php } ?></td>
        */
        ?>
	</tbody>
</table>
<p><?php 
        _e('Enabling a language will cause qTranslate to update the Gettext-Database for the language, which can take a while depending on your server\'s connection speed.', 'qtranslate');
        ?>
</p>
</div>
</div><!-- /col-right -->

<div id="col-left">
<div class="col-wrap">
<div class="form-wrap">
<h3><?php 
        _e('Add Language', 'qtranslate');
        ?>
</h3>
<form name="addcat" id="addcat" method="post" class="add:the-list: validate">
<?php 
        qtranxf_language_form($language_code, $language_code, $language_name, $language_locale, $language_date_format, $language_time_format, $language_flag, $language_na_message, $language_default);
        ?>
<p class="submit"><input type="submit" name="submit" value="<?php 
        _e('Add Language &raquo;', 'qtranslate');
        ?>
" /></p>
</form></div>
</div>
</div><!-- /col-left -->

</div><!-- /col-container -->
</div><!-- /qtranslate-admin-languages in qtranxf_admin_section_start -->
<script type="text/javascript">
//<![CDATA[
	qtranxj_readShowHideCookie('qtranslate-admin-languages');
// ]]>
</script>
</div><!-- /wrap -->
<?php 
    }
}
Esempio n. 4
0
function qtranxf_wp_get_nav_menu_items($items, $menu, $args)
{
    global $q_config;
    $language = $q_config['language'];
    $flag_location = qtranxf_flag_location();
    $itemid = 0;
    $menu_order = 0;
    $qtransmenu = null;
    $altlang = null;
    $url = '';
    //options
    $type = 'LM';
    //[LM|AL]
    $title = 'Language';
    //[none|Language|Current]
    $current = true;
    //[shown|hidden]
    $flags = true;
    //[none|all|items]
    $lang_names = true;
    //names=[shown|hidden]
    $colon = true;
    //[shown|hidden]
    $topflag = true;
    $itemsmodified = false;
    foreach ($items as $key => $item) {
        //qtranxf_dbg_log('qtranxf_wp_get_nav_menu_items: $item->url: ',$item->url);
        //qtranxf_dbg_log('qtranxf_wp_get_nav_menu_items: $item: ',$item);
        //qtranxf_dbg_log('qtranxf_wp_get_nav_menu_items: item: '.$item->title.'; p='.$item->menu_item_parent.'; ID='.$item->ID);
        $qtransLangSw = isset($item->url) && stristr($item->url, 'qtransLangSw') !== FALSE;
        if (!$qtransLangSw) {
            $item_title = qtranxf_use_language($language, $item->title, false, true);
            if (empty($item_title)) {
                //qtranxf_dbg_echo('removed item: '.$item->title.'; p='.$item->menu_item_parent);
                unset($items[$key]);
                //remove menu item with empty title for this language
                $itemsmodified = true;
                continue;
            }
            $item->title = $item_title;
            if ($item->object == 'custom' && !empty($item->url)) {
                if (strpos($item->url, 'setlang=no') === FALSE) {
                    $item->url = qtranxf_convertURL($item->url, $language);
                } else {
                    $item->url = remove_query_arg('setlang', $item->url);
                }
            }
        }
        $item->post_content = qtranxf_use_language($language, $item->post_content, false, true);
        $item->post_title = qtranxf_use_language($language, $item->post_title, false, true);
        $item->post_excerpt = qtranxf_use_language($language, $item->post_excerpt, false, true);
        $item->description = qtranxf_use_language($language, $item->description, false, true);
        if (isset($item->attr_title)) {
            $item->attr_title = qtranxf_use_language($language, $item->attr_title, false, true);
        }
        if ($itemid < $item->ID) {
            $itemid = $item->ID;
        }
        if ($menu_order < $item->menu_order) {
            $menu_order = $item->menu_order;
        }
        if (!$qtransLangSw) {
            continue;
        }
        $p = strpos($item->url, '?');
        if ($p !== FALSE) {
            $qs = substr($item->url, $p + 1);
            $qs = str_replace('#', '', $qs);
            $pars = array();
            parse_str($qs, $pars);
            if (isset($pars['type']) && stripos($pars['type'], 'AL') !== FALSE) {
                $type = 'AL';
            }
            if (isset($pars['flags'])) {
                $flags = stripos($pars['flags'], 'no') === FALSE;
                if ($flags) {
                    $topflag = stripos($pars['flags'], 'items') === FALSE;
                } else {
                    $topflag = false;
                }
            }
            if (isset($pars['names'])) {
                $lang_names = stripos($pars['names'], 'hid') === FALSE;
            }
            if (isset($pars['title'])) {
                $title = $pars['title'];
                if (stripos($pars['title'], 'no') !== FALSE) {
                    $title = '';
                }
                if (!$topflag && empty($title)) {
                    $title = 'Language';
                }
            }
            if (isset($pars['colon'])) {
                $colon = stripos($pars['colon'], 'hid') === FALSE;
            }
            if (isset($pars['current'])) {
                $current = stripos($pars['current'], 'hid') === FALSE;
            }
            if (!$lang_names && !$flags) {
                $flags = true;
            }
        }
        if ($type == 'AL') {
            foreach ($q_config['enabled_languages'] as $lang) {
                if ($lang == $language) {
                    continue;
                }
                $toplang = $lang;
                $altlang = $lang;
                break;
            }
            $item->title = empty($title) ? '' : $q_config['language_name'][$toplang];
            $item->url = qtranxf_convertURL($url, $altlang, false, true);
        } else {
            $toplang = $language;
            if (empty($title)) {
                $item->title = '';
            } elseif (stripos($title, 'Current') !== FALSE) {
                $item->title = $q_config['language_name'][$toplang];
            } else {
                $blocks = qtranxf_get_language_blocks($item->title);
                if (count($blocks) <= 1) {
                    //no customization is done
                    $item->title = __('Language', 'qtranslate');
                    if ($item->title == 'Language') {
                        $item->title = qtranxf_translate_wp('Language');
                    }
                } else {
                    $item->title = qtranxf_use_block($toplang, $blocks);
                }
            }
            $item->url = null;
        }
        if ($topflag) {
            if (!empty($item->title)) {
                if ($colon) {
                    $item->title .= ':';
                }
                $item->title .= '&nbsp;';
            }
            $item->title .= '<img src="' . $flag_location . $q_config['flag'][$toplang] . '" alt="' . $q_config['language_name'][$toplang] . '" />';
            //.' '.__('Flag', 'qtranslate')
        }
        if (empty($item->attr_title)) {
            $item->attr_title = $q_config['language_name'][$toplang];
        }
        //$item->classes[] = 'qtranxs_flag_'.$language;
        $item->classes[] = 'qtranxs-lang-menu';
        $item->classes[] = 'qtranxs-lang-menu-' . $toplang;
        //qtranxf_dbg_log('qtranxf_wp_get_nav_menu_items: top $item: ',$item);
        $qtransmenu = $item;
    }
    //if(	$itemsmodified ) qtranxf_remove_detached_children($items);
    if (!$qtransmenu) {
        return $items;
    }
    foreach ($q_config['enabled_languages'] as $lang) {
        if ($type == 'AL') {
            if ($lang == $language) {
                continue;
            }
            if ($lang == $altlang) {
                continue;
            }
        } elseif (!$current) {
            if ($lang == $language) {
                continue;
            }
        }
        $item = new WP_Post((object) array('ID' => ++$itemid));
        //$item->db_id=$item->ID;
        $item->menu_item_parent = $qtransmenu->ID;
        $item->menu_order = ++$menu_order;
        $item->post_type = 'nav_menu_item';
        $item->object = 'custom';
        $item->object_id = $qtransmenu->object_id;
        $item->type = 'custom';
        $item->type_label = 'Custom';
        $item->title = '';
        if ($flags) {
            $item->title = '<img src="' . $flag_location . $q_config['flag'][$lang] . '" alt="' . $q_config['language_name'][$lang] . '" />';
        }
        if ($lang_names) {
            if ($flags) {
                $item->title .= '&nbsp;';
            }
            $item->title .= $q_config['language_name'][$lang];
        }
        $item->post_title = $item->title;
        $item->post_name = 'language-menuitem-' . $lang;
        if ($lang != $language) {
            $item->url = qtranxf_convertURL($url, $lang, false, true);
            $item->url = esc_url($item->url);
            //not sure if this is needed
        }
        $item->attr_title = $q_config['language_name'][$lang];
        $item->classes = array();
        //$item->classes[] = 'qtranxs_flag_'.$lang;
        $item->classes[] = 'qtranxs-lang-menu-item';
        $item->classes[] = 'qtranxs-lang-menu-item-' . $lang;
        $items[] = $item;
        ++$menu->count;
        //qtranxf_dbg_log('qtranxf_wp_get_nav_menu_items: language menu $item',$item);
    }
    return $items;
}
function qtranxf_editConfig()
{
    global $q_config;
    if (!qtranxf_verify_nonce('qtranslate-x_configuration_form')) {
        return;
    }
    // init some needed variables
    if (!isset($q_config['url_info']['errors'])) {
        $q_config['url_info']['errors'] = array();
    }
    if (!isset($q_config['url_info']['warnings'])) {
        $q_config['url_info']['warnings'] = array();
    }
    if (!isset($q_config['url_info']['messages'])) {
        $q_config['url_info']['messages'] = array();
    }
    $errors =& $q_config['url_info']['errors'];
    //$warnings = &$q_config['url_info']['warnings'];
    $messages =& $q_config['url_info']['messages'];
    $q_config['posted'] = array();
    $q_config['posted']['lang_props'] = array();
    $q_config['posted']['language_code'] = '';
    $q_config['posted']['original_lang'] = '';
    $language_code =& $q_config['posted']['language_code'];
    $lang_props =& $q_config['posted']['lang_props'];
    $original_lang =& $q_config['posted']['original_lang'];
    // check for action
    if (isset($_POST['qtranslate_reset']) && isset($_POST['qtranslate_reset2'])) {
        $messages[] = __('qTranslate has been reset.', 'qtranslate');
    } elseif (isset($_POST['default_language'])) {
        qtranxf_updateSettings();
        //execute actions
        qtranxf_executeOnUpdate();
    }
    if (isset($_POST['original_lang'])) {
        // validate form input
        $original_lang = sanitize_text_field($_POST['original_lang']);
        $lang = sanitize_text_field($_POST['language_code']);
        $lang_props['language_name'] = sanitize_text_field($_POST['language_name']);
        $lang_props['flag'] = sanitize_text_field($_POST['language_flag']);
        $lang_props['locale'] = sanitize_text_field($_POST['language_locale']);
        if (strlen($lang) != 2) {
            $errors[] = __('Language Code has to be 2 characters long!', 'qtranslate');
        }
        if (empty($lang_props['language_name'])) {
            $errors[] = __('The Language must have a name!', 'qtranslate');
        }
        if (strlen($lang_props['locale']) < 2) {
            $errors[] = __('The Language must have a Locale!', 'qtranslate');
        }
        if ($original_lang) {
            $lang_props['locale_html'] = sanitize_text_field($_POST['language_locale_html']);
            $lang_props['date_format'] = sanitize_text_field(stripslashes($_POST['language_date_format']));
            $lang_props['time_format'] = sanitize_text_field(stripslashes($_POST['language_time_format']));
            $nam = wp_kses_post(stripslashes($_POST['language_na_message']));
            //allow valid HTML
            $nam = htmlentities(html_entity_decode($nam));
            //standardize HTML entities
            $lang_props['not_available'] = $nam;
            if (empty($lang_props['date_format'])) {
                $errors[] = sprintf(__('Option "%s" must not be empty.', 'qtranslate'), qtranxf_translate_wp('Date Format')) . ' ' . sprintf(__('It has now been pre-filled with a default value as entered on page %s, which you may wish to adjust for this language.', 'qtranslate'), '<a href="' . admin_url('options-general.php') . '" target="_blank">' . qtranxf_translate_wp('General Settings') . '</a>');
                $lang_props['date_format'] = qtranxf_translate_dt_format('date_format', $lang);
            }
            if (empty($lang_props['time_format'])) {
                $errors[] = sprintf(__('Option "%s" must not be empty.', 'qtranslate'), qtranxf_translate_wp('Time Format')) . ' ' . sprintf(__('It has now been pre-filled with a default value as entered on page %s, which you may wish to adjust for this language.', 'qtranslate'), '<a href="' . admin_url('options-general.php') . '" target="_blank">' . qtranxf_translate_wp('General Settings') . '</a>');
                $lang_props['time_format'] = qtranxf_translate_dt_format('time_format', $lang);
            }
            if (empty($lang_props['not_available'])) {
                $errors[] = __('The Language must have a Not-Available Message!', 'qtranslate');
            }
        }
        $langs_preset = qtranxf_langs_preset();
        $langs_stored = qtranxf_langs_stored($langs_preset);
        if (empty($errors)) {
            if (empty($original_lang)) {
                // new language
                if (isset($langs_stored[$lang])) {
                    $errors[] = __('There is already a language with the same Language Code!', 'qtranslate');
                }
            } else {
                // language update
                if ($lang != $original_lang && isset($langs_stored[$lang])) {
                    $errors[] = __('There is already a language with the same Language Code!', 'qtranslate');
                } else {
                    if ($lang != $original_lang) {
                        // remove old language
                        //qtranxf_unsetLanguage($langs,$original_lang);
                        unset($langs_stored[$original_lang]);
                        qtranxf_unsetLanguage($q_config, $original_lang);
                        // if was enabled, set modified one to enabled too
                        foreach ($q_config['enabled_languages'] as $k => $lng) {
                            if ($lng != $original_lang) {
                                continue;
                            }
                            $q_config['enabled_languages'][$k] = $lng;
                            break;
                        }
                    }
                    if ($original_lang == $q_config['default_language']) {
                        // was default, so set modified the default
                        $q_config['default_language'] = $lang;
                    }
                    if ($q_config['language'] == $original_lang) {
                        qtranxf_setLanguageAdmin($lang);
                    }
                }
            }
        }
        if (empty($errors)) {
            // everything is fine, insert language
            foreach ($lang_props as $k => $v) {
                $q_config[$k][$lang] = $v;
                if (empty($v) || !empty($langs_preset[$lang][$k]) && $langs_preset[$lang][$k] == $v) {
                    unset($langs_stored[$lang][$k]);
                } else {
                    $langs_stored[$lang][$k] = $v;
                }
            }
            qtranxf_set_date_i18n_formats($q_config, $lang);
            qtranxf_save_languages($langs_stored);
            qtranxf_enableLanguage($lang);
            $s = 'Custom Language Properties Used for "' . $lang . '"';
            $b = 'I use the following language properties for ' . $lang . ':' . PHP_EOL . PHP_EOL;
            $b .= 'Language Code: ' . $lang . PHP_EOL;
            foreach ($lang_props as $k => $v) {
                $b .= $k . ': ' . $v . PHP_EOL;
            }
            $b .= PHP_EOL . 'which should probably be used as a default preset on the plugin.' . PHP_EOL;
            $b .= PHP_EOL . 'Thank you very much!' . PHP_EOL;
            $u = 'qtranslateteam@gmail.com?subject=' . rawurlencode($s) . '&body=' . rawurlencode($b);
            $messages[] = sprintf(__('The new language properties have been saved. If you think these properties should be the preset default, please %ssend email%s to the development team.', 'qtranslate'), '<a href="mailto:' . $u . '"><strong>', '</strong></a>');
        }
        //qtranxf_dbg_log('$lang: ',$lang);
        if (!empty($errors) || isset($_GET['edit'])) {
            if (empty($errors) && $original_lang != $lang) {
                $target = admin_url('options-general.php?page=qtranslate-x&edit=' . $lang);
                wp_redirect($target);
                exit;
            }
            // get old values in the form
            $language_code = $lang;
        } else {
            if (empty($original_lang)) {
                $target = admin_url('options-general.php?page=qtranslate-x&edit=' . $lang . '&msg=new');
                wp_redirect($target);
                exit;
            } else {
                //reset form for new language
                $lang_props = array();
                $original_lang = '';
            }
        }
    } elseif (isset($_GET['convert'])) {
        // update language tags
        global $wpdb;
        $wpdb->show_errors();
        @set_time_limit(0);
        $cnt = 0;
        //this will not work correctly if set of languages is different
        foreach ($q_config['enabled_languages'] as $lang) {
            $cnt += $wpdb->query('UPDATE ' . $wpdb->posts . ' set post_title = REPLACE(post_title, "[lang_' . $lang . ']","[:' . $lang . ']"),  post_content = REPLACE(post_content, "[lang_' . $lang . ']","[:' . $lang . ']")');
            $wpdb->query('UPDATE ' . $wpdb->posts . ' set post_title = REPLACE(post_title, "[/lang_' . $lang . ']","[:]"),  post_content = REPLACE(post_content, "[/lang_' . $lang . ']","[:]")');
        }
        if ($cnt > 0) {
            $messages[] = sprintf(__('%d database entries have been converted.', 'qtranslate'), $cnt);
        } else {
            $messages[] = __('No database entry has been affected while processing the conversion request.', 'qtranslate');
        }
    } elseif (isset($_GET['markdefault'])) {
        // update language tags
        global $wpdb;
        $wpdb->show_errors();
        @set_time_limit(0);
        $result = $wpdb->get_results('SELECT ID, post_content, post_title, post_excerpt, post_type FROM ' . $wpdb->posts . ' WHERE post_status = \'publish\' AND  (post_type = \'post\' OR post_type = \'page\') AND NOT (post_content LIKE \'%<!--:-->%\' OR post_title LIKE \'%<!--:-->%\' OR post_content LIKE \'%![:!]%\' ESCAPE \'!\' OR post_title LIKE \'%![:!]%\' ESCAPE \'!\')');
        if (is_array($result)) {
            $cnt_page = 0;
            $cnt_post = 0;
            foreach ($result as $post) {
                $title = qtranxf_mark_default($post->post_title);
                $content = qtranxf_mark_default($post->post_content);
                $excerpt = qtranxf_mark_default($post->post_excerpt);
                if ($title == $post->post_title && $content == $post->post_content && $excerpt == $post->post_excerpt) {
                    continue;
                }
                switch ($post->post_type) {
                    case 'post':
                        ++$cnt_post;
                        break;
                    case 'page':
                        ++$cnt_page;
                        break;
                }
                //qtranxf_dbg_log('markdefault:'. PHP_EOL .'title old: '.$post->post_title. PHP_EOL .'title new: '.$title. PHP_EOL .'content old: '.$post->post_content. PHP_EOL .'content new: '.$content); continue;
                $wpdb->query($wpdb->prepare('UPDATE ' . $wpdb->posts . ' set post_content = %s, post_title = %s, post_excerpt = %s WHERE ID = %d', $content, $title, $excerpt, $post->ID));
            }
            if ($cnt_page > 0) {
                $messages[] = sprintf(__('%d pages have been processed to set the default language.', 'qtranslate'), $cnt_page);
            } else {
                $messages[] = __('No initially untranslated pages found to set the default language', 'qtranslate');
            }
            if ($cnt_post > 0) {
                $messages[] = sprintf(__('%d posts have been processed to set the default language.', 'qtranslate'), $cnt_post);
            } else {
                $messages[] = __('No initially untranslated posts found to set the default language.', 'qtranslate');
            }
            $messages[] = sprintf(__('Post types other than "post" or "page", as well as unpublished entries, will have to be adjusted manually as needed, since there is no common way to automate setting the default language otherwise. It can be done with a custom script though. You may request a %spaid support%s for this.', 'qtranslate'), '<a href="https://qtranslatexteam.wordpress.com/contact-us/">', '</a>');
        }
    } elseif (isset($_GET['edit'])) {
        $lang = sanitize_text_field($_GET['edit']);
        $lang = preg_replace('/[^a-z]/i', '', $lang);
        if (strlen($lang) != 2) {
            $errors[] = __('Language Code has to be 2 characters long!', 'qtranslate');
        }
        $original_lang = $lang;
        $language_code = $lang;
        //$langs = array(); qtranxf_langs_config($langs);
        //$lang_props['language_name'] = isset($langs['language_name'][$lang])?$langs['language_name'][$lang]:'';
        //$lang_props['locale'] = isset($langs['locale'][$lang])?$langs['locale'][$lang]:'';
        //$lang_props['locale_html'] = isset($langs['locale_html'][$lang])?$langs['locale_html'][$lang]:'';
        //$lang_props['date_format'] = isset($langs['date_format'][$lang])?$langs['date_format'][$lang]:'';
        //$lang_props['time_format'] = isset($langs['time_format'][$lang])?$langs['time_format'][$lang]:'';
        //$lang_props['not_available'] = isset($langs['not_available'][$lang])?$langs['not_available'][$lang]:'';
        //$lang_props['flag'] = isset($langs['flag'][$lang])?$langs['flag'][$lang]:'';
        $langs = qtranxf_langs_config();
        $lang_props = isset($langs[$lang]) ? $langs[$lang] : array();
    } elseif (isset($_GET['delete'])) {
        $lang = sanitize_text_field($_GET['delete']);
        // validate delete (protect code)
        //if($q_config['default_language']==$lang) $errors[] = 'Cannot delete Default Language!';
        //if(!isset($q_config['language_name'][$lang])||strtolower($lang)=='code') $errors[] = __('No such language!', 'qtranslate');
        //if(empty($errors)) {
        //	// everything seems fine, delete language
        $err = qtranxf_deleteLanguage($lang);
        if (!empty($err)) {
            $errors[] = $err;
        }
        //}
    } elseif (isset($_GET['enable'])) {
        $lang = sanitize_text_field($_GET['enable']);
        // enable validate
        if (!qtranxf_enableLanguage($lang)) {
            $errors[] = __('Language is already enabled or invalid!', 'qtranslate');
        }
    } elseif (isset($_GET['disable'])) {
        $lang = sanitize_text_field($_GET['disable']);
        // enable validate
        if ($lang == $q_config['default_language']) {
            $errors[] = __('Cannot disable Default Language!', 'qtranslate');
        }
        if (!qtranxf_isEnabled($lang)) {
            if (!isset($q_config['language_name'][$lang])) {
                $errors[] = __('No such language!', 'qtranslate');
            }
        }
        // everything seems fine, disable language
        if (empty($errors) && !qtranxf_disableLanguage($lang)) {
            $errors[] = __('Language is already disabled!', 'qtranslate');
        }
    } elseif (isset($_GET['moveup'])) {
        $lang = sanitize_text_field($_GET['moveup']);
        $languages = qtranxf_getSortedLanguages();
        $msg = __('No such language!', 'qtranslate');
        foreach ($languages as $key => $language) {
            if ($language != $lang) {
                continue;
            }
            if ($key == 0) {
                $msg = __('Language is already first!', 'qtranslate');
                break;
            }
            $languages[$key] = $languages[$key - 1];
            $languages[$key - 1] = $language;
            $q_config['enabled_languages'] = $languages;
            $msg = __('New order saved.', 'qtranslate');
            qtranxf_update_config_header_css();
            break;
        }
        $messages[] = $msg;
    } elseif (isset($_GET['movedown'])) {
        $lang = sanitize_text_field($_GET['movedown']);
        $languages = qtranxf_getSortedLanguages();
        $msg = __('No such language!', 'qtranslate');
        foreach ($languages as $key => $language) {
            if ($language != $lang) {
                continue;
            }
            if ($key == sizeof($languages) - 1) {
                $msg = __('Language is already last!', 'qtranslate');
                break;
            }
            $languages[$key] = $languages[$key + 1];
            $languages[$key + 1] = $language;
            $q_config['enabled_languages'] = $languages;
            $msg = __('New order saved.', 'qtranslate');
            qtranxf_update_config_header_css();
            break;
        }
        $messages[] = $msg;
    }
    do_action('qtranslate_editConfig');
    $everything_fine = (isset($_POST['submit']) || isset($_GET['delete']) || isset($_GET['enable']) || isset($_GET['disable']) || isset($_GET['moveup']) || isset($_GET['movedown'])) && empty($errors);
    if ($everything_fine) {
        // settings might have changed, so save
        qtranxf_saveConfig();
        if (empty($messages)) {
            $messages[] = __('Options saved.', 'qtranslate');
        }
    }
    if ($q_config['auto_update_mo']) {
        if (!is_dir(WP_LANG_DIR) || !($ll = @fopen(trailingslashit(WP_LANG_DIR) . 'qtranslate.test', 'a'))) {
            $errors[] = sprintf(__('Could not write to "%s", Gettext Databases could not be downloaded!', 'qtranslate'), WP_LANG_DIR);
        } else {
            @fclose($ll);
            @unlink(trailingslashit(WP_LANG_DIR) . 'qtranslate.test');
        }
    }
}
function qtranxf_admin_notices_config()
{
    global $q_config;
    if (empty($q_config['url_info']['errors']) && empty($q_config['url_info']['warnings']) && empty($q_config['url_info']['messages'])) {
        return;
    }
    $screen = get_current_screen();
    $link = isset($screen->id) && $screen->id == 'settings_page_qtranslate-x' ? '' : '<a href="' . admin_url('options-general.php?page=qtranslate-x') . '" style="color:magenta">qTranslate&#8209;X</a>:&nbsp;';
    if (isset($q_config['url_info']['errors']) && is_array($q_config['url_info']['errors'])) {
        foreach ($q_config['url_info']['errors'] as $key => $msg) {
            echo '<div class="error notice is-dismissible" id="qtranxs_error_' . $key . '"><p>' . $link . '<strong><span style="color: red;">' . qtranxf_translate_wp('Error') . '</span></strong>:&nbsp;' . $msg . '</p></div>';
        }
        unset($q_config['url_info']['errors']);
    }
    if (isset($q_config['url_info']['warnings']) && is_array($q_config['url_info']['warnings'])) {
        foreach ($q_config['url_info']['warnings'] as $key => $msg) {
            echo '<div class="update-nag notice is-dismissible" id="qtranxs_warning_' . $key . '"><p>' . $link . '<strong><span style="color: blue;">' . qtranxf_translate_wp('Warning') . '</span></strong>:&nbsp;' . $msg . '</p></div>';
        }
        unset($q_config['url_info']['warnings']);
    }
    if (isset($q_config['url_info']['messages']) && is_array($q_config['url_info']['messages'])) {
        foreach ($q_config['url_info']['messages'] as $key => $msg) {
            echo '<div class="updated notice is-dismissible" id="qtranxs_message_' . $key . '"><p>' . $link . $msg . '</p></div>';
        }
        unset($q_config['url_info']['messages']);
    }
}
function qtranxf_add_language_menu_item(&$items, &$menu_order, &$itemid, $key, $language)
{
    global $q_config;
    $item = $items[$key];
    $flag_location = qtranxf_flag_location();
    $altlang = null;
    $url = '';
    //options
    $type = 'LM';
    //[LM|AL]
    $title = 'Language';
    //[none|Language|Current]
    $current = true;
    //[shown|hidden]
    $flags = true;
    //[none|all|items]
    $lang_names = true;
    //names=[shown|hidden]
    $colon = true;
    //[shown|hidden]
    $topflag = true;
    $p = strpos($item->url, '?');
    if ($p !== FALSE) {
        $qs = substr($item->url, $p + 1);
        $qs = str_replace('#', '', $qs);
        $pars = array();
        parse_str($qs, $pars);
        if (isset($pars['type']) && stripos($pars['type'], 'AL') !== FALSE) {
            $type = 'AL';
        }
        if (isset($pars['flags'])) {
            $flags = stripos($pars['flags'], 'no') === FALSE;
            if ($flags) {
                $topflag = stripos($pars['flags'], 'items') === FALSE;
            } else {
                $topflag = false;
            }
        }
        if (isset($pars['names'])) {
            $lang_names = stripos($pars['names'], 'hid') === FALSE;
        }
        if (isset($pars['title'])) {
            $title = $pars['title'];
            if (stripos($pars['title'], 'no') !== FALSE) {
                $title = '';
            }
            if (!$topflag && empty($title)) {
                $title = 'Language';
            }
        }
        if (isset($pars['colon'])) {
            $colon = stripos($pars['colon'], 'hid') === FALSE;
        }
        if (isset($pars['current'])) {
            $current = stripos($pars['current'], 'hid') === FALSE;
        }
        if (!$lang_names && !$flags) {
            $flags = true;
        }
    }
    if ($type == 'AL') {
        foreach ($q_config['enabled_languages'] as $lang) {
            if ($lang == $language) {
                continue;
            }
            $toplang = $lang;
            $altlang = $lang;
            break;
        }
        $item->title = empty($title) ? '' : $q_config['language_name'][$toplang];
        $item->url = qtranxf_convertURL($url, $altlang, false, true);
    } else {
        $toplang = $language;
        if (empty($title)) {
            $item->title = '';
        } elseif (stripos($title, 'Current') !== FALSE) {
            $item->title = $q_config['language_name'][$toplang];
        } else {
            $blocks = qtranxf_get_language_blocks($item->title);
            if (count($blocks) <= 1) {
                //no customization is done
                $item->title = __('Language', 'qtranslate');
                if ($item->title == 'Language') {
                    $item->title = qtranxf_translate_wp('Language');
                }
            } else {
                $item->title = qtranxf_use_block($toplang, $blocks);
            }
        }
        $item->url = null;
    }
    if ($topflag) {
        if (!empty($item->title)) {
            if ($colon) {
                $item->title .= ':';
            }
            $item->title .= '&nbsp;';
        }
        $item->title .= '<img src="' . $flag_location . $q_config['flag'][$toplang] . '" alt="' . $q_config['language_name'][$toplang] . '" />';
        //.' '.__('Flag', 'qtranslate')
    }
    if (empty($item->attr_title)) {
        $item->attr_title = $q_config['language_name'][$toplang];
    }
    //$item->classes[] = 'qtranxs_flag_'.$language;
    $item->classes[] = 'qtranxs-lang-menu';
    $item->classes[] = 'qtranxs-lang-menu-' . $toplang;
    //qtranxf_dbg_log('qtranxf_wp_get_nav_menu_items: top $item: ',$item);
    $qtransmenu = $item;
    foreach ($q_config['enabled_languages'] as $lang) {
        if ($type == 'AL') {
            if ($lang == $language) {
                continue;
            }
            if ($lang == $altlang) {
                continue;
            }
        } elseif (!$current) {
            if ($lang == $language) {
                continue;
            }
        }
        $item = new WP_Post((object) array('ID' => ++$itemid));
        //$item->db_id=$item->ID;
        $item->menu_item_parent = $qtransmenu->ID;
        $item->menu_order = ++$menu_order;
        $item->post_type = 'nav_menu_item';
        $item->object = 'custom';
        $item->object_id = $qtransmenu->object_id;
        $item->type = 'custom';
        $item->type_label = 'Custom';
        $item->title = '';
        if ($flags) {
            $item->title = '<img src="' . $flag_location . $q_config['flag'][$lang] . '" alt="' . $q_config['language_name'][$lang] . '" />';
        }
        if ($lang_names) {
            if ($flags) {
                $item->title .= '&nbsp;';
            }
            $item->title .= $q_config['language_name'][$lang];
        }
        $item->post_title = $item->title;
        $item->post_name = 'language-menuitem-' . $lang;
        if ($lang != $language) {
            $item->url = qtranxf_convertURL($url, $lang, false, true);
            $item->url = esc_url($item->url);
            //not sure if this is needed
        }
        $item->attr_title = $q_config['language_name'][$lang];
        $item->classes = array();
        //$item->classes[] = 'qtranxs_flag_'.$lang;
        $item->classes[] = 'qtranxs-lang-menu-item';
        $item->classes[] = 'qtranxs-lang-menu-item-' . $lang;
        $items[] = $item;
        //qtranxf_dbg_log('qtranxf_add_language_menu_item: language menu $item',$item);
    }
    //return $item;
}
function qtranxf_conf()
{
    global $q_config, $qtranslate_options, $wpdb;
    //qtranxf_dbg_log('qtranxf_conf: REQUEST_TIME_FLOAT: ', $_SERVER['REQUEST_TIME_FLOAT']);
    //qtranxf_dbg_log('qtranxf_conf: POST: ',$_POST);
    //qtranxf_dbg_log('qtranxf_conf: GET: ',$_GET);
    // do redirection for dashboard
    if (isset($_GET['godashboard'])) {
        echo '<h2>' . __('Switching Language', 'qtranslate') . '</h2>' . sprintf(__('Switching language to %1$s... If the Dashboard isn\'t loading, use this <a href="%2$s" title="Dashboard">link</a>.', 'qtranslate'), $q_config['language_name'][qtranxf_getLanguage()], admin_url()) . '<script type="text/javascript">document.location="' . admin_url() . '";</script>';
        exit;
    }
    // don't accidentally delete/enable/disable twice
    //$clean_uri = preg_replace("/&(delete|enable|disable|convert|markdefault|moveup|movedown)=[^&#]*/i","",$_SERVER['REQUEST_URI']);
    $clean_uri = $q_config['url_info']['qtranslate-settings-url'];
    $clean_uri = apply_filters('qtranslate_clean_uri', $clean_uri);
    $pluginurl = plugin_dir_url(QTRANSLATE_FILE);
    $nonce_action = 'qtranslate-x_configuration_form';
    if (!qtranxf_verify_nonce($nonce_action)) {
        return;
    }
    // Allow to prepare loading additional features
    do_action('qtranslate_configuration_pre', $clean_uri);
    // Generate XHTML
    ?>
<div class="wrap">
<?php 
    if (isset($_GET['edit'])) {
        ?>
<h2><?php 
        _e('Edit Language', 'qtranslate');
        ?>
</h2>
<form action="" method="post" id="qtranxs-edit-language">
<?php 
        wp_nonce_field($nonce_action);
        qtranxf_language_form();
        ?>
<p class="submit"><input type="submit" name="submit" class="button-primary" value="<?php 
        _e('Save Changes &raquo;', 'qtranslate');
        ?>
" /></p>
</form>
<p class="qtranxs_notes"><a href="<?php 
        echo admin_url('options-general.php?page=qtranslate-x#languages');
        ?>
"><?php 
        _e('back to configuration page', 'qtranslate');
        ?>
</a></p>
<?php 
    } else {
        ?>
<h2><?php 
        _e('Language Management (qTranslate Configuration)', 'qtranslate');
        ?>
</h2>
<p class="qtranxs_heading" style="font-size: small"><?php 
        printf(__('For help on how to configure qTranslate correctly, take a look at the <a href="%1$s">qTranslate FAQ</a> and the <a href="%2$s">Support Forum</a>.', 'qtranslate'), 'https://qtranslatexteam.wordpress.com/faq/', 'https://wordpress.org/support/plugin/qtranslate-x');
        echo '<br><small><em>';
        printf(__('Plugin development is supported through your %sdonations to the development team%s.', 'qtranslate'), '<a href="https://qtranslatexteam.wordpress.com/donations/" target="_blank">', '</a>');
        ?>
</em></small></p>
<?php 
        if (isset($_GET['config_inspector'])) {
            $admin_config = $q_config['admin_config'];
            $admin_config = apply_filters('qtranslate_load_admin_page_config', $admin_config);
            $admin_config = apply_filters('i18n_admin_config', $admin_config);
            $front_config = $q_config['front_config'];
            $front_config = apply_filters('i18n_front_config', $front_config);
            $configs = array();
            $configs['vendor'] = 'combined effective configuration';
            $configs['admin-config'] = $admin_config;
            $configs['front-config'] = $front_config;
            $configs = qtranxf_standardize_i18n_config($configs);
            ?>
<p class="qtranxs_notes"><a href="<?php 
            echo admin_url('options-general.php?page=qtranslate-x#integration');
            ?>
"><?php 
            _e('back to configuration page', 'qtranslate');
            ?>
</a></p>
<h3 class="heading"><?php 
            _e('Configuration Inspector', 'qtranslate');
            ?>
</h3>
<p class="qtranxs_explanation">
<?php 
            printf(__('Review a combined JSON-encoded configuration as loaded from options %s and %s, as well as from the theme and other plugins via filters %s and %s.', 'qtranslate'), '"' . __('Configuration Files', 'qtranslate') . '"', '"' . __('Custom Configuration', 'qtranslate') . '"', '"i18n_admin_config"', '"i18n_front_config"');
            echo ' ';
            printf(__('Please, read %sIntegration Guide%s for more information.', 'qtranslate'), '<a href="https://qtranslatexteam.wordpress.com/integration/" target="_blank">', '</a>');
            ?>
</p>
<p class="qtranxs_explanation"><textarea class="widefat" rows="30"><?php 
            echo qtranxf_json_encode($configs);
            ?>
</textarea></p>
<p class="qtranxs_notes"><?php 
            printf(__('Note to developers: ensure that front-end filter %s is also active on admin side, otherwise the changes it makes will not show up here. Having this filter active on admin side does not affect admin pages functionality, except this field.', 'qtranslate'), '"i18n_front_config"');
            ?>
</p>
<p class="qtranxs_notes"><a href="<?php 
            echo admin_url('options-general.php?page=qtranslate-x#integration');
            ?>
"><?php 
            _e('back to configuration page', 'qtranslate');
            ?>
</a></p>
<?php 
        } else {
            // Set Navigation Tabs
            $admin_sections = qtranxf_get_admin_sections();
            echo '<h2 class="nav-tab-wrapper">' . PHP_EOL;
            foreach ($admin_sections as $slug => $name) {
                echo '<a class="nav-tab" href="#' . $slug . '" title="' . sprintf(__('Click to switch to %s', 'qtranslate'), $name) . '">' . $name . '</a>' . PHP_EOL;
            }
            echo '</h2>' . PHP_EOL;
            ?>
	<form id="qtranxs-configuration-form" action="<?php 
            echo $clean_uri;
            ?>
" method="post">
	<?php 
            wp_nonce_field($nonce_action);
            // Prevent CSRF
            ?>
	<div class="tabs-content"><?php 
            //<!-- tabs-container -->
            ?>
	<?php 
            qtranxf_admin_section_start('general');
            $permalink_is_query = qtranxf_is_permalink_structure_query();
            //qtranxf_dbg_echo('$permalink_is_query: ',$permalink_is_query);
            $url_mode = $q_config['url_mode'];
            ?>
		<table class="form-table">
			<tr valign="top">
				<th scope="row"><?php 
            _e('Default Language / Order', 'qtranslate');
            ?>
</th>
				<td><p class="qtranxs_explanation"><?php 
            echo __('Every multilingual field is expected to have a meaningful content in the "Default Language". Usually, it is the language of your site before it became multilingual.', 'qtranslate');
            echo ' ';
            echo __('Order of languages defines in which order they are listed, when languages need to be listed, otherwise it is not important.', 'qtranslate');
            ?>
</p>
					<fieldset id="qtranxs-languages-menu">
					<legend class="hidden"><?php 
            _e('Default Language', 'qtranslate');
            ?>
</legend>
					<table id="qtranxs-enabled-languages">
				<?php 
            $flag_location = qtranxf_flag_location();
            foreach (qtranxf_getSortedLanguages() as $key => $language) {
                echo '<tr>';
                echo '<td><label title="' . $q_config['language_name'][$language] . '"><input type="radio" name="default_language" value="' . $language . '"';
                checked($language, $q_config['default_language']);
                echo ' />';
                echo ' <a href="' . add_query_arg('moveup', $language, $clean_uri) . '"><img src="' . $pluginurl . 'arrowup.png" alt="up" /></a>';
                echo ' <a href="' . add_query_arg('movedown', $language, $clean_uri) . '"><img src="' . $pluginurl . 'arrowdown.png" alt="down" /></a>';
                echo ' <img src="' . $flag_location . $q_config['flag'][$language] . '" alt="' . $q_config['language_name'][$language] . '" /> ';
                echo ' ' . $q_config['language_name'][$language];
                echo '</label></td>';
                echo '<td>[:' . $language . ']</td><td><a href="' . $clean_uri . '&edit=' . $language . '">' . __('Edit', 'qtranslate') . '</a></td><td><a href="' . $clean_uri . '&disable=' . $language . '">' . __('Disable', 'qtranslate') . '</a></td>';
                echo '</tr>' . PHP_EOL;
            }
            ?>
					</table>
					<p class="qtranxs_notes"><?php 
            $url = get_bloginfo('url');
            $url = qtranxf_convertURL($url, $q_config['default_language'], true);
            printf(__('Choose the default language of your blog. This is the language which will be shown on %s. You can also change the order the languages by clicking on the arrows above.', 'qtranslate'), $url);
            ?>
</p>
					</fieldset>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
            _e('URL Modification Mode', 'qtranslate');
            ?>
</th>
				<td>
					<?php 
            if ($permalink_is_query) {
                ?>
					<p><?php 
                printf(__('Use one of the pretty %spermalinks%s, if the desirable mode is disabled.', 'qtranslate'), '<a href="' . admin_url('options-permalink.php') . '">', '</a>');
                ?>
</p>
					<?php 
            }
            ?>
					<fieldset><legend class="hidden"><?php 
            _e('URL Modification Mode', 'qtranslate');
            ?>
</legend>
						<label title="Query Mode"><input type="radio" name="url_mode" value="<?php 
            echo QTX_URL_QUERY;
            ?>
" <?php 
            checked($url_mode, QTX_URL_QUERY);
            ?>
 /> <?php 
            echo __('Use Query Mode (?lang=en)', 'qtranslate') . '. ' . __('Most SEO unfriendly, not recommended.', 'qtranslate');
            ?>
</label><br/><br/>
					<?php 
            /*
            							if($permalink_is_query) {
            								echo '<br/>'.PHP_EOL;
            								printf(__('No other URL Modification Modes are available if permalink structure is set to "Default" on configuration page %sPermalink Setting%s. It is SEO advantageous to use some other permalink mode, which will enable more URL Modification Modes here as well.', 'qtranslate'),'<a href="'.admin_url('options-permalink.php').'">', '</a>');
            								echo PHP_EOL.'<br/><br/>'.PHP_EOL;
            							}else{ */
            ?>
						<label title="Pre-Path Mode"><input type="radio" name="url_mode" value="<?php 
            echo QTX_URL_PATH;
            ?>
" <?php 
            checked($url_mode, QTX_URL_PATH);
            disabled($permalink_is_query);
            ?>
 /> <?php 
            echo __('Use Pre-Path Mode (Default, puts /en/ in front of URL)', 'qtranslate') . '. ' . __('SEO friendly.', 'qtranslate');
            ?>
</label><br/>
						<label title="Pre-Domain Mode"><input type="radio" name="url_mode" value="<?php 
            echo QTX_URL_DOMAIN;
            ?>
" <?php 
            checked($url_mode, QTX_URL_DOMAIN);
            ?>
 /> <?php 
            echo __('Use Pre-Domain Mode (uses http://en.yoursite.com)', 'qtranslate') . '. ' . __('You will need to configure DNS sub-domains on your site.', 'qtranslate');
            ?>
</label><br/>
					<?php 
            /*
            						<p class="qtranxs_notes"><?php _e('Pre-Path and Pre-Domain mode will only work with mod_rewrite/pretty permalinks. Additional Configuration is needed for Pre-Domain mode or Per-Domain mode.', 'qtranslate') ?></p><br/><br/>
            							} */
            ?>
						<label for="hide_default_language">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="hide_default_language" id="hide_default_language" value="1"<?php 
            checked($q_config['hide_default_language']);
            ?>
/> <?php 
            _e('Hide URL language information for default language.', 'qtranslate');
            ?>
</label>
						<p class="qtranxs_notes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php 
            _e('This is only applicable to Pre-Path and Pre-Domain mode.', 'qtranslate');
            ?>
</p><br>
					<?php 
            //if(!$permalink_is_query) {
            do_action('qtranslate_url_mode_choices', $permalink_is_query, $url_mode);
            ?>
						<label title="Per-Domain Mode"><input type="radio" name="url_mode" value="<?php 
            echo QTX_URL_DOMAINS;
            ?>
" <?php 
            checked($url_mode, QTX_URL_DOMAINS);
            ?>
 /> <?php 
            echo __('Use Per-Domain mode: specify separate user-defined domain for each language.', 'qtranslate');
            ?>
</label>
					<?php 
            //}
            ?>
					</fieldset>
				</td>
			</tr>
	<?php 
            if ($url_mode == QTX_URL_DOMAINS) {
                $homeinfo = qtranxf_get_home_info();
                $home_host = $homeinfo['host'];
                //parse_url(get_option('home'),PHP_URL_HOST);
                foreach ($q_config['enabled_languages'] as $lang) {
                    $id = 'language_domain_' . $lang;
                    $domain = isset($q_config['domains'][$lang]) ? $q_config['domains'][$lang] : $lang . '.' . $home_host;
                    echo '<tr><td style="text-align: right">' . __('Domain for', 'qtranslate') . ' <a href="' . $clean_uri . '&edit=' . $lang . '">' . $q_config['language_name'][$lang] . '</a>&nbsp;(' . $lang . '):</td><td><input type="text" name="' . $id . '" id="' . $id . '" value="' . $domain . '" style="width:100%"/></td></tr>' . PHP_EOL;
                }
            }
            ?>
			<tr valign="top">
				<th scope="row"><?php 
            _e('Untranslated Content', 'qtranslate');
            ?>
</th>
				<td>
					<p class="qtranxs_explanation"><?php 
            printf(__('The choices below define how to handle untranslated content at front-end of the site. A content of a page or a post is considered untranslated if the main text (%s) is empty for a given language, regardless of other fields like title, excerpt, etc. All three options are independent of each other.', 'qtranslate'), 'post_content');
            ?>
</p>
					<br/>
					<label for="hide_untranslated"><input type="checkbox" name="hide_untranslated" id="hide_untranslated" value="1"<?php 
            checked($q_config['hide_untranslated']);
            ?>
/> <?php 
            _e('Hide Content which is not available for the selected language.', 'qtranslate');
            ?>
</label>
					<br/>
					<p class="qtranxs_notes"><?php 
            _e('When checked, posts will be hidden if the content is not available for the selected language. If unchecked, a message will appear showing all the languages the content is available in.', 'qtranslate');
            ?>
					<?php 
            _e('The message about available languages for the content of a post or a page may also appear if a single post display with an untranslated content if viewed directly.', 'qtranslate');
            ?>
					<?php 
            printf(__('This function will not work correctly if you installed %s on a blog with existing entries. In this case you will need to take a look at option "%s" under "%s" section.', 'qtranslate'), 'qTranslate', __('Convert Database', 'qtranslate'), __('Import', 'qtranslate') . '/' . __('Export', 'qtranslate'));
            ?>
</p>
					<br/>
					<label for="show_displayed_language_prefix"><input type="checkbox" name="show_displayed_language_prefix" id="show_displayed_language_prefix" value="1"<?php 
            checked($q_config['show_displayed_language_prefix']);
            ?>
/> <?php 
            _e('Show displayed language prefix when content is not available for the selected language.', 'qtranslate');
            ?>
</label>
					<br/>
					<p class="qtranxs_notes"><?php 
            _e('This is relevant to all fields other than the main content of posts and pages. Such untranslated fields are always shown in an alternative available language, and will be prefixed with the language name in parentheses, if this option is on.', 'qtranslate');
            ?>
</p>
					<br/>
					<label for="show_alternative_content"><input type="checkbox" name="show_alternative_content" id="show_alternative_content" value="1"<?php 
            checked($q_config['show_alternative_content']);
            ?>
/> <?php 
            _e('Show content in an alternative language when translation is not available for the selected language.', 'qtranslate');
            ?>
</label>
					<p class="qtranxs_notes"><?php 
            printf(__('When a page or a post with an untranslated content is viewed, a message with a list of other available languages is displayed, in which languages are ordered as defined by option "%s". If this option is on, then the content of the first available language will also be shown, instead of the expected language, for the sake of user convenience.', 'qtranslate'), __('Default Language / Order', 'qtranslate'));
            ?>
</p>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
            _e('Language Names', 'qtranslate');
            ?>
</th>
				<td>
					<label for="camel_case"><input type="checkbox" name="camel_case" id="camel_case" value="1"<?php 
            checked(!isset($q_config['language_name_case']) || !$q_config['language_name_case']);
            ?>
/> <?php 
            _e('Show language names in "Camel Case".', 'qtranslate');
            ?>
</label>
					<p class="qtranxs_notes"><?php 
            printf(__('Define how to display translated language names, whenever languages need to be listed, for example, in "%s" statement.', 'qtranslate'), __('Not Available Message', 'qtranslate'));
            ?>
</p>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
            _e('Detect Browser Language', 'qtranslate');
            ?>
</th>
				<td>
					<label for="detect_browser_language"><input type="checkbox" name="detect_browser_language" id="detect_browser_language" value="1"<?php 
            checked($q_config['detect_browser_language']);
            ?>
/> <?php 
            _e('Detect the language of the browser and redirect accordingly.', 'qtranslate');
            ?>
</label>
					<p class="qtranxs_notes"><?php 
            _e('When the frontpage is visited via bookmark/external link/type-in, the visitor will be forwarded to the correct URL for the language specified by his browser.', 'qtranslate');
            ?>
</p>
				</td>
			</tr>
		</table>
	<?php 
            qtranxf_admin_section_end('general');
            ?>
	<?php 
            qtranxf_admin_section_start('advanced');
            ?>
		<table class="form-table">
			<tr valign="top">
				<th scope="row"><?php 
            _e('Post Types', 'qtranslate');
            ?>
</th>
				<td>
					<label for="post_types"><?php 
            _e('Post types enabled for translation:', 'qtranslate');
            ?>
</label><p>
					<?php 
            $post_types = get_post_types();
            foreach ($post_types as $post_type) {
                if (!qtranxf_post_type_optional($post_type)) {
                    continue;
                }
                $post_type_off = isset($q_config['post_type_excluded']) && in_array($post_type, $q_config['post_type_excluded']);
                ?>
					<span style="margin-right: 12pt"><input type="hidden" name="post_types_all[<?php 
                echo $post_type;
                ?>
]" value="<?php 
                echo $post_type_off ? '0' : '1';
                ?>
"><input type="checkbox" name="post_types[<?php 
                echo $post_type;
                ?>
]" id="post_type_<?php 
                echo $post_type;
                ?>
" value="1"<?php 
                checked(!$post_type_off);
                ?>
 />&nbsp;<?php 
                echo $post_type;
                ?>
</span>
					<?php 
            }
            ?>
					</p><p class="qtranxs_notes"><?php 
            _e('If a post type unchecked, no fields in a post of that type are treated as translatable on editing pages. However, the manual raw multilingual entries with language tags may still get translated in a usual way at front-end.', 'qtranslate');
            ?>
</p>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
            _e('Flag Image Path', 'qtranslate');
            ?>
</th>
				<td>
					<?php 
            echo trailingslashit(content_url());
            ?>
<input type="text" name="flag_location" id="flag_location" value="<?php 
            echo $q_config['flag_location'];
            ?>
" style="width:100%"/>
					<p class="qtranxs_notes"><?php 
            printf(__('Path to the flag images under wp-content, with trailing slash. (Default: %s, clear the value above to reset it to the default)', 'qtranslate'), qtranxf_flag_location_default());
            ?>
</p>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
            _e('Ignore Links', 'qtranslate');
            ?>
</th>
				<td>
					<input type="text" name="ignore_file_types" id="ignore_file_types" value="<?php 
            echo implode(',', array_diff($q_config['ignore_file_types'], explode(',', QTX_IGNORE_FILE_TYPES)));
            ?>
" style="width:100%"/>
					<p class="qtranxs_notes"><?php 
            printf(__('Don\'t convert links to files of the given file types. (Always included: %s)', 'qtranslate'), implode(', ', explode(',', QTX_IGNORE_FILE_TYPES)));
            ?>
</p>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
            _e('Head inline CSS', 'qtranslate');
            ?>
</th>
				<td>
					<label for="header_css_on"><input type="checkbox" name="header_css_on" id="header_css_on" value="1"<?php 
            checked($q_config['header_css_on']);
            ?>
 />&nbsp;<?php 
            _e('CSS code added by plugin in the head of front-end pages:', 'qtranslate');
            ?>
</label>
					<br />
					<textarea id="header_css" name="header_css" style="width:100%"><?php 
            echo esc_textarea($q_config['header_css']);
            ?>
</textarea>
					<p class="qtranxs_notes"><?php 
            echo __('To reset to default, clear the text.', 'qtranslate') . ' ' . __('To disable this inline CSS, clear the check box.', 'qtranslate');
            ?>
</p>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
            _e('Cookie Settings', 'qtranslate');
            ?>
</th>
				<td>
					<label for="disable_client_cookies"><input type="checkbox" name="disable_client_cookies" id="disable_client_cookies" value="1"<?php 
            checked($q_config['disable_client_cookies']);
            disabled($url_mode == QTX_URL_DOMAIN || $url_mode == QTX_URL_DOMAINS);
            ?>
 /> <?php 
            printf(__('Disable language client cookie "%s" (not recommended).', 'qtranslate'), QTX_COOKIE_NAME_FRONT);
            ?>
</label>
					<p class="qtranxs_notes"><?php 
            echo sprintf(__('Language cookie is auto-disabled for "%s" "Pre-Domain" and "Per-Domain", as language is always unambiguously defined by a url in those modes.', 'qtranslate'), __('URL Modification Mode', 'qtranslate')) . ' ' . sprintf(__('Otherwise, use this option with a caution, for simple enough sites only. If checked, the user choice of browsing language will not be saved between sessions and some AJAX calls may deliver unexpected language, as well as some undesired language switching during browsing may occur under certain themes (%sRead More%s).', 'qtranslate'), '<a href="https://qtranslatexteam.wordpress.com/2015/02/26/browser-redirection-based-on-language/" target="_blank">', '</a>');
            ?>
</p>
					<br />
					<label for="use_secure_cookie"><input type="checkbox" name="use_secure_cookie" id="use_secure_cookie" value="1"<?php 
            checked($q_config['use_secure_cookie']);
            ?>
 /><?php 
            printf(__('Make %s cookies available only through HTTPS connections.', 'qtranslate'), 'qTranslate&#8209;X');
            ?>
</label>
					<p class="qtranxs_notes"><?php 
            _e("Don't check this if you don't know what you're doing!", 'qtranslate');
            ?>
</p>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
            _e('Update Gettext Databases', 'qtranslate');
            ?>
</th>
				<td>
					<label for="auto_update_mo"><input type="checkbox" name="auto_update_mo" id="auto_update_mo" value="1"<?php 
            checked($q_config['auto_update_mo']);
            ?>
/> <?php 
            _e('Automatically check for .mo-Database Updates of installed languages.', 'qtranslate');
            ?>
</label>
					<br/>
					<label for="update_mo_now"><input type="checkbox" name="update_mo_now" id="update_mo_now" value="1" /> <?php 
            _e('Update Gettext databases now.', 'qtranslate');
            ?>
</label>
					<p class="qtranxs_notes"><?php 
            _e('qTranslate will query the Wordpress Localisation Repository every week and download the latest Gettext Databases (.mo Files).', 'qtranslate');
            ?>
</p>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
            _e('Date / Time Conversion', 'qtranslate');
            ?>
</th>
				<td>
					<label><input type="radio" name="use_strftime" value="<?php 
            echo QTX_DATE;
            ?>
" <?php 
            checked($q_config['use_strftime'], QTX_DATE);
            ?>
/> <?php 
            _e('Use emulated date function.', 'qtranslate');
            ?>
</label><br/>
					<label><input type="radio" name="use_strftime" value="<?php 
            echo QTX_DATE_OVERRIDE;
            ?>
" <?php 
            checked($q_config['use_strftime'], QTX_DATE_OVERRIDE);
            ?>
/> <?php 
            _e('Use emulated date function and replace formats with the predefined formats for each language.', 'qtranslate');
            ?>
</label><br/>
					<label><input type="radio" name="use_strftime" value="<?php 
            echo QTX_STRFTIME;
            ?>
" <?php 
            checked($q_config['use_strftime'], QTX_STRFTIME);
            ?>
/> <?php 
            _e('Use strftime instead of date.', 'qtranslate');
            ?>
</label><br/>
					<label><input type="radio" name="use_strftime" value="<?php 
            echo QTX_STRFTIME_OVERRIDE;
            ?>
" <?php 
            checked($q_config['use_strftime'], QTX_STRFTIME_OVERRIDE);
            ?>
/> <?php 
            _e('Use strftime instead of date and replace formats with the predefined formats for each language.', 'qtranslate');
            ?>
</label>
					<p class="qtranxs_notes"><?php 
            _e('Depending on the mode selected, additional customizations of the theme may be needed.', 'qtranslate');
            ?>
</p>
					<?php 
            /*
            <br/><br/>
            <label><?php _e('If one of the above options "... replace formats with the predefined formats for each language" is in use, then exclude the following formats from being overridden:', 'qtranslate') ?></label><br/>
            <input type="text" name="ex_date_formats" id="qtranxs_ex_date_formats" value="<?php echo isset($q_config['ex_date_formats']) ? implode(' ',$q_config['ex_date_formats']) : QTX_EX_DATE_FORMATS_DEFAULT; ?>" style="width:100%"><br/>
            */
            ?>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
            _e('Translation of options', 'qtranslate');
            ?>
</th>
				<td>
					<label for="filter_options_mode_all"><input type="radio" name="filter_options_mode" id="filter_options_mode_all" value=<?php 
            echo '"' . QTX_FILTER_OPTIONS_ALL . '"';
            checked($q_config['filter_options_mode'], QTX_FILTER_OPTIONS_ALL);
            ?>
 /> <?php 
            _e('Filter all WordPress options for translation at front-end. It may hurt performance of the site, but ensures that all options are translated.', 'qtranslate');
            ?>
 <?php 
            _e('Starting from version 3.2.5, only options with multilingual content get filtered, which should help on performance issues.', 'qtranslate');
            ?>
</label>
					<br />
					<label for="filter_options_mode_list"><input type="radio" name="filter_options_mode" id="filter_options_mode_list" value=<?php 
            echo '"' . QTX_FILTER_OPTIONS_LIST . '"';
            checked($q_config['filter_options_mode'], QTX_FILTER_OPTIONS_LIST);
            ?>
 /> <?php 
            _e('Translate only options listed below (for experts only):', 'qtranslate');
            ?>
 </label>
					<br />
					<input type="text" name="filter_options" id="qtranxs_filter_options" value="<?php 
            echo isset($q_config['filter_options']) ? implode(' ', $q_config['filter_options']) : QTX_FILTER_OPTIONS_DEFAULT;
            ?>
" style="width:100%">
					<p class="qtranxs_notes"><?php 
            printf(__('By default, all options are filtered to be translated at front-end for the sake of simplicity of configuration. However, for a developed site, this may cause a considerable performance degradation. Normally, there are very few options, which actually need a translation. You may simply list them above to minimize the performance impact, while still getting translations needed. Options names must match the field "%s" of table "%s" of WordPress database. A minimum common set of option, normally needed a translation, is already entered in the list above as a default example. Option names in the list may contain wildcard with symbol "%s".', 'qtranslate'), 'option_name', 'options', '%');
            ?>
</p>
				</td>
			</tr>
			<tr valign="top" id="option_editor_mode">
				<th scope="row"><?php 
            _e('Editor Mode', 'qtranslate');
            ?>
</th>
				<td>
					<label for="qtranxs_editor_mode_lsb"><input type="radio" name="editor_mode" id="qtranxs_editor_mode_lsb" value="<?php 
            echo QTX_EDITOR_MODE_LSB;
            ?>
"<?php 
            checked($q_config['editor_mode'], QTX_EDITOR_MODE_LSB);
            ?>
/>&nbsp;<?php 
            _e('Use Language Switching Buttons (LSB).', 'qtranslate');
            ?>
</label>
					<p class="qtranxs_notes"><?php 
            echo __('This is the default mode.', 'qtranslate') . ' ' . __('Pages with translatable fields have Language Switching Buttons, which control what language is being edited, while admin language stays the same.', 'qtranslate');
            ?>
</p><br/>
					<label for="qtranxs_editor_mode_raw"><input type="radio" name="editor_mode" id="qtranxs_editor_mode_raw" value="<?php 
            echo QTX_EDITOR_MODE_RAW;
            ?>
"<?php 
            checked($q_config['editor_mode'], QTX_EDITOR_MODE_RAW);
            ?>
/>&nbsp;<?php 
            _e('Editor Raw Mode', 'qtranslate');
            ?>
. <?php 
            _e('Do not use Language Switching Buttons to edit multi-language text entries.', 'qtranslate');
            ?>
</label>
					<p class="qtranxs_notes"><?php 
            _e('Some people prefer to edit the raw entries containing all languages together separated by language defining tags, as they are stored in database.', 'qtranslate');
            ?>
</p><br/>
					<label for="qtranxs_editor_mode_single"><input type="radio" name="editor_mode" id="qtranxs_editor_mode_single" value="<?php 
            echo QTX_EDITOR_MODE_SINGLGE;
            ?>
"<?php 
            checked($q_config['editor_mode'], QTX_EDITOR_MODE_SINGLGE);
            ?>
/>&nbsp;<?php 
            echo __('Single Language Mode.', 'qtranslate') . ' ' . __('The language edited is the same as admin language.', 'qtranslate');
            ?>
</label>
					<p class="qtranxs_notes"><?php 
            echo __('Edit language cannot be switched without page re-loading. Try this mode, if some of the advanced translatable fields do not properly respond to the Language Switching Buttons due to incompatibility with a plugin, which severely alters the default WP behaviour. This mode is the most compatible with other themes and plugins.', 'qtranslate') . ' ' . __('One may find convenient to use the default Editor Mode, while remembering not to switch edit languages on custom advanced translatable fields, where LSB do not work.', 'qtranslate');
            ?>
</p>
				</td>
			</tr>
			<?php 
            $options = qtranxf_fetch_file_selection(QTRANSLATE_DIR . '/admin/css/opLSBStyle');
            if ($options) {
                ?>
			<tr valign="top" id="option_lsb_style">
				<th scope="row"><?php 
                _e('LSB Style', 'qtranslate');
                ?>
</th>
				<td>
					<fieldset>
						<legend class="hidden"><?php 
                _e('LSB Style', 'qtranslate');
                ?>
</legend>
						<label><?php 
                printf(__('Choose CSS style for how Language Switching Buttons are rendered:', 'qtranslate'));
                ?>
</label>
						<br/><?php 
                printf(__('LSB %s-wrap classes:', 'qtranslate'), 'ul');
                ?>
&nbsp;<input type="text" name="lsb_style_wrap_class" id="lsb_style_wrap_class" value="<?php 
                echo $q_config['lsb_style_wrap_class'];
                ?>
" size="50" >
						<br/><?php 
                _e('Active button class:', 'qtranslate');
                ?>
&nbsp;<input type="text" name="lsb_style_active_class" id="lsb_style_active_class" value="<?php 
                echo $q_config['lsb_style_active_class'];
                ?>
" size="40" >
						<p class="qtranxs_notes"><?php 
                _e('The above is reset to an appropriate default, if the below is changed.', 'qtranslate');
                ?>
</p>
						<br/><?php 
                _e('CSS set:', 'qtranslate');
                ?>
&nbsp;<select name="lsb_style" id="lsb_style"><?php 
                foreach ($options as $nm => $val) {
                    echo '<option value="' . $val . '"' . selected($val, $q_config['lsb_style']) . '>' . $nm . '</option>';
                }
                echo '<option value="custom"' . selected('custom', $q_config['lsb_style']) . '>' . __('Use custom CSS', 'qtranslate') . '</option>';
                ?>
</select>
						<p class="qtranxs_notes"><?php 
                printf(__('Choice "%s" disables this option and allows one to use its own custom CSS provided by other means.', 'qtranslate'), __('Use custom CSS', 'qtranslate'));
                ?>
</p>
					</fieldset>
				</td>
			</tr>
			<?php 
            }
            ?>
			<tr valign="top" id="option_highlight_mode">
				<?php 
            $highlight_mode = $q_config['highlight_mode'];
            // reset default custom CSS when the field is empty, or when the "custom" option is not checked
            if (empty($q_config['highlight_mode_custom_css']) || $highlight_mode != QTX_HIGHLIGHT_MODE_CUSTOM_CSS) {
                $highlight_mode_custom_css = qtranxf_get_admin_highlight_css($highlight_mode);
            } else {
                $highlight_mode_custom_css = $q_config['highlight_mode_custom_css'];
            }
            ?>
				<th scope="row"><?php 
            _e('Highlight Style', 'qtranslate');
            ?>
</th>
				<td>
					<p class="qtranxs_explanation"><?php 
            _e('When there are many integrated or customized translatable fields, it may become confusing to know which field has multilingual value. The highlighting of translatable fields may come handy then:', 'qtranslate');
            ?>
</p>
					<fieldset>
						<legend class="hidden"><?php 
            _e('Highlight Style', 'qtranslate');
            ?>
</legend>
						<label title="<?php 
            _e('Do not highlight the translatable fields.', 'qtranslate');
            ?>
">
							<input type="radio" name="highlight_mode" value="<?php 
            echo QTX_HIGHLIGHT_MODE_NONE;
            ?>
" <?php 
            checked($highlight_mode, QTX_HIGHLIGHT_MODE_NONE);
            ?>
 />
							<?php 
            _e('Do not highlight the translatable fields.', 'qtranslate');
            ?>
						</label><br/>
						<label title="<?php 
            _e('Show a line on the left border of translatable fields.', 'qtranslate');
            ?>
">
							<input type="radio" name="highlight_mode" value="<?php 
            echo QTX_HIGHLIGHT_MODE_BORDER_LEFT;
            ?>
" <?php 
            checked($highlight_mode, QTX_HIGHLIGHT_MODE_BORDER_LEFT);
            ?>
 />
							<?php 
            _e('Show a line on the left border of translatable fields.', 'qtranslate');
            ?>
						</label><br/>
						<label title="<?php 
            _e('Draw a border around translatable fields.', 'qtranslate');
            ?>
">
							<input type="radio" name="highlight_mode" value="<?php 
            echo QTX_HIGHLIGHT_MODE_BORDER;
            ?>
" <?php 
            checked($highlight_mode, QTX_HIGHLIGHT_MODE_BORDER);
            ?>
 />
							<?php 
            _e('Draw a border around translatable fields.', 'qtranslate');
            ?>
						</label><br/>
						<label title="<?php 
            _e('Show a shadow on the left of translatable fields.', 'qtranslate');
            ?>
">
							<input type="radio" name="highlight_mode" value="<?php 
            echo QTX_HIGHLIGHT_MODE_LEFT_SHADOW;
            ?>
" <?php 
            checked($highlight_mode, QTX_HIGHLIGHT_MODE_LEFT_SHADOW);
            ?>
 />
							<?php 
            _e('Show a shadow on the left of translatable fields.', 'qtranslate');
            ?>
						</label><br/>
						<label title="<?php 
            _e('Outline border around translatable fields.', 'qtranslate');
            ?>
">
							<input type="radio" name="highlight_mode" value="<?php 
            echo QTX_HIGHLIGHT_MODE_OUTLINE;
            ?>
" <?php 
            checked($highlight_mode, QTX_HIGHLIGHT_MODE_OUTLINE);
            ?>
 />
							<?php 
            _e('Outline border around translatable fields.', 'qtranslate');
            ?>
						</label><br/>
						<label title="<?php 
            _e('Use custom CSS', 'qtranslate');
            ?>
">
							<input type="radio" name="highlight_mode" value="<?php 
            echo QTX_HIGHLIGHT_MODE_CUSTOM_CSS;
            ?>
" <?php 
            checked($highlight_mode, QTX_HIGHLIGHT_MODE_CUSTOM_CSS);
            ?>
/>
							<?php 
            echo __('Use custom CSS', 'qtranslate') . ':';
            ?>
						</label><br/>
					</fieldset><br />
					<textarea id="highlight_mode_custom_css" name="highlight_mode_custom_css" style="width:100%"><?php 
            echo esc_textarea($highlight_mode_custom_css);
            ?>
</textarea>
					<p class="qtranxs_notes"><?php 
            echo __('To reset to default, clear the text.', 'qtranslate') . ' ';
            printf(__('The color in use is taken from your profile option %s, the third color.', 'qtranslate'), '"<a href="' . admin_url('/profile.php') . '">' . qtranxf_translate_wp('Admin Color Scheme') . '</a>"');
            ?>
</p>
				</td>
			</tr>
<?php 
            /*
            			<tr valign="top">
            				<th scope="row"><?php _e('Debugging Information', 'qtranslate') ?></th>
            				<td>
            					<p class="qtranxs_explanation"><?php printf(__('If you encounter any problems and you are unable to solve them yourself, you can visit the <a href="%s">Support Forum</a>. Posting the following Content will help other detect any misconfigurations.', 'qtranslate'), 'https://wordpress.org/support/plugin/qtranslate-x') ?></p>
            					<textarea readonly="readonly" id="qtranxs_debug"><?php
            						$q_config_copy = $q_config;
            						// remove information to keep data anonymous and other not needed things
            						unset($q_config_copy['url_info']);
            						unset($q_config_copy['js']);
            						unset($q_config_copy['windows_locale']);
            						//unset($q_config_copy['pre_domain']);
            						unset($q_config_copy['term_name']);
            						echo htmlspecialchars(print_r($q_config_copy, true));
            					?></textarea>
            				</td>
            			</tr>
            */
            ?>
		</table>
	<?php 
            qtranxf_admin_section_end('advanced');
            ?>
	<?php 
            qtranxf_admin_section_start('integration');
            ?>
		<table class="form-table">
			<tr valign="top">
				<td scope="row" colspan="2"><p class="heading"><?php 
            printf(__('If your theme or some plugins are not fully integrated with %s, suggest their authors to review the %sIntegration Guide%s. In many cases they would only need to create a simple text file in order to be fully compatible with %s. Alternatively, you may create such a file for them and for yourselves.', 'qtranslate'), 'qTranslate&#8209;X', '<a href="https://qtranslatexteam.wordpress.com/integration/" target="_blank">', '</a>', 'qTranslate&#8209;X');
            echo ' ';
            printf(__('Read %sIntegration Guide%s for more information on how to customize the configuration of %s.', 'qtranslate'), '<a href="https://qtranslatexteam.wordpress.com/integration/" target="_blank">', '</a>', 'qTranslate&#8209;X');
            ?>
</p></td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
            _e('Configuration Files', 'qtranslate');
            ?>
</th>
				<td><label for="qtranxs_config_files" class="qtranxs_explanation"><?php 
            printf(__('List of configuration files. Unless prefixed with "%s", paths are relative to %s variable: %s. Absolute paths are also acceptable.', 'qtranslate'), './', 'WP_CONTENT_DIR', trailingslashit(WP_CONTENT_DIR));
            ?>
</label>
				<br/><textarea name="json_config_files" id="qtranxs_config_files" rows="4" style="width:100%"><?php 
            if (isset($_POST['json_config_files'])) {
                echo sanitize_text_field(stripslashes($_POST['json_config_files']));
            } else {
                echo implode(PHP_EOL, $q_config['config_files']);
            }
            ?>
</textarea>
				<p class="qtranxs_notes"><?php 
            printf(__('The list gets auto-updated on a 3rd-party integrated plugin activation/deactivation. You may also add your own custom files for your theme or plugins. File "%s" is the default configuration loaded from this plugin folder. It is not recommended to modify any configuration file from other authors, but you may alter any configuration item through your own custom file appended to the end of this list.', 'qtranslate'), './i18n-config.json');
            echo ' ';
            printf(__('Use "%s" to review the resulting combined configuration from all "%s" and this option.', 'qtranslate'), '<a href="' . admin_url('options-general.php?page=qtranslate-x&config_inspector=show') . '">' . __('Configuration Inspector', 'qtranslate') . '</a>', __('Custom Configuration', 'qtranslate'));
            echo ' ';
            printf(__('Please, read %sIntegration Guide%s for more information.', 'qtranslate'), '<a href="https://qtranslatexteam.wordpress.com/integration/" target="_blank">', '</a>');
            echo ' ' . __('To reset to default, clear the text.', 'qtranslate');
            ?>
</p>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
            _e('Custom Configuration', 'qtranslate');
            ?>
</th>
				<td><label for="qtranxs_json_custom_i18n_config" class="qtranxs_explanation"><?php 
            printf(__('Additional custom JSON-encoded configuration of %s for all admin pages. It is processed after all files from option "%s" are loaded, providing opportunity to add or to override configuration tokens as necessary.', 'qtranslate'), 'qTranslate&#8209;X', __('Configuration Files', 'qtranslate'));
            ?>
</label>
				<br/><textarea name="json_custom_i18n_config" id="qtranxs_json_custom_i18n_config" rows="4" style="width:100%"><?php 
            if (isset($_POST['json_custom_i18n_config'])) {
                echo sanitize_text_field(stripslashes($_POST['json_custom_i18n_config']));
            } else {
                if (!empty($q_config['custom_i18n_config'])) {
                    echo qtranxf_json_encode($q_config['custom_i18n_config']);
                }
            }
            ?>
</textarea>
				<p class="qtranxs_notes"><?php 
            printf(__('It would make no difference, if the content of this field is stored in a file, which name is listed last in option "%s". Therefore, this field only provides flexibility for the sake of convenience.', 'qtranslate'), __('Configuration Files', 'qtranslate'));
            echo ' ';
            printf(__('Please, read %sIntegration Guide%s for more information.', 'qtranslate'), '<a href="https://qtranslatexteam.wordpress.com/integration/" target="_blank">', '</a>');
            echo ' ';
            printf(__('Use "%s" to review the resulting combined configuration from all "%s" and this option.', 'qtranslate'), '<a href="' . admin_url('options-general.php?page=qtranslate-x&config_inspector=show') . '">' . __('Configuration Inspector', 'qtranslate') . '</a>', __('Configuration Files', 'qtranslate'));
            ?>
</p>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
            _e('Custom Fields', 'qtranslate');
            ?>
</th>
				<td><p class="qtranxs_explanation">
					<?php 
            printf(__('Enter "%s" or "%s" attribute of text fields from your theme, which you wish to translate. This applies to post, page and media editors (%s). To lookup "%s" or "%s", right-click on the field in the post or the page editor and choose "%s". Look for an attribute of the field named "%s" or "%s". Enter it below, as many as you need, space- or comma-separated. After saving configuration, these fields will start responding to the language switching buttons, and you can enter different text for each language. The input fields of type %s will be parsed using %s syntax, while single line text fields will use %s syntax. If you need to override this behaviour, prepend prefix %s or %s to the name of the field to specify which syntax to use. For more information, read %sFAQ%s.', 'qtranslate'), 'id', 'class', '/wp-admin/post*', 'id', 'class', _x('Inspect Element', 'browser option', 'qtranslate'), 'id', 'class', '\'textarea\'', esc_html('<!--:-->'), '[:]', '\'<\'', '\'[\'', '<a href="https://qtranslatexteam.wordpress.com/faq/">', '</a>');
            ?>
</p>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row" style="text-align: right">id</th>
				<td><label for="qtranxs_custom_fields" class="qtranxs_explanation">
					<input type="text" name="custom_fields" id="qtranxs_custom_fields" value="<?php 
            echo implode(' ', $q_config['custom_fields']);
            ?>
" style="width:100%"></label>
					<p class="qtranxs_notes"><?php 
            _e('The value of "id" attribute is normally unique within one page, otherwise the first field found, having an id specified, is picked up.', 'qtranslate');
            ?>
</p>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row" style="text-align: right">class</th>
				<td><label for="qtranxs_custom_field_classes" class="qtranxs_explanation">
					<input type="text" name="custom_field_classes" id="qtranxs_custom_field_classes" value="<?php 
            echo implode(' ', $q_config['custom_field_classes']);
            ?>
" style="width:100%"></label>
					<p class="qtranxs_notes"><?php 
            printf(__('All the fields of specified classes will respond to Language Switching Buttons. Be careful not to include a class, which would affect language-neutral fields. If you cannot uniquely identify a field needed neither by %s, nor by %s attribute, report the issue on %sSupport Forum%s', 'qtranslate'), '"id"', '"class"', '<a href="https://wordpress.org/support/plugin/qtranslate-x">', '</a>');
            ?>
</p>
				</td>
			</tr>
			<tr valign="top">
				<th scope="row"><?php 
            _e('Custom Filters', 'qtranslate');
            ?>
</th>
				<td><label for="qtranxs_text_field_filters" class="qtranxs_explanation">
					<input type="text" name="text_field_filters" id="qtranxs_text_field_filters" value="<?php 
            echo implode(' ', $q_config['text_field_filters']);
            ?>
" style="width:100%"></label>
					<p class="qtranxs_notes"><?php 
            printf(__('Names of filters (which are enabled on theme or other plugins via %s function) to add translation to. For more information, read %sFAQ%s.', 'qtranslate'), 'apply_filters()', '<a href="https://qtranslatexteam.wordpress.com/faq/#CustomFields">', '</a>');
            ?>
</p>
				</td>
			</tr>
			<?php 
            /* ?>
            			<tr valign="top">
            				<th scope="row"><?php _e('Custom Admin Pages', 'qtranslate') ?></th>
            				<td><label for="qtranxs_custom_pages" class="qtranxs_explanation"><input type="text" name="custom_pages" id="qtranxs_custom_pages" value="<?php echo implode(' ',$q_config['custom_pages']) ?>" style="width:100%"></label>
            					<p class="qtranxs_notes"><?php printf(__('List the custom admin page paths for which you wish Language Switching Buttons to show up. The Buttons will then control fields configured in "Custom Fields" section. You may only include part of the full URL after %s, including a distinctive query string if needed. As many as desired pages can be listed space/comma separated. For more information, read %sFAQ%s.', 'qtranslate'),'/wp-admin/','<a href="https://qtranslatexteam.wordpress.com/faq/">','</a>') ?></p>
            				</td>
            			</tr>
            			<?php */
            ?>
			<tr valign="top">
				<th scope="row"><?php 
            _e('Compatibility Functions', 'qtranslate');
            ?>
</th>
				<td>
					<label for="qtranxs_qtrans_compatibility"><input type="checkbox" name="qtrans_compatibility" id="qtranxs_qtrans_compatibility" value="1"<?php 
            checked($q_config['qtrans_compatibility']);
            ?>
/>&nbsp;<?php 
            printf(__('Enable function name compatibility (%s).', 'qtranslate'), 'qtrans_convertURL, qtrans_getAvailableLanguages, qtrans_generateLanguageSelectCode, qtrans_getLanguage, qtrans_getLanguageName, qtrans_getSortedLanguages, qtrans_join, qtrans_split, qtrans_use, qtrans_useCurrentLanguageIfNotFoundShowAvailable, qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage, qtrans_useDefaultLanguage, qtrans_useTermLib');
            ?>
</label><br/>
					<p class="qtranxs_notes"><?php 
            printf(__('Some plugins and themes use direct calls to the functions listed, which are defined in former %s plugin and some of its forks. Turning this flag on will enable those function to exists, which will make the dependent plugins and themes to work. WordPress policy prohibits to define functions with the same names as in other plugins, since it generates user-unfriendly fatal errors, when two conflicting plugins are activated simultaneously. Before turning this option on, you have to make sure that there are no other plugins active, which define those functions.', 'qtranslate'), '<a href="https://wordpress.org/plugins/qtranslate/" target="_blank">qTranslate</a>');
            ?>
</p>
				</td>
			</tr>
		</table>
	<?php 
            qtranxf_admin_section_end('integration');
            // Allow to load additional services
            do_action('qtranslate_configuration', $clean_uri);
            ?>
	</div><?php 
            //<!-- /tabs-container -->
            ?>
	</form>
<?php 
        }
        ?>
</div><!-- /wrap -->
<div class="wrap">

<div class="tabs-content">
<?php 
        qtranxf_admin_section_start('languages');
        class QTX_LanguageList extends WP_List_Table
        {
            private $_clean_uri;
            private $_language_names;
            public function __construct($language_names, $clean_uri)
            {
                parent::__construct(array('screen' => 'language'));
                $this->_language_names = $language_names;
                $this->_clean_uri = $clean_uri;
            }
            public function get_columns()
            {
                return array('code' => _x('Code', 'Two-letter Language Code meant.', 'qtranslate'), 'flag' => __('Flag', 'qtranslate'), 'name' => __('Name', 'qtranslate'), 'action' => __('Action', 'qtranslate'), 'edit' => __('Edit', 'qtranslate'), 'stored' => __('Stored', 'qtranslate'));
            }
            /* public function get_sortable_columns() {
            		return array(
            			'code' => array('code',false),
            			'name' => array('name',true) //true means it's already sorted
            		);
            	}*/
            protected function column_default($item, $column_name)
            {
                return $item[$column_name];
            }
            protected function get_default_primary_column_name()
            {
                return 'name';
            }
            protected function display_tablenav($which)
            {
            }
            protected function get_table_classes()
            {
                return array('widefat', 'qtranxs-language-list');
            }
            public function prepare_items()
            {
                global $q_config;
                $flags = qtranxf_language_configured('flag');
                $languages_stored = get_option('qtranslate_language_names', array());
                $languages_predef = qtranxf_default_language_name();
                $flag_location_url = qtranxf_flag_location();
                $flag_location_dir = trailingslashit(WP_CONTENT_DIR) . $q_config['flag_location'];
                $flag_location_url_def = content_url(qtranxf_flag_location_default());
                //trailingslashit(content_url()).'/plugins/'.basename(dirname(QTRANSLATE_FILE)).'/flags/';
                $clean_uri = $this->_clean_uri;
                $data = array();
                foreach ($this->_language_names as $lang => $language) {
                    if ($lang == 'code') {
                        continue;
                    }
                    $flag = $flags[$lang];
                    if (file_exists($flag_location_dir . $flag)) {
                        $flag_url = $flag_location_url . $flag;
                    } else {
                        $flag_url = $flag_location_url_def . $flag;
                    }
                    $data[] = array('code' => $lang, 'flag' => '<img src="' . $flag_url . '" alt="' . sprintf(__('%s Flag', 'qtranslate'), $language) . '">', 'name' => $language, 'action' => in_array($lang, $q_config['enabled_languages']) ? $q_config['default_language'] == $lang ? __('Default', 'qtranslate') : '<a class="edit" href="' . $clean_uri . '&disable=' . $lang . '#languages">' . __('Disable', 'qtranslate') . '</a>' : '<a class="edit" href="' . $clean_uri . '&enable=' . $lang . '#languages">' . __('Enable', 'qtranslate') . '</a>', 'edit' => '<a class="edit" href="' . $clean_uri . '&edit=' . $lang . '">' . __('Edit', 'qtranslate') . '</a>', 'stored' => !isset($languages_stored[$lang]) ? __('Pre-Defined', 'qtranslate') : '<a class="delete" href="' . $clean_uri . '&delete=' . $lang . '#languages">' . (isset($languages_predef[$lang]) ? __('Reset', 'qtranslate') : __('Delete', 'qtranslate')) . '</a>');
                }
                $this->items = $data;
            }
        }
        ?>
<div id="col-container">

<div id="col-right">
<div class="col-wrap">
<h3><?php 
        _e('List of Configured Languages', 'qtranslate');
        ?>
</h3>
<p class="qtranxs_notes"><?php 
        $language_names = qtranxf_language_configured('language_name');
        printf(__('Only enabled languages are loaded at front-end, while all %d configured languages are listed here.', 'qtranslate'), count($language_names));
        echo ' ';
        _e('The table below contains both pre-defined and manually added or modified languages.', 'qtranslate');
        echo ' ';
        printf(__('You may %s or %s a language, or %s manually added language, or %s previous modifications of a pre-defined language.', 'qtranslate'), '"' . __('Enable', 'qtranslate') . '"', '"' . __('Disable', 'qtranslate') . '"', '"' . __('Delete', 'qtranslate') . '"', '"' . __('Reset', 'qtranslate') . '"');
        echo ' ';
        printf(__('Click %s to modify language properties.', 'qtranslate'), '"' . __('Edit', 'qtranslate') . '"');
        ?>
</p>
<?php 
        $tbl = new QTX_LanguageList($language_names, $clean_uri);
        $tbl->prepare_items();
        $tbl->display();
        /* ?>
        <table class="widefat">
        	<thead><tr><?php $tbl->print_column_headers(true) ?></tr></thead>
        	<tbody id="the-list" class="qtranxs-language-list" class="list:cat">
        <?php
        	$flags = qtranxf_language_configured('flag');
        	$languages_stored = get_option('qtranslate_language_names',array());
        	$languages_predef = qtranxf_default_language_name();
        	$flag_location_url = qtranxf_flag_location();
        	$flag_location_dir = trailingslashit(WP_CONTENT_DIR).$q_config['flag_location'];
        	$flag_location_url_def = content_url(qtranxf_flag_location_default());
        	//trailingslashit(content_url()).'/plugins/'.basename(dirname(QTRANSLATE_FILE)).'/flags/';
        	foreach($language_names as $lang => $language){ if($lang=='code') continue;
        		$flag = $flags[$lang];
        		if(file_exists($flag_location_dir.$flag)){
        			$flag_url = $flag_location_url.$flag;
        		}else{
        			$flag_url = $flag_location_url_def.$flag;
        		}
        ?>
        	<tr>
        		<td><?php echo $lang; ?></td>
        		<td><img src="<?php echo $flag_url; ?>" alt="<?php echo sprintf(__('%s Flag', 'qtranslate'), $language) ?>"></td>
        		<td><?php echo $language; ?></td>
        		<td><?php if(in_array($lang,$q_config['enabled_languages'])) { if($q_config['default_language']==$lang){ _e('Default', 'qtranslate'); } else{ ?><a class="edit" href="<?php echo $clean_uri; ?>&disable=<?php echo $lang; ?>#languages"><?php _e('Disable', 'qtranslate') ?></a><?php } } else { ?><a class="edit" href="<?php echo $clean_uri; ?>&enable=<?php echo $lang; ?>#languages"><?php _e('Enable', 'qtranslate') ?></a><?php } ?></td>
        		<td><a class="edit" href="<?php echo $clean_uri; ?>&edit=<?php echo $lang; ?>"><?php _e('Edit', 'qtranslate') ?></a></td>
        		<td><?php if(!isset($languages_stored[$lang])){ _e('Pre-Defined', 'qtranslate'); } else { ?><a class="delete" href="<?php echo $clean_uri; ?>&delete=<?php echo $lang; ?>#languages"><?php if(isset($languages_predef[$lang])) _e('Reset', 'qtranslate'); else _e('Delete', 'qtranslate') ?></a><?php } ?></td>
        	</tr>
        <?php } ?>
        	</tbody>
        	<tfoot><tr><?php $tbl->print_column_headers(false) ?></tr></tfoot>
        </table>
        <?php */
        ?>
<p class="qtranxs_notes"><?php 
        _e('Enabling a language will cause qTranslate to update the Gettext-Database for the language, which can take a while depending on your server\'s connection speed.', 'qtranslate');
        ?>
</p>
</div>
</div>

<div id="col-left">
<div class="col-wrap">
<div class="form-wrap">
<h3><?php 
        _e('Add Language', 'qtranslate');
        ?>
</h3>
<form action="<?php 
        echo $clean_uri;
        ?>
" name="addlang" id="addlang" method="post" class="add:the-list: validate">
<?php 
        wp_nonce_field($nonce_action);
        // Prevent CSRF
        qtranxf_language_form();
        qtranxf_admin_section_end('languages', __('Add Language &raquo;', 'qtranslate'));
        ?>
</form></div></div></div></div></div>
<?php 
    }
    ?>
</div>
<?php 
}
Esempio n. 9
0
function qtranxf_update_option_time_format($old_value, $value)
{
    qtranxf_update_dt_format($old_value, $value, 'time_format', qtranxf_translate_wp('Time Format'));
}
Esempio n. 10
0
    echo walk_nav_menu_tree(array_map('wp_setup_nav_menu_item', $elems_obj), 0, (object) array('walker' => $walker));
    ?>
		</ul>
	</div>
	<span class="list-controls hide-if-no-js">
		<a href="javascript:void(0);" class="help" onclick="jQuery( '#qtranxs-langsw-help' ).toggle();"><?php 
    _e('Help', 'qtranslate');
    ?>
</a>
		<span class="hide-if-js" id="qtranxs-langsw-help"><p><a name="qtranxs-langsw-help"></a>
		<?php 
    echo __('Menu item added is replaced with a drop-down menu of available languages, when menu is rendered.', 'qtranslate');
    echo ' ';
    printf(__('The rendered menu items have CSS classes %s and %s ("%s" is a language code), which can be defined in theme style, if desired. The label of language menu can also be customized via field "%s" in the menu configuration.', 'qtranslate'), '.qtranxs-lang-menu, .qtranxs-lang-menu-xx, .qtranxs-lang-menu-item', '.qtranxs-lang-menu-item-xx', 'xx', qtranxf_translate_wp('Navigation Label'));
    echo ' ';
    printf(__('The field "%s" of inserted menu item allows additional configuration described in %sFAQ%s.', 'qtranslate'), qtranxf_translate_wp('URL'), '<a href="https://qtranslatexteam.wordpress.com/faq/#LanguageSwitcherMenuConfig" target="blank">', '</a>');
    ?>
</p>
		</span>
	</span>
	<p class="button-controls">
		<span class="add-to-menu">
			<input type="submit"<?php 
    disabled($nav_menu_selected_id, 0);
    ?>
 class="button-secondary submit-add-to-menu right" value="<?php 
    esc_attr_e('Add to Menu', 'qtranslate');
    ?>
" name="add-qtranxs-langsw-menu-item" id="submit-qtranxs-langsw" />
			<span class="spinner"></span>
		</span>
function qtranxf_slug_config($request_uri)
{
    global $q_config;
    $nopermalinks = qtranxf_is_permalink_structure_query();
    qtranxf_admin_section_start('slugs');
    ?>
<table class="form-table" id="qtranxf_slug_config">
<?php 
    if ($nopermalinks) {
        ?>
	<tr>
		<th scope="row" colspan="2"><?php 
        printf(__('You have to use pretty %spermalinks%s in order to take advantage of multilingual slugs.', 'qtranslate'), '<a href="' . admin_url('options-permalink.php') . '">', '</a>');
        ?>
</th>
	</tr>
<?php 
    } else {
        ?>
	<tr>
		<th scope="row"><?php 
        _e('Translate Slugs', 'qtranslate');
        ?>
</th>
		<td><input type="checkbox" name="slugs" id="qtranxs_slugs"<?php 
        checked(!empty($q_config['slugs']));
        ?>
  value="1"><label for="qtranxs_slugs" class="qtranxs_explanation"><?php 
        printf(__('Enable multilingual URL slugs for posts, pages, categories, post types, tags, etc.', 'qtranslate'));
        ?>
</label>
		<p class="qtranxs_notes"><?php 
        printf(__('Make sure to deactivate all other 3rd-party slug services. You may need to %simport slug data%s from other slug-plugins upon activation this service.', 'qtranslate'), '<a href="' . $request_uri . '#import">', '</a>') . ' ' . printf(__('It is important to read %sLocalized Slugs Guide%s to prevent other possible confusions.', 'qtranslate'), '<a href="https://qtranslatexteam.wordpress.com/slugs/" target="_blank">', '</a>');
        ?>
</p>
		</td>
	</tr>
<?php 
        if (!empty($q_config['slugs'])) {
            ?>
	<tr>
		<td colspan="2"><p class="qtranxs_explanation"><?php 
            echo __('If you change the default language value in one of the fields below, you may need to go back to the appropriate 3rd-party configuration page and make the same change there. It may also not be possible to make the same change using their tool, since additional restrictions may apply. That is why, it is advisable to tune all the default language values first, using corresponding native tools, before entering their translations to other languages on this page.', 'qtranslate') . ' ' . __('Be aware that not all browsers support non-latin alphabets in the address field, and therefore such slugs may appear url-encoded, which is probably not what you would wish. Please, test the appearance of non-latin slugs before going too far with them, you might change your mind.', 'qtranslate') . ' ' . sprintf(__('It is important to read %sLocalized Slugs Guide%s to prevent other possible confusions.', 'qtranslate'), '<a href="https://qtranslatexteam.wordpress.com/slugs/" target="_blank">', '</a>');
            ?>
</p>
		</td>
	</tr>
	<tr><td colspan="2" id="qtranxs_slug_lsb_top"></td></tr>
<?php 
            $objects = get_taxonomies(array('public' => true, 'show_ui' => true, '_builtin' => true), 'object');
            $objects = qtranxf_slug_admin_filter_types($objects);
            if (!empty($objects)) {
                ?>
	<tr>
		<th scope="row" class="qtranxs_option_group"><?php 
                _e('Built-in Taxonomies', 'qtranslate');
                ?>
</th>
		<td><p class="qtranxs_explanation"><?php 
                printf(__('Multilingual slug base for WordPress built-in taxonomies. The default language value is defined by %sWordPress%s on admin page %s.', 'qtranslate'), '<a href="https://codex.wordpress.org/Taxonomies" target="_blank">', '</a>', '<a href="' . admin_url('options-permalink.php') . '" target="_blank">' . qtranxf_translate_wp('Settings') . '/' . qtranxf_translate_wp('Permalinks') . '</a>');
                ?>
</p>
		</td>
	</tr>
<?php 
                //qtranxf_slug_admin_field('taxonomy', qtranxf_translate_wp('Category base'), 'taxonomy_category');
                //qtranxf_slug_admin_field('taxonomy', qtranxf_translate_wp('Tag base'), 'taxonomy_post_tag');
                qtranxf_slug_admin_fields($objects, 'taxonomy_builtin');
            }
            //global $wp_taxonomies; $objects = $wp_taxonomies;
            $objects = get_taxonomies(array('public' => true, 'show_ui' => true, '_builtin' => false), 'object');
            $objects = qtranxf_slug_admin_filter_types($objects);
            if (!empty($objects)) {
                ?>
	<tr>
		<th scope="row" class="qtranxs_option_group"><?php 
                _e('Custom Taxonomies', 'qtranslate');
                ?>
</th>
		<td><p class="qtranxs_explanation"><?php 
                echo __('Multilingual slug base for custom taxonomies.', 'qtranslate') . ' ';
                printf(__('The default language value is as provided in the argument %s of a call to function %s made by a 3rd-party, which created the term.', 'qtranslate'), '<code>$args[\'rewrite\'][\'slug\']</code>', '<a href="http://codex.wordpress.org/Function_Reference/register_taxonomy" target="_blank"><code>register_taxonomy</code></a>');
                ?>
</p>
		</td>
	</tr>
<?php 
                qtranxf_slug_admin_fields($objects, 'taxonomy');
            }
            //global $wp_post_types; $objects = $wp_post_types;
            $objects = get_post_types(array('_builtin' => true, 'public' => true), 'objects');
            $objects = qtranxf_slug_admin_filter_types($objects);
            if (!empty($objects)) {
                ?>
	<tr>
		<th scope="row" class="qtranxs_option_group"><?php 
                _e('Built-in Post Types', 'qtranslate');
                ?>
</th>
		<td><p class="qtranxs_explanation"><?php 
                printf(__('Multilingual slug base for WordPress built-in post types. The default value is defined by %sWordPress%s.', 'qtranslate'), '<a href="https://codex.wordpress.org/Post_Types" target="_blank">', '</a>');
                ?>
</p>
		</td>
	</tr>
<?php 
                qtranxf_slug_admin_fields($objects, 'post_type_builtin');
            }
            //$objects = get_post_types( array('publicly_queryable' => true) );
            $objects = get_post_types(array('_builtin' => false, 'public' => true), 'objects');
            $objects = qtranxf_slug_admin_filter_types($objects);
            if (!empty($objects)) {
                ?>
	<tr>
		<th scope="row" class="qtranxs_option_group"><?php 
                _e('Custom Post Types', 'qtranslate');
                ?>
</th>
		<td><p class="qtranxs_explanation"><?php 
                echo __('Multilingual slug base for custom post types.', 'qtranslate') . ' ';
                printf(__('The default language value is as provided in the argument %s of a call to function %s made by a 3rd-party, which created the term.', 'qtranslate'), '<code>$args[\'rewrite\'][\'slug\']</code>', '<a href="http://codex.wordpress.org/Function_Reference/register_post_type" target="_blank"><code>register_post_type</code></a>');
                ?>
</p>
		</td>
	</tr>
<?php 
                qtranxf_slug_admin_fields($objects, 'post_type');
            }
            ?>
	<tr><td colspan="2" id="qtranxf_slug_lsb_bottom"></td></tr>
<?php 
        }
        //if(!empty($q_config['slugs']))
    }
    //if(pretty permalinks)
    ?>
</table>
<?php 
    qtranxf_admin_section_end('slugs', $nopermalinks ? null : '');
}