ACF qTranslate - Version 1.7.20

Version Description

  • Core: Added ability to display LSBs on specific pages
Download this release

Release Info

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

Code changes from version 1.7.19 to 1.7.20

Files changed (3) hide show
  1. acf-qtranslate.php +1 -1
  2. readme.txt +5 -2
  3. src/plugin.php +53 -4
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.19
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.20
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.7.2
6
- Version: 1.7.19
7
- Stable tag: 1.7.19
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -54,6 +54,9 @@ The plugin is based on code samples posted to the ACF support forums by taeo bac
54
 
55
  == Changelog ==
56
 
 
 
 
57
  = 1.7.19 =
58
  * Bug Fix: Fixed issue with saving File and Image fields after ACF 5.5.5 upgrade
59
 
3
  Tags: acf, advanced custom fields, qtranslate, add-on, admin
4
  Requires at least: 3.5.0
5
  Tested up to: 4.7.2
6
+ Version: 1.7.20
7
+ Stable tag: 1.7.20
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
54
 
55
  == Changelog ==
56
 
57
+ = 1.7.20 =
58
+ * Core: Added ability to display LSBs on specific pages
59
+
60
  = 1.7.19 =
61
  * Bug Fix: Fixed issue with saving File and Image fields after ACF 5.5.5 upgrade
62
 
src/plugin.php CHANGED
@@ -17,7 +17,7 @@ class acf_qtranslate_plugin {
17
  add_action('plugins_loaded', array($this, 'init'), 3);
18
  add_action('after_setup_theme', array($this, 'init'), -10);
19
  add_action('acf/input/admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
20
- add_action('admin_footer', array($this, 'admin_footer'));
21
  add_action('admin_menu', array($this, 'admin_menu'));
22
  add_action('admin_init', array($this, 'admin_init'));
23
 
@@ -101,7 +101,26 @@ class acf_qtranslate_plugin {
101
  * to include the LSB.
102
  */
103
  public function admin_footer() {
104
- echo '<span id="acf-qtranslate-lsb-shim" style="display:none">[:en]LSB[:]</span>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  }
106
 
107
  /**
@@ -121,9 +140,21 @@ class acf_qtranslate_plugin {
121
  */
122
  public function qtranslate_load_admin_page_config($config)
123
  {
 
 
 
 
 
 
 
 
 
124
  $config['acf-display-nodes'] = array(
125
- 'pages' => array('post.php' => '', 'admin.php' => 'page='),
126
- 'forms' => array(
 
 
 
127
  'wpwrap' => array(
128
  'fields' => array(
129
  'lsb-shim' => array(
@@ -213,6 +244,14 @@ class acf_qtranslate_plugin {
213
  'acf_qtranslate',
214
  'qtranslatex_section'
215
  );
 
 
 
 
 
 
 
 
216
  }
217
 
218
  /**
@@ -262,4 +301,14 @@ class acf_qtranslate_plugin {
262
  <?php
263
  }
264
 
 
 
 
 
 
 
 
 
 
 
265
  }
17
  add_action('plugins_loaded', array($this, 'init'), 3);
18
  add_action('after_setup_theme', array($this, 'init'), -10);
19
  add_action('acf/input/admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
20
+ add_action('admin_footer', array($this, 'admin_footer'), -10);
21
  add_action('admin_menu', array($this, 'admin_menu'));
22
  add_action('admin_init', array($this, 'admin_init'));
23
 
101
  * to include the LSB.
102
  */
103
  public function admin_footer() {
104
+ ?>
105
+ <script type="text/javascript">
106
+ (function($){
107
+ var anchors = {
108
+ '#post-body-content': 'prepend',
109
+ '#widgets-right': 'before',
110
+ '#posts-filter': 'prepend',
111
+ '#wpbody-content h1': 'after',
112
+ '#wpbody-content': 'prepend'
113
+ };
114
+ $.each(anchors, function(anchor, fn){
115
+ var $anchor = $(anchor);
116
+ if ($anchor.length) {
117
+ $anchor[fn]('<span id="acf-qtranslate-lsb-shim" style="display:none">[:en]LSB[:]</span>');
118
+ return false;
119
+ }
120
+ });
121
+ })(jQuery);
122
+ </script>
123
+ <?php
124
  }
125
 
126
  /**
140
  */
141
  public function qtranslate_load_admin_page_config($config)
142
  {
143
+ $pages = array(
144
+ 'post.php' => '',
145
+ 'admin.php' => 'page=',
146
+ );
147
+
148
+ foreach (explode("\n", $this->get_plugin_setting('show_on_pages')) as $page) {
149
+ $pages[$page] = '';
150
+ }
151
+
152
  $config['acf-display-nodes'] = array(
153
+ 'pages' => $pages,
154
+ 'anchors' => array(
155
+ 'acf-qtranslate-lsb-shim' => array('where' => 'after'),
156
+ ),
157
+ 'forms' => array(
158
  'wpwrap' => array(
159
  'fields' => array(
160
  'lsb-shim' => array(
244
  'acf_qtranslate',
245
  'qtranslatex_section'
246
  );
247
+
248
+ add_settings_field(
249
+ 'show_on_pages',
250
+ 'Display the LSB on the following pages',
251
+ array($this, 'render_setting_show_on_pages'),
252
+ 'acf_qtranslate',
253
+ 'qtranslatex_section'
254
+ );
255
  }
256
 
257
  /**
301
  <?php
302
  }
303
 
304
+ /**
305
+ * Render setting.
306
+ */
307
+ function render_setting_show_on_pages() {
308
+ ?>
309
+ <textarea name="acf_qtranslate[show_on_pages]" style="max-width:500px;width:100%;height:200px;padding-top:6px" placeholder="post.php"><?= esc_html($this->get_plugin_setting('show_on_pages')) ?></textarea><br>
310
+ <small>Enter each page on it's own line</small>
311
+ <?php
312
+ }
313
+
314
  }