Meta Box - Version 4.3.8

Version Description

  • Bug fix: compatibility with PHP 5.2
Download this release

Release Info

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

Code changes from version 4.3.7 to 4.3.8

Files changed (5) hide show
  1. inc/common.php +0 -16
  2. inc/field.php +6 -5
  3. inc/meta-box.php +7 -12
  4. meta-box.php +2 -2
  5. readme.txt +4 -1
inc/common.php CHANGED
@@ -39,19 +39,3 @@ if ( !class_exists( 'RWMB_Common' ) )
39
 
40
  RWMB_Common::on_load();
41
  }
42
-
43
- if ( !function_exists( 'get_called_class' ) )
44
- {
45
- /**
46
- * Get called class, used for PHP version < 5.3 only
47
- * @return bool|string
48
- */
49
- function get_called_class()
50
- {
51
- $t = debug_backtrace();
52
- $t = $t[0];
53
- if ( isset( $t['object'] ) && $t['object'] instanceof $t['class'] )
54
- return get_class( $t['object'] );
55
- return false;
56
- }
57
- }
39
 
40
  RWMB_Common::on_load();
41
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/field.php CHANGED
@@ -29,13 +29,14 @@ if ( !class_exists( 'RWMB_Field ' ) )
29
  {
30
  global $post;
31
 
32
- $meta = call_user_func( array( get_called_class(), 'meta' ), $post->ID, $saved, $field );
 
33
 
34
  $group = ''; // Empty the clone-group field
35
  $type = $field['type'];
36
  $id = $field['id'];
37
 
38
- $begin = call_user_func( array( get_called_class(), 'begin_html' ), $meta, $field );
39
 
40
  // Apply filter to field begin HTML
41
  // 1st filter applies to all fields
@@ -68,7 +69,7 @@ if ( !class_exists( 'RWMB_Field ' ) )
68
  $input_html = '<div class="rwmb-clone">';
69
 
70
  // Call separated methods for displaying each type of field
71
- $input_html .= call_user_func( array( get_called_class(), 'html' ), $sub_meta, $sub_field );
72
 
73
  // Apply filter to field HTML
74
  // 1st filter applies to all fields with the same type
@@ -88,7 +89,7 @@ if ( !class_exists( 'RWMB_Field ' ) )
88
  else
89
  {
90
  // Call separated methods for displaying each type of field
91
- $field_html = call_user_func( array( get_called_class(), 'html' ), $meta, $field );
92
 
93
  // Apply filter to field HTML
94
  // 1st filter applies to all fields with the same type
@@ -97,7 +98,7 @@ if ( !class_exists( 'RWMB_Field ' ) )
97
  $field_html = apply_filters( "rwmb_{$id}_html", $field_html, $field, $meta );
98
  }
99
 
100
- $end = call_user_func( array( get_called_class(), 'end_html' ), $meta, $field );
101
 
102
  // Apply filter to field end HTML
103
  // 1st filter applies to all fields
29
  {
30
  global $post;
31
 
32
+ $field_class = RW_Meta_Box::get_class_name( $field );
33
+ $meta = call_user_func( array( $field_class, 'meta' ), $post->ID, $saved, $field );
34
 
35
  $group = ''; // Empty the clone-group field
36
  $type = $field['type'];
37
  $id = $field['id'];
38
 
39
+ $begin = call_user_func( array( $field_class, 'begin_html' ), $meta, $field );
40
 
41
  // Apply filter to field begin HTML
42
  // 1st filter applies to all fields
69
  $input_html = '<div class="rwmb-clone">';
70
 
71
  // Call separated methods for displaying each type of field
72
+ $input_html .= call_user_func( array( $field_class, 'html' ), $sub_meta, $sub_field );
73
 
74
  // Apply filter to field HTML
75
  // 1st filter applies to all fields with the same type
89
  else
90
  {
91
  // Call separated methods for displaying each type of field
92
+ $field_html = call_user_func( array( $field_class, 'html' ), $meta, $field );
93
 
94
  // Apply filter to field HTML
95
  // 1st filter applies to all fields with the same type
98
  $field_html = apply_filters( "rwmb_{$id}_html", $field_html, $field, $meta );
99
  }
100
 
101
+ $end = call_user_func( array( $field_class, 'end_html' ), $meta, $field );
102
 
103
  // Apply filter to field end HTML
104
  // 1st filter applies to all fields
inc/meta-box.php CHANGED
@@ -394,20 +394,15 @@ if ( ! class_exists( 'RW_Meta_Box' ) )
394
  */
395
  static function get_class_name( $field )
396
  {
 
 
397
 
398
- // Convert underscores to whitespace so ucwords works as expected. Otherwise: plupload_image -> Plupload_image instead of Plupload_Image
399
- $_type = str_replace( '_', ' ', $field['type'] );
400
 
401
- // Uppercase first words
402
- $class = 'RWMB_' . ucwords( $_type ) . '_Field';
403
-
404
- // Relace whitespace with underscores
405
- $class = str_replace( ' ', '_', $class );
406
-
407
- if ( class_exists( $class ) )
408
- return $class;
409
-
410
- return false;
411
  }
412
 
413
  /**
394
  */
395
  static function get_class_name( $field )
396
  {
397
+ // Convert underscores to whitespace so ucwords works as expected. Otherwise: plupload_image -> Plupload_image instead of Plupload_Image
398
+ $type = str_replace( '_', ' ', $field['type'] );
399
 
400
+ // Uppercase first words
401
+ $class = 'RWMB_' . ucwords( $type ) . '_Field';
402
 
403
+ // Relace whitespace with underscores
404
+ $class = str_replace( ' ', '_', $class );
405
+ return class_exists( $class ) ? $class : false;
 
 
 
 
 
 
 
406
  }
407
 
408
  /**
meta-box.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Meta Box
4
  Plugin URI: http://www.deluxeblogtips.com/meta-box
5
  Description: Create meta box for editing pages in WordPress. Compatible with custom post types since WP 3.0
6
- Version: 4.3.7
7
  Author: Rilwis
8
  Author URI: http://www.deluxeblogtips.com
9
  License: GPL2+
@@ -13,7 +13,7 @@ License: GPL2+
13
  defined( 'ABSPATH' ) || exit;
14
 
15
  // Script version, used to add version for scripts and styles
16
- define( 'RWMB_VER', '4.3.7' );
17
 
18
  // Define plugin URLs, for fast enqueuing scripts and styles
19
  if ( ! defined( 'RWMB_URL' ) )
3
  Plugin Name: Meta Box
4
  Plugin URI: http://www.deluxeblogtips.com/meta-box
5
  Description: Create meta box for editing pages in WordPress. Compatible with custom post types since WP 3.0
6
+ Version: 4.3.8
7
  Author: Rilwis
8
  Author URI: http://www.deluxeblogtips.com
9
  License: GPL2+
13
  defined( 'ABSPATH' ) || exit;
14
 
15
  // Script version, used to add version for scripts and styles
16
+ define( 'RWMB_VER', '4.3.8' );
17
 
18
  // Define plugin URLs, for fast enqueuing scripts and styles
19
  if ( ! defined( 'RWMB_URL' ) )
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.deluxeblogtips.com/donate
4
  Tags: meta-box, custom-fields, custom-field, meta, meta-boxes
5
  Requires at least: 3.5
6
  Tested up to: 3.8
7
- Stable tag: 4.3.7
8
 
9
  Meta Box plugin helps you easily implement multiple meta boxes in editing pages in WordPress. Works with custom post types and various field types.
10
 
@@ -58,6 +58,9 @@ To getting started with the plugin API, please read [this tutorial](http://www.d
58
 
59
  == Changelog ==
60
 
 
 
 
61
  = 4.3.7 =
62
  * Bug fix: use WP_Query instead of `query_posts` to be compatible with WPML
63
  * Bug fix: `get_called_class` function in PHP < 5.3
4
  Tags: meta-box, custom-fields, custom-field, meta, meta-boxes
5
  Requires at least: 3.5
6
  Tested up to: 3.8
7
+ Stable tag: 4.3.8
8
 
9
  Meta Box plugin helps you easily implement multiple meta boxes in editing pages in WordPress. Works with custom post types and various field types.
10
 
58
 
59
  == Changelog ==
60
 
61
+ = 4.3.8 =
62
+ * Bug fix: compatibility with PHP 5.2
63
+
64
  = 4.3.7 =
65
  * Bug fix: use WP_Query instead of `query_posts` to be compatible with WPML
66
  * Bug fix: `get_called_class` function in PHP < 5.3