function qtranxf_admin_loadConfig() { global $q_config, $qtranslate_options; qtranxf_admin_set_default_options($qtranslate_options); foreach ($qtranslate_options['admin']['int'] as $nm => $def) { qtranxf_load_option($nm, $def); } foreach ($qtranslate_options['admin']['bool'] as $nm => $def) { qtranxf_load_option_bool($nm, $def); } foreach ($qtranslate_options['admin']['str'] as $nm => $def) { qtranxf_load_option($nm, $def); } foreach ($qtranslate_options['admin']['text'] as $nm => $def) { qtranxf_load_option($nm, $def); } foreach ($qtranslate_options['admin']['array'] as $nm => $def) { qtranxf_load_option_array($nm, $def); } if (empty($q_config['admin_config'])) { require_once QTRANSLATE_DIR . '/admin/qtx_admin_options_update.php'; qtranxf_update_i18n_config(); } /** * Opportunity to load additional admin features. */ do_action('qtranslate_admin_loadConfig'); qtranxf_add_conf_filters(); }
function qtranxf_admin_loadConfig() { global $q_config, $qtranslate_options; qtranxf_admin_set_default_options($qtranslate_options); foreach ($qtranslate_options['admin']['int'] as $nm => $def) { qtranxf_load_option($nm, $def); } foreach ($qtranslate_options['admin']['bool'] as $nm => $def) { qtranxf_load_option_bool($nm, $def); } foreach ($qtranslate_options['admin']['str'] as $nm => $def) { qtranxf_load_option($nm, $def); } foreach ($qtranslate_options['admin']['text'] as $nm => $def) { qtranxf_load_option($nm, $def); } foreach ($qtranslate_options['admin']['array'] as $nm => $def) { qtranxf_load_option_array($nm, $def); } qtranxf_add_admin_filters(); do_action('qtranslate_admin_loadConfig'); }
function qtranxf_admin_loadConfig() { global $q_config, $qtranslate_options; qtranxf_admin_set_default_options($qtranslate_options); foreach ($qtranslate_options['admin']['int'] as $nm => $def) { qtranxf_load_option($nm, $def); } foreach ($qtranslate_options['admin']['bool'] as $nm => $def) { qtranxf_load_option_bool($nm, $def); } foreach ($qtranslate_options['admin']['str'] as $nm => $def) { qtranxf_load_option($nm, $def); } foreach ($qtranslate_options['admin']['text'] as $nm => $def) { qtranxf_load_option($nm, $def); } foreach ($qtranslate_options['admin']['array'] as $nm => $def) { qtranxf_load_option_array($nm, $def); } if (empty($q_config['admin_config'])) { require_once QTRANSLATE_DIR . '/admin/qtx_admin_options_update.php'; qtranxf_update_i18n_config(); } // Set Admin Sections Names $q_config['admin_sections'] = array(); $admin_sections =& $q_config['admin_sections']; $admin_sections['general'] = __('General', 'qtranslate'); //General Settings $admin_sections['advanced'] = __('Advanced', 'qtranslate'); //Advanced Settings do_action('qtranslate_admin_loadConfig'); $admin_sections['integration'] = __('Integration', 'qtranslate'); //Custom Integration $admin_sections['import'] = __('Import', 'qtranslate') . '/' . __('Export', 'qtranslate'); $admin_sections['languages'] = __('Languages', 'qtranslate'); //always last section qtranxf_add_admin_filters(); }
function qtranxf_loadConfig() { global $qtranslate_options, $q_config; qtranxf_set_default_options($qtranslate_options); $q_config = array(); qtranxf_load_option_func('default_language'); qtranxf_load_option_array('enabled_languages'); qtranxf_load_option_flag_location('flag_location'); foreach ($qtranslate_options['front']['int'] as $nm => $def) { qtranxf_load_option($nm, $def); } //qtranxf_dbg_log('qtranxf_loadConfig: $q_config[use_strftime]: ',$q_config['use_strftime']); if ($q_config['use_strftime'] != QTX_DATE_WP && qtranxf_windows_os()) { $q_config['use_strftime'] = QTX_DATE_WP; } qtranxf_load_languages_enabled(); foreach ($qtranslate_options['front']['bool'] as $nm => $def) { qtranxf_load_option_bool($nm, $def); } foreach ($qtranslate_options['front']['str'] as $nm => $def) { qtranxf_load_option($nm, $def); } foreach ($qtranslate_options['front']['text'] as $nm => $def) { qtranxf_load_option($nm, $def); } foreach ($qtranslate_options['front']['array'] as $nm => $def) { qtranxf_load_option_array($nm, $def); } qtranxf_load_option_array('term_name', array()); if ($q_config['filter_options_mode'] == QTX_FILTER_OPTIONS_LIST) { qtranxf_load_option_array('filter_options', QTX_FILTER_OPTIONS_DEFAULT); } $url_mode = $q_config['url_mode']; // check for invalid permalink/url mode combinations if (qtranxf_is_permalink_structure_query()) { switch ($url_mode) { case QTX_URL_QUERY: case QTX_URL_DOMAIN: case QTX_URL_DOMAINS: break; default: $q_config['url_mode'] = $url_mode = QTX_URL_QUERY; break; } } switch ($url_mode) { case QTX_URL_DOMAINS: $q_config['domains'] = array(); qtranxf_load_option_array('domains'); //qtranxf_dbg_echo('domains loaded: ',$q_config['domains']); foreach ($q_config['enabled_languages'] as $lang) { if (isset($q_config['domains'][$lang])) { continue; } $homeinfo = qtranxf_get_home_info(); $q_config['domains'][$lang] = $lang . '.' . $homeinfo['host']; } $q_config['disable_client_cookies'] = true; $q_config['hide_default_language'] = false; break; case QTX_URL_QUERY: case QTX_URL_PATH: $q_config['disable_client_cookies'] = false; qtranxf_load_option_bool('disable_client_cookies'); break; case QTX_URL_DOMAIN: default: $q_config['disable_client_cookies'] = true; break; } $ignore_file_types = get_option('qtranslate_ignore_file_types'); $val = explode(',', QTX_IGNORE_FILE_TYPES); if (!empty($ignore_file_types)) { $vals = preg_split('/[\\s,]+/', strtolower($ignore_file_types), null, PREG_SPLIT_NO_EMPTY); foreach ($vals as $v) { if (empty($v)) { continue; } if (in_array($v, $val)) { continue; } $val[] = $v; } } $q_config['ignore_file_types'] = $val; if (empty($q_config['front_config'])) { //todo this should be granulated to load only what is needed require_once QTRANSLATE_DIR . '/admin/qtx_activation_hook.php'; require_once QTRANSLATE_DIR . '/admin/qtx_admin_options_update.php'; qtranxf_update_i18n_config(); } /** * Opportunity to load additional front-end features. */ do_action('qtranslate_loadConfig'); }
/** * Updates 'admin_config' and 'front_config' from *.json files listed in option 'config_files', and option 'custom_i18n_config'. * @since 3.3.1 */ function qtranxf_update_i18n_config() { global $q_config; if (!isset($q_config['config_files'])) { global $qtranslate_options; qtranxf_admin_set_default_options($qtranslate_options); qtranxf_load_option_array('config_files', $qtranslate_options['admin']['array']['config_files']); qtranxf_load_option_array('custom_i18n_config', $qtranslate_options['admin']['array']['custom_i18n_config']); } $json_files = $q_config['config_files']; $custom_i18n_config = $q_config['custom_i18n_config']; $cfg = qtranxf_load_config_all($json_files, $custom_i18n_config); if ($q_config['admin_config'] !== $cfg['admin-config']) { $q_config['admin_config'] = $cfg['admin-config']; qtranxf_update_option('admin_config'); } if ($q_config['front_config'] !== $cfg['front-config']) { $q_config['front_config'] = $cfg['front-config']; qtranxf_update_option('front_config'); } }
function qtranxf_loadConfig() { global $qtranslate_options, $q_config; qtranxf_set_default_options($qtranslate_options); $q_config = array(); qtranxf_load_option_func('default_language'); qtranxf_load_option_array('enabled_languages'); qtranxf_load_option_flag_location('flag_location'); qtranxf_load_languages_enabled(); foreach ($qtranslate_options['front']['int'] as $nm => $def) { qtranxf_load_option($nm, $def); } foreach ($qtranslate_options['front']['bool'] as $nm => $def) { qtranxf_load_option_bool($nm, $def); } foreach ($qtranslate_options['front']['str'] as $nm => $def) { qtranxf_load_option($nm, $def); } foreach ($qtranslate_options['front']['text'] as $nm => $def) { qtranxf_load_option($nm, $def); } foreach ($qtranslate_options['front']['array'] as $nm => $def) { qtranxf_load_option_array($nm, $def); } qtranxf_load_option_array('term_name', array()); if ($q_config['filter_options_mode'] == QTX_FILTER_OPTIONS_LIST) { qtranxf_load_option_array('filter_options', QTX_FILTER_OPTIONS_DEFAULT); } $url_mode = $q_config['url_mode']; // check for invalid permalink/url mode combinations if (qtranxf_is_permalink_structure_query()) { switch ($url_mode) { case QTX_URL_QUERY: case QTX_URL_DOMAIN: case QTX_URL_DOMAINS: break; default: $q_config['url_mode'] = $url_mode = QTX_URL_QUERY; break; } } switch ($url_mode) { case QTX_URL_DOMAINS: $q_config['domains'] = array(); qtranxf_load_option_array('domains'); //qtranxf_dbg_echo('domains loaded: ',$q_config['domains']); foreach ($q_config['enabled_languages'] as $lang) { if (isset($q_config['domains'][$lang])) { continue; } $homeinfo = qtranxf_get_home_info(); $q_config['domains'][$lang] = $lang . '.' . $homeinfo['host']; } $q_config['disable_client_cookies'] = true; $q_config['hide_default_language'] = false; break; case QTX_URL_QUERY: case QTX_URL_PATH: $q_config['disable_client_cookies'] = false; qtranxf_load_option_bool('disable_client_cookies'); break; case QTX_URL_DOMAIN: default: $q_config['disable_client_cookies'] = true; break; } $ignore_file_types = get_option('qtranslate_ignore_file_types'); $val = explode(',', QTX_IGNORE_FILE_TYPES); if (!empty($ignore_file_types)) { $vals = preg_split('/[\\s,]+/', strtolower($ignore_file_types), null, PREG_SPLIT_NO_EMPTY); foreach ($vals as $v) { if (empty($v)) { continue; } if (in_array($v, $val)) { continue; } $val[] = $v; } } $q_config['ignore_file_types'] = $val; do_action('qtranslate_loadConfig'); }