Version Description
- Bug Fix: (HeikoMamerow) ACF5 File compatibility fix
- Bug Fix: (Tusko) ACF5 Image compatibility fix
- Bug Fix: (Tusko) Replace deprecated
acf/input/admin_footer_js
action - Bug Fix: (Tusko) Switcher styles fixed
- Bug Fix: (fburatti) ACF4 WYSIWYG WP 4.3 compatibility fix
- Bug Fix: (fburatti) WYSIWYG was appending all values together
- Bug Fix: (fburatti) WP 4.3 PHP warning in WYSIWYG value
Download this release
Release Info
Developer | funkjedi |
Plugin | ACF qTranslate |
Version | 1.7.10 |
Comparing to | |
See all releases |
Code changes from version 1.7.9 to 1.7.10
- acf-qtranslate.php +1 -1
- assets/acf_5/main.js +29 -23
- assets/common.css +6 -3
- assets/common.js +6 -1
- readme.txt +11 -2
- src/acf_4/fields/wysiwyg.php +13 -12
- src/acf_5/fields/wysiwyg.php +26 -14
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.
|
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.10
|
7 |
Author: funkjedi
|
8 |
Author URI: http://funkjedi.com
|
9 |
License: GPLv2 or later
|
assets/acf_5/main.js
CHANGED
@@ -3,11 +3,14 @@
|
|
3 |
* Clone functionality from standard Image field type
|
4 |
*/
|
5 |
acf.fields.qtranslate_image = acf.fields.image.extend({
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
11 |
});
|
12 |
|
13 |
/**
|
@@ -17,6 +20,9 @@ acf.fields.qtranslate_file = acf.fields.file.extend({
|
|
17 |
type: 'qtranslate_file',
|
18 |
focus: function() {
|
19 |
this.$el = this.$field.find('.acf-file-uploader.current-language');
|
|
|
|
|
|
|
20 |
this.o = acf.get_data(this.$el);
|
21 |
}
|
22 |
});
|
@@ -25,22 +31,22 @@ acf.fields.qtranslate_file = acf.fields.file.extend({
|
|
25 |
* Clone functionality from standard WYSIWYG field type
|
26 |
*/
|
27 |
acf.fields.qtranslate_wysiwyg = acf.fields.wysiwyg.extend({
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
});
|
3 |
* Clone functionality from standard Image field type
|
4 |
*/
|
5 |
acf.fields.qtranslate_image = acf.fields.image.extend({
|
6 |
+
type: 'qtranslate_image',
|
7 |
+
focus: function() {
|
8 |
+
this.$el = this.$field.find('.acf-image-uploader.current-language');
|
9 |
+
this.$input = this.$el.find('[data-name="id"]');
|
10 |
+
this.$img = this.$el.find('[data-name="image"]');
|
11 |
+
|
12 |
+
this.o = acf.get_data(this.$el);
|
13 |
+
}
|
14 |
});
|
15 |
|
16 |
/**
|
20 |
type: 'qtranslate_file',
|
21 |
focus: function() {
|
22 |
this.$el = this.$field.find('.acf-file-uploader.current-language');
|
23 |
+
this.$input = this.$el.find('[data-name="id"]');
|
24 |
+
this.$img = this.$el.find('[data-name="file"]');
|
25 |
+
|
26 |
this.o = acf.get_data(this.$el);
|
27 |
}
|
28 |
});
|
31 |
* Clone functionality from standard WYSIWYG field type
|
32 |
*/
|
33 |
acf.fields.qtranslate_wysiwyg = acf.fields.wysiwyg.extend({
|
34 |
+
type: 'qtranslate_wysiwyg',
|
35 |
+
focus: function() {
|
36 |
+
this.$el = this.$field.find('.wp-editor-wrap.current-language').last();
|
37 |
+
this.$textarea = this.$el.find('textarea');
|
38 |
+
this.o = acf.get_data(this.$el);
|
39 |
+
this.o.id = this.$textarea.attr('id');
|
40 |
+
},
|
41 |
+
initialize: function() {
|
42 |
+
var self = this;
|
43 |
+
this.$field.find('.wp-editor-wrap').each(function() {
|
44 |
+
self.$el = jQuery(this);
|
45 |
+
self.$textarea = self.$el.find('textarea');
|
46 |
+
self.o = acf.get_data(self.$el);
|
47 |
+
self.o.id = self.$textarea.attr('id');
|
48 |
+
acf.fields.wysiwyg.initialize.call(self);
|
49 |
+
});
|
50 |
+
this.focus();
|
51 |
+
}
|
52 |
});
|
assets/common.css
CHANGED
@@ -33,7 +33,11 @@
|
|
33 |
position: relative;
|
34 |
top: 1px;
|
35 |
z-index: 100;
|
36 |
-
|
|
|
|
|
|
|
|
|
37 |
}
|
38 |
|
39 |
.multi-language-field input,
|
@@ -95,5 +99,4 @@
|
|
95 |
.multi-language-field-wysiwyg .wp-switch-editor.current-language {
|
96 |
background-color: #f5f5f5;
|
97 |
border-bottom-color: #f5f5f5;
|
98 |
-
}
|
99 |
-
|
33 |
position: relative;
|
34 |
top: 1px;
|
35 |
z-index: 100;
|
36 |
+
border: 1px solid #ededed;
|
37 |
+
margin-left: -1px;
|
38 |
+
padding: 6px 7px;
|
39 |
+
text-transform: uppercase;
|
40 |
+
cursor: pointer
|
41 |
}
|
42 |
|
43 |
.multi-language-field input,
|
99 |
.multi-language-field-wysiwyg .wp-switch-editor.current-language {
|
100 |
background-color: #f5f5f5;
|
101 |
border-bottom-color: #f5f5f5;
|
102 |
+
}
|
|
assets/common.js
CHANGED
@@ -41,7 +41,12 @@ jQuery(function($) {
|
|
41 |
var parent = $(this).parents('.multi-language-field'),
|
42 |
editor = $(this).hasClass('switch-tmce') ? 'tmce' : 'html';
|
43 |
parent.find('.wp-editor-tabs .wp-switch-editor.switch-' + editor).not(this).each(function() {
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
45 |
});
|
46 |
});
|
47 |
|
41 |
var parent = $(this).parents('.multi-language-field'),
|
42 |
editor = $(this).hasClass('switch-tmce') ? 'tmce' : 'html';
|
43 |
parent.find('.wp-editor-tabs .wp-switch-editor.switch-' + editor).not(this).each(function() {
|
44 |
+
var id = $(this).attr( 'data-wp-editor-id' );
|
45 |
+
if (id) { // WP 4.3
|
46 |
+
window.switchEditors.go(id, editor);
|
47 |
+
} else { // WP < 4.3
|
48 |
+
switchEditors.switchto(this);
|
49 |
+
}
|
50 |
});
|
51 |
});
|
52 |
|
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.
|
7 |
-
Stable tag: 1.7.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -59,6 +59,15 @@ The plugin is based on code samples posted to the ACF support forums by taeo bac
|
|
59 |
|
60 |
== Changelog ==
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
= 1.7.9 =
|
63 |
* Bug Fix: WYSIWYG was creating second acf_settings wp_editor instance
|
64 |
|
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.10
|
7 |
+
Stable tag: 1.7.10
|
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.10 =
|
63 |
+
* Bug Fix: (HeikoMamerow) ACF5 File compatibility fix
|
64 |
+
* Bug Fix: (Tusko) ACF5 Image compatibility fix
|
65 |
+
* Bug Fix: (Tusko) Replace deprecated `acf/input/admin_footer_js` action
|
66 |
+
* Bug Fix: (Tusko) Switcher styles fixed
|
67 |
+
* Bug Fix: (fburatti) ACF4 WYSIWYG WP 4.3 compatibility fix
|
68 |
+
* Bug Fix: (fburatti) WYSIWYG was appending all values together
|
69 |
+
* Bug Fix: (fburatti) WP 4.3 PHP warning in WYSIWYG value
|
70 |
+
|
71 |
= 1.7.9 =
|
72 |
* Bug Fix: WYSIWYG was creating second acf_settings wp_editor instance
|
73 |
|
src/acf_4/fields/wysiwyg.php
CHANGED
@@ -61,6 +61,18 @@ class acf_qtranslate_acf_4_wysiwyg extends acf_field_wysiwyg {
|
|
61 |
$languages = qtrans_getSortedLanguages(true);
|
62 |
$values = qtrans_split($field['value'], $quicktags = true);
|
63 |
$currentLanguage = $this->plugin->get_active_language();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
echo '<div class="multi-language-field multi-language-field-wysiwyg">';
|
66 |
|
@@ -93,18 +105,7 @@ class acf_qtranslate_acf_4_wysiwyg extends acf_field_wysiwyg {
|
|
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;
|
61 |
$languages = qtrans_getSortedLanguages(true);
|
62 |
$values = qtrans_split($field['value'], $quicktags = true);
|
63 |
$currentLanguage = $this->plugin->get_active_language();
|
64 |
+
|
65 |
+
// filter value for editor
|
66 |
+
remove_all_filters('acf_the_editor_content');
|
67 |
+
|
68 |
+
// WP 4.3
|
69 |
+
if( version_compare($wp_version, '4.3', '>=' ) ) {
|
70 |
+
add_filter( 'acf_the_editor_content', 'format_for_editor' );
|
71 |
+
// WP < 4.3
|
72 |
+
} else {
|
73 |
+
$function = user_can_richedit() ? 'wp_richedit_pre' : 'wp_htmledit_pre';
|
74 |
+
add_filter('acf_the_editor_content', $function);
|
75 |
+
}
|
76 |
|
77 |
echo '<div class="multi-language-field multi-language-field-wysiwyg">';
|
78 |
|
105 |
<?php endif; ?>
|
106 |
<?php endif; ?>
|
107 |
<div id="wp-<?php echo $id; ?>-editor-container" class="wp-editor-container">
|
108 |
+
<textarea id="<?php echo $id; ?>" class="qtx-wp-editor-area" name="<?php echo $name; ?>" ><?php echo apply_filters( 'acf_the_editor_content', $value, 'tinymce' ); ?></textarea>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
</div>
|
110 |
</div>
|
111 |
<?php endforeach;
|
src/acf_5/fields/wysiwyg.php
CHANGED
@@ -50,7 +50,7 @@ class acf_qtranslate_acf_5_wysiwyg extends acf_field_wysiwyg {
|
|
50 |
add_filter( 'acf_the_content', 'do_shortcode', 11);
|
51 |
|
52 |
// actions
|
53 |
-
add_action('acf/input/
|
54 |
|
55 |
acf_field::__construct();
|
56 |
}
|
@@ -97,19 +97,22 @@ class acf_qtranslate_acf_5_wysiwyg extends acf_field_wysiwyg {
|
|
97 |
}
|
98 |
|
99 |
// mode
|
100 |
-
$switch_class = $mode
|
101 |
|
102 |
// filter value for editor
|
103 |
remove_all_filters('acf_the_editor_content');
|
104 |
-
|
105 |
-
if ($mode == 'tmce') {
|
106 |
-
add_filter('acf_the_editor_content', 'wp_richedit_pre');
|
107 |
-
}
|
108 |
-
else {
|
109 |
-
add_filter('acf_the_editor_content', 'wp_htmledit_pre');
|
110 |
-
}
|
111 |
-
|
112 |
global $q_config, $wp_version;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
$languages = qtrans_getSortedLanguages(true);
|
114 |
$values = qtrans_split($field['value'], $quicktags = true);
|
115 |
$currentLanguage = $this->plugin->get_active_language();
|
@@ -123,14 +126,23 @@ class acf_qtranslate_acf_5_wysiwyg extends acf_field_wysiwyg {
|
|
123 |
|
124 |
$uid = uniqid('acf-editor-');
|
125 |
foreach ($languages as $language):
|
126 |
-
|
127 |
$id = $uid . "-$language";
|
128 |
$name = $field['name'] . "[$language]";
|
129 |
$class = $switch_class;
|
130 |
if ($language === $currentLanguage) {
|
131 |
$class .= ' current-language';
|
132 |
}
|
133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
?>
|
135 |
<div id="wp-<?php echo $id; ?>-wrap" class="acf-editor-wrap wp-core-ui wp-editor-wrap <?php echo $class; ?>" data-toolbar="<?php echo $field['toolbar']; ?>" data-upload="<?php echo $field['media_upload']; ?>" data-language="<?php echo $language; ?>">
|
136 |
<div id="wp-<?php echo $id; ?>-editor-tools" class="wp-editor-tools hide-if-no-js">
|
@@ -141,8 +153,8 @@ class acf_qtranslate_acf_5_wysiwyg extends acf_field_wysiwyg {
|
|
141 |
<?php endif; ?>
|
142 |
<?php if( user_can_richedit() && $show_tabs ): ?>
|
143 |
<div class="wp-editor-tabs">
|
144 |
-
<button id="<?php echo $id; ?>-tmce" class="wp-switch-editor switch-tmce"
|
145 |
-
<button id="<?php echo $id; ?>-html" class="wp-switch-editor switch-html"
|
146 |
</div>
|
147 |
<?php endif; ?>
|
148 |
</div>
|
50 |
add_filter( 'acf_the_content', 'do_shortcode', 11);
|
51 |
|
52 |
// actions
|
53 |
+
add_action('acf/input/admin_footer', array($this, 'input_admin_footer'));
|
54 |
|
55 |
acf_field::__construct();
|
56 |
}
|
97 |
}
|
98 |
|
99 |
// mode
|
100 |
+
$switch_class = ($mode === 'html') ? 'html-active' : 'tmce-active';
|
101 |
|
102 |
// filter value for editor
|
103 |
remove_all_filters('acf_the_editor_content');
|
104 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
global $q_config, $wp_version;
|
106 |
+
|
107 |
+
// WP 4.3
|
108 |
+
if( version_compare($wp_version, '4.3', '>=' ) ) {
|
109 |
+
add_filter( 'acf_the_editor_content', 'format_for_editor', 10, 2 );
|
110 |
+
// WP < 4.3
|
111 |
+
} else {
|
112 |
+
$function = ($mode === 'html') ? 'wp_htmledit_pre' : 'wp_richedit_pre';
|
113 |
+
add_filter('acf_the_editor_content', $function, 10, 1);
|
114 |
+
}
|
115 |
+
|
116 |
$languages = qtrans_getSortedLanguages(true);
|
117 |
$values = qtrans_split($field['value'], $quicktags = true);
|
118 |
$currentLanguage = $this->plugin->get_active_language();
|
126 |
|
127 |
$uid = uniqid('acf-editor-');
|
128 |
foreach ($languages as $language):
|
129 |
+
|
130 |
$id = $uid . "-$language";
|
131 |
$name = $field['name'] . "[$language]";
|
132 |
$class = $switch_class;
|
133 |
if ($language === $currentLanguage) {
|
134 |
$class .= ' current-language';
|
135 |
}
|
136 |
+
// WP 4.3
|
137 |
+
if( version_compare($wp_version, '4.3', '>=' ) ) {
|
138 |
+
$button = 'data-wp-editor-id="' . $id . '"';
|
139 |
+
// WP < 4.3
|
140 |
+
} else {
|
141 |
+
$button = 'onclick="switchEditors.switchto(this);"';
|
142 |
+
}
|
143 |
+
|
144 |
+
$value = apply_filters('acf_the_editor_content', $values[$language], $mode);
|
145 |
+
|
146 |
?>
|
147 |
<div id="wp-<?php echo $id; ?>-wrap" class="acf-editor-wrap wp-core-ui wp-editor-wrap <?php echo $class; ?>" data-toolbar="<?php echo $field['toolbar']; ?>" data-upload="<?php echo $field['media_upload']; ?>" data-language="<?php echo $language; ?>">
|
148 |
<div id="wp-<?php echo $id; ?>-editor-tools" class="wp-editor-tools hide-if-no-js">
|
153 |
<?php endif; ?>
|
154 |
<?php if( user_can_richedit() && $show_tabs ): ?>
|
155 |
<div class="wp-editor-tabs">
|
156 |
+
<button id="<?php echo $id; ?>-tmce" class="wp-switch-editor switch-tmce" <?php echo $button; ?> type="button"><?php echo __('Visual', 'acf'); ?></button>
|
157 |
+
<button id="<?php echo $id; ?>-html" class="wp-switch-editor switch-html" <?php echo $button; ?> type="button"><?php echo _x( 'Text', 'Name for the Text editor tab (formerly HTML)', 'acf' ); ?></button>
|
158 |
</div>
|
159 |
<?php endif; ?>
|
160 |
</div>
|