Meta Box - Version 5.6.8

Version Description

  • 2022-11-11 =
  • Fix PHP8 warning in image field file info
  • Fix wrong comment for translation
  • Bump PHP version requirement to 7.0
Download this release

Release Info

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

Code changes from version 5.6.7 to 5.6.8

Files changed (4) hide show
  1. inc/fields/image.php +11 -23
  2. inc/fields/post.php +1 -1
  3. meta-box.php +1 -1
  4. readme.txt +9 -4
inc/fields/image.php CHANGED
@@ -15,7 +15,7 @@ class RWMB_Image_Field extends RWMB_File_Field {
15
  public static function admin_enqueue_scripts() {
16
  parent::admin_enqueue_scripts();
17
  wp_enqueue_media();
18
- wp_enqueue_style( 'rwmb-image', RWMB_CSS_URL . 'image.css', array(), RWMB_VER );
19
  }
20
 
21
  /**
@@ -65,18 +65,8 @@ class RWMB_Image_Field extends RWMB_File_Field {
65
  */
66
  public static function normalize( $field ) {
67
  $field = parent::normalize( $field );
68
- $field = wp_parse_args(
69
- $field,
70
- array(
71
- 'image_size' => 'thumbnail',
72
- )
73
- );
74
- $field['attributes'] = wp_parse_args(
75
- $field['attributes'],
76
- array(
77
- 'accept' => 'image/*',
78
- )
79
- );
80
 
81
  return $field;
82
  }
@@ -110,21 +100,19 @@ class RWMB_Image_Field extends RWMB_File_Field {
110
  *
111
  * @return array|bool False if file not found. Array of image info on success.
112
  */
113
- public static function file_info( $file, $args = array(), $field = array() ) {
114
  $path = get_attached_file( $file );
115
  if ( ! $path ) {
116
  return false;
117
  }
118
 
119
- $args = wp_parse_args(
120
- $args,
121
- array(
122
- 'size' => 'thumbnail',
123
- )
124
- );
125
- $image = wp_get_attachment_image_src( $file, $args['size'] );
126
  $attachment = get_post( $file );
127
- $info = array(
128
  'ID' => $file,
129
  'name' => basename( $path ),
130
  'path' => $path,
@@ -134,7 +122,7 @@ class RWMB_Image_Field extends RWMB_File_Field {
134
  'caption' => $attachment->post_excerpt,
135
  'description' => $attachment->post_content,
136
  'alt' => get_post_meta( $file, '_wp_attachment_image_alt', true ),
137
- );
138
  if ( function_exists( 'wp_get_attachment_image_srcset' ) ) {
139
  $info['srcset'] = wp_get_attachment_image_srcset( $file, $args['size'] );
140
  }
15
  public static function admin_enqueue_scripts() {
16
  parent::admin_enqueue_scripts();
17
  wp_enqueue_media();
18
+ wp_enqueue_style( 'rwmb-image', RWMB_CSS_URL . 'image.css', [], RWMB_VER );
19
  }
20
 
21
  /**
65
  */
66
  public static function normalize( $field ) {
67
  $field = parent::normalize( $field );
68
+ $field = wp_parse_args( $field, [ 'image_size' => 'thumbnail' ] );
69
+ $field['attributes'] = wp_parse_args( $field['attributes'], [ 'accept' => 'image/*' ] );
 
 
 
 
 
 
 
 
 
 
70
 
71
  return $field;
72
  }
100
  *
101
  * @return array|bool False if file not found. Array of image info on success.
102
  */
103
+ public static function file_info( $file, $args = [], $field = [] ) {
104
  $path = get_attached_file( $file );
105
  if ( ! $path ) {
106
  return false;
107
  }
108
 
109
+ $args = wp_parse_args( $args, [ 'size' => 'thumbnail' ] );
110
+ $image = wp_get_attachment_image_src( $file, $args['size'] );
111
+ if ( ! $image ) {
112
+ return false;
113
+ }
 
 
114
  $attachment = get_post( $file );
115
+ $info = [
116
  'ID' => $file,
117
  'name' => basename( $path ),
118
  'path' => $path,
122
  'caption' => $attachment->post_excerpt,
123
  'description' => $attachment->post_content,
124
  'alt' => get_post_meta( $file, '_wp_attachment_image_alt', true ),
125
+ ];
126
  if ( function_exists( 'wp_get_attachment_image_srcset' ) ) {
127
  $info['srcset'] = wp_get_attachment_image_srcset( $file, $args['size'] );
128
  }
inc/fields/post.php CHANGED
@@ -82,7 +82,7 @@ class RWMB_Post_Field extends RWMB_Object_Choice_Field {
82
  $post_type = reset( $field['post_type'] );
83
  $post_type_object = get_post_type_object( $post_type );
84
  if ( ! empty( $post_type_object ) ) {
85
- // Translators: %s is the taxonomy singular label.
86
  $placeholder = sprintf( __( 'Select a %s', 'meta-box' ), strtolower( $post_type_object->labels->singular_name ) );
87
  }
88
  }
82
  $post_type = reset( $field['post_type'] );
83
  $post_type_object = get_post_type_object( $post_type );
84
  if ( ! empty( $post_type_object ) ) {
85
+ // Translators: %s is the post singular label.
86
  $placeholder = sprintf( __( 'Select a %s', 'meta-box' ), strtolower( $post_type_object->labels->singular_name ) );
87
  }
88
  }
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.6.7
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: 5.6.8
7
  * Author: MetaBox.io
8
  * Author URI: https://metabox.io
9
  * License: GPL2+
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: elightup, metabox, rilwis, fitwp, f-j-kaiser, funkatronic, PerWikl
3
  Donate link: https://metabox.io/pricing/
4
  Tags: meta box, custom fields, custom post types, custom taxonomies, cpt, meta boxes, custom field, post type, taxonomy, meta, admin, advanced, custom, edit, field, file, image, magic fields, post types, more fields, post, repeater, simple fields, text, textarea, type, cms, fields post
5
  Requires at least: 4.3
6
- Requires PHP: 5.6
7
- Tested up to: 6.0.2
8
- Stable tag: 5.6.7
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.
@@ -177,8 +177,13 @@ To getting started with the plugin, please read the [Quick Start Guide](https://
177
 
178
  == Changelog ==
179
 
 
 
 
 
 
180
  = 5.6.7 - 2022-09-16 =
181
- - Fix file_upload not working with required validation
182
  - Fix wrong text domain
183
  - Fix button group option to display horizontally not save in the builder
184
 
3
  Donate link: https://metabox.io/pricing/
4
  Tags: meta box, custom fields, custom post types, custom taxonomies, cpt, meta boxes, custom field, post type, taxonomy, meta, admin, advanced, custom, edit, field, file, image, magic fields, post types, more fields, post, repeater, simple fields, text, textarea, type, cms, fields post
5
  Requires at least: 4.3
6
+ Requires PHP: 7.0
7
+ Tested up to: 6.1.0
8
+ Stable tag: 5.6.8
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.
177
 
178
  == Changelog ==
179
 
180
+ = 5.6.8 - 2022-11-11 =
181
+ - Fix PHP8 warning in image field file info
182
+ - Fix wrong comment for translation
183
+ - Bump PHP version requirement to 7.0
184
+
185
  = 5.6.7 - 2022-09-16 =
186
+ - Fix `file_upload` not working with required validation
187
  - Fix wrong text domain
188
  - Fix button group option to display horizontally not save in the builder
189