Advanced Custom Fields - Version 4.3.7

Version Description

  • WYSIWYG field: Fixed missing tinyMCE buttons in WP 3.9
Download this release

Release Info

Developer elliotcondon
Plugin Icon 128x128 Advanced Custom Fields
Version 4.3.7
Comparing to
See all releases

Code changes from version 4.3.6 to 4.3.7

Files changed (5) hide show
  1. acf.php +2 -2
  2. core/fields/wysiwyg.php +89 -11
  3. js/input.js +2 -1
  4. js/tinymce.code.min.js +1 -0
  5. readme.txt +4 -1
acf.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Advanced Custom Fields
4
  Plugin URI: http://www.advancedcustomfields.com/
5
  Description: Fully customise WordPress edit screens with powerful fields. Boasting a professional interface and a powerful API, it’s a must have for any web developer working with WordPress. Field types include: Wysiwyg, text, textarea, image, file, select, checkbox, page link, post object, date picker, color picker, repeater, flexible content, gallery and more!
6
- Version: 4.3.6
7
  Author: Elliot Condon
8
  Author URI: http://www.elliotcondon.com/
9
  License: GPL
@@ -43,7 +43,7 @@ class acf
43
  'path' => apply_filters('acf/helpers/get_path', __FILE__),
44
  'dir' => apply_filters('acf/helpers/get_dir', __FILE__),
45
  'hook' => basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ),
46
- 'version' => '4.3.6',
47
  'upgrade_version' => '3.4.1',
48
  'include_3rd_party' => false
49
  );
3
  Plugin Name: Advanced Custom Fields
4
  Plugin URI: http://www.advancedcustomfields.com/
5
  Description: Fully customise WordPress edit screens with powerful fields. Boasting a professional interface and a powerful API, it’s a must have for any web developer working with WordPress. Field types include: Wysiwyg, text, textarea, image, file, select, checkbox, page link, post object, date picker, color picker, repeater, flexible content, gallery and more!
6
+ Version: 4.3.7
7
  Author: Elliot Condon
8
  Author URI: http://www.elliotcondon.com/
9
  License: GPL
43
  'path' => apply_filters('acf/helpers/get_path', __FILE__),
44
  'dir' => apply_filters('acf/helpers/get_dir', __FILE__),
45
  'hook' => basename( dirname( __FILE__ ) ) . '/' . basename( __FILE__ ),
46
+ 'version' => '4.3.7',
47
  'upgrade_version' => '3.4.1',
48
  'include_3rd_party' => false
49
  );
core/fields/wysiwyg.php CHANGED
@@ -48,6 +48,42 @@ class acf_field_wysiwyg extends acf_field
48
 
49
  // filters
