Meta Box - Version 4.9.3

Version Description

  • Fix: Quick fix saving datetime field
Download this release

Release Info

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

Code changes from version 4.9.2 to 4.9.3

inc/field.php CHANGED
@@ -303,6 +303,9 @@ abstract class RWMB_Field
303
  'attributes' => array(),
304
  ) );
305
 
 
 
 
306
  return $field;
307
  }
308
 
@@ -319,7 +322,7 @@ abstract class RWMB_Field
319
  $attributes = wp_parse_args( $field['attributes'], array(
320
  'disabled' => $field['disabled'],
321
  'required' => $field['required'],
322
- 'class' => "rwmb-{$field['type']}",
323
  'id' => $field['id'],
324
  'name' => $field['field_name'],
325
  ) );
303
  'attributes' => array(),
304
  ) );
305
 
306
+ $classes = array_merge( (array) $field['class'], array( "rwmb-{$field['type']}" ) );
307
+ $field['class'] = implode( ' ', $classes );
308
+
309
  return $field;
310
  }
311
 
322
  $attributes = wp_parse_args( $field['attributes'], array(
323
  'disabled' => $field['disabled'],
324
  'required' => $field['required'],
325
+ 'class' => $field['class'],
326
  'id' => $field['id'],
327
  'name' => $field['field_name'],
328
  ) );
inc/fields/datetime.php CHANGED
@@ -127,7 +127,7 @@ class RWMB_Datetime_Field extends RWMB_Text_Field
127
  */
128
  public static function value( $new, $old, $post_id, $field )
129
  {
130
- return isset( $new['timestamp'] ) ? $new['timestamp'] : $new;
131
  }
132
 
133
  /**
127
  */
128
  public static function value( $new, $old, $post_id, $field )
129
  {
130
+ return $field['timestamp'] ? $new['timestamp'] : $new;
131
  }
132
 
133
  /**
inc/fields/media.php CHANGED
@@ -141,20 +141,6 @@ class RWMB_Media_Field extends RWMB_File_Field
141
  return $extensions;
142
  }
143
 
144
- /**
145
- * Save meta value
146
- *
147
- * @param $new
148
- * @param $old
149
- * @param $post_id
150
- * @param $field
151
- */
152
- public static function save( $new, $old, $post_id, $field )
153
- {
154
- delete_post_meta( $post_id, $field['id'] );
155
- parent::save( $new, array(), $post_id, $field );
156
- }
157
-
158
  /**
159
  * Get meta values to save
160
  *
@@ -167,10 +153,22 @@ class RWMB_Media_Field extends RWMB_File_Field
167
  */
168
  public static function value( $new, $old, $post_id, $field )
169
  {
170
- if ( - 1 === intval( $new ) )
171
- return $old;
 
172
 
173
- return $new;
 
 
 
 
 
 
 
 
 
 
 
174
  }
175
 
176
  /**
141
  return $extensions;
142
  }
143
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  /**
145
  * Get meta values to save
146
  *
153
  */
154
  public static function value( $new, $old, $post_id, $field )
155
  {
156
+ array_walk( $new, 'absint' );
157
+ return array_filter( array_unique( $new ) );
158
+ }
159
 
160
+ /**
161
+ * Save meta value
162
+ *
163
+ * @param $new
164
+ * @param $old
165
+ * @param $post_id
166
+ * @param $field
167
+ */
168
+ public static function save( $new, $old, $post_id, $field )
169
+ {
170
+ delete_post_meta( $post_id, $field['id'] );
171
+ parent::save( $new, array(), $post_id, $field );
172
  }
173
 
