Version Description
Download this release
Release Info
Developer | rilwis |
Plugin | Meta Box |
Version | 4.15.3 |
Comparing to | |
See all releases |
Code changes from version 4.15.2 to 4.15.3
- css/osm.css +44 -0
- inc/fields/background.php +1 -1
- inc/fields/object-choice.php +14 -0
- inc/fields/oembed.php +1 -1
- inc/fields/post.php +0 -3
- inc/fields/sidebar.php +0 -3
- inc/fields/taxonomy.php +0 -2
- inc/fields/user.php +1 -3
- inc/functions.php +4 -2
- inc/loader.php +1 -1
- inc/meta-box.php +1 -1
- inc/sanitizer.php +11 -0
- js/validate.js +7 -2
- js/wysiwyg.js +1 -1
- meta-box.php +1 -1
- readme.txt +1 -1
css/osm.css
CHANGED
@@ -3,3 +3,47 @@
|
|
3 |
height: 400px;
|
4 |
margin-bottom: 10px;
|
5 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
height: 400px;
|
4 |
margin-bottom: 10px;
|
5 |
}
|
6 |
+
|
7 |
+
/* Autocomplete style, copy from WordPress's common.css and forms.css */
|
8 |
+
|
9 |
+
input.ui-autocomplete-input.open {
|
10 |
+
border-bottom-color: transparent;
|
11 |
+
}
|
12 |
+
|
13 |
+
.ui-autocomplete {
|
14 |
+
padding: 0;
|
15 |
+
margin: 0;
|
16 |
+
list-style: none;
|
17 |
+
position: absolute;
|
18 |
+
z-index: 10000;
|
19 |
+
border: 1px solid #5b9dd9;
|
20 |
+
box-shadow: 0 1px 2px rgba( 30, 140, 190, 0.8 );
|
21 |
+
background-color: #fff;
|
22 |
+
}
|
23 |
+
|
24 |
+
.ui-autocomplete li {
|
25 |
+
margin-bottom: 0;
|
26 |
+
padding: 4px 10px;
|
27 |
+
white-space: nowrap;
|
28 |
+
text-align: left;
|
29 |
+
cursor: pointer;
|
30 |
+
}
|
31 |
+
|
32 |
+
/* Colors for the wplink toolbar autocomplete. */
|
33 |
+
.ui-autocomplete .ui-state-focus {
|
34 |
+
background-color: #ddd;
|
35 |
+
}
|
36 |
+
|
37 |
+
.ui-helper-hidden-accessible {
|
38 |
+
border: 0;
|
39 |
+
clip: rect(1px, 1px, 1px, 1px);
|
40 |
+
-webkit-clip-path: inset(50%);
|
41 |
+
clip-path: inset(50%);
|
42 |
+
height: 1px;
|
43 |
+
margin: -1px;
|
44 |
+
overflow: hidden;
|
45 |
+
padding: 0;
|
46 |
+
position: absolute;
|
47 |
+
width: 1px;
|
48 |
+
word-wrap: normal !important; /* many screen reader and browser combinations announce broken words as they would appear visually */
|
49 |
+
}
|
inc/fields/background.php
CHANGED
@@ -144,7 +144,7 @@ class RWMB_Background_Field extends RWMB_Field {
|
|
144 |
$output = '';
|
145 |
$value = array_filter( $value );
|
146 |
foreach ( $value as $key => $subvalue ) {
|
147 |
-
$subvalue = 'image' === $key ? 'url(
|
148 |
$output .= 'background-' . $key . ': ' . $subvalue . ';';
|
149 |
}
|
150 |
return $output;
|
144 |
$output = '';
|
145 |
$value = array_filter( $value );
|
146 |
foreach ( $value as $key => $subvalue ) {
|
147 |
+
$subvalue = 'image' === $key ? 'url(' . esc_url( $subvalue ) . ')' : $subvalue;
|
148 |
$output .= 'background-' . $key . ': ' . $subvalue . ';';
|
149 |
}
|
150 |
return $output;
|
inc/fields/object-choice.php
CHANGED
@@ -9,6 +9,20 @@
|
|
9 |
* Abstract field to select an object: post, user, taxonomy, etc.
|
10 |
*/
|
11 |
abstract class RWMB_Object_Choice_Field extends RWMB_Choice_Field {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
/**
|
13 |
* Get field HTML.
|
14 |
*
|
9 |
* Abstract field to select an object: post, user, taxonomy, etc.
|
10 |
*/
|
11 |
abstract class RWMB_Object_Choice_Field extends RWMB_Choice_Field {
|
12 |
+
/**
|
13 |
+
* Show field HTML.
|
14 |
+
* Populate field options before showing to make sure query is made only once.
|
15 |
+
*
|
16 |
+
* @param array $field Field parameters.
|
17 |
+
* @param bool $saved Whether the meta box is saved at least once.
|
18 |
+
* @param int $post_id Post ID.
|
19 |
+
*/
|
20 |
+
public static function show( $field, $saved, $post_id = 0 ) {
|
21 |
+
$field['options'] = self::call( $field, 'query' );
|
22 |
+
|
23 |
+
parent::show( $field, $saved, $post_id );
|
24 |
+
}
|
25 |
+
|
26 |
/**
|
27 |
* Get field HTML.
|
28 |
*
|
inc/fields/oembed.php
CHANGED
@@ -91,7 +91,7 @@ class RWMB_OEmbed_Field extends RWMB_Text_Field {
|
|
91 |
}
|
92 |
$not_available = apply_filters( 'rwmb_oembed_not_available_string', $not_available );
|
93 |
|
94 |
-
return $embed
|
95 |
}
|
96 |
|
97 |
/**
|
91 |
}
|
92 |
$not_available = apply_filters( 'rwmb_oembed_not_available_string', $not_available );
|
93 |
|
94 |
+
return $embed ? $embed : $not_available;
|
95 |
}
|
96 |
|
97 |
/**
|
inc/fields/post.php
CHANGED
@@ -42,9 +42,6 @@ class RWMB_Post_Field extends RWMB_Object_Choice_Field {
|
|
42 |
'placeholder' => $placeholder,
|
43 |
) );
|
44 |
|
45 |
-
// Query posts for field options.
|
46 |
-
$field['options'] = self::query( $field );
|
47 |
-
|
48 |
// Set parent option, which will change field name to `parent_id` to save as post parent.
|
49 |
if ( $field['parent'] ) {
|
50 |
$field['multiple'] = false;
|
42 |
'placeholder' => $placeholder,
|
43 |
) );
|
44 |
|
|
|
|
|
|
|
45 |
// Set parent option, which will change field name to `parent_id` to save as post parent.
|
46 |
if ( $field['parent'] ) {
|
47 |
$field['multiple'] = false;
|
inc/fields/sidebar.php
CHANGED
@@ -21,9 +21,6 @@ class RWMB_Sidebar_Field extends RWMB_Object_Choice_Field {
|
|
21 |
'placeholder' => __( 'Select a sidebar', 'meta-box' ),
|
22 |
) );
|
23 |
|
24 |
-
// Get sidebars for field options.
|
25 |
-
$field['options'] = self::query( $field );
|
26 |
-
|
27 |
$field = parent::normalize( $field );
|
28 |
|
29 |
return $field;
|
21 |
'placeholder' => __( 'Select a sidebar', 'meta-box' ),
|
22 |
) );
|
23 |
|
|
|
|
|
|
|
24 |
$field = parent::normalize( $field );
|
25 |
|
26 |
return $field;
|
inc/fields/taxonomy.php
CHANGED
@@ -58,8 +58,6 @@ class RWMB_Taxonomy_Field extends RWMB_Object_Choice_Field {
|
|
58 |
$field['query_args'] = wp_parse_args( $field['query_args'], array(
|
59 |
'hide_empty' => false,
|
60 |
) );
|
61 |
-
// Query terms for field options.
|
62 |
-
$field['options'] = self::query( $field );
|
63 |
|
64 |
// Prevent cloning for taxonomy field.
|
65 |
$field['clone'] = false;
|
58 |
$field['query_args'] = wp_parse_args( $field['query_args'], array(
|
59 |
'hide_empty' => false,
|
60 |
) );
|
|
|
|
|
61 |
|
62 |
// Prevent cloning for taxonomy field.
|
63 |
$field['clone'] = false;
|
inc/fields/user.php
CHANGED
@@ -24,9 +24,6 @@ class RWMB_User_Field extends RWMB_Object_Choice_Field {
|
|
24 |
'display_field' => 'display_name',
|
25 |
) );
|
26 |
|
27 |
-
// Query posts for field options.
|
28 |
-
$field['options'] = self::query( $field );
|
29 |
-
|
30 |
$field = parent::normalize( $field );
|
31 |
|
32 |
return $field;
|
@@ -43,6 +40,7 @@ class RWMB_User_Field extends RWMB_Object_Choice_Field {
|
|
43 |
$args = wp_parse_args( $field['query_args'], array(
|
44 |
'orderby' => $display_field,
|
45 |
'order' => 'asc',
|
|
|
46 |
) );
|
47 |
$users = get_users( $args );
|
48 |
$options = array();
|
24 |
'display_field' => 'display_name',
|
25 |
) );
|
26 |
|
|
|
|
|
|
|
27 |
$field = parent::normalize( $field );
|
28 |
|
29 |
return $field;
|
40 |
$args = wp_parse_args( $field['query_args'], array(
|
41 |
'orderby' => $display_field,
|
42 |
'order' => 'asc',
|
43 |
+
'fields' => array( 'ID', $display_field ),
|
44 |
) );
|
45 |
$users = get_users( $args );
|
46 |
$options = array();
|
inc/functions.php
CHANGED
@@ -47,7 +47,6 @@ if ( ! function_exists( 'rwmb_get_field_settings' ) ) {
|
|
47 |
$args = wp_parse_args( $args, array(
|
48 |
'object_type' => 'post',
|
49 |
) );
|
50 |
-
$type = get_post_type( $object_id );
|
51 |
|
52 |
/**
|
53 |
* Filter meta type from object type and object id.
|
@@ -56,7 +55,10 @@ if ( ! function_exists( 'rwmb_get_field_settings' ) ) {
|
|
56 |
* @var string Object type.
|
57 |
* @var string|int Object id.
|
58 |
*/
|
59 |
-
$type = apply_filters( 'rwmb_meta_type',
|
|
|
|
|
|
|
60 |
|
61 |
return rwmb_get_registry( 'field' )->get( $key, $type, $args['object_type'] );
|
62 |
}
|
47 |
$args = wp_parse_args( $args, array(
|
48 |
'object_type' => 'post',
|
49 |
) );
|
|
|
50 |
|
51 |
/**
|
52 |
* Filter meta type from object type and object id.
|
55 |
* @var string Object type.
|
56 |
* @var string|int Object id.
|
57 |
*/
|
58 |
+
$type = apply_filters( 'rwmb_meta_type', '', $args['object_type'], $object_id );
|
59 |
+
if ( ! $type ) {
|
60 |
+
$type = get_post_type( $object_id );
|
61 |
+
}
|
62 |
|
63 |
return rwmb_get_registry( 'field' )->get( $key, $type, $args['object_type'] );
|
64 |
}
|
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.15.
|
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.15.3' );
|
22 |
|
23 |
list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
|
24 |
|
inc/meta-box.php
CHANGED
@@ -415,7 +415,7 @@ class RW_Meta_Box {
|
|
415 |
}
|
416 |
if (
|
417 |
( ! $field['multiple'] && '' !== $value )
|
418 |
-
|| ( $field['multiple'] && array() !== $value )
|
419 |
) {
|
420 |
return true;
|
421 |
}
|
415 |
}
|
416 |
if (
|
417 |
( ! $field['multiple'] && '' !== $value )
|
418 |
+
|| ( $field['multiple'] && is_array( $value ) && array() !== $value )
|
419 |
) {
|
420 |
return true;
|
421 |
}
|
inc/sanitizer.php
CHANGED
@@ -49,4 +49,15 @@ class RWMB_Sanitizer {
|
|
49 |
public function checkbox( $value ) {
|
50 |
return (int) ! empty( $value );
|
51 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
49 |
public function checkbox( $value ) {
|
50 |
return (int) ! empty( $value );
|
51 |
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* Set the value of switch to 1 or 0 instead of 'checked' and empty string.
|
55 |
+
* This prevents using default value once the switch has been unchecked.
|
56 |
+
*
|
57 |
+
* @param string $value Switch value.
|
58 |
+
* @return int
|
59 |
+
*/
|
60 |
+
public function switch( $value ) {
|
61 |
+
return (int) ! empty( $value );
|
62 |
+
}
|
63 |
}
|
js/validate.js
CHANGED
@@ -37,9 +37,14 @@ jQuery( function ( $ ) {
|
|
37 |
|
38 |
// Required field styling
|
39 |
$.each( subRules.rules, function ( k, v ) {
|
40 |
-
if ( v['required'] ) {
|
41 |
-
|
42 |
}
|
|
|
|
|
|
|
|
|
|
|
43 |
} );
|
44 |
} );
|
45 |
|
37 |
|
38 |
// Required field styling
|
39 |
$.each( subRules.rules, function ( k, v ) {
|
40 |
+
if ( ! v['required'] ) {
|
41 |
+
return;
|
42 |
}
|
43 |
+
var $el = $( '[name="' + k + '"]' );
|
44 |
+
if ( ! $el.length ) {
|
45 |
+
return;
|
46 |
+
}
|
47 |
+
$el.closest( '.rwmb-input' ).siblings( '.rwmb-label' ).append( '<span class="rwmb-required">*</span>' );
|
48 |
} );
|
49 |
} );
|
50 |
|
js/wysiwyg.js
CHANGED
@@ -70,7 +70,7 @@ jQuery( function ( $ ) {
|
|
70 |
function updateDom( $wrapper, id ) {
|
71 |
// Wrapper div and media buttons
|
72 |
$wrapper.attr( 'id', 'wp-' + id + '-wrap' )
|
73 |
-
.removeClass( 'html-active' ).addClass( '
|
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' )
|
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' )
|
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.15.
|
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.15.3
|
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: 4.9.8
|
7 |
-
Stable tag: 4.15.
|
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: 4.9.8
|
7 |
+
Stable tag: 4.15.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.
|