50
  add_filter( 'acf/fields/wysiwyg/toolbars', array( $this, 'toolbars'), 1, 1 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
52
 
53
 
@@ -65,22 +101,64 @@ class acf_field_wysiwyg extends acf_field
65
  * @date 23/01/13
66
  */
67
 
68
- function toolbars( $toolbars )
69
- {
 
 
 
 
 
70
  $editor_id = 'acf_settings';
71
 
72
 
73
- // Full
74
- $toolbars['Full'] = array();
75
- $toolbars['Full'][1] = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'justifyleft', 'justifycenter', 'justifyright', 'link', 'unlink', 'wp_more', 'spellchecker', 'fullscreen', 'wp_adv' ), $editor_id);
76
- $toolbars['Full'][2] = apply_filters('mce_buttons_2', array( 'formatselect', 'underline', 'justifyfull', 'forecolor', 'pastetext', 'pasteword', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help', 'code' ), $editor_id);
77
- $toolbars['Full'][3] = apply_filters('mce_buttons_3', array(), $editor_id);
78
- $toolbars['Full'][4] = apply_filters('mce_buttons_4', array(), $editor_id);
79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
- // Basic
82
- $toolbars['Basic'] = array();
83
- $toolbars['Basic'][1] = apply_filters( 'teeny_mce_buttons', array('bold', 'italic', 'underline', 'blockquote', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'undo', 'redo', 'link', 'unlink', 'fullscreen'), $editor_id );
84
 
85
 
86
  // Custom - can be added with acf/fields/wysiwyg/toolbars filter
48
 
49
  // filters
50
  add_filter( 'acf/fields/wysiwyg/toolbars', array( $this, 'toolbars'), 1, 1 );
51
+ add_filter( 'mce_external_plugins', array( $this, 'mce_external_plugins'), 20, 1 );
52
+
53
+ }
54
+
55
+
56
+ /*
57
+ * mce_external_plugins
58
+ *
59
+ * This filter will add in the tinyMCE 'code' plugin which is missing in WP 3.9
60
+ *
61
+ * @type function
62
+ * @date 18/04/2014
63
+ * @since 5.0.0
64
+ *
65
+ * @param $post_id (int)
66
+ * @return $post_id (int)
67
+ */
68
+
69
+ function mce_external_plugins( $plugins ){
70
+
71
+ // global
72
+ global $wp_version;
73
+
74
+
75
+ // WP 3.9 an above
76
+ if( version_compare($wp_version, '3.9', '>=' ) ) {
77
+
78
+ // add code
79
+ $plugins['code'] = apply_filters('acf/get_info', 'dir') . 'js/tinymce.code.min.js';
80
+
81
+ }
82
+
83
+
84
+ // return
85
+ return $plugins;
86
+
87
  }
88
 
89
 
101
  * @date 23/01/13
102
  */
103
 
104
+ function toolbars( $toolbars ) {
105
+
106
+ // global
107
+ global $wp_version;
108
+
109
+
110
+ // vars
111
  $editor_id = 'acf_settings';
112
 
113
 
114
+ if( version_compare($wp_version, '3.9', '>=' ) ) {
 
 
 
 
 
115
 
116
+ // Full
117
+ $toolbars['Full'] = array(
118
+
119
+ 1 => apply_filters( 'mce_buttons', array('bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'hr', 'alignleft', 'aligncenter', 'alignright', 'link', 'unlink', 'wp_more', 'spellchecker', 'fullscreen', 'wp_adv' ), $editor_id ),
120
+
121
+ 2 => apply_filters( 'mce_buttons_2', array( 'formatselect', 'underline', 'alignjustify', 'forecolor', 'pastetext', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help', 'code' ), $editor_id ),
122
+
123
+ 3 => apply_filters('mce_buttons_3', array(), $editor_id),
124
+
125
+ 4 => apply_filters('mce_buttons_4', array(), $editor_id),
126
+
127
+ );
128
+
129
+
130
+ // Basic
131
+ $toolbars['Basic'] = array(
132
+
133
+ 1 => apply_filters( 'teeny_mce_buttons', array('bold', 'italic', 'underline', 'blockquote', 'strikethrough', 'bullist', 'numlist', 'alignleft', 'aligncenter', 'alignright', 'undo', 'redo', 'link', 'unlink', 'fullscreen'), $editor_id ),
134
+
135
+ );
136
+
137
+ } else {
138
+
139
+ // Full
140
+ $toolbars['Full'] = array(
141
+
142
+ 1 => apply_filters( 'mce_buttons', array('bold', 'italic', 'strikethrough', 'bullist', 'numlist', 'blockquote', 'justifyleft', 'justifycenter', 'justifyright', 'link', 'unlink', 'wp_more', 'spellchecker', 'fullscreen', 'wp_adv' ), $editor_id ),
143
+
144
+ 2 => apply_filters( 'mce_buttons_2', array( 'formatselect', 'underline', 'justifyfull', 'forecolor', 'pastetext', 'pasteword', 'removeformat', 'charmap', 'outdent', 'indent', 'undo', 'redo', 'wp_help', 'code' ), $editor_id ),
145
+
146
+ 3 => apply_filters('mce_buttons_3', array(), $editor_id),
147
+
148
+ 4 => apply_filters('mce_buttons_4', array(), $editor_id),
149
+
150
+ );
151
+
152
+
153
+ // Basic
154
+ $toolbars['Basic'] = array(
155
+
156
+ 1 => apply_filters( 'teeny_mce_buttons', array('bold', 'italic', 'underline', 'blockquote', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'undo', 'redo', 'link', 'unlink', 'fullscreen'), $editor_id ),
157
+
158
+ );
159
+
160
+ }
161
 
 
 
 
162
 
163
 
164
  // Custom - can be added with acf/fields/wysiwyg/toolbars filter
js/input.js CHANGED
@@ -4449,6 +4449,7 @@ var acf = {
4449
 
4450
  }, 11);
4451
 
 
4452
  });
4453
 
4454
 
@@ -4473,5 +4474,5 @@ var acf = {
4473
 
4474
  });
4475
 
4476
-
4477
  })(jQuery);
4449
 
4450
  }, 11);
4451
 
4452
+
4453
  });
4454
 
4455
 
4474
 
4475
  });
4476
 
4477
+
4478
  })(jQuery);
js/tinymce.code.min.js ADDED
@@ -0,0 +1 @@
 
1
+ tinymce.PluginManager.add("code",function(e){function o(){e.windowManager.open({title:"Source code",body:{type:"textbox",name:"code",multiline:!0,minWidth:e.getParam("code_dialog_width",600),minHeight:e.getParam("code_dialog_height",Math.min(tinymce.DOM.getViewPort().h-200,500)),value:e.getContent({source_view:!0}),spellcheck:!1,style:"direction: ltr; text-align: left"},onSubmit:function(o){e.focus(),e.undoManager.transact(function(){e.setContent(o.data.code)}),e.selection.setCursorLocation(),e.nodeChanged()}})}e.addCommand("mceCodeEditor",o),e.addButton("code",{icon:"code",tooltip:"Source code",onclick:o}),e.addMenuItem("code",{icon:"code",text:"Source code",context:"tools",onclick:o})});
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: elliotcondon
3
  Tags: custom, field, custom field, advanced, simple fields, magic fields, more fields, repeater, matrix, post, type, text, textarea, file, image, edit, admin
4
  Requires at least: 3.5.0
5
- Tested up to: 3.9.0
6
  License: GPLv2 or later
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
 
@@ -107,6 +107,9 @@ http://support.advancedcustomfields.com/
107
 
108
  == Changelog ==
109
 
 
 
 
110
  = 4.3.6 =
111
  * Core: Improved efficiency and speed when saving values by removing ACF meta from the native WP postmeta box
112
  * Field Group: Fixed cache issue causing field settings to not update
2
  Contributors: elliotcondon
3
  Tags: custom, field, custom field, advanced, simple fields, magic fields, more fields, repeater, matrix, post, type, text, textarea, file, image, edit, admin
4
  Requires at least: 3.5.0
5
+ Tested up to: 3.9
6
  License: GPLv2 or later
7
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
8
 
107
 
108
  == Changelog ==
109
 
110
+ = 4.3.7 =
111
+ * WYSIWYG field: Fixed missing tinyMCE buttons in WP 3.9
112
+
113
  = 4.3.6 =
114
  * Core: Improved efficiency and speed when saving values by removing ACF meta from the native WP postmeta box
115
  * Field Group: Fixed cache issue causing field settings to not update