Meta Box - Version 5.2.3

Version Description

  • 2019-11-01 =

Changed

  • Set clone=false if max_clone=1
  • Shows only images in the selection popup for image field
  • Hide license key

Fixed

  • Fixed parsed terms in taxonomy advanced for MB Blocks
  • Don't show date picker for readonly fields
  • Fix warning when output empty background field value
  • Fix empty meta value when save_field=false
Download this release

Release Info

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

Code changes from version 5.2.2 to 5.2.3

inc/field.php CHANGED
@@ -206,7 +206,7 @@ abstract class RWMB_Field {
206
  $meta = self::call( $field, 'raw_meta', $post_id );
207
 
208
  // Use $field['std'] only when the meta box hasn't been saved (i.e. the first time we run).
209
- $meta = ! $saved ? $field['std'] : $meta;
210
 
211
  // Ensure multiple fields are arrays.
212
  if ( $field['multiple'] ) {
@@ -380,6 +380,10 @@ abstract class RWMB_Field {
380
  );
381
  }
382
 
 
 
 
 
383
  return $field;
384
  }
385
 
206
  $meta = self::call( $field, 'raw_meta', $post_id );
207
 
208
  // Use $field['std'] only when the meta box hasn't been saved (i.e. the first time we run).
209
+ $meta = ! $saved || ! $field['save_field'] ? $field['std'] : $meta;
210
 
211
  // Ensure multiple fields are arrays.
212
  if ( $field['multiple'] ) {
380
  );
381
  }
382
 
383
+ if ( 1 === $field['max_clone'] ) {
384
+ $field['clone'] = false;
385
+ }
386
+
387
  return $field;
388
  }
389
 
inc/fields/background.php CHANGED
@@ -156,6 +156,9 @@ class RWMB_Background_Field extends RWMB_Field {
156
  * @return string
157
  */
158
  public static function format_single_value( $field, $value, $args, $post_id ) {
 
 
 
159
  $output = '';
160
  $value = array_filter( $value );
161
  foreach ( $value as $key => $subvalue ) {
156
  * @return string
157
  */
158
  public static function format_single_value( $field, $value, $args, $post_id ) {
159
+ if ( empty( $value ) ) {
160
+ return '';
161
+ }
162
  $output = '';
163
  $value = array_filter( $value );
164
  foreach ( $value as $key => $subvalue ) {
inc/fields/image.php CHANGED
@@ -76,6 +76,12 @@ class RWMB_Image_Field extends RWMB_File_Field {
76
  'image_size' => 'thumbnail',
77
  )
78
  );
 
 
 
 
 
 
79
 
80
  return $field;
81
  }
76
  'image_size' => 'thumbnail',
77
  )
78
  );
79
+ $field['attributes'] = wp_parse_args(
80
+ $field['attributes'],
81
+ array(
82
+ 'accept' => 'image/*',
83
+ )
84
+ );
85
 
86
  return $field;
87
  }
inc/fields/post.php CHANGED
@@ -25,18 +25,18 @@ class RWMB_Post_Field extends RWMB_Object_Choice_Field {
25
 
26
  $request = rwmb_request();
27
 
28
- $field = $request->filter_get( 'field', FILTER_DEFAULT, FILTER_FORCE_ARRAY );
29
 
30
  // Required for 'choice_label' filter. See self::filter().
31
  $field['clone'] = false;
32
  $field['_original_id'] = $field['id'];
33
 
34
  // Search.
35
- $field['query_args']['s'] = $request->filter_get( 'term', FILTER_SANITIZE_STRING );
36
 
37
  // Pagination.
38
- if ( 'query:append' === $request->filter_get( '_type', FILTER_SANITIZE_STRING ) ) {
39
- $field['query_args']['paged'] = $request->filter_get( 'page', FILTER_SANITIZE_NUMBER_INT );
40
  }
41
 
42
  // Query the database.
25
 
26
  $request = rwmb_request();
27
 
28
+ $field = $request->filter_post( 'field', FILTER_DEFAULT, FILTER_FORCE_ARRAY );
29
 
30
  // Required for 'choice_label' filter. See self::filter().
31
  $field['clone'] = false;
32
  $field['_original_id'] = $field['id'];
33
 
34
  // Search.
35
+ $field['query_args']['s'] = $request->filter_post( 'term', FILTER_SANITIZE_STRING );
36
 
37
  // Pagination.
38
+ if ( 'query:append' === $request->filter_post( '_type', FILTER_SANITIZE_STRING ) ) {
39
+ $field['query_args']['paged'] = $request->filter_post( 'page', FILTER_SANITIZE_NUMBER_INT );
40
  }
41
 
42
  // Query the database.
inc/fields/taxonomy-advanced.php CHANGED
@@ -55,7 +55,7 @@ class RWMB_Taxonomy_Advanced_Field extends RWMB_Taxonomy_Field {
55
  return $field['multiple'] ? array() : '';
56
  }
57
 
58
- $meta = is_array( $meta ) ? array_map( 'wp_parse_id_list', $meta ) : wp_parse_id_list( $meta );
59
 
60
  $meta = array_filter( $meta );
61
 
55
  return $field['multiple'] ? array() : '';
56
  }
