Version Description
- 2021-05-08 =
- Shortcode: add
render_shortcodes
attribute (default true) to allow render inner shortcodes. - File fields: allow to change uploaded file name when uploading to custom folder via
unique_filename_callback
setting - Dashboard: add more video tutorials
- Image fields: fix actions (edit, delete) not visible on mobile
- Choice fields: fix not saving value if they contain quotes
- Datetime fields: fix not saving timestamp via REST API
Download this release
Release Info
Developer | rilwis |
Plugin | Meta Box |
Version | 5.4.0 |
Comparing to | |
See all releases |
Code changes from version 5.3.10 to 5.4.0
- css/image.css +7 -0
- inc/about/about.php +5 -1
- inc/about/css/about.css +30 -3
- inc/about/sections/getting-started-pro.php +6 -0
- inc/about/sections/getting-started.php +5 -5
- inc/about/sections/welcome.php +5 -6
- inc/fields/datetime.php +6 -1
- inc/fields/file.php +13 -11
- inc/functions.php +0 -56
- inc/loader.php +4 -1
- inc/sanitizer.php +1 -0
- inc/shortcode.php +56 -0
- meta-box.php +3 -3
- readme.txt +9 -1
css/image.css
CHANGED
@@ -64,3 +64,10 @@
|
|
64 |
.rwmb-image-item:hover .rwmb-image-overlay {
|
65 |
opacity: .6;
|
66 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
.rwmb-image-item:hover .rwmb-image-overlay {
|
65 |
opacity: .6;
|
66 |
}
|
67 |
+
|
68 |
+
@media (max-width: 767px) {
|
69 |
+
.rwmb-image-actions {
|
70 |
+
opacity: 1;
|
71 |
+
z-index: 99;
|
72 |
+
}
|
73 |
+
}
|
inc/about/about.php
CHANGED
@@ -119,7 +119,11 @@ class RWMB_About {
|
|
119 |
<?php
|
120 |
include __DIR__ . '/sections/welcome.php';
|
121 |
include __DIR__ . '/sections/tabs.php';
|
122 |
-
|
|
|
|
|
|
|
|
|
123 |
include __DIR__ . '/sections/extensions.php';
|
124 |
include __DIR__ . '/sections/support.php';
|
125 |
do_action( 'rwmb_about_tabs_content' );
|
119 |
<?php
|
120 |
include __DIR__ . '/sections/welcome.php';
|
121 |
include __DIR__ . '/sections/tabs.php';
|
122 |
+
if ( $this->update_checker->has_extensions() ) {
|
123 |
+
include __DIR__ . '/sections/getting-started-pro.php';
|
124 |
+
} else {
|
125 |
+
include __DIR__ . '/sections/getting-started.php';
|
126 |
+
}
|
127 |
include __DIR__ . '/sections/extensions.php';
|
128 |
include __DIR__ . '/sections/support.php';
|
129 |
do_action( 'rwmb_about_tabs_content' );
|
inc/about/css/about.css
CHANGED
@@ -33,6 +33,10 @@
|
|
33 |
|
34 |
.gt-tab-pane {
|
35 |
display: none;
|
|
|
|
|
|
|
|
|
36 |
}
|
37 |
|
38 |
.gt-is-active {
|
@@ -40,14 +44,16 @@
|
|
40 |
}
|
41 |
|
42 |
.two {
|
43 |
-
margin-top: 15px;
|
44 |
display: flex;
|
45 |
}
|
46 |
.two .col + .col {
|
47 |
margin-left: 40px;
|
48 |
}
|
49 |
-
.two h3
|
50 |
-
margin-top:
|
|
|
|
|
|
|
51 |
}
|
52 |
.two img {
|
53 |
display: block;
|
@@ -60,6 +66,7 @@
|
|
60 |
}
|
61 |
.col {
|
62 |
flex: 1;
|
|
|
63 |
}
|
64 |
.col ul {
|
65 |
font-size: 14px;
|
@@ -167,3 +174,23 @@
|
|
167 |
top: 4px;
|
168 |
left: 0;
|
169 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
.gt-tab-pane {
|
35 |
display: none;
|
36 |
+
padding-top: 24px;
|
37 |
+
}
|
38 |
+
.gt-tab-pane .about-description.about-description {
|
39 |
+
margin-top: 0;
|
40 |
}
|
41 |
|
42 |
.gt-is-active {
|
44 |
}
|
45 |
|
46 |
.two {
|
|
|
47 |
display: flex;
|
48 |
}
|
49 |
.two .col + .col {
|
50 |
margin-left: 40px;
|
51 |
}
|
52 |
+
.two h3 {
|
53 |
+
margin-top: 2em;
|
54 |
+
}
|
55 |
+
.two h3:first-child {
|
56 |
+
margin-top: 0;
|
57 |
}
|
58 |
.two img {
|
59 |
display: block;
|
66 |
}
|
67 |
.col {
|
68 |
flex: 1;
|
69 |
+
max-width: 50%;
|
70 |
}
|
71 |
.col ul {
|
72 |
font-size: 14px;
|
174 |
top: 4px;
|
175 |
left: 0;
|
176 |
}
|
177 |
+
|
178 |
+
.youtube-video-container {
|
179 |
+
position: relative;
|
180 |
+
overflow: hidden;
|
181 |
+
width: 100%;
|
182 |
+
}
|
183 |
+
|
184 |
+
.youtube-video-container::after {
|
185 |
+
display: block;
|
186 |
+
content: "";
|
187 |
+
padding-top: 56.25%;
|
188 |
+
}
|
189 |
+
|
190 |
+
.youtube-video-container iframe {
|
191 |
+
position: absolute;
|
192 |
+
top: 0;
|
193 |
+
left: 0;
|
194 |
+
width: 100%;
|
195 |
+
height: 100%;
|
196 |
+
}
|
inc/about/sections/getting-started-pro.php
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<div id="getting-started" class="gt-tab-pane gt-is-active">
|
2 |
+
<p class="about-description"><?php esc_html_e( 'Please follow this video tutorial to get started with Meta Box and extensions:', 'meta-box' ); ?></p>
|
3 |
+
<div class="youtube-video-container">
|
4 |
+
<iframe width="560" height="315" src="https://www.youtube.com/embed/M0nEF7b0woU" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
5 |
+
</div>
|
6 |
+
</div>
|
inc/about/sections/getting-started.php
CHANGED
@@ -14,14 +14,10 @@
|
|
14 |
|
15 |
<a target="_blank" class="screenshot" href="https://metabox.io/online-generator/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><img src="<?php echo esc_url( RWMB_URL . 'inc/about/images/online-generator.png' ); ?>" alt="<?php esc_attr_e( 'online generator', 'meta-box' ); ?>"></a>
|
16 |
|
17 |
-
<p><a class="button" target="_blank" href="
|
18 |
</div>
|
19 |
|
20 |
<div class="col">
|
21 |
-
<h3><?php esc_html_e( 'Understand The Basics', 'meta-box' ); ?></h3>
|
22 |
-
<p><?php esc_html_e( 'Meta Box doesn\'t have any admin page for configuration or settings. Instead of that, it provides a very powerful API to speed up the process of creating meta boxes and custom fields. It might take you a little time at first, but then you\'ll love the way it work because it helps you do and customize almost everything.', 'meta-box' ); ?><p>
|
23 |
-
<p><a class="button" target="_blank" href="<?php echo esc_url( 'https://docs.metabox.io/quick-start/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin' ); ?>"><?php esc_html_e( 'Learn More', 'meta-box' ); ?></a></p>
|
24 |
-
|
25 |
<h3><?php esc_html_e( 'Extensions', 'meta-box' ); ?></h3>
|
26 |
<p><?php esc_html_e( 'Wanna see more features that transform your WordPress website into a powerful CMS? Check out some extensions below:', 'meta-box' ); ?><p>
|
27 |
<ul>
|
@@ -30,6 +26,10 @@
|
|
30 |
<li><a target="_blank" href="https://metabox.io/plugins/meta-box-conditional-logic/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e( 'Meta Box Conditional Logic', 'meta-box' ); ?></a> - <?php esc_html_e( 'Control the visibility of fields.', 'meta-box' ); ?></li>
|
31 |
<li><a target="_blank" href="https://metabox.io/plugins/mb-settings-page/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e( 'MB Settings Page', 'meta-box' ); ?></a> - <?php esc_html_e( 'Create settings pages/Customizer options.', 'meta-box' ); ?></li>
|
32 |
</ul>
|
|
|
|
|
|
|
|
|
33 |
<p><a class="button" target="_blank" href="https://metabox.io/plugins/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e( 'More Extensions', 'meta-box' ); ?></a></p>
|
34 |
</div>
|
35 |
</div>
|
14 |
|
15 |
<a target="_blank" class="screenshot" href="https://metabox.io/online-generator/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><img src="<?php echo esc_url( RWMB_URL . 'inc/about/images/online-generator.png' ); ?>" alt="<?php esc_attr_e( 'online generator', 'meta-box' ); ?>"></a>
|
16 |
|
17 |
+
<p><a class="button" target="_blank" href="https://metabox.io/online-generator/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e( 'Go to Online Generator', 'meta-box' ); ?></a></p>
|
18 |
</div>
|
19 |
|
20 |
<div class="col">
|
|
|
|
|
|
|
|
|
21 |
<h3><?php esc_html_e( 'Extensions', 'meta-box' ); ?></h3>
|
22 |
<p><?php esc_html_e( 'Wanna see more features that transform your WordPress website into a powerful CMS? Check out some extensions below:', 'meta-box' ); ?><p>
|
23 |
<ul>
|
26 |
<li><a target="_blank" href="https://metabox.io/plugins/meta-box-conditional-logic/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e( 'Meta Box Conditional Logic', 'meta-box' ); ?></a> - <?php esc_html_e( 'Control the visibility of fields.', 'meta-box' ); ?></li>
|
27 |
<li><a target="_blank" href="https://metabox.io/plugins/mb-settings-page/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e( 'MB Settings Page', 'meta-box' ); ?></a> - <?php esc_html_e( 'Create settings pages/Customizer options.', 'meta-box' ); ?></li>
|
28 |
</ul>
|
29 |
+
|
30 |
+
<div class="youtube-video-container">
|
31 |
+
<iframe width="560" height="315" src="https://www.youtube.com/embed/M0nEF7b0woU" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
32 |
+
</div>
|
33 |
<p><a class="button" target="_blank" href="https://metabox.io/plugins/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e( 'More Extensions', 'meta-box' ); ?></a></p>
|
34 |
</div>
|
35 |
</div>
|
inc/about/sections/welcome.php
CHANGED
@@ -15,11 +15,10 @@
|
|
15 |
?>
|
16 |
</h1>
|
17 |
<div class="about-text"><?php esc_html_e( 'Meta Box is a free Gutenberg and GDPR-compatible WordPress custom fields plugin and framework that makes quick work of customizing a website with—you guessed it—meta boxes and custom fields in WordPress. Follow the instruction below to get started!', 'meta-box' ); ?></div>
|
18 |
-
<a target="_blank" class="wp-badge" href="
|
19 |
<p class="about-buttons">
|
20 |
-
<a target="_blank" class="button" href="
|
21 |
-
<a target="_blank" class="button" href="
|
22 |
-
<a target="_blank" class="button" href="
|
23 |
-
<a target="_blank" class="button" href="https://www.
|
24 |
-
<a target="_blank" class="button" href="https://twitter.com/home?status=Reduce%20your%20dev%20time!%20Meta%20Box%20is%20the%20most%20powerful%20custom%20fields%20plugin%20for%20WordPress%20on%20the%20web%20https%3A//metabox.io%20via%20%40wpmetabox"><span class="dashicons dashicons-twitter"></span> Tweet</a>
|
25 |
</p>
|
15 |
?>
|
16 |
</h1>
|
17 |
<div class="about-text"><?php esc_html_e( 'Meta Box is a free Gutenberg and GDPR-compatible WordPress custom fields plugin and framework that makes quick work of customizing a website with—you guessed it—meta boxes and custom fields in WordPress. Follow the instruction below to get started!', 'meta-box' ); ?></div>
|
18 |
+
<a target="_blank" class="wp-badge" href="https://metabox.io/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php echo esc_html( $plugin_data['Name'] ); ?></a>
|
19 |
<p class="about-buttons">
|
20 |
+
<a target="_blank" class="button" href="https://docs.metabox.io?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e( 'Documentation', 'meta-box' ); ?></a>
|
21 |
+
<a target="_blank" class="button" href="https://metabox.io/support/?utm_source=WordPress&utm_medium=link&utm_campaign=plugin"><?php esc_html_e( 'Support', 'meta-box' ); ?></a>
|
22 |
+
<a target="_blank" class="button" href="http://facebook.com/groups/metaboxusers"><?php esc_html_e( 'Facebook Group', 'meta-box' ); ?></a>
|
23 |
+
<a target="_blank" class="button" href="https://www.youtube.com/c/MetaBoxWP"><?php esc_html_e( 'Youtube Channel', 'meta-box' ); ?></a>
|
|
|
24 |
</p>
|
inc/fields/datetime.php
CHANGED
@@ -141,7 +141,12 @@ class RWMB_Datetime_Field extends RWMB_Text_Field {
|
|
141 |
*/
|
142 |
public static function value( $new, $old, $post_id, $field ) {
|
143 |
if ( $field['timestamp'] ) {
|
144 |
-
|
|
|
|
|
|
|
|
|
|
|
145 |
}
|
146 |
|
147 |
if ( $field['save_format'] ) {
|
141 |
*/
|
142 |
public static function value( $new, $old, $post_id, $field ) {
|
143 |
if ( $field['timestamp'] ) {
|
144 |
+
if ( is_array( $new ) ) {
|
145 |
+
return $new['timestamp'];
|
146 |
+
} elseif ( ! is_numeric( $new ) ) {
|
147 |
+
return strtotime( $new );
|
148 |
+
}
|
149 |
+
return $new;
|
150 |
}
|
151 |
|
152 |
if ( $field['save_format'] ) {
|
inc/fields/file.php
CHANGED
@@ -348,16 +348,14 @@ class RWMB_File_Field extends RWMB_Field {
|
|
348 |
*/
|
349 |
public static function normalize( $field ) {
|
350 |
$field = parent::normalize( $field );
|
351 |
-
$field = wp_parse_args(
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
)
|
360 |
-
);
|
361 |
|
362 |
$field['multiple'] = true;
|
363 |
$field['input_name'] = "_file_{$field['id']}";
|
@@ -491,7 +489,11 @@ class RWMB_File_Field extends RWMB_Field {
|
|
491 |
|
492 |
// Let WordPress handle upload to the custom directory.
|
493 |
add_filter( 'upload_dir', $filter_upload_dir );
|
494 |
-
$
|
|
|
|
|
|
|
|
|
495 |
remove_filter( 'upload_dir', $filter_upload_dir );
|
496 |
|
497 |
return empty( $file_info['url'] ) ? null : $file_info['url'];
|
348 |
*/
|
349 |
public static function normalize( $field ) {
|
350 |
$field = parent::normalize( $field );
|
351 |
+
$field = wp_parse_args( $field, [
|
352 |
+
'std' => [],
|
353 |
+
'force_delete' => false,
|
354 |
+
'max_file_uploads' => 0,
|
355 |
+
'mime_type' => '',
|
356 |
+
'upload_dir' => '',
|
357 |
+
'unique_filename_callback' => null,
|
358 |
+
] );
|
|
|
|
|
359 |
|
360 |
$field['multiple'] = true;
|
361 |
$field['input_name'] = "_file_{$field['id']}";
|
489 |
|
490 |
// Let WordPress handle upload to the custom directory.
|
491 |
add_filter( 'upload_dir', $filter_upload_dir );
|
492 |
+
$overrides = [
|
493 |
+
'test_form' => false,
|
494 |
+
'unique_filename_callback' => $field['unique_filename_callback'],
|
495 |
+
];
|
496 |
+
$file_info = wp_handle_upload( $file, $overrides );
|
497 |
remove_filter( 'upload_dir', $filter_upload_dir );
|
498 |
|
499 |
return empty( $file_info['url'] ) ? null : $file_info['url'];
|
inc/functions.php
CHANGED
@@ -277,62 +277,6 @@ if ( ! function_exists( 'rwmb_check_meta_box_supports' ) ) {
|
|
277 |
}
|
278 |
}
|
279 |
|
280 |
-
if ( ! function_exists( 'rwmb_meta_shortcode' ) ) {
|
281 |
-
/**
|
282 |
-
* Shortcode to display meta value.
|
283 |
-
*
|
284 |
-
* @param array $atts Shortcode attributes, same as rwmb_meta() function, but has more "meta_key" parameter.
|
285 |
-
*
|
286 |
-
* @return string
|
287 |
-
*/
|
288 |
-
function rwmb_meta_shortcode( $atts ) {
|
289 |
-
$atts = wp_parse_args(
|
290 |
-
$atts,
|
291 |
-
array(
|
292 |
-
'id' => '',
|
293 |
-
'object_id' => null,
|
294 |
-
'attribute' => '',
|
295 |
-
)
|
296 |
-
);
|
297 |
-
RWMB_Helpers_Array::change_key( $atts, 'post_id', 'object_id' );
|
298 |
-
RWMB_Helpers_Array::change_key( $atts, 'meta_key', 'id' );
|
299 |
-
|
300 |
-
if ( empty( $atts['id'] ) ) {
|
301 |
-
return '';
|
302 |
-
}
|
303 |
-
|
304 |
-
$field_id = $atts['id'];
|
305 |
-
$object_id = $atts['object_id'];
|
306 |
-
unset( $atts['id'], $atts['object_id'] );
|
307 |
-
|
308 |
-
$attribute = $atts['attribute'];
|
309 |
-
if ( ! $attribute ) {
|
310 |
-
return rwmb_the_value( $field_id, $atts, $object_id, false );
|
311 |
-
}
|
312 |
-
|
313 |
-
$value = rwmb_get_value( $field_id, $atts, $object_id );
|
314 |
-
|
315 |
-
if ( ! is_array( $value ) && ! is_object( $value ) ) {
|
316 |
-
return $value;
|
317 |
-
}
|
318 |
-
|
319 |
-
if ( is_object( $value ) ) {
|
320 |
-
return $value->$attribute;
|
321 |
-
}
|
322 |
-
|
323 |
-
if ( isset( $value[ $attribute ] ) ) {
|
324 |
-
return $value[ $attribute ];
|
325 |
-
}
|
326 |
-
|
327 |
-
$value = wp_list_pluck( $value, $attribute );
|
328 |
-
$value = implode( ',', array_filter( $value ) );
|
329 |
-
|
330 |
-
return $value;
|
331 |
-
}
|
332 |
-
|
333 |
-
add_shortcode( 'rwmb_meta', 'rwmb_meta_shortcode' );
|
334 |
-
}
|
335 |
-
|
336 |
if ( ! function_exists( 'rwmb_get_registry' ) ) {
|
337 |
/**
|
338 |
* Get the registry by type.
|
277 |
}
|
278 |
}
|
279 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
280 |
if ( ! function_exists( 'rwmb_get_registry' ) ) {
|
281 |
/**
|
282 |
* Get the registry by type.
|
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', '5.
|
22 |
|
23 |
list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
|
24 |
|
@@ -88,6 +88,9 @@ class RWMB_Loader {
|
|
88 |
$core = new RWMB_Core();
|
89 |
$core->init();
|
90 |
|
|
|
|
|
|
|
91 |
// Validation module.
|
92 |
new RWMB_Validation();
|
93 |
|
18 |
*/
|
19 |
protected function constants() {
|
20 |
// Script version, used to add version for scripts and styles.
|
21 |
+
define( 'RWMB_VER', '5.4.0' );
|
22 |
|
23 |
list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
|
24 |
|
88 |
$core = new RWMB_Core();
|
89 |
$core->init();
|
90 |
|
91 |
+
$shortcode = new RWMB_Shortcode();
|
92 |
+
$shortcode->init();
|
93 |
+
|
94 |
// Validation module.
|
95 |
new RWMB_Validation();
|
96 |
|
inc/sanitizer.php
CHANGED
@@ -152,6 +152,7 @@ class RWMB_Sanitizer {
|
|
152 |
private function sanitize_choice( $value, $field ) {
|
153 |
$options = RWMB_Choice_Field::transform_options( $field['options'] );
|
154 |
$options = wp_list_pluck( $options, 'value' );
|
|
|
155 |
return is_array( $value ) ? array_intersect( $value, $options ) : ( in_array( $value, $options ) ? $value : '' );
|
156 |
}
|
157 |
|
152 |
private function sanitize_choice( $value, $field ) {
|
153 |
$options = RWMB_Choice_Field::transform_options( $field['options'] );
|
154 |
$options = wp_list_pluck( $options, 'value' );
|
155 |
+
$value = wp_unslash( $value );
|
156 |
return is_array( $value ) ? array_intersect( $value, $options ) : ( in_array( $value, $options ) ? $value : '' );
|
157 |
}
|
158 |
|
inc/shortcode.php
ADDED
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
class RWMB_Shortcode {
|
3 |
+
public function init() {
|
4 |
+
add_shortcode( 'rwmb_meta', [ $this, 'register_shortcode' ] );
|
5 |
+
}
|
6 |
+
|
7 |
+
public function register_shortcode( $atts ) {
|
8 |
+
$atts = wp_parse_args( $atts, [
|
9 |
+
'id' => '',
|
10 |
+
'object_id' => null,
|
11 |
+
'attribute' => '',
|
12 |
+
'render_shortcodes' => 'true',
|
13 |
+
] );
|
14 |
+
RWMB_Helpers_Array::change_key( $atts, 'post_id', 'object_id' );
|
15 |
+
RWMB_Helpers_Array::change_key( $atts, 'meta_key', 'id' );
|
16 |
+
|
17 |
+
if ( empty( $atts['id'] ) ) {
|
18 |
+
return '';
|
19 |
+
}
|
20 |
+
|
21 |
+
$field_id = $atts['id'];
|
22 |
+
$object_id = $atts['object_id'];
|
23 |
+
unset( $atts['id'], $atts['object_id'] );
|
24 |
+
|
25 |
+
$value = $this->get_value( $field_id, $object_id, $atts );
|
26 |
+
$value = 'true' === $atts['render_shortcodes'] ? do_shortcode( $value ) : $value;
|
27 |
+
|
28 |
+
return $value;
|
29 |
+
}
|
30 |
+
|
31 |
+
private function get_value( $field_id, $object_id, $atts ) {
|
32 |
+
$attribute = $atts['attribute'];
|
33 |
+
if ( ! $attribute ) {
|
34 |
+
return rwmb_the_value( $field_id, $atts, $object_id, false );
|
35 |
+
}
|
36 |
+
|
37 |
+
$value = rwmb_get_value( $field_id, $atts, $object_id );
|
38 |
+
|
39 |
+
if ( ! is_array( $value ) && ! is_object( $value ) ) {
|
40 |
+
return $value;
|
41 |
+
}
|
42 |
+
|
43 |
+
if ( is_object( $value ) ) {
|
44 |
+
return $value->$attribute;
|
45 |
+
}
|
46 |
+
|
47 |
+
if ( isset( $value[ $attribute ] ) ) {
|
48 |
+
return $value[ $attribute ];
|
49 |
+
}
|
50 |
+
|
51 |
+
$value = wp_list_pluck( $value, $attribute );
|
52 |
+
$value = implode( ',', array_filter( $value ) );
|
53 |
+
|
54 |
+
return $value;
|
55 |
+
}
|
56 |
+
}
|
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: 5.
|
7 |
* Author: MetaBox.io
|
8 |
* Author URI: https://metabox.io
|
9 |
* License: GPL2+
|
@@ -20,8 +20,8 @@ if ( defined( 'ABSPATH' ) && ! defined( 'RWMB_VER' ) ) {
|
|
20 |
* Display notice for old PHP version.
|
21 |
*/
|
22 |
function rwmb_check_php_version() {
|
23 |
-
if ( version_compare( phpversion(), '5.
|
24 |
-
die( esc_html__( 'Meta Box requires PHP version 5.
|
25 |
}
|
26 |
}
|
27 |
|
3 |
* Plugin Name: Meta Box
|
4 |
* Plugin URI: https://metabox.io
|
5 |
* Description: Create custom meta boxes and custom fields in WordPress.
|
6 |
+
* Version: 5.4.0
|
7 |
* Author: MetaBox.io
|
8 |
* Author URI: https://metabox.io
|
9 |
* License: GPL2+
|
20 |
* Display notice for old PHP version.
|
21 |
*/
|
22 |
function rwmb_check_php_version() {
|
23 |
+
if ( version_compare( phpversion(), '5.6', '<' ) ) {
|
24 |
+
die( esc_html__( 'Meta Box requires PHP version 5.6+. Please contact your host to upgrade.', 'meta-box' ) );
|
25 |
}
|
26 |
}
|
27 |
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: meta box, custom fields, custom post types, custom taxonomies, cpt, meta b
|
|
5 |
Requires at least: 4.3
|
6 |
Requires PHP: 5.6
|
7 |
Tested up to: 5.7
|
8 |
-
Stable tag: 5.
|
9 |
License: GPLv2 or later
|
10 |
|
11 |
Meta Box plugin is a powerful, professional developer toolkit to create custom meta boxes and custom fields for your custom post types in WordPress.
|
@@ -168,6 +168,14 @@ To getting started with the plugin, please read the [Quick Start Guide](https://
|
|
168 |
|
169 |
== Changelog ==
|
170 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
= 5.3.10 - 2021-04-24 =
|
172 |
- Disable autocomplete for date/datetime fields
|
173 |
- Input list field: Fix label not working if contains HTML
|
5 |
Requires at least: 4.3
|
6 |
Requires PHP: 5.6
|
7 |
Tested up to: 5.7
|
8 |
+
Stable tag: 5.4.0
|
9 |
License: GPLv2 or later
|
10 |
|
11 |
Meta Box plugin is a powerful, professional developer toolkit to create custom meta boxes and custom fields for your custom post types in WordPress.
|
168 |
|
169 |
== Changelog ==
|
170 |
|
171 |
+
= 5.4.0 - 2021-05-08 =
|
172 |
+
- Shortcode: add `render_shortcodes` attribute (default true) to allow render inner shortcodes.
|
173 |
+
- File fields: allow to change uploaded file name when uploading to custom folder via `unique_filename_callback` setting
|
174 |
+
- Dashboard: add more video tutorials
|
175 |
+
- Image fields: fix actions (edit, delete) not visible on mobile
|
176 |
+
- Choice fields: fix not saving value if they contain quotes
|
177 |
+
- Datetime fields: fix not saving timestamp via REST API
|
178 |
+
|
179 |
= 5.3.10 - 2021-04-24 =
|
180 |
- Disable autocomplete for date/datetime fields
|
181 |
- Input list field: Fix label not working if contains HTML
|