ACF qTranslate - Version 1.7.9

Version Description

  • Bug Fix: WYSIWYG was creating second acf_settings wp_editor instance
Download this release

Release Info

Developer funkjedi
Plugin Icon wp plugin ACF qTranslate
Version 1.7.9
Comparing to
See all releases

Code changes from version 1.7.8 to 1.7.9

Files changed (3) hide show
  1. acf-qtranslate.php +1 -1
  2. readme.txt +5 -2
  3. src/acf_4/fields/wysiwyg.php +20 -22
acf-qtranslate.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Advanced Custom Fields: qTranslate
4
  Plugin URI: http://github.com/funkjedi/acf-qtranslate
5
  Description: Provides multilingual versions of the text, text area, and wysiwyg fields.
6
- Version: 1.7.8
7
  Author: funkjedi
8
  Author URI: http://funkjedi.com
9
  License: GPLv2 or later
3
  Plugin Name: Advanced Custom Fields: qTranslate
4
  Plugin URI: http://github.com/funkjedi/acf-qtranslate
5
  Description: Provides multilingual versions of the text, text area, and wysiwyg fields.
6
+ Version: 1.7.9
7
  Author: funkjedi
8
  Author URI: http://funkjedi.com
9
  License: GPLv2 or later
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: funkjedi
3
  Tags: acf, advanced custom fields, qtranslate, add-on, admin
4
  Requires at least: 3.5.0
5
  Tested up to: 4.2.1
6
- Version: 1.7.8
7
- Stable tag: 1.7.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -59,6 +59,9 @@ The plugin is based on code samples posted to the ACF support forums by taeo bac
59
 
60
  == Changelog ==
61
 
 
 
 
62
  = 1.7.8 =
63
  * Core: Updated WYSIWYG monkey patches for qTranslate Plus
64
  * Bug Fix: E_NOTICE in ACF4 field types
3
  Tags: acf, advanced custom fields, qtranslate, add-on, admin
4
  Requires at least: 3.5.0
5
  Tested up to: 4.2.1
6
+ Version: 1.7.9
7
+ Stable tag: 1.7.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
59
 
60
  == Changelog ==
61
 
62
+ = 1.7.9 =
63
+ * Bug Fix: WYSIWYG was creating second acf_settings wp_editor instance
64
+
65
  = 1.7.8 =
66
  * Core: Updated WYSIWYG monkey patches for qTranslate Plus
67
  * Bug Fix: E_NOTICE in ACF4 field types
src/acf_4/fields/wysiwyg.php CHANGED
@@ -30,26 +30,20 @@ class acf_qtranslate_acf_4_wysiwyg extends acf_field_wysiwyg {
30
  );
31
 
32
  acf_field::__construct();
33
-
34
- add_filter('acf/fields/wysiwyg/toolbars', array($this, 'toolbars'), 1, 1);
35
  }
36
 
37
  /*
38
- * toolbars()
39
- *
40
- * This filter allowsyou to customize the WYSIWYG toolbars
41
- *
42
- * @param $toolbars - an array of toolbars
43
  *
44
- * @return $toolbars - the modified $toolbars
 
45
  *
46
- * @type filter
 
47
  * @since 3.6
48
  * @date 23/01/13
49
  */
50
- function toolbars($toolbars) {
51
- return parent::toolbars($toolbars);
52
- }
53
 
54
  /*
55
  * create_field()
@@ -63,13 +57,6 @@ class acf_qtranslate_acf_4_wysiwyg extends acf_field_wysiwyg {
63
  * @date 23/01/13
64
  */