57
 
58
+ $meta = $field['clone'] ? array_map( 'wp_parse_id_list', $meta ) : wp_parse_id_list( $meta );
59
 
60
  $meta = array_filter( $meta );
61
 
inc/fields/taxonomy.php CHANGED
@@ -25,19 +25,19 @@ class RWMB_Taxonomy_Field extends RWMB_Object_Choice_Field {
25
 
26
  $request = rwmb_request();
27
 
28
- $field = $request->filter_get( 'field', FILTER_DEFAULT, FILTER_FORCE_ARRAY );
29
 
30
  // Required for 'choice_label' filter. See self::filter().
31
  $field['clone'] = false;
32
  $field['_original_id'] = $field['id'];
33
 
34
  // Search.
35
- $field['query_args']['name__like'] = $request->filter_get( 'term', FILTER_SANITIZE_STRING );
36
 
37
  // Pagination.
38
  $limit = isset( $field['query_args']['number'] ) ? (int) $field['query_args']['number'] : 0;
39
- if ( 'query:append' === $request->filter_get( '_type', FILTER_SANITIZE_STRING ) ) {
40
- $page = $request->filter_get( 'page', FILTER_SANITIZE_NUMBER_INT );
41
  $field['query_args']['offset'] = $limit * ( $page - 1 );
42
  }
43
 
25
 
26
  $request = rwmb_request();
27
 
28
+ $field = $request->filter_post( 'field', FILTER_DEFAULT, FILTER_FORCE_ARRAY );
29
 
30
  // Required for 'choice_label' filter. See self::filter().
31
  $field['clone'] = false;
32
  $field['_original_id'] = $field['id'];
33
 
34
  // Search.
35
+ $field['query_args']['name__like'] = $request->filter_post( 'term', FILTER_SANITIZE_STRING );
36
 
37
  // Pagination.
38
  $limit = isset( $field['query_args']['number'] ) ? (int) $field['query_args']['number'] : 0;
39
+ if ( 'query:append' === $request->filter_post( '_type', FILTER_SANITIZE_STRING ) ) {
40
+ $page = $request->filter_post( 'page', FILTER_SANITIZE_NUMBER_INT );
41
  $field['query_args']['offset'] = $limit * ( $page - 1 );
42
  }
43
 
inc/fields/user.php CHANGED
@@ -26,22 +26,22 @@ class RWMB_User_Field extends RWMB_Object_Choice_Field {
26
 
27
  $request = rwmb_request();
28
 
29
- $field = $request->filter_get( 'field', FILTER_DEFAULT, FILTER_FORCE_ARRAY );
30
 
31
  // Required for 'choice_label' filter. See self::filter().
32
  $field['clone'] = false;
33
  $field['_original_id'] = $field['id'];
34
 
35
  // Search.
36
- $term = $request->filter_get( 'term', FILTER_SANITIZE_STRING );
37
  if ( $term ) {
38
  $field['query_args']['search'] = "*{$term}*";
39
  }
40
 
41
  // Pagination.
42
  $limit = isset( $field['query_args']['number'] ) ? (int) $field['query_args']['number'] : 0;
43
- if ( $limit && 'query:append' === $request->filter_get( '_type', FILTER_SANITIZE_STRING ) ) {
44
- $field['query_args']['paged'] = $request->filter_get( 'page', FILTER_SANITIZE_NUMBER_INT );
45
  }
46
 
47
  // Query the database.
26
 
27
  $request = rwmb_request();
28
 
29
+ $field = $request->filter_post( 'field', FILTER_DEFAULT, FILTER_FORCE_ARRAY );
30
 
31
  // Required for 'choice_label' filter. See self::filter().
32
  $field['clone'] = false;
33
  $field['_original_id'] = $field['id'];
34
 
35
  // Search.
36
+ $term = $request->filter_post( 'term', FILTER_SANITIZE_STRING );
37
  if ( $term ) {
38
  $field['query_args']['search'] = "*{$term}*";
39
  }
40
 
41
  // Pagination.
42
  $limit = isset( $field['query_args']['number'] ) ? (int) $field['query_args']['number'] : 0;
43
+ if ( $limit && 'query:append' === $request->filter_post( '_type', FILTER_SANITIZE_STRING ) ) {
44
+ $field['query_args']['paged'] = $request->filter_post( 'page', FILTER_SANITIZE_NUMBER_INT );
45
  }
46
 
47
  // Query the database.
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.2.2' );
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', '5.2.3' );
22
 
23
  list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
24
 
inc/meta-box.php CHANGED
@@ -234,7 +234,7 @@ class RW_Meta_Box {
234
  */
235
  public function show() {
236
  if ( null === $this->object_id ) {
237
- $this->set_object_id( $this->get_current_object_id() );
238
  }
239
  $saved = $this->is_saved();
240
 
@@ -280,8 +280,8 @@ class RW_Meta_Box {
280
  }
281
  $this->saved = true;
282
 
283
- $object_id = $this->get_real_object_id( $object_id );
284
- $this->set_object_id( $object_id );
285
 
286
  // Before save action.
287
  do_action( 'rwmb_before_save_post', $object_id );
234
  */
235
  public function show() {
236
  if ( null === $this->object_id ) {
237
+ $this->object_id = $this->get_current_object_id();
238
  }
239
  $saved = $this->is_saved();
240
 
280
  }
281
  $this->saved = true;
282
 
283
+ $object_id = $this->get_real_object_id( $object_id );
284
+ $this->object_id = $object_id;
285
 
286
  // Before save action.
287
  do_action( 'rwmb_before_save_post', $object_id );
inc/update/settings.php CHANGED
@@ -107,7 +107,6 @@ class RWMB_Update_Settings {
107
  <tr>
108
  <th scope="row"><?php esc_html_e( 'License Key', 'meta-box' ); ?></th>
109
  <td>
110
- <input required class="regular-text" name="meta_box_updater[api_key]" value="<?php echo esc_attr( $this->option->get( 'api_key' ) ); ?>" type="password">
111
  <?php
112
  $messages = array(
113
  // Translators: %1$s - URL to the pricing page.
@@ -119,10 +118,12 @@ class RWMB_Update_Settings {
119
  'active' => __( 'Your license key is <b>active</b>.', 'meta-box' ),
120
  );
121
  $status = $this->option->get_license_status();
122
- if ( isset( $messages[ $status ] ) ) {
123
- echo '<p class="description">', wp_kses_post( sprintf( $messages[ $status ], 'https://metabox.io/pricing/', 'https://metabox.io/my-account/' ) ), '</p>';
124
- }
125
  ?>
 
 
 
 
126
  </td>
127
  </tr>
128
  </table>
107
  <tr>
108
  <th scope="row"><?php esc_html_e( 'License Key', 'meta-box' ); ?></th>
109
  <td>
 
110
  <?php
111
  $messages = array(
112
  // Translators: %1$s - URL to the pricing page.
118
  'active' => __( 'Your license key is <b>active</b>.', 'meta-box' ),
119
  );
120
  $status = $this->option->get_license_status();
121
+ $api_key = in_array( $status, array( 'expired', 'active' ), true ) ? '********************************' : $this->option->get( 'api_key' );
 
 
122
  ?>
123
+ <input required class="regular-text" name="meta_box_updater[api_key]" value="<?php echo esc_attr( $api_key ); ?>" type="password">
124
+ <?php if ( isset( $messages[ $status ] ) ) : ?>
125
+ <p class="description"><?php echo wp_kses_post( sprintf( $messages[ $status ], 'https://metabox.io/pricing/', 'https://metabox.io/my-account/' ) ); ?></p>
126
+ <?php endif; ?>
127
  </td>
128
  </tr>
129
  </table>
js/date.js CHANGED
@@ -17,6 +17,11 @@
17
  options.onSelect = function() {
18
  $this.trigger( 'change' );
19
  }
 
 
 
 
 
20
 
21
  if ( $timestamp.length ) {
22
  options.onClose = options.onSelect = function () {
17
  options.onSelect = function() {
18
  $this.trigger( 'change' );
19
  }
20
+ options.beforeShow = function( i ) {
21
+ if ( $( i ).prop( 'readonly' ) ) {
22
+ return false;
23
+ }
24
+ }
25
 
26
  if ( $timestamp.length ) {
27
  options.onClose = options.onSelect = function () {
js/datetime.js CHANGED
@@ -17,6 +17,11 @@
17
  options.onSelect = function() {
18
  $this.trigger( 'change' );
19
  }
 
 
 
 
 
20
 
21
  if ( $timestamp.length ) {
22
  options.onClose = options.onSelect = function () {
17
  options.onSelect = function() {
18
  $this.trigger( 'change' );
19
  }
20
+ options.beforeShow = function( i ) {
21
+ if ( $( i ).prop( 'readonly' ) ) {
22
+ return false;
23
+ }
24
+ }
25
 
26
  if ( $timestamp.length ) {
27
  options.onClose = options.onSelect = function () {
js/select-advanced.js CHANGED
@@ -81,6 +81,7 @@
81
  'user' : 'rwmb_get_users'
82
  };
83
  params.data.action = actions[ params.data.field.type ];
 
84
 
85
  return $.ajax( params ).then( function ( data ) {
86
  cache[key] = data;
81
  'user' : 'rwmb_get_users'
82
  };
83
  params.data.action = actions[ params.data.field.type ];
84
+ params.method = 'POST';
85
 
86
  return $.ajax( params ).then( function ( data ) {
87
  cache[key] = data;
js/time.js CHANGED
@@ -15,6 +15,11 @@
15
  options.onSelect = function() {
16
  $this.trigger( 'change' );
17
  }
 
 
 
 
 
18
 
19
  if ( ! $inline.length ) {
20
  $this.removeClass( 'hasDatepicker' ).timepicker( options );
15
  options.onSelect = function() {
16
  $this.trigger( 'change' );
17
  }
18
+ options.beforeShow = function( i ) {
19
+ if ( $( i ).prop( 'readonly' ) ) {
20
+ return false;
21
+ }
22
+ }
23
 
24
  if ( ! $inline.length ) {
25
  $this.removeClass( 'hasDatepicker' ).timepicker( options );
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.2.2
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.2.3
7
  * Author: MetaBox.io
8
  * Author URI: https://metabox.io
9
  * License: GPL2+
readme.txt CHANGED
@@ -4,8 +4,8 @@ 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
  Requires PHP: 5.3
7
- Tested up to: 5.2.3
8
- Stable tag: 5.2.2
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 WordPress.
@@ -167,6 +167,21 @@ To getting started with the plugin, please read the [Quick Start Guide](https://
167
 
168
  == Changelog ==
169
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  = 5.2.2 - 2019-10-09 =
171
 
172
  **Fixed**
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
  Requires PHP: 5.3
7
+ Tested up to: 5.2.4
8
+ Stable tag: 5.2.3
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 WordPress.
167
 
168
  == Changelog ==
169
 
170
+ = 5.2.3 - 2019-11-01 =
171
+
172
+ **Changed**
173
+
174
+ - Set clone=false if max_clone=1
175
+ - Shows only images in the selection popup for image field
176
+ - Hide license key
177
+
178
+ **Fixed**
179
+
180
+ - Fixed parsed terms in taxonomy advanced for MB Blocks
181
+ - Don't show date picker for readonly fields
182
+ - Fix warning when output empty background field value
183
+ - Fix empty meta value when save_field=false
184
+
185
  = 5.2.2 - 2019-10-09 =
186
 
187
  **Fixed**