settings['version'][0]; } return ''; } // qTranslate Monkey Patches add_action('plugins_loaded', 'acf_qtranslate_monkey_patch', 3); function acf_qtranslate_monkey_patch() { global $q_config; // http://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=3497 if (strpos($q_config['js']['qtrans_switch'], 'originalSwitchEditors') === false) { $q_config['js']['qtrans_switch'] = "originalSwitchEditors = jQuery.extend(true, {}, switchEditors);\n" . $q_config['js']['qtrans_switch']; $q_config['js']['qtrans_switch'] = preg_replace("/(var vta = document\.getElementById\('qtrans_textarea_' \+ id\);)/", "\$1\nif(!vta)return originalSwitchEditors.go(id, lang);", $q_config['js']['qtrans_switch']); } // https://github.com/funkjedi/acf-qtranslate/issues/2#issuecomment-37612918 if (strpos($q_config['js']['qtrans_hook_on_tinyMCE'], 'ed.editorId.match(/^qtrans_/)') === false) { $q_config['js']['qtrans_hook_on_tinyMCE'] = preg_replace("/(qtrans_save\(switchEditors\.pre_wpautop\(o\.content\)\);)/", "if (ed.editorId.match(/^qtrans_/)) \$1", $q_config['js']['qtrans_hook_on_tinyMCE']); } }