174
  /**
inc/loader.php CHANGED
@@ -18,7 +18,7 @@ class RWMB_Loader
18
  protected function constants()
19
  {
20
  // Script version, used to add version for scripts and styles
21
- define( 'RWMB_VER', '4.9.2' );
22
 
23
  list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
24
 
@@ -42,8 +42,8 @@ class RWMB_Loader
42
  public static function get_path( $path = '' )
43
  {
44
  // Plugin base path
45
- $path = wp_normalize_path( untrailingslashit( $path ) );
46
- $content_dir = wp_normalize_path( untrailingslashit( WP_CONTENT_DIR ) );
47
 
48
  // Default URL
49
  $url = plugins_url( '', $path . '/' . basename( $path ) . '.php' );
@@ -52,11 +52,11 @@ class RWMB_Loader
52
  if (
53
  0 !== strpos( $path, wp_normalize_path( WP_PLUGIN_DIR ) )
54
  && 0 !== strpos( $path, wp_normalize_path( WPMU_PLUGIN_DIR ) )
55
- && 0 === strpos( $path, $content_dir )
56
  )
57
  {
58
- $content_url = untrailingslashit( dirname( dirname( get_stylesheet_directory_uri() ) ) );
59
- $url = str_replace( $content_dir, $content_url, $path );
60
  }
61
 
62
  $path = trailingslashit( $path );
18
  protected function constants()
19
  {
20
  // Script version, used to add version for scripts and styles
21
+ define( 'RWMB_VER', '4.9.3' );
22
 
23
  list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
24
 
42
  public static function get_path( $path = '' )
43
  {
44
  // Plugin base path
45
+ $path = wp_normalize_path( untrailingslashit( $path ) );
46
+ $themes_dir = wp_normalize_path( untrailingslashit( dirname( realpath( get_stylesheet_directory() ) ) ) );
47
 
48
  // Default URL
49
  $url = plugins_url( '', $path . '/' . basename( $path ) . '.php' );
52
  if (
53
  0 !== strpos( $path, wp_normalize_path( WP_PLUGIN_DIR ) )
54
  && 0 !== strpos( $path, wp_normalize_path( WPMU_PLUGIN_DIR ) )
55
+ && 0 === strpos( $path, $themes_dir )
56
  )
57
  {
58
+ $themes_url = untrailingslashit( dirname( get_stylesheet_directory_uri() ) );
59
+ $url = str_replace( $themes_dir, $themes_url, $path );
60
  }
61
 
62
  $path = trailingslashit( $path );
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 for any post type in WordPress.
6
- * Version: 4.9.2
7
  * Author: Rilwis
8
  * Author URI: http://www.deluxeblogtips.com
9
  * License: GPL2+
@@ -13,7 +13,7 @@
13
 
14
  if ( defined( 'ABSPATH' ) && ! defined( 'RWMB_VER' ) )
15
  {
16
- require_once plugin_dir_path( __FILE__ ) . 'inc/loader.php';
17
  $loader = new RWMB_Loader;
18
  $loader->init();
19
  }
3
  * Plugin Name: Meta Box
4
  * Plugin URI: https://metabox.io
5
  * Description: Create custom meta boxes and custom fields for any post type in WordPress.
6
+ * Version: 4.9.3
7
  * Author: Rilwis
8
  * Author URI: http://www.deluxeblogtips.com
9
  * License: GPL2+
13
 
14
  if ( defined( 'ABSPATH' ) && ! defined( 'RWMB_VER' ) )
15
  {
16
+ require_once dirname( __FILE__ ) . '/inc/loader.php';
17
  $loader = new RWMB_Loader;
18
  $loader->init();
19
  }
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Meta Box ===
2
  Contributors: metabox, rilwis, fitwp, f-j-kaiser, funkatronic, PerWiklander, ruanmer, Omnicia
3
- Donate link: http://www.deluxeblogtips.com/donate
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.1
6
  Tested up to: 4.6.1
7
- Stable tag: 4.9.2
8
  License: GPLv2 or later
9
 
10
  Meta Box plugin is a powerful, professional solution to create custom meta boxes and custom fields for WordPress websites.
@@ -80,6 +80,9 @@ To getting started with the plugin API, please read [this tutorial](https://meta
80
 
81
  == Changelog ==
82
 
 
 
 
83
  = 4.9.2 =
84
  * Fix: Quick fix validation
85
 
1
  === Meta Box ===
2
  Contributors: metabox, rilwis, fitwp, f-j-kaiser, funkatronic, PerWiklander, ruanmer, Omnicia
3
+ Donate link: http://paypal.me/anhtnt
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.1
6
  Tested up to: 4.6.1
7
+ Stable tag: 4.9.3
8
  License: GPLv2 or later
9
 
10
  Meta Box plugin is a powerful, professional solution to create custom meta boxes and custom fields for WordPress websites.
80
 
81
  == Changelog ==
82
 
83
+ = 4.9.3 =
84
+ * Fix: Quick fix saving datetime field
85
+
86
  = 4.9.2 =
87
  * Fix: Quick fix validation
88