function qtranxf_adjust_config_files($fn_add, $fn_del) { $config_files = qtranxf_get_option_config_files(); if ($fn_add) { if (in_array($fn_add, $config_files)) { $fn_add = false; } else { $config_files = qtranxf_add_config_file($config_files, $fn_add); } } if ($fn_del) { $i = array_search($fn_del, $config_files); if ($i === FALSE) { $fn_del = false; } else { unset($config_files[$i]); } } if (!$fn_add && !$fn_del) { return; } qtranxf_update_config_options($config_files); }
function qtranxf_on_deactivate_plugin($plugin, $network_deactivating = false) { //qtranxf_dbg_log('qtranxf_on_deactivate_plugin: $plugin: ',$plugin); $bnm = dirname($plugin); $qtx = qtranxf_plugin_dirname(); if ($bnm == $qtx) { if ($bnm == 'qtranslate-x') { //not testing version $ver_cur = qtranxf_version_int(); update_option('qtranslate_version_previous', $ver_cur); } return; } $fn = qtranxf_find_plugin_file($bnm . '/i18n-config.json'); if (!$fn) { $fn = qtranxf_plugin_dirname() . '/i18n-config/plugins/' . $bnm . '/i18n-config.json'; $fn = qtranxf_find_plugin_file($fn); if (!$fn) { return; } } //qtranxf_dbg_log('qtranxf_on_deactivate_plugin: $fn: ',$fn); $config_files = qtranxf_get_option_config_files(); $i = array_search($fn, $config_files); if ($i === FALSE) { return; } unset($config_files[$i]); qtranxf_update_config_options($config_files); }