65
  function create_field($field) {
66
- $defaults = array(
67
- 'toolbar' => 'full',
68
- 'media_upload' => 'yes',
69
- );
70
- $field = array_merge($defaults, $field);
71
-
72
-
73
  global $q_config, $wp_version;
74
  $languages = qtrans_getSortedLanguages(true);
75
  $values = qtrans_split($field['value'], $quicktags = true);
@@ -84,13 +71,13 @@ class acf_qtranslate_acf_4_wysiwyg extends acf_field_wysiwyg {
84
 
85
  foreach ($languages as $language):
86
  $value = $values[$language];
87
- $id = 'wysiwyg' . $field['id'] . "[$language]";
88
  $name = $field['name'] . "[$language]";
89
  $class = ($language === $currentLanguage) ? 'acf_wysiwyg wp-editor-wrap current-language' : 'acf_wysiwyg wp-editor-wrap';
90
 
91
  ?>
92
  <div id="wp-<?php echo $id; ?>-wrap" class="<?php echo $class; ?>" data-toolbar="<?php echo $field['toolbar']; ?>" data-upload="<?php echo $field['media_upload']; ?>" data-language="<?php echo $language; ?>">
93
- <?php if($field['media_upload'] == 'yes'): ?>
94
  <?php if( version_compare($wp_version, '3.3', '<') ): ?>
95
  <div id="editor-toolbar">
96
  <div id="media-buttons" class="hide-if-no-js">
@@ -106,7 +93,18 @@ class acf_qtranslate_acf_4_wysiwyg extends acf_field_wysiwyg {
106
  <?php endif; ?>
107
  <?php endif; ?>
108
  <div id="wp-<?php echo $id; ?>-editor-container" class="wp-editor-container">
109
- <textarea id="<?php echo $id; ?>" class="qtx-wp-editor-area" name="<?php echo $name; ?>" ><?php echo wp_richedit_pre($value); ?></textarea>
 
 
 
 
 
 
 
 
 
 
 
110
  </div>
111
  </div>
112
  <?php endforeach;
30
  );
31
 
32
  acf_field::__construct();
 
 
33
  }
34
 
35
  /*
36
+ * input_admin_head()
 
 
 
 
37
  *
38
+ * This action is called in the admin_head action on the edit screen where your field is created.
39
+ * Use this action to add css and javascript to assist your create_field() action.
40
  *
41
+ * @info http://codex.wordpress.org/Plugin_API/Action_Reference/admin_head
42
+ * @type action
43
  * @since 3.6
44
  * @date 23/01/13
45
  */
46
+ function input_admin_head() {}
 
 
47
 
48
  /*
49
  * create_field()
57
  * @date 23/01/13
58
  */
59
  function create_field($field) {
 
 
 
 
 
 
 
60
  global $q_config, $wp_version;
61
  $languages = qtrans_getSortedLanguages(true);
62
  $values = qtrans_split($field['value'], $quicktags = true);
71
 
72
  foreach ($languages as $language):
73
  $value = $values[$language];
74
+ $id = 'wysiwyg-' . $field['id'] . '-' . uniqid();
75
  $name = $field['name'] . "[$language]";
76
  $class = ($language === $currentLanguage) ? 'acf_wysiwyg wp-editor-wrap current-language' : 'acf_wysiwyg wp-editor-wrap';
77
 
78
  ?>
79
  <div id="wp-<?php echo $id; ?>-wrap" class="<?php echo $class; ?>" data-toolbar="<?php echo $field['toolbar']; ?>" data-upload="<?php echo $field['media_upload']; ?>" data-language="<?php echo $language; ?>">
80
+ <?php if( user_can_richedit() && $field['media_upload'] == 'yes' ): ?>
81
  <?php if( version_compare($wp_version, '3.3', '<') ): ?>
82
  <div id="editor-toolbar">
83
  <div id="media-buttons" class="hide-if-no-js">
93
  <?php endif; ?>
94
  <?php endif; ?>
95
  <div id="wp-<?php echo $id; ?>-editor-container" class="wp-editor-container">
96
+ <textarea id="<?php echo $id; ?>" class="qtx-wp-editor-area" name="<?php echo $name; ?>" ><?php
97
+
98
+ if( user_can_richedit() )
99
+ {
100
+ echo wp_richedit_pre( $field['value'] );
101
+ }
102
+ else
103
+ {
104
+ echo wp_htmledit_pre( $field['value'] );
105
+ }
106
+
107
+ ?></textarea>
108
  </div>
109
  </div>
110
  <?php endforeach;