function qtrans_loadConfig() { global $q_config; // Load everything $language_names = get_option('qtranslate_language_names'); $enabled_languages = get_option('qtranslate_enabled_languages'); $default_language = get_option('qtranslate_default_language'); $flag_location = get_option('qtranslate_flag_location'); $flags = get_option('qtranslate_flags'); $locales = get_option('qtranslate_locales'); $na_messages = get_option('qtranslate_na_messages'); $date_formats = get_option('qtranslate_date_formats'); $time_formats = get_option('qtranslate_time_formats'); $use_strftime = get_option('qtranslate_use_strftime'); $ignore_file_types = get_option('qtranslate_ignore_file_types'); $url_mode = get_option('qtranslate_url_mode'); $detect_browser_language = get_option('qtranslate_detect_browser_language'); $hide_untranslated = get_option('qtranslate_hide_untranslated'); $auto_update_mo = get_option('qtranslate_auto_update_mo'); $term_name = get_option('qtranslate_term_name'); $hide_default_language = get_option('qtranslate_hide_default_language'); // default if not set if (!is_array($ignore_file_types)) { $ignore_file_types = $q_config['ignore_file_types']; } if (!is_array($date_formats)) { $date_formats = $q_config['date_format']; } if (!is_array($time_formats)) { $time_formats = $q_config['time_format']; } if (!is_array($na_messages)) { $na_messages = $q_config['not_available']; } if (!is_array($locales)) { $locales = $q_config['locale']; } if (!is_array($flags)) { $flags = $q_config['flag']; } if (!is_array($language_names)) { $language_names = $q_config['language_name']; } if (!is_array($enabled_languages)) { $enabled_languages = $q_config['enabled_languages']; } if (!is_array($term_name)) { $term_name = $q_config['term_name']; } if (empty($default_language)) { $default_language = $q_config['default_language']; } if (empty($use_strftime)) { $use_strftime = $q_config['use_strftime']; } if (empty($url_mode)) { $url_mode = $q_config['url_mode']; } if (!is_string($flag_location) || $flag_location === '') { $flag_location = $q_config['flag_location']; } $detect_browser_language = qtrans_validateBool($detect_browser_language, $q_config['detect_browser_language']); $hide_untranslated = qtrans_validateBool($hide_untranslated, $q_config['hide_untranslated']); $auto_update_mo = qtrans_validateBool($auto_update_mo, $q_config['auto_update_mo']); $hide_default_language = qtrans_validateBool($hide_default_language, $q_config['hide_default_language']); // url fix for upgrading users $flag_location = trailingslashit(preg_replace('#^wp-content/#', '', $flag_location)); // check for invalid permalink/url mode combinations $permalink_structure = get_option('permalink_structure'); if ($permalink_structure === "" || strpos($permalink_structure, '?') !== false || strpos($permalink_structure, 'index.php') !== false) { $url_mode = QT_URL_QUERY; } // overwrite default values with loaded values $q_config['date_format'] = $date_formats; $q_config['time_format'] = $time_formats; $q_config['not_available'] = $na_messages; $q_config['locale'] = $locales; $q_config['flag'] = $flags; $q_config['language_name'] = $language_names; $q_config['enabled_languages'] = $enabled_languages; $q_config['default_language'] = $default_language; $q_config['flag_location'] = $flag_location; $q_config['use_strftime'] = $use_strftime; $q_config['ignore_file_types'] = $ignore_file_types; $q_config['url_mode'] = $url_mode; $q_config['detect_browser_language'] = $detect_browser_language; $q_config['hide_untranslated'] = $hide_untranslated; $q_config['auto_update_mo'] = $auto_update_mo; $q_config['hide_default_language'] = $hide_default_language; $q_config['term_name'] = $term_name; do_action('qtranslate_loadConfig'); }
function qs_load() { global $q_config, $qs_public_key; $qtranslate_services = get_option('qtranslate_qtranslate_services'); $qtranslate_services = qtrans_validateBool($qtranslate_services, $q_config['qtranslate_services']); $q_config['qtranslate_services'] = $qtranslate_services && function_exists('openssl_get_publickey'); if ($q_config['qtranslate_services'] && is_string($qs_public_key)) { $qs_public_key = openssl_get_publickey(join("\n", explode("|", $qs_public_key))); } }
function qs_load() { global $q_config, $qs_public_key; $mqtranslate_services = get_option('mqtranslate_mqtranslate_services'); $mqtranslate_services = qtrans_validateBool($mqtranslate_services, $q_config['mqtranslate_services']); $q_config['mqtranslate_services'] = $mqtranslate_services && qs_isOpenSSLAvailable(); if ($q_config['mqtranslate_services'] && is_string($qs_public_key)) { $qs_public_key = openssl_get_publickey(join("\n", explode("|", $qs_public_key))); } }