Version Description
- Fix: wrong text domain
- Fix:
select_advanced
field not cloning - Fix: cloned emails are not saved
- Improvement: Use
post_types
instead ofpages
, accept string for single post type as well. Fallback topages
for previous versions.
Download this release
Release Info
Developer | rilwis |
Plugin | Meta Box |
Version | 4.4.1 |
Comparing to | |
See all releases |
Code changes from version 4.4.0 to 4.4.1
- inc/common.php +1 -1
- inc/fields/email.php +11 -1
- inc/meta-box.php +21 -5
- js/select-advanced.js +10 -4
- meta-box.php +2 -2
- readme.txt +18 -2
inc/common.php
CHANGED
@@ -36,7 +36,7 @@ if ( ! class_exists( 'RWMB_Common' ) )
|
|
36 |
$mofile = "{$dir}{$locale}.mo";
|
37 |
|
38 |
// In themes/plugins/mu-plugins directory
|
39 |
-
load_textdomain( '
|
40 |
}
|
41 |
|
42 |
/**
|
36 |
$mofile = "{$dir}{$locale}.mo";
|
37 |
|
38 |
// In themes/plugins/mu-plugins directory
|
39 |
+
load_textdomain( 'meta-box', $mofile );
|
40 |
}
|
41 |
|
42 |
/**
|
inc/fields/email.php
CHANGED
@@ -41,7 +41,17 @@ if ( ! class_exists( 'RWMB_Email_Field' ) )
|
|
41 |
*/
|
42 |
static function value( $new, $old, $post_id, $field )
|
43 |
{
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
}
|
46 |
}
|
47 |
}
|
41 |
*/
|
42 |
static function value( $new, $old, $post_id, $field )
|
43 |
{
|
44 |
+
if ( $field['clone'] )
|
45 |
+
{
|
46 |
+
$new = (array) $new;
|
47 |
+
$new = array_map( 'sanitize_email', $new );
|
48 |
+
}
|
49 |
+
else
|
50 |
+
{
|
51 |
+
$new = sanitize_email( $new );
|
52 |
+
}
|
53 |
+
|
54 |
+
return $new;
|
55 |
}
|
56 |
}
|
57 |
}
|
inc/meta-box.php
CHANGED
@@ -105,7 +105,7 @@ if ( ! class_exists( 'RW_Meta_Box' ) )
|
|
105 |
$screen = get_current_screen();
|
106 |
|
107 |
// Enqueue scripts and styles for registered pages (post types) only
|
108 |
-
if ( 'post' != $screen->base || ! in_array( $screen->post_type, $this->meta_box['
|
109 |
return;
|
110 |
|
111 |
wp_enqueue_style( 'rwmb', RWMB_CSS_URL . 'style.css', array(), RWMB_VER );
|
@@ -168,13 +168,13 @@ if ( ! class_exists( 'RW_Meta_Box' ) )
|
|
168 |
*/
|
169 |
function add_meta_boxes()
|
170 |
{
|
171 |
-
foreach ( $this->meta_box['
|
172 |
{
|
173 |
add_meta_box(
|
174 |
$this->meta_box['id'],
|
175 |
$this->meta_box['title'],
|
176 |
array( $this, 'show' ),
|
177 |
-
$
|
178 |
$this->meta_box['context'],
|
179 |
$this->meta_box['priority']
|
180 |
);
|
@@ -193,7 +193,7 @@ if ( ! class_exists( 'RW_Meta_Box' ) )
|
|
193 |
{
|
194 |
if (
|
195 |
'post' === $screen->base
|
196 |
-
&& in_array( $screen->post_type, $this->meta_box['
|
197 |
&& $this->meta_box['default_hidden']
|
198 |
)
|
199 |
{
|
@@ -342,11 +342,27 @@ if ( ! class_exists( 'RW_Meta_Box' ) )
|
|
342 |
'id' => sanitize_title( $meta_box['title'] ),
|
343 |
'context' => 'normal',
|
344 |
'priority' => 'high',
|
345 |
-
'
|
346 |
'autosave' => false,
|
347 |
'default_hidden' => false,
|
348 |
) );
|
349 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
350 |
// Set default values for fields
|
351 |
$meta_box['fields'] = self::normalize_fields( $meta_box['fields'] );
|
352 |
|
105 |
$screen = get_current_screen();
|
106 |
|
107 |
// Enqueue scripts and styles for registered pages (post types) only
|
108 |
+
if ( 'post' != $screen->base || ! in_array( $screen->post_type, $this->meta_box['post_types'] ) )
|
109 |
return;
|
110 |
|
111 |
wp_enqueue_style( 'rwmb', RWMB_CSS_URL . 'style.css', array(), RWMB_VER );
|
168 |
*/
|
169 |
function add_meta_boxes()
|
170 |
{
|
171 |
+
foreach ( $this->meta_box['post_types'] as $post_type )
|
172 |
{
|
173 |
add_meta_box(
|
174 |
$this->meta_box['id'],
|
175 |
$this->meta_box['title'],
|
176 |
array( $this, 'show' ),
|
177 |
+
$post_type,
|
178 |
$this->meta_box['context'],
|
179 |
$this->meta_box['priority']
|
180 |
);
|
193 |
{
|
194 |
if (
|
195 |
'post' === $screen->base
|
196 |
+
&& in_array( $screen->post_type, $this->meta_box['post_types'] )
|
197 |
&& $this->meta_box['default_hidden']
|
198 |
)
|
199 |
{
|
342 |
'id' => sanitize_title( $meta_box['title'] ),
|
343 |
'context' => 'normal',
|
344 |
'priority' => 'high',
|
345 |
+
'post_types' => 'post',
|
346 |
'autosave' => false,
|
347 |
'default_hidden' => false,
|
348 |
) );
|
349 |
|
350 |
+
/**
|
351 |
+
* Use 'post_types' for better understanding and fallback to 'pages' for previous versions
|
352 |
+
*
|
353 |
+
* @since 4.4.1
|
354 |
+
*/
|
355 |
+
if ( ! empty( $meta_box['pages'] ) )
|
356 |
+
{
|
357 |
+
$meta_box['post_types'] = $meta_box['pages'];
|
358 |
+
}
|
359 |
+
|
360 |
+
// Allow to set 'post_types' param by string
|
361 |
+
if ( is_string( $meta_box['post_types'] ) )
|
362 |
+
{
|
363 |
+
$meta_box['post_types'] = array( $meta_box['post_types'] );
|
364 |
+
}
|
365 |
+
|
366 |
// Set default values for fields
|
367 |
$meta_box['fields'] = self::normalize_fields( $meta_box['fields'] );
|
368 |
|
js/select-advanced.js
CHANGED
@@ -2,14 +2,20 @@ jQuery( function ( $ )
|
|
2 |
{
|
3 |
'use strict';
|
4 |
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
{
|
7 |
var $this = $( this ),
|
8 |
options = $this.data( 'options' );
|
9 |
$this.siblings( '.select2-container' ).remove();
|
10 |
-
$this.select2( options );
|
11 |
}
|
12 |
|
13 |
-
$( ':input.rwmb-select-advanced' ).each(
|
14 |
-
$( '.rwmb-input' ).on( 'clone', ':input.rwmb-select-advanced',
|
15 |
} );
|
2 |
{
|
3 |
'use strict';
|
4 |
|
5 |
+
/**
|
6 |
+
* Turn select field into beautiful dropdown with select2 library
|
7 |
+
* This function is called when document ready and when clone button is clicked (to update the new cloned field)
|
8 |
+
*
|
9 |
+
* @return void
|
10 |
+
*/
|
11 |
+
function update()
|
12 |
{
|
13 |
var $this = $( this ),
|
14 |
options = $this.data( 'options' );
|
15 |
$this.siblings( '.select2-container' ).remove();
|
16 |
+
$this.show().select2( options );
|
17 |
}
|
18 |
|
19 |
+
$( ':input.rwmb-select-advanced' ).each( update );
|
20 |
+
$( '.rwmb-input' ).on( 'clone', ':input.rwmb-select-advanced', update );
|
21 |
} );
|
meta-box.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Meta Box
|
4 |
Plugin URI: http://www.deluxeblogtips.com/meta-box
|
5 |
Description: Create meta box for editing pages in WordPress. Compatible with custom post types since WP 3.0
|
6 |
-
Version: 4.4.
|
7 |
Author: Rilwis
|
8 |
Author URI: http://www.deluxeblogtips.com
|
9 |
License: GPL2+
|
@@ -13,7 +13,7 @@ License: GPL2+
|
|
13 |
defined( 'ABSPATH' ) || exit;
|
14 |
|
15 |
// Script version, used to add version for scripts and styles
|
16 |
-
define( 'RWMB_VER', '4.4.
|
17 |
|
18 |
// Define plugin URLs, for fast enqueuing scripts and styles
|
19 |
if ( ! defined( 'RWMB_URL' ) )
|
3 |
Plugin Name: Meta Box
|
4 |
Plugin URI: http://www.deluxeblogtips.com/meta-box
|
5 |
Description: Create meta box for editing pages in WordPress. Compatible with custom post types since WP 3.0
|
6 |
+
Version: 4.4.1
|
7 |
Author: Rilwis
|
8 |
Author URI: http://www.deluxeblogtips.com
|
9 |
License: GPL2+
|
13 |
defined( 'ABSPATH' ) || exit;
|
14 |
|
15 |
// Script version, used to add version for scripts and styles
|
16 |
+
define( 'RWMB_VER', '4.4.1' );
|
17 |
|
18 |
// Define plugin URLs, for fast enqueuing scripts and styles
|
19 |
if ( ! defined( 'RWMB_URL' ) )
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.deluxeblogtips.com/donate
|
|
4 |
Tags: meta-box, custom-fields, custom-field, meta, meta-boxes
|
5 |
Requires at least: 3.5
|
6 |
Tested up to: 4.0.1
|
7 |
-
Stable tag: 4.4.
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Meta Box plugin is a complete tool to create meta box and custom fields in WordPress: lightweight, powerful and easy-to-use.
|
@@ -20,15 +20,25 @@ Meta Box plugin provides powerful API to implement custom meta boxes and custom
|
|
20 |
* Has built-in hooks which allow you to change the appearance and behavior of meta boxes
|
21 |
* Easily integrate with themes
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
### Premium Extensions
|
24 |
|
|
|
25 |
- [Meta Box Tooltip](http://metabox.io/plugins/meta-box-tooltip/): Display help information for fields using beautiful tooltips.
|
26 |
- [Meta Box Show Hide (Javascript)](http://metabox.io/plugins/meta-box-show-hide-javascript/): Toggle meta boxes by page template, post format, taxonomy (including category) via Javascript.
|
27 |
- [Meta Box Tabs](http://metabox.io/plugins/meta-box-tabs/): Create tabs for meta boxes easily. Support 3 WordPress-native tab styles and tab icon.
|
28 |
- [Meta Box Columns](http://metabox.io/plugins/meta-box-columns/): Display fields more beautiful by putting them into 12-columns grid.
|
29 |
- [Meta Box Include Exclude](http://metabox.io/plugins/meta-box-include-exclude/): Show/hide meta boxes by ID, page template, taxonomy or custom function.
|
30 |
|
31 |
-
See all premium extensions [here](http://metabox.io).
|
32 |
|
33 |
### Plugin Links
|
34 |
|
@@ -52,6 +62,12 @@ To getting started with the plugin API, please read [this tutorial](http://metab
|
|
52 |
|
53 |
== Changelog ==
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
= 4.4.0 =
|
56 |
* New: 'autocomplete' field.
|
57 |
* Improvement: field id is now optional (heading, divider)
|
4 |
Tags: meta-box, custom-fields, custom-field, meta, meta-boxes
|
5 |
Requires at least: 3.5
|
6 |
Tested up to: 4.0.1
|
7 |
+
Stable tag: 4.4.1
|
8 |
License: GPLv2 or later
|
9 |
|
10 |
Meta Box plugin is a complete tool to create meta box and custom fields in WordPress: lightweight, powerful and easy-to-use.
|
20 |
* Has built-in hooks which allow you to change the appearance and behavior of meta boxes
|
21 |
* Easily integrate with themes
|
22 |
|
23 |
+
### Documentation
|
24 |
+
|
25 |
+
- [Getting Started](http://metabox.io/docs/getting-started/)
|
26 |
+
- [Register Meta Boxes](http://metabox.io/docs/registering-meta-boxes/)
|
27 |
+
- [Define Fields](http://metabox.io/docs/define-fields/)
|
28 |
+
- [Get Meta Value](http://metabox.io/docs/get-meta-value/)
|
29 |
+
|
30 |
+
See more documentation [here](http://metabox.io/docs/).
|
31 |
+
|
32 |
### Premium Extensions
|
33 |
|
34 |
+
- [Meta Box Template](http://metabox.io/plugins/meta-box-template/): Define custom meta boxes and custom fields easier with templates.
|
35 |
- [Meta Box Tooltip](http://metabox.io/plugins/meta-box-tooltip/): Display help information for fields using beautiful tooltips.
|
36 |
- [Meta Box Show Hide (Javascript)](http://metabox.io/plugins/meta-box-show-hide-javascript/): Toggle meta boxes by page template, post format, taxonomy (including category) via Javascript.
|
37 |
- [Meta Box Tabs](http://metabox.io/plugins/meta-box-tabs/): Create tabs for meta boxes easily. Support 3 WordPress-native tab styles and tab icon.
|
38 |
- [Meta Box Columns](http://metabox.io/plugins/meta-box-columns/): Display fields more beautiful by putting them into 12-columns grid.
|
39 |
- [Meta Box Include Exclude](http://metabox.io/plugins/meta-box-include-exclude/): Show/hide meta boxes by ID, page template, taxonomy or custom function.
|
40 |
|
41 |
+
See all premium extensions [here](http://metabox.io/plugins/).
|
42 |
|
43 |
### Plugin Links
|
44 |
|
62 |
|
63 |
== Changelog ==
|
64 |
|
65 |
+
= 4.4.1 =
|
66 |
+
* Fix: wrong text domain
|
67 |
+
* Fix: `select_advanced` field not cloning
|
68 |
+
* Fix: cloned emails are not saved
|
69 |
+
* Improvement: Use `post_types` instead of `pages`, accept string for single post type as well. Fallback to `pages` for previous versions.
|
70 |
+
|
71 |
= 4.4.0 =
|
72 |
* New: 'autocomplete' field.
|
73 |
* Improvement: field id is now optional (heading, divider)
|