Beispiel #1
0
function qtranxf_reset_config()
{
    global $qtranslate_options;
    if (!current_user_can('manage_options')) {
        return;
    }
    if (isset($_POST['qtranslate_reset_admin_notices'])) {
        delete_option('qtranslate_admin_notices');
    }
    if (!isset($_POST['qtranslate_reset']) || !isset($_POST['qtranslate_reset2'])) {
        return;
    }
    // reset all settings
    foreach ($qtranslate_options['front'] as $ops) {
        foreach ($ops as $nm => $def) {
            delete_option('qtranslate_' . $nm);
        }
    }
    foreach ($qtranslate_options['admin'] as $ops) {
        foreach ($ops as $nm => $def) {
            delete_option('qtranslate_' . $nm);
        }
    }
    foreach ($qtranslate_options['default_value'] as $nm => $def) {
        delete_option('qtranslate_' . $nm);
    }
    foreach ($qtranslate_options['languages'] as $nm => $opn) {
        delete_option($opn);
    }
    //internal private options not loaded by default
    delete_option('qtranslate_next_update_mo');
    delete_option('qtranslate_next_thanks');
    // obsolete options
    delete_option('qtranslate_plugin_js_composer_off');
    delete_option('qtranslate_widget_css');
    delete_option('qtranslate_version');
    delete_option('qtranslate_disable_header_css');
    if (isset($_POST['qtranslate_reset3'])) {
        delete_option('qtranslate_term_name');
        if (isset($_POST['qtranslate_reset4'])) {
            //not implemented yet
            delete_option('qtranslate_version_previous');
            //and delete translations in posts
        }
    }
    remove_filter('locale', 'qtranxf_localeForCurrentLanguage', 99);
    qtranxf_reloadConfig();
    add_filter('locale', 'qtranxf_localeForCurrentLanguage', 99);
}
function qtranxf_migrate_plugins()
{
    if (!current_user_can('manage_options')) {
        return;
    }
    //qtranxf_migrate_plugin('mqtranslate');
    //qtranxf_migrate_plugin('qtranslate-xp');
    ////qtranxf_migrate_plugin('ztranslate');//ok same db
    ////do_action('qtranslate_migrate_plugins');
    foreach ($_POST as $key => $value) {
        if (!is_string($value)) {
            continue;
        }
        if ($value == 'none') {
            continue;
        }
        if (!qtranxf_endsWith($key, '-migration')) {
            continue;
        }
        $plugin = substr($key, 0, -strlen('-migration'));
        $f = 'qtranxf_migrate_' . $value . '_' . str_replace('-', '_', $plugin);
        if (!function_exists($f)) {
            continue;
        }
        $f();
        if ($value == 'import') {
            qtranxf_reloadConfig();
            //}elseif($value == 'export'){
        }
    }
}
Beispiel #3
0
function qtranxf_migrate_plugin($plugin)
{
    $var = $plugin . '-migration';
    if (!isset($_POST[$var])) {
        return;
    }
    $action = $_POST[$var];
    if ($action == 'none') {
        return;
    }
    $f = 'qtranxf_migrate_' . $_POST[$var] . '_' . str_replace('-', '_', $plugin);
    $f();
    if ($action == 'export') {
        return;
    }
    //if( $plugin == 'mqtranslate' )//since 3.2-b2: moved to qtranxf_migrate_import_mqtranslate
    //	update_option('qtranslate_qtrans_compatibility', '1');
    qtranxf_reloadConfig();
}