Version Description
- Core: Updated WYSIWYG monkey patches for qTranslate Plus
- Bug Fix: E_NOTICE in ACF4 field types
- Bug Fix: E_NOTICE on admin.php pages when Options addon is missing
Download this release
Release Info
Developer | funkjedi |
Plugin | ACF qTranslate |
Version | 1.7.8 |
Comparing to | |
See all releases |
Code changes from version 1.7.7 to 1.7.8
- acf-qtranslate.php +1 -1
- readme.txt +7 -2
- src/acf_4/acf.php +1 -20
- src/acf_4/fields/text.php +8 -0
- src/acf_4/fields/textarea.php +7 -0
- src/acf_4/fields/wysiwyg.php +5 -0
- src/mqtranslate.php +53 -0
- src/plugin.php +6 -0
- src/ppqtranslate.php +24 -0
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.8
|
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.
|
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,11 @@ The plugin is based on code samples posted to the ACF support forums by taeo bac
|
|
59 |
|
60 |
== Changelog ==
|
61 |
|
|
|
|
|
|
|
|
|
|
|
62 |
= 1.7.7 =
|
63 |
* Core: Added configuration page
|
64 |
* Core: Support for Standard Field Types when using qTranslate-X is disabled by default
|
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 |
|
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
|
65 |
+
* Bug Fix: E_NOTICE on admin.php pages when Options addon is missing
|
66 |
+
|
67 |
= 1.7.7 =
|
68 |
* Core: Added configuration page
|
69 |
* Core: Support for Standard Field Types when using qTranslate-X is disabled by default
|
src/acf_4/acf.php
CHANGED
@@ -21,8 +21,6 @@ class acf_qtranslate_acf_4 implements acf_qtranslate_acf_interface {
|
|
21 |
add_filter('acf/format_value_for_api', array($this, 'format_value_for_api'));
|
22 |
add_action('acf/register_fields', array($this, 'register_fields'));
|
23 |
add_action('acf/input/admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
|
24 |
-
|
25 |
-
$this->monkey_patch_qtranslate();
|
26 |
}
|
27 |
|
28 |
/**
|
@@ -145,7 +143,7 @@ class acf_qtranslate_acf_4 implements acf_qtranslate_acf_interface {
|
|
145 |
public function acf_get_options_page($slug) {
|
146 |
global $acf_options_page;
|
147 |
|
148 |
-
if (is_array($acf_options_page->settings)
|
149 |
return false;
|
150 |
}
|
151 |
|
@@ -166,21 +164,4 @@ class acf_qtranslate_acf_4 implements acf_qtranslate_acf_interface {
|
|
166 |
}
|
167 |
}
|
168 |
|
169 |
-
/**
|
170 |
-
* Monkey patches to fix little qTranslate javascript issues.
|
171 |
-
*/
|
172 |
-
public function monkey_patch_qtranslate() {
|
173 |
-
global $q_config;
|
174 |
-
|
175 |
-
// http://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=3497
|
176 |
-
if (isset($q_config['js']) && strpos($q_config['js']['qtrans_switch'], 'originalSwitchEditors') === false) {
|
177 |
-
$q_config['js']['qtrans_switch'] = "originalSwitchEditors = jQuery.extend(true, {}, switchEditors);\n" . $q_config['js']['qtrans_switch'];
|
178 |
-
$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']);
|
179 |
-
}
|
180 |
-
|
181 |
-
// https://github.com/funkjedi/acf-qtranslate/issues/2#issuecomment-37612918
|
182 |
-
if (isset($q_config['js']) && strpos($q_config['js']['qtrans_hook_on_tinyMCE'], 'ed.editorId.match(/^qtrans_/)') === false) {
|
183 |
-
$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']);
|
184 |
-
}
|
185 |
-
}
|
186 |
}
|
21 |
add_filter('acf/format_value_for_api', array($this, 'format_value_for_api'));
|
22 |
add_action('acf/register_fields', array($this, 'register_fields'));
|
23 |
add_action('acf/input/admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
|
|
|
|
|
24 |
}
|
25 |
|
26 |
/**
|
143 |
public function acf_get_options_page($slug) {
|
144 |
global $acf_options_page;
|
145 |
|
146 |
+
if (!is_object($acf_options_page) || !is_array($acf_options_page->settings)) {
|
147 |
return false;
|
148 |
}
|
149 |
|
164 |
}
|
165 |
}
|
166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
}
|
src/acf_4/fields/text.php
CHANGED
@@ -23,6 +23,14 @@ class acf_qtranslate_acf_4_text extends acf_field_text {
|
|
23 |
$this->name = 'qtranslate_text';
|
24 |
$this->label = __("Text",'acf');
|
25 |
$this->category = __("qTranslate",'acf');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
acf_field::__construct();
|
28 |
}
|
23 |
$this->name = 'qtranslate_text';
|
24 |
$this->label = __("Text",'acf');
|
25 |
$this->category = __("qTranslate",'acf');
|
26 |
+
$this->defaults = array(
|
27 |
+
'default_value' => '',
|
28 |
+
'formatting' => 'html',
|
29 |
+
'maxlength' => '',
|
30 |
+
'placeholder' => '',
|
31 |
+
'prepend' => '',
|
32 |
+
'append' => ''
|
33 |
+
);
|
34 |
|
35 |
acf_field::__construct();
|
36 |
}
|
src/acf_4/fields/textarea.php
CHANGED
@@ -23,6 +23,13 @@ class acf_qtranslate_acf_4_textarea extends acf_field_textarea {
|
|
23 |
$this->name = 'qtranslate_textarea';
|
24 |
$this->label = __("Text Area",'acf');
|
25 |
$this->category = __("qTranslate",'acf');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
acf_field::__construct();
|
28 |
}
|
23 |
$this->name = 'qtranslate_textarea';
|
24 |
$this->label = __("Text Area",'acf');
|
25 |
$this->category = __("qTranslate",'acf');
|
26 |
+
$this->defaults = array(
|
27 |
+
'default_value' => '',
|
28 |
+
'formatting' => 'br',
|
29 |
+
'maxlength' => '',
|
30 |
+
'placeholder' => '',
|
31 |
+
'rows' => ''
|
32 |
+
);
|
33 |
|
34 |
acf_field::__construct();
|
35 |
}
|
src/acf_4/fields/wysiwyg.php
CHANGED
@@ -23,6 +23,11 @@ class acf_qtranslate_acf_4_wysiwyg extends acf_field_wysiwyg {
|
|
23 |
$this->name = 'qtranslate_wysiwyg';
|
24 |
$this->label = __("Wysiwyg Editor",'acf');
|
25 |
$this->category = __("qTranslate",'acf');
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
acf_field::__construct();
|
28 |
|
23 |
$this->name = 'qtranslate_wysiwyg';
|
24 |
$this->label = __("Wysiwyg Editor",'acf');
|
25 |
$this->category = __("qTranslate",'acf');
|
26 |
+
$this->defaults = array(
|
27 |
+
'toolbar' => 'full',
|
28 |
+
'media_upload' => 'yes',
|
29 |
+
'default_value' => '',
|
30 |
+
);
|
31 |
|
32 |
acf_field::__construct();
|
33 |
|
src/mqtranslate.php
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
require_once ACF_QTRANSLATE_PLUGIN_DIR . 'src/acf_interface.php';
|
4 |
+
|
5 |
+
class acf_qtranslate_mqtranslate {
|
6 |
+
|
7 |
+
/**
|
8 |
+
* An ACF instance.
|
9 |
+
* @var \acf_qtranslate_acf_interface
|
10 |
+
*/
|
11 |
+
protected $acf;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* The plugin instance.
|
15 |
+
* @var \acf_qtranslate_plugin
|
16 |
+
*/
|
17 |
+
protected $plugin;
|
18 |
+
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Create an instance.
|
22 |
+
* @return void
|
23 |
+
*/
|
24 |
+
public function __construct(acf_qtranslate_plugin $plugin, acf_qtranslate_acf_interface $acf) {
|
25 |
+
$this->acf = $acf;
|
26 |
+
$this->plugin = $plugin;
|
27 |
+
|
28 |
+
$this->monkey_patches();
|
29 |
+
}
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Monkey patches.
|
33 |
+
*/
|
34 |
+
public function monkey_patches() {
|
35 |
+
global $q_config;
|
36 |
+
|
37 |
+
// http://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=3497
|
38 |
+
if (isset($q_config['js']['qtrans_switch'])) {
|
39 |
+
if (strpos($q_config['js']['qtrans_switch'], 'originalSwitchEditors') === false) {
|
40 |
+
$q_config['js']['qtrans_switch'] = "var _switchEditors = jQuery.extend(true, {}, switchEditors);\n" . $q_config['js']['qtrans_switch'];
|
41 |
+
$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']);
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
// https://github.com/funkjedi/acf-qtranslate/issues/2#issuecomment-37612918
|
46 |
+
if (isset($q_config['js']['qtrans_hook_on_tinyMCE'])) {
|
47 |
+
if (strpos($q_config['js']['qtrans_hook_on_tinyMCE'], 'ed.editorId.match(/^qtrans_/)') === false) {
|
48 |
+
$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']);
|
49 |
+
}
|
50 |
+
}
|
51 |
+
}
|
52 |
+
|
53 |
+
}
|
src/plugin.php
CHANGED
@@ -41,6 +41,12 @@ class acf_qtranslate_plugin {
|
|
41 |
$this->acf = new acf_qtranslate_acf_5($this);
|
42 |
}
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
// setup ppqtranslate integration
|
45 |
if ($this->ppqtranslate_enabled()) {
|
46 |
require_once ACF_QTRANSLATE_PLUGIN_DIR . 'src/ppqtranslate.php';
|
41 |
$this->acf = new acf_qtranslate_acf_5($this);
|
42 |
}
|
43 |
|
44 |
+
// setup mqtranslate integration
|
45 |
+
if ($this->mqtranslate_enabled()) {
|
46 |
+
require_once ACF_QTRANSLATE_PLUGIN_DIR . 'src/mqtranslate.php';
|
47 |
+
new acf_qtranslate_mqtranslate($this, $this->acf);
|
48 |
+
}
|
49 |
+
|
50 |
// setup ppqtranslate integration
|
51 |
if ($this->ppqtranslate_enabled()) {
|
52 |
require_once ACF_QTRANSLATE_PLUGIN_DIR . 'src/ppqtranslate.php';
|
src/ppqtranslate.php
CHANGED
@@ -27,6 +27,30 @@ class acf_qtranslate_ppqtranslate {
|
|
27 |
|
28 |
// include compatibility functions
|
29 |
require_once ACF_QTRANSLATE_PLUGIN_DIR . 'compatibility/ppqtranslate.php';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
}
|
31 |
|
32 |
}
|
27 |
|
28 |
// include compatibility functions
|
29 |
require_once ACF_QTRANSLATE_PLUGIN_DIR . 'compatibility/ppqtranslate.php';
|
30 |
+
|
31 |
+
$this->monkey_patches();
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Monkey patches.
|
36 |
+
*/
|
37 |
+
public function monkey_patches() {
|
38 |
+
global $q_config;
|
39 |
+
|
40 |
+
// http://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=3497
|
41 |
+
if (isset($q_config['js']['ppqtrans_switch'])) {
|
42 |
+
if (strpos($q_config['js']['ppqtrans_switch'], '_switchEditors') === false) {
|
43 |
+
$q_config['js']['ppqtrans_switch'] = "var _switchEditors = jQuery.extend(true, {}, switchEditors);\n" . $q_config['js']['ppqtrans_switch'];
|
44 |
+
$q_config['js']['ppqtrans_switch'] = preg_replace("/(var vta = document\.getElementById\('ppqtrans_textarea_' \+ id\);)/", "\$1\nif(!vta)return _switchEditors.go(id, lang);", $q_config['js']['ppqtrans_switch']);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
|
48 |
+
// https://github.com/funkjedi/acf-qtranslate/issues/2#issuecomment-37612918
|
49 |
+
if (isset($q_config['js']['ppqtrans_hook_on_tinyMCE'])) {
|
50 |
+
if (strpos($q_config['js']['ppqtrans_hook_on_tinyMCE'], 'ed.id.match(/^ppqtrans_/)') === false) {
|
51 |
+
$q_config['js']['ppqtrans_hook_on_tinyMCE'] = preg_replace("/(ppqtrans_save\(switchEditors\.pre_wpautop\(e\.content\)\);)/", "if (ed.id.match(/^ppqtrans_/)) \$1", $q_config['js']['ppqtrans_hook_on_tinyMCE']);
|
52 |
+
}
|
53 |
+
}
|
54 |
}
|
55 |
|
56 |
}
|