get_col("SELECT `option_name` FROM {$wpdb->options} WHERE `option_name` LIKE '$nm_to\_%'"); foreach ($option_names as $name) { if(strpos($name,'_flag_location')>0) continue; $nm = str_replace($nm_to,$nm_from,$name); $value=get_option($nm); if($value===FALSE) continue; update_option($name,$value); } } function qtranxf_migrate_options_copy($nm_to,$nm_from) { global $wpdb; $options = $wpdb->get_results("SELECT option_name, option_value FROM {$wpdb->options} WHERE `option_name` LIKE '$nm_from\_%'"); foreach ($options as $option) { $name = $option->option_name; //skip new qTranslate-X specific options // It is now easier to list options which need to be copied, instead. switch($name){ case 'qtranslate_flag_location': case 'qtranslate_admin_notices': case 'qtranslate_domains': case 'qtranslate_editor_mode': case 'qtranslate_custom_fields': case 'qtranslate_custom_field_classes': case 'qtranslate_text_field_filters': case 'qtranslate_qtrans_compatibility': case 'qtranslate_header_css_on': case 'qtranslate_header_css': case 'qtranslate_filter_options_mode': case 'qtranslate_filter_options': case 'qtranslate_highlight_mode': case 'qtranslate_highlight_mode_custom_css': case 'qtranslate_lsb_style': case 'qtranslate_lsb_style_wrap_class': case 'qtranslate_lsb_style_active_class': case 'qtranslate_custom_i18n_config': case 'qtranslate_config_files': case 'qtranslate_page_configs': case 'qtranslate_admin_config': case 'qtranslate_front_config': continue; default: break; } //if(strpos($name,'_flag_location')>0) continue; $value = maybe_unserialize($option->option_value); if(strpos($name,'_flag_location')>0) continue; $nm = str_replace($nm_from,$nm_to,$name); update_option($nm,$value); } //save enabled languages global $q_config, $qtranslate_options; foreach($qtranslate_options['languages'] as $nm => $opn){ $op = str_replace($nm_from,$nm_to,$opn); update_option($op,$q_config[$nm]); } } function qtranxf_migrate_import_mqtranslate(){ qtranxf_migrate_import('mqTranslate','mqtranslate'); //qtranxf_migrate_options_update('qtranslate','mqtranslate'); update_option('qtranslate_qtrans_compatibility', '1');//since 3.1 $nm = 'mqTranslate'; qtranxf_add_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'), ''.__('Compatibility Functions', 'qtranslate').'', $nm, '', '')); } //function qtranxf_migrate_export_mqtranslate(){ qtranxf_migrate_options_copy('mqtranslate','qtranslate'); } function qtranxf_migrate_export_mqtranslate(){ qtranxf_migrate_export('mqTranslate','mqtranslate'); } //function qtranxf_migrate_import_qtranslate_xp(){ qtranxf_migrate_options_update('qtranslate','ppqtranslate'); } //function qtranxf_migrate_export_qtranslate_xp(){ qtranxf_migrate_options_copy('ppqtranslate','qtranslate'); } function qtranxf_migrate_import_qtranslate_xp(){ qtranxf_migrate_import('qTranslate Plus','ppqtranslate'); } function qtranxf_migrate_export_qtranslate_xp(){ qtranxf_migrate_export('qTranslate Plus','ppqtranslate'); } function qtranxf_migrate_import($plugin_name, $nm_from){ qtranxf_migrate_options_update('qtranslate', $nm_from); $nm = ''.$plugin_name.''; qtranxf_add_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‑X').' '.sprintf(__('It might be a good idea to review %smigration instructions%s, if you have not yet done so.', 'qtranslate'),'','')); qtranxf_add_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'), '', '', ''.'Known Issues'.'', $nm, 'qTranslate', $nm, ''.__('Convert Database', 'qtranslate').'', $nm, 'qTranslate‑X', 'qtranslateteam@gmail.com', $nm, '', '', 'qTranslate‑X').'
'.__('This is a one-time message, which you will not see again, unless the same import is repeated.', 'qtranslate').''); } function qtranxf_migrate_export($plugin_name, $nm_to){ qtranxf_migrate_options_copy($nm_to, 'qtranslate'); $nm = ''.$plugin_name.''; qtranxf_add_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, ''.__('Convert Database', 'qtranslate').'', $nm)); } /* 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(); } */ 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'){ } } } add_action('qtranslate_saveConfig','qtranxf_migrate_plugins',30); function qtranxf_add_row_migrate($nm,$plugin,$args=null) { $plugin_file = qtranxf_find_plugin_file($plugin); if(!$plugin_file) return; //$pd = get_plugin_data( $plugin_file.'/mqtranslate.php', false, true ); //qtranxf_dbg_log('qtranxf_add_row_migrate: $pd:',$pd); $href = isset($args['href']) ? $args['href'] : 'https://wordpress.org/plugins/'.$plugin; ?>

'.$args['note'].'

'; } ?> '; qtranxf_admin_section_start('import'); ?> true)) ?> true)) ?> 'https://wpml.org', 'text' => sprintf(__('Use plugin %s to import data.', 'qtranslate'), 'W2Q: WPML to qTranslate'))) ?>
click here to convert posts to the new language tag format.', 'qtranslate'), $request_uri.'&convert=true#import') ?> click here to mark all existing posts as written in the default language.', 'qtranslate'), $request_uri.'&markdefault=true#import') ?> irreversible! Be sure to make a full database backup before clicking one of the links.', 'qtranslate') ?>




'),'[:]','qTranslate','"[:en]English[:de]Deutsch[:]"') ?>







'; } add_action('qtranslate_configuration', 'qtranxf_admin_section_import_export', 9);