acf_qtranslate_mqtranslate

The Advanced Custom Fields: qTranslate acf qtranslate mqtranslate class.

Defined (1)

The class is defined in the following location(s).

/src/mqtranslate.php  
  1. class acf_qtranslate_mqtranslate { 
  2.  
  3. /** 
  4. * An ACF instance. 
  5. * @var \acf_qtranslate_acf_interface 
  6. */ 
  7. protected $acf; 
  8.  
  9. /** 
  10. * The plugin instance. 
  11. * @var \acf_qtranslate_plugin 
  12. */ 
  13. protected $plugin; 
  14.  
  15.  
  16. /** 
  17. * Create an instance. 
  18. * @return void 
  19. */ 
  20. public function __construct(acf_qtranslate_plugin $plugin, acf_qtranslate_acf_interface $acf) { 
  21. $this->acf = $acf; 
  22. $this->plugin = $plugin; 
  23.  
  24. $this->monkey_patches(); 
  25.  
  26. /** 
  27. * Monkey patches. 
  28. */ 
  29. public function monkey_patches() { 
  30. global $q_config; 
  31.  
  32. // http://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=3497 
  33. if (isset($q_config['js']['qtrans_switch'])) { 
  34. if (strpos($q_config['js']['qtrans_switch'], 'originalSwitchEditors') === false) { 
  35. $q_config['js']['qtrans_switch'] = "var _switchEditors = jQuery.extend(true, {}, switchEditors);\n" . $q_config['js']['qtrans_switch']; 
  36. $q_config['js']['qtrans_switch'] = preg_replace("/(var vta = document\.getElementById\('qtrans_textarea_' \+ id\);)/", "\$1\nif(!vta)return _switchEditors.go(id, lang);", $q_config['js']['qtrans_switch']); 
  37.  
  38. // https://github.com/funkjedi/acf-qtranslate/issues/2#issuecomment-37612918 
  39. if (isset($q_config['js']['qtrans_hook_on_tinyMCE'])) { 
  40. if (strpos($q_config['js']['qtrans_hook_on_tinyMCE'], 'ed.editorId.match(/^qtrans_/)') === false) { 
  41. $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']); 
  42.