Meta Box - Version 4.18.4

Version Description

Download this release

Release Info

Developer rilwis
Plugin Icon 128x128 Meta Box
Version 4.18.4
Comparing to
See all releases

Code changes from version 4.18.3 to 4.18.4

Files changed (7) hide show
  1. css/style.css +8 -0
  2. inc/fields/taxonomy.php +2 -2
  3. inc/loader.php +1 -1
  4. js/select-tree.js +54 -54
  5. js/wysiwyg.js +113 -113
  6. meta-box.php +1 -1
  7. readme.txt +1 -1
css/style.css CHANGED
@@ -144,3 +144,11 @@ select.rwmb-error {
144
  .rwmb-seamless .rwmb-clone {
145
  background: none;
146
  }
 
 
 
 
 
 
 
 
144
  .rwmb-seamless .rwmb-clone {
145
  background: none;
146
  }
147
+
148
+ /* CSS fixes
149
+ --------------------------------------------------------------*/
150
+ /* Fix color picker field is hidden by the post editor at after_title position. https://metabox.io/support/topic/bug-color-picker-field-is-showed-below-the-title-field/ */
151
+ .postarea {
152
+ position: relative;
153
+ z-index: 0;
154
+ }
inc/fields/taxonomy.php CHANGED
@@ -33,7 +33,7 @@ class RWMB_Taxonomy_Field extends RWMB_Object_Choice_Field {
33
  array(
34
  'taxonomy' => 'category',
35
  'query_args' => array(),
36
- 'remove_default' => true,
37
  )
38
  );
39
 
@@ -298,7 +298,7 @@ class RWMB_Taxonomy_Field extends RWMB_Object_Choice_Field {
298
  * @param array $field Field settings.
299
  */
300
  protected static function remove_default_meta_box( $field ) {
301
- if ( empty( $field['remove_default'] ) ) {
302
  return;
303
  }
304
  foreach ( $field['taxonomy'] as $taxonomy ) {
33
  array(
34
  'taxonomy' => 'category',
35
  'query_args' => array(),
36
+ 'remove_default' => false,
37
  )
38
  );
39
 
298
  * @param array $field Field settings.
299
  */
300
  protected static function remove_default_meta_box( $field ) {
301
+ if ( empty( $field['remove_default'] ) || ! function_exists( 'remove_meta_box' ) ) {
302
  return;
303
  }
304
  foreach ( $field['taxonomy'] as $taxonomy ) {
inc/loader.php CHANGED
@@ -18,7 +18,7 @@ class RWMB_Loader {
18
  */
19
  protected function constants() {
20
  // Script version, used to add version for scripts and styles.
21
- define( 'RWMB_VER', '4.18.3' );
22
 
23
  list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
24
 
18
  */
19
  protected function constants() {
20
  // Script version, used to add version for scripts and styles.
21
+ define( 'RWMB_VER', '4.18.4' );
22
 
23
  list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
24
 
js/select-tree.js CHANGED
@@ -1,54 +1,54 @@
1
- jQuery( function ( $ ) {
2
- 'use strict';
3
-
4
- function setInitialRequiredProp() {
5
- var $this = $( this ),
6
- required = $this.prop( 'required' );
7
-
8
- if ( required ) {
9
- $this.data( 'initial-required', required );
10
- }
11
- }
12
-
13
- function unsetRequiredProp() {
14
- $( this ).prop( 'required', false );
15
- }
16
-
17
- function setRequiredProp() {
18
- var $this = $( this );
19
-
20
- if ( $this.data( 'initial-required' ) ) {
21
- $this.prop( 'required', true );
22
- }
23
- }
24
-
25
- function toggleTree() {
26
- var $this = $( this ),
27
- val = $this.val(),
28
- $tree = $this.siblings( '.rwmb-select-tree' ),
29
- $selected = $tree.filter( "[data-parent-id='" + val + "']" ),
30
- $notSelected = $tree.not( $selected );
31
-
32
- $selected.removeClass( 'hidden' ).find( 'select' ).each( setRequiredProp );
33
- $notSelected.addClass( 'hidden' ).find( 'select' ).each( unsetRequiredProp ).prop( 'selectedIndex', 0 );
34
- }
35
-
36
- function instantiateSelect2() {
37
- var $this = $( this ),
38
- options = $this.data( 'options' );
39
-
40
- $this
41
- .removeClass( 'select2-hidden-accessible' ).removeAttr( 'data-select2-id' )
42
- .children().removeAttr( 'data-select2-id' ).end()
43
- .siblings( '.select2-container' ).remove().end()
44
- .select2( options );
45
-
46
- toggleTree.call( this );
47
- }
48
-
49
- $( '.rwmb-select-tree > select' ).select2();
50
- $( '.rwmb-select-tree > select' ).each( setInitialRequiredProp );
51
- $( '.rwmb-input' )
52
- .on( 'change', '.rwmb-select-tree > select', toggleTree )
53
- .on( 'clone', '.rwmb-select-tree > select', instantiateSelect2 );
54
- } );
1
+ jQuery( function ( $ ) {
2
+ 'use strict';
3
+
4
+ function setInitialRequiredProp() {
5
+ var $this = $( this ),
6
+ required = $this.prop( 'required' );
7
+
8
+ if ( required ) {
9
+ $this.data( 'initial-required', required );
10
+ }
11
+ }
12
+
13
+ function unsetRequiredProp() {
14
+ $( this ).prop( 'required', false );
15
+ }
16
+
17
+ function setRequiredProp() {
18
+ var $this = $( this );
19
+
20
+ if ( $this.data( 'initial-required' ) ) {
21
+ $this.prop( 'required', true );
22
+ }
23
+ }
24
+
25
+ function toggleTree() {
26
+ var $this = $( this ),
27
+ val = $this.val(),
28
+ $tree = $this.siblings( '.rwmb-select-tree' ),
29
+ $selected = $tree.filter( "[data-parent-id='" + val + "']" ),
30
+ $notSelected = $tree.not( $selected );
31
+
32
+ $selected.removeClass( 'hidden' ).find( 'select' ).each( setRequiredProp );
33
+ $notSelected.addClass( 'hidden' ).find( 'select' ).each( unsetRequiredProp ).prop( 'selectedIndex', 0 );
34
+ }
35
+
36
+ function instantiateSelect2() {
37
+ var $this = $( this ),
38
+ options = $this.data( 'options' );
39
+
40
+ $this
41
+ .removeClass( 'select2-hidden-accessible' ).removeAttr( 'data-select2-id' )
42
+ .children().removeAttr( 'data-select2-id' ).end()
43
+ .siblings( '.select2-container' ).remove().end()
44
+ .select2( options );
45
+
46
+ toggleTree.call( this );
47
+ }
48
+
49
+ $( '.rwmb-select-tree > select' ).select2();
50
+ $( '.rwmb-select-tree > select' ).each( setInitialRequiredProp );
51
+ $( '.rwmb-input' )
52
+ .on( 'change', '.rwmb-select-tree > select', toggleTree )
53
+ .on( 'clone', '.rwmb-select-tree > select', instantiateSelect2 );
54
+ } );
js/wysiwyg.js CHANGED
@@ -1,113 +1,113 @@
1
- /* global tinymce, quicktags */
2
-
3
- jQuery( function ( $ ) {
4
- 'use strict';
5
-
6
- /**
7
- * Update date picker element
8
- * Used for static & dynamic added elements (when clone)
9
- */
10
- function update() {
11
- var $this = $( this ),
12
- $wrapper = $this.closest( '.wp-editor-wrap' ),
13
- id = $this.attr( 'id' );
14
-
15
- // Ignore existing editor.
16
- if ( tinyMCEPreInit.mceInit[id] ) {
17
- return;
18
- }
19
-
20
- // Get id of the original editor to get its tinyMCE and quick tags settings
21
- var originalId = getOriginalId( $this );
22
- if ( ! originalId ) {
23
- return;
24
- }
25
-
26
- // Update the DOM
27
- $this.show();
28
- updateDom( $wrapper, id );
29
-
30
- // TinyMCE
31
- if ( tinyMCEPreInit.mceInit.hasOwnProperty( originalId ) ) {
32
- var settings = tinyMCEPreInit.mceInit[originalId],
33
- editor = new tinymce.Editor(id, settings, tinymce.EditorManager);
34
- editor.render();
35
- }
36
-
37
- // Quick tags
38
- if ( typeof quicktags === 'function' && tinyMCEPreInit.qtInit.hasOwnProperty( originalId ) ) {
39
- var qtSettings = tinyMCEPreInit.qtInit[originalId];
40
- qtSettings.id = id;
41
- quicktags( qtSettings );
42
- QTags._buttonsInit();
43
- }
44
- }
45
-
46
- /**
47
- * Get original ID of the textarea
48
- * The ID will be used to reference to tinyMCE and quick tags settings
49
- * @param $el Current cloned textarea
50
- */
51
- function getOriginalId( $el ) {
52
- var $clone = $el.closest( '.rwmb-clone' ),
53
- currentId = $clone.find( '.rwmb-wysiwyg' ).attr( 'id' );
54
-
55
- if ( /_\d+$/.test( currentId ) ) {
56
- currentId = currentId.replace( /_\d+$/, '' );
57
- }
58
- if ( tinyMCEPreInit.mceInit.hasOwnProperty( currentId ) || tinyMCEPreInit.qtInit.hasOwnProperty( currentId ) ) {
59
- return currentId;
60
- }
61
-
62
- return '';
63
- }
64
-
65
- /**
66
- * Update id, class, [data-] attributes, ... of the cloned editor.
67
- * @param $wrapper Editor wrapper element
68
- * @param id Editor ID
69
- */
70
- function updateDom( $wrapper, id ) {
71
- // Wrapper div and media buttons
72
- $wrapper.attr( 'id', 'wp-' + id + '-wrap' )
73
- .removeClass( 'html-active' ).addClass( 'tmce-active' ) // Active the visual mode by default
74
- .find( '.mce-container' ).remove().end() // Remove rendered tinyMCE editor
75
- .find( '.wp-editor-tools' ).attr( 'id', 'wp-' + id + '-editor-tools' )
76
- .find( '.wp-media-buttons' ).attr( 'id', 'wp-' + id + '-media-buttons' )
77
- .find( 'button' ).data( 'editor', id ).attr( 'data-editor', id );
78
-
79
- // Editor tabs
80
- $wrapper.find( '.switch-tmce' )
81
- .attr( 'id', id + 'tmce' )
82
- .data( 'wp-editor-id', id ).attr( 'data-wp-editor-id', id ).end()
83
- .find( '.switch-html' )
84
- .attr( 'id', id + 'html' )
85
- .data( 'wp-editor-id', id ).attr( 'data-wp-editor-id', id );
86
-
87
- // Quick tags
88
- $wrapper.find( '.wp-editor-container' ).attr( 'id', 'wp-' + id + '-editor-container' )
89
- .find( '.quicktags-toolbar' ).attr( 'id', 'qt_' + id + '_toolbar' ).html( '' );
90
- }
91
-
92
- /**
93
- * Handles updating tiny mce instances when saving a gutenberg post.
94
- * https://metabox.io/support/topic/data-are-not-saved-into-the-database/
95
- * https://github.com/WordPress/gutenberg/issues/7176
96
- */
97
- function ensureSave() {
98
- if ( ! wp.data || ! wp.data.hasOwnProperty( 'subscribe' ) || ! window.tinyMCE ) {
99
- return;
100
- }
101
- wp.data.subscribe( function() {
102
- var editor = wp.data.hasOwnProperty( 'select' ) ? wp.data.select( 'core/editor' ) : {};
103
-
104
- if ( editor && editor.isSavingPost && editor.isSavingPost() ) {
105
- window.tinyMCE.triggerSave();
106
- }
107
- } );
108
- }
109
-
110
- $( '.rwmb-wysiwyg' ).each( update );
111
- $( document ).on( 'clone', '.rwmb-wysiwyg', update );
112
- ensureSave();
113
- } );
1
+ /* global tinymce, quicktags */
2
+
3
+ jQuery( function ( $ ) {
4
+ 'use strict';
5
+
6
+ /**
7
+ * Update date picker element
8
+ * Used for static & dynamic added elements (when clone)
9
+ */
10
+ function update() {
11
+ var $this = $( this ),
12
+ $wrapper = $this.closest( '.wp-editor-wrap' ),
13
+ id = $this.attr( 'id' );
14
+
15
+ // Ignore existing editor.
16
+ if ( tinyMCEPreInit.mceInit[id] ) {
17
+ return;
18
+ }
19
+
20
+ // Get id of the original editor to get its tinyMCE and quick tags settings
21
+ var originalId = getOriginalId( $this );
22
+ if ( ! originalId ) {
23
+ return;
24
+ }
25
+
26
+ // Update the DOM
27
+ $this.show();
28
+ updateDom( $wrapper, id );
29
+
30
+ // TinyMCE
31
+ if ( tinyMCEPreInit.mceInit.hasOwnProperty( originalId ) ) {
32
+ var settings = tinyMCEPreInit.mceInit[originalId],
33
+ editor = new tinymce.Editor(id, settings, tinymce.EditorManager);
34
+ editor.render();
35
+ }
36
+
37
+ // Quick tags
38
+ if ( typeof quicktags === 'function' && tinyMCEPreInit.qtInit.hasOwnProperty( originalId ) ) {
39
+ var qtSettings = tinyMCEPreInit.qtInit[originalId];
40
+ qtSettings.id = id;
41
+ quicktags( qtSettings );
42
+ QTags._buttonsInit();
43
+ }
44
+ }
45
+
46
+ /**
47
+ * Get original ID of the textarea
48
+ * The ID will be used to reference to tinyMCE and quick tags settings
49
+ * @param $el Current cloned textarea
50
+ */
51
+ function getOriginalId( $el ) {
52
+ var $clone = $el.closest( '.rwmb-clone' ),
53
+ currentId = $clone.find( '.rwmb-wysiwyg' ).attr( 'id' );
54
+
55
+ if ( /_\d+$/.test( currentId ) ) {
56
+ currentId = currentId.replace( /_\d+$/, '' );
57
+ }
58
+ if ( tinyMCEPreInit.mceInit.hasOwnProperty( currentId ) || tinyMCEPreInit.qtInit.hasOwnProperty( currentId ) ) {
59
+ return currentId;
60
+ }
61
+
62
+ return '';
63
+ }
64
+
65
+ /**
66
+ * Update id, class, [data-] attributes, ... of the cloned editor.
67
+ * @param $wrapper Editor wrapper element
68
+ * @param id Editor ID
69
+ */
70
+ function updateDom( $wrapper, id ) {
71
+ // Wrapper div and media buttons
72
+ $wrapper.attr( 'id', 'wp-' + id + '-wrap' )
73
+ .removeClass( 'html-active' ).addClass( 'tmce-active' ) // Active the visual mode by default
74
+ .find( '.mce-container' ).remove().end() // Remove rendered tinyMCE editor
75
+ .find( '.wp-editor-tools' ).attr( 'id', 'wp-' + id + '-editor-tools' )
76
+ .find( '.wp-media-buttons' ).attr( 'id', 'wp-' + id + '-media-buttons' )
77
+ .find( 'button' ).data( 'editor', id ).attr( 'data-editor', id );
78
+
79
+ // Editor tabs
80
+ $wrapper.find( '.switch-tmce' )
81
+ .attr( 'id', id + 'tmce' )
82
+ .data( 'wp-editor-id', id ).attr( 'data-wp-editor-id', id ).end()
83
+ .find( '.switch-html' )
84
+ .attr( 'id', id + 'html' )
85
+ .data( 'wp-editor-id', id ).attr( 'data-wp-editor-id', id );
86
+
87
+ // Quick tags
88
+ $wrapper.find( '.wp-editor-container' ).attr( 'id', 'wp-' + id + '-editor-container' )
89
+ .find( '.quicktags-toolbar' ).attr( 'id', 'qt_' + id + '_toolbar' ).html( '' );
90
+ }
91
+
92
+ /**
93
+ * Handles updating tiny mce instances when saving a gutenberg post.
94
+ * https://metabox.io/support/topic/data-are-not-saved-into-the-database/
95
+ * https://github.com/WordPress/gutenberg/issues/7176
96
+ */
97
+ function ensureSave() {
98
+ if ( ! wp.data || ! wp.data.hasOwnProperty( 'subscribe' ) || ! window.tinyMCE ) {
99
+ return;
100
+ }
101
+ wp.data.subscribe( function() {
102
+ var editor = wp.data.hasOwnProperty( 'select' ) ? wp.data.select( 'core/editor' ) : {};
103
+
104
+ if ( editor && editor.isSavingPost && editor.isSavingPost() ) {
105
+ window.tinyMCE.triggerSave();
106
+ }
107
+ } );
108
+ }
109
+
110
+ $( '.rwmb-wysiwyg' ).each( update );
111
+ $( document ).on( 'clone', '.rwmb-wysiwyg', update );
112
+ ensureSave();
113
+ } );
meta-box.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Meta Box
4
  * Plugin URI: https://metabox.io
5
  * Description: Create custom meta boxes and custom fields in WordPress.
6
- * Version: 4.18.3
7
  * Author: MetaBox.io
8
  * Author URI: https://metabox.io
9
  * License: GPL2+
3
  * Plugin Name: Meta Box
4
  * Plugin URI: https://metabox.io
5
  * Description: Create custom meta boxes and custom fields in WordPress.
6
+ * Version: 4.18.4
7
  * Author: MetaBox.io
8
  * Author URI: https://metabox.io
9
  * License: GPL2+
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://metabox.io/pricing/
4
  Tags: meta-box, custom fields, custom field, meta, meta-boxes, admin, advanced, custom, edit, field, file, image, magic fields, matrix, more fields, Post, repeater, simple fields, text, textarea, type, cms, fields post
5
  Requires at least: 4.3
6
  Tested up to: 5.2.2
7
- Stable tag: 4.18.3
8
  License: GPLv2 or later
9
 
10
  Meta Box plugin is a powerful, professional developer toolkit to create custom meta boxes and custom fields for WordPress.
4
  Tags: meta-box, custom fields, custom field, meta, meta-boxes, admin, advanced, custom, edit, field, file, image, magic fields, matrix, more fields, Post, repeater, simple fields, text, textarea, type, cms, fields post
5
  Requires at least: 4.3
6
  Tested up to: 5.2.2
7
+ Stable tag: 4.18.4
8
  License: GPLv2 or later
9
 
10
  Meta Box plugin is a powerful, professional developer toolkit to create custom meta boxes and custom fields for WordPress.