Meta Box - Version 4.2.4

Version Description

  • Bug fix: path to Select2 JS and CSS. Link
  • Bug fix: taxonomy.js loading
  • Bug fix: saving in quick mode edit
  • Improvement: add before and after attributes to fields that can be used to display custom text
  • Improvement: add Arabic and Spanish languages
  • Improvement: add rwmb*_before_save_post and rwmb*_before_save_post actions before and after save post
  • Improvement: add autocomplete for geo location in map field, add fancy animation to drop marker
  • Improvemnet: add url field
Download this release

Release Info

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

Code changes from version 4.2.3 to 4.2.4

demo/all-custom-post-types.php CHANGED
@@ -1,38 +1,38 @@
1
- <?php
2
-
3
- // This file shows a demo for register meta boxes for ALL custom post types
4
-
5
- add_action( 'admin_init', 'YOUR_PREFIX_register_meta_boxes' );
6
-
7
- function YOUR_PREFIX_register_meta_boxes()
8
- {
9
- if ( ! class_exists( 'RW_Meta_Box' ) )
10
- return;
11
-
12
- $prefix = 'YOUR_PREFIX_';
13
- $meta_boxes = array();
14
-
15
- $post_types = get_post_types();
16
-
17
- // 1st meta box
18
- $meta_boxes[] = array(
19
- 'id' => 'personal',
20
- 'title' => 'Personal Information',
21
- 'pages' => $post_types,
22
-
23
- 'fields' => array(
24
- array(
25
- 'name' => 'Full name',
26
- 'id' => $prefix . 'fname',
27
- 'type' => 'text',
28
- ),
29
- // Other fields go here
30
- )
31
- );
32
- // Other meta boxes go here
33
-
34
- foreach ( $meta_boxes as $meta_box )
35
- {
36
- new RW_Meta_Box( $meta_box );
37
- }
38
  }
1
+ <?php
2
+
3
+ // This file shows a demo for register meta boxes for ALL custom post types
4
+
5
+ add_action( 'admin_init', 'YOUR_PREFIX_register_meta_boxes' );
6
+
7
+ function YOUR_PREFIX_register_meta_boxes()
8
+ {
9
+ if ( ! class_exists( 'RW_Meta_Box' ) )
10
+ return;
11
+
12
+ $prefix = 'YOUR_PREFIX_';
13
+ $meta_boxes = array();
14
+
15
+ $post_types = get_post_types();
16
+
17
+ // 1st meta box
18
+ $meta_boxes[] = array(
19
+ 'id' => 'personal',
20
+ 'title' => 'Personal Information',
21
+ 'pages' => $post_types,
22
+
23
+ 'fields' => array(
24
+ array(
25
+ 'name' => 'Full name',
26
+ 'id' => $prefix . 'fname',
27
+ 'type' => 'text',
28
+ ),
29
+ // Other fields go here
30
+ )
31
+ );
32
+ // Other meta boxes go here
33
+
34
+ foreach ( $meta_boxes as $meta_box )
35
+ {
36
+ new RW_Meta_Box( $meta_box );
37
+ }
38
  }
demo/better-include.php CHANGED
@@ -1,119 +1,119 @@
1
- <?php
2
- /**
3
- * This file show you an improvement of better include meta box in some pages
4
- * based on post ID, post slug, page template and page parent
5
- *
6
- * @author Charlie Rosenbury <charlie@40digits.com>
7
- */
8
-
9
- $prefix = 'rw_';
10
-
11
- global $meta_boxes;
12
-
13
- $meta_boxes = array();
14
-
15
- $meta_boxes[] = array(
16
- 'title' => 'Meta Box Title',
17
- 'fields' => array(
18
- array(
19
- 'name' => 'Your images',
20
- 'id' => "{$prefix}img",
21
- 'type' => 'plupload_image',
22
- ),
23
- ),
24
- 'only_on' => array(
25
- 'id' => array( 1, 2 ),
26
- // 'slug' => array( 'news', 'blog' ),
27
- 'template' => array( 'fullwidth.php', 'simple.php' ),
28
- 'parent' => array( 10 )
29
- ),
30
- );
31
-
32
- /**
33
- * Register meta boxes
34
- *
35
- * @return void
36
- */
37
- function rw_register_meta_boxes()
38
- {
39
- global $meta_boxes;
40
-
41
- // Make sure there's no errors when the plugin is deactivated or during upgrade
42
- if ( class_exists( 'RW_Meta_Box' ) ) {
43
- foreach ( $meta_boxes as $meta_box ) {
44
- if ( isset( $meta_box['only_on'] ) && ! rw_maybe_include( $meta_box['only_on'] ) ) {
45
- continue;
46
- }
47
-
48
- new RW_Meta_Box( $meta_box );
49
- }
50
- }
51
- }
52
-
53
- add_action( 'admin_init', 'rw_register_meta_boxes' );
54
-
55
- /**
56
- * Check if meta boxes is included
57
- *
58
- * @return bool
59
- */
60
- function rw_maybe_include( $conditions ) {
61
- // Include in back-end only
62
- if ( ! defined( 'WP_ADMIN' ) || ! WP_ADMIN ) {
63
- return false;
64
- }
65
-
66
- // Always include for ajax
67
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
68
- return true;
69
- }
70
-
71
- if ( isset( $_GET['post'] ) ) {
72
- $post_id = $_GET['post'];
73
- }
74
- elseif ( isset( $_POST['post_ID'] ) ) {
75
- $post_id = $_POST['post_ID'];
76
- }
77
- else {
78
- $post_id = false;
79
- }
80
-
81
- $post_id = (int) $post_id;
82
- $post = get_post( $post_id );
83
-
84
- foreach ( $conditions as $cond => $v ) {
85
- // Catch non-arrays too
86
- if ( ! is_array( $v ) ) {
87
- $v = array( $v );
88
- }
89
-
90
- switch ( $cond ) {
91
- case 'id':
92
- if ( in_array( $post_id, $v ) ) {
93
- return true;
94
- }
95
- break;
96
- case 'parent':
97
- $post_parent = $post->post_parent;
98
- if ( in_array( $post_parent, $v ) ) {
99
- return true;
100
- }
101
- break;
102
- case 'slug':
103
- $post_slug = $post->post_name;
104
- if ( in_array( $post_slug, $v ) ) {
105
- return true;
106
- }
107
- break;
108
- case 'template':
109
- $template = get_post_meta( $post_id, '_wp_page_template', true );
110
- if ( in_array( $template, $v ) ) {
111
- return true;
112
- }
113
- break;
114
- }
115
- }
116
-
117
- // If no condition matched
118
- return false;
119
  }
1
+ <?php
2
+ /**
3
+ * This file show you an improvement of better include meta box in some pages
4
+ * based on post ID, post slug, page template and page parent
5
+ *
6
+ * @author Charlie Rosenbury <charlie@40digits.com>
7
+ */
8
+
9
+ $prefix = 'rw_';
10
+
11
+ global $meta_boxes;
12
+
13
+ $meta_boxes = array();
14
+
15
+ $meta_boxes[] = array(
16
+ 'title' => 'Meta Box Title',
17
+ 'fields' => array(
18
+ array(
19
+ 'name' => 'Your images',
20
+ 'id' => "{$prefix}img",
21
+ 'type' => 'plupload_image',
22
+ ),
23
+ ),
24
+ 'only_on' => array(
25
+ 'id' => array( 1, 2 ),
26
+ // 'slug' => array( 'news', 'blog' ),
27
+ 'template' => array( 'fullwidth.php', 'simple.php' ),
28
+ 'parent' => array( 10 )
29
+ ),
30
+ );
31
+
32
+ /**
33
+ * Register meta boxes
34
+ *
35
+ * @return void
36
+ */
37
+ function rw_register_meta_boxes()
38
+ {
39
+ global $meta_boxes;
40
+
41
+ // Make sure there's no errors when the plugin is deactivated or during upgrade
42
+ if ( class_exists( 'RW_Meta_Box' ) ) {
43
+ foreach ( $meta_boxes as $meta_box ) {
44
+ if ( isset( $meta_box['only_on'] ) && ! rw_maybe_include( $meta_box['only_on'] ) ) {
45
+ continue;
46
+ }
47
+
48
+ new RW_Meta_Box( $meta_box );
49
+ }
50
+ }
51
+ }
52
+
53
+ add_action( 'admin_init', 'rw_register_meta_boxes' );
54
+
55
+ /**
56
+ * Check if meta boxes is included
57
+ *
58
+ * @return bool
59
+ */
60
+ function rw_maybe_include( $conditions ) {
61
+ // Include in back-end only
62
+ if ( ! defined( 'WP_ADMIN' ) || ! WP_ADMIN ) {
63
+ return false;
64
+ }
65
+
66
+ // Always include for ajax
67
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
68
+ return true;
69
+ }
70
+
71
+ if ( isset( $_GET['post'] ) ) {
72
+ $post_id = $_GET['post'];
73
+ }
74
+ elseif ( isset( $_POST['post_ID'] ) ) {
75
+ $post_id = $_POST['post_ID'];
76
+ }
77
+ else {
78
+ $post_id = false;
79
+ }
80
+
81
+ $post_id = (int) $post_id;
82
+ $post = get_post( $post_id );
83
+
84
+ foreach ( $conditions as $cond => $v ) {
85
+ // Catch non-arrays too
86
+ if ( ! is_array( $v ) ) {
87
+ $v = array( $v );
88
+ }
89
+
90
+ switch ( $cond ) {
91
+ case 'id':
92
+ if ( in_array( $post_id, $v ) ) {
93
+ return true;
94
+ }
95
+ break;
96
+ case 'parent':
97
+ $post_parent = $post->post_parent;
98
+ if ( in_array( $post_parent, $v ) ) {
99
+ return true;
100
+ }
101
+ break;
102
+ case 'slug':
103
+ $post_slug = $post->post_name;
104
+ if ( in_array( $post_slug, $v ) ) {
105
+ return true;
106
+ }
107
+ break;
108
+ case 'template':
109
+ $template = get_post_meta( $post_id, '_wp_page_template', true );
110
+ if ( in_array( $template, $v ) ) {
111
+ return true;
112
+ }
113
+ break;
114
+ }
115
+ }
116
+
117
+ // If no condition matched
118
+ return false;
119
  }
demo/include-by-ID-or-page-template.php CHANGED
@@ -1,85 +1,85 @@
1
- <?php
2
- $prefix = 'rw_';
3
-
4
- global $meta_boxes;
5
- $meta_boxes = array();
6
- $meta_boxes[] = array(
7
- 'id' => 'any_id',
8
- 'title' => 'Meta Box Title',
9
- 'pages' => array( 'post' ),
10
- 'fields' => array(
11
-
12
- // IMAGE UPLOAD
13
- array(
14
- 'name' => 'Your images',
15
- 'id' => "{$prefix}img",
16
- 'type' => 'plupload_image',
17
- ),
18
- ),
19
- );
20
-
21
- /**
22
- * Register meta boxes
23
- *
24
- * @return void
25
- */
26
- function rw_register_meta_boxes()
27
- {
28
- global $meta_boxes;
29
-
30
- // Make sure there's no errors when the plugin is deactivated or during upgrade
31
- if ( ! class_exists( 'RW_Meta_Box' ) )
32
- return;
33
-
34
- // Register meta boxes only for some posts/pages
35
- if ( ! rw_maybe_include() )
36
- return;
37
-
38
- foreach ( $meta_boxes as $meta_box )
39
- {
40
- new RW_Meta_Box( $meta_box );
41
- }
42
- }
43
-
44
- add_action( 'admin_init', 'rw_register_meta_boxes' );
45
-
46
- /**
47
- * Check if meta boxes is included
48
- *
49
- * @return bool
50
- */
51
- function rw_maybe_include()
52
- {
53
- // Include in back-end only
54
- if ( ! defined( 'WP_ADMIN' ) || ! WP_ADMIN )
55
- return false;
56
-
57
- // Always include for ajax
58
- if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
59
- return true;
60
-
61
- // Check for post IDs
62
- $checked_post_IDs = array( 61, 63, 65, 67, 2 );
63
-
64
- if ( isset( $_GET['post'] ) )
65
- $post_id = $_GET['post'];
66
- elseif ( isset( $_POST['post_ID'] ) )
67
- $post_id = $_POST['post_ID'];
68
- else
69
- $post_id = false;
70
-
71
- $post_id = (int) $post_id;
72
-
73
- if ( in_array( $post_id, $checked_post_IDs ) )
74
- return true;
75
-
76
- // Check for page template
77
- $checked_templates = array( 'full-width.php', 'sidebar-page.php' );
78
-
79
- $template = get_post_meta( $post_id, '_wp_page_template', true );
80
- if ( in_array( $template, $checked_templates ) )
81
- return true;
82
-
83
- // If no condition matched
84
- return false;
85
- }
1
+ <?php
2
+ $prefix = 'rw_';
3
+
4
+ global $meta_boxes;
5
+ $meta_boxes = array();
6
+ $meta_boxes[] = array(
7
+ 'id' => 'any_id',
8
+ 'title' => 'Meta Box Title',
9
+ 'pages' => array( 'post' ),
10
+ 'fields' => array(
11
+
12
+ // IMAGE UPLOAD
13
+ array(
14
+ 'name' => 'Your images',
15
+ 'id' => "{$prefix}img",
16
+ 'type' => 'plupload_image',
17
+ ),
18
+ ),
19
+ );
20
+
21
+ /**
22
+ * Register meta boxes
23
+ *
24
+ * @return void
25
+ */
26
+ function rw_register_meta_boxes()
27
+ {
28
+ global $meta_boxes;
29
+
30
+ // Make sure there's no errors when the plugin is deactivated or during upgrade
31
+ if ( ! class_exists( 'RW_Meta_Box' ) )
32
+ return;
33
+
34
+ // Register meta boxes only for some posts/pages
35
+ if ( ! rw_maybe_include() )
36
+ return;
37
+
38
+ foreach ( $meta_boxes as $meta_box )
39
+ {
40
+ new RW_Meta_Box( $meta_box );
41
+ }
42
+ }
43
+
44
+ add_action( 'admin_init', 'rw_register_meta_boxes' );
45
+
46
+ /**
47
+ * Check if meta boxes is included
48
+ *
49
+ * @return bool
50
+ */
51
+ function rw_maybe_include()
52
+ {
53
+ // Include in back-end only
54
+ if ( ! defined( 'WP_ADMIN' ) || ! WP_ADMIN )
55
+ return false;
56
+
57
+ // Always include for ajax
58
+ if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
59
+ return true;
60
+
61
+ // Check for post IDs
62
+ $checked_post_IDs = array( 61, 63, 65, 67, 2 );
63
+
64
+ if ( isset( $_GET['post'] ) )
65
+ $post_id = $_GET['post'];
66
+ elseif ( isset( $_POST['post_ID'] ) )
67
+ $post_id = $_POST['post_ID'];
68
+ else
69
+ $post_id = false;
70
+
71
+ $post_id = (int) $post_id;
72
+
73
+ if ( in_array( $post_id, $checked_post_IDs ) )
74
+ return true;
75
+
76
+ // Check for page template
77
+ $checked_templates = array( 'full-width.php', 'sidebar-page.php' );
78
+
79
+ $template = get_post_meta( $post_id, '_wp_page_template', true );
80
+ if ( in_array( $template, $checked_templates ) )
81
+ return true;
82
+
83
+ // If no condition matched
84
+ return false;
85
+ }
inc/classes/meta-box.php CHANGED
@@ -1,650 +1,669 @@
1
- <?php
2
- // Prevent loading this file directly
3
- defined( 'ABSPATH' ) || exit;
4
-
5
- // Meta Box Class
6
- if ( ! class_exists( 'RW_Meta_Box' ) )
7
- {
8
- /**
9
- * A class to rapid develop meta boxes for custom & built in content types
10
- * Piggybacks on WordPress
11
- *
12
- * @author Rilwis
13
- * @author Co-Authors @see https://github.com/rilwis/meta-box
14
- * @license GNU GPL2+
15
- * @package RW Meta Box
16
- */
17
- class RW_Meta_Box
18
- {
19
- /**
20
- * Meta box information
21
- */
22
- var $meta_box;
23
-
24
- /**
25
- * Fields information
26
- */
27
- var $fields;
28
-
29
- /**
30
- * Contains all field types of current meta box
31
- */
32
- var $types;
33
-
34
- /**
35
- * Validation information
36
- */
37
- var $validation;
38
-
39
- /**
40
- * Create meta box based on given data
41
- *
42
- * @see demo/demo.php file for details
43
- *
44
- * @param array $meta_box Meta box definition
45
- *
46
- * @return \RW_Meta_Box
47
- */
48
- function __construct( $meta_box )
49
- {
50
- // Run script only in admin area
51
- if ( ! is_admin() )
52
- return;
53
-
54
- // Assign meta box values to local variables and add it's missed values
55
- $this->meta_box = self::normalize( $meta_box );
56
- $this->fields = &$this->meta_box['fields'];
57
- $this->validation = &$this->meta_box['validation'];
58
-
59
- // Enqueue common styles and scripts
60
- add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
61
-
62
- // Add additional actions for fields
63
- foreach ( $this->fields as $field )
64
- {
65
- $class = self::get_class_name( $field );
66
-
67
- if ( method_exists( $class, 'add_actions' ) )
68
- call_user_func( array( $class, 'add_actions' ) );
69
- }
70
-
71
- // Add meta box
72
- foreach ( $this->meta_box['pages'] as $page )
73
- {
74
- add_action( "add_meta_boxes_{$page}", array( $this, 'add_meta_boxes' ) );
75
- }
76
-
77
- // Save post meta
78
- add_action( 'save_post', array( $this, 'save_post' ) );
79
- }
80
-
81
- /**
82
- * Enqueue common styles
83
- *
84
- * @return void
85
- */
86
- function admin_enqueue_scripts()
87
- {
88
- $screen = get_current_screen();
89
-
90
- // Enqueue scripts and styles for registered pages (post types) only
91
- if ( 'post' != $screen->base || ! in_array( $screen->post_type, $this->meta_box['pages'] ) )
92
- return;
93
-
94
- wp_enqueue_style( 'rwmb', RWMB_CSS_URL . 'style.css', array(), RWMB_VER );
95
-
96
- // Load clone script conditionally
97
- $has_clone = false;
98
- foreach ( $this->fields as $field )
99
- {
100
- if ( $field['clone'] )
101
- $has_clone = true;
102
-
103
- // Enqueue scripts and styles for fields
104
- $class = self::get_class_name( $field );
105
- if ( method_exists( $class, 'admin_enqueue_scripts' ) )
106
- call_user_func( array( $class, 'admin_enqueue_scripts' ) );
107
- }
108
-
109
- if ( $has_clone )
110
- wp_enqueue_script( 'rwmb-clone', RWMB_JS_URL . 'clone.js', array( 'jquery' ), RWMB_VER, true );
111
-
112
- if ( $this->validation )
113
- {
114
- wp_enqueue_script( 'jquery-validate', RWMB_JS_URL . 'jquery.validate.min.js', array( 'jquery' ), RWMB_VER, true );
115
- wp_enqueue_script( 'rwmb-validate', RWMB_JS_URL . 'validate.js', array( 'jquery-validate' ), RWMB_VER, true );
116
- }
117
- }
118
-
119
- /**************************************************
120
- SHOW META BOX
121
- **************************************************/
122
-
123
- /**
124
- * Add meta box for multiple post types
125
- *
126
- * @return void
127
- */
128
- function add_meta_boxes()
129
- {
130
- foreach ( $this->meta_box['pages'] as $page )
131
- {
132
- // Allow users to show/hide meta boxes
133
- // 1st action applies to all meta boxes
134
- // 2nd action applies to only current meta box
135
- $show = true;
136
- $show = apply_filters( 'rwmb_show', $show, $this->meta_box );
137
- $show = apply_filters( "rwmb_show_{$this->meta_box['id']}", $show, $this->meta_box );
138
- if ( !$show )
139
- continue;
140
-
141
- add_meta_box(
142
- $this->meta_box['id'],
143
- $this->meta_box['title'],
144
- array( $this, 'show' ),
145
- $page,
146
- $this->meta_box['context'],
147
- $this->meta_box['priority']
148
- );
149
- }
150
- }
151
-
152
- /**
153
- * Callback function to show fields in meta box
154
- *
155
- * @return void
156
- */
157
- public function show()
158
- {
159
- global $post;
160
-
161
- $saved = self::has_been_saved( $post->ID, $this->fields );
162
-
163
- wp_nonce_field( "rwmb-save-{$this->meta_box['id']}", "nonce_{$this->meta_box['id']}" );
164
-
165
- // Allow users to add custom code before meta box content
166
- // 1st action applies to all meta boxes
167
- // 2nd action applies to only current meta box
168
- do_action( 'rwmb_before' );
169
- do_action( "rwmb_before_{$this->meta_box['id']}" );
170
-
171
- foreach ( $this->fields as $field )
172
- {
173
- $group = ''; // Empty the clone-group field
174
- $type = $field['type'];
175
- $id = $field['id'];
176
- $meta = self::apply_field_class_filters( $field, 'meta', '', $post->ID, $saved );
177
- $meta = apply_filters( "rwmb_{$type}_meta", $meta );
178
- $meta = apply_filters( "rwmb_{$id}_meta", $meta );
179
-
180
- $begin = self::apply_field_class_filters( $field, 'begin_html', '', $meta );
181
-
182
- // Apply filter to field begin HTML
183
- // 1st filter applies to all fields
184
- // 2nd filter applies to all fields with the same type
185
- // 3rd filter applies to current field only
186
- $begin = apply_filters( 'rwmb_begin_html', $begin, $field, $meta );
187
- $begin = apply_filters( "rwmb_{$type}_begin_html", $begin, $field, $meta );
188
- $begin = apply_filters( "rwmb_{$id}_begin_html", $begin, $field, $meta );
189
-
190
- // Separate code for cloneable and non-cloneable fields to make easy to maintain
191
-
192
- // Cloneable fields
193
- if ( $field['clone'] )
194
- {
195
- if ( isset( $field['clone-group'] ) )
196
- $group = " clone-group='{$field['clone-group']}'";
197
-
198
- $meta = (array) $meta;
199
-
200
- $field_html = '';
201
-
202
- foreach ( $meta as $index => $meta_data )
203
- {
204
- $sub_field = $field;
205
- $sub_field['field_name'] = $field['field_name'] . "[{$index}]";
206
- if ( $field['multiple'] )
207
- $sub_field['field_name'] .= '[]';
208
-
209
- add_filter( "rwmb_{$id}_html", array( $this, 'add_clone_buttons' ), 10, 3 );
210
-
211
- // Wrap field HTML in a div with class="rwmb-clone" if needed
212
- $input_html = '<div class="rwmb-clone">';
213
-
214
- // Call separated methods for displaying each type of field
215
- $input_html .= self::apply_field_class_filters( $sub_field, 'html', '', $meta_data );
216
-
217
- // Apply filter to field HTML
218
- // 1st filter applies to all fields with the same type
219
- // 2nd filter applies to current field only
220
- $input_html = apply_filters( "rwmb_{$type}_html", $input_html, $field, $meta_data );
221
- $input_html = apply_filters( "rwmb_{$id}_html", $input_html, $field, $meta_data );
222
-
223
- $input_html .= '</div>';
224
-
225
- $field_html .= $input_html;
226
- }
227
- }
228
- // Non-cloneable fields
229
- else
230
- {
231
- // Call separated methods for displaying each type of field
232
- $field_html = self::apply_field_class_filters( $field, 'html', '', $meta );
233
-
234
- // Apply filter to field HTML
235
- // 1st filter applies to all fields with the same type
236
- // 2nd filter applies to current field only
237
- $field_html = apply_filters( "rwmb_{$type}_html", $field_html, $field, $meta );
238
- $field_html = apply_filters( "rwmb_{$id}_html", $field_html, $field, $meta );
239
- }
240
-
241
- $end = self::apply_field_class_filters( $field, 'end_html', '', $meta );
242
-
243
- // Apply filter to field end HTML
244
- // 1st filter applies to all fields
245
- // 2nd filter applies to all fields with the same type
246
- // 3rd filter applies to current field only
247
- $end = apply_filters( 'rwmb_end_html', $end, $field, $meta );
248
- $end = apply_filters( "rwmb_{$type}_end_html", $end, $field, $meta );
249
- $end = apply_filters( "rwmb_{$id}_end_html", $end, $field, $meta );
250
-
251
- // Apply filter to field wrapper
252
- // This allow users to change whole HTML markup of the field wrapper (i.e. table row)
253
- // 1st filter applies to all fields with the same type
254
- // 2nd filter applies to current field only
255
- $html = apply_filters( "rwmb_{$type}_wrapper_html", "{$begin}{$field_html}{$end}", $field, $meta );
256
- $html = apply_filters( "rwmb_{$id}_wrapper_html", $html, $field, $meta );
257
-
258
- // Display label and input in DIV and allow user-defined classes to be appended
259
- $classes = array( 'rwmb-field', "rwmb-{$field['type']}-wrapper" );
260
- if ( 'hidden' === $field['type'] )
261
- $classes[] = 'hidden';
262
- if ( !empty( $field['required'] ) )
263
- $classes[] = 'required';
264
- if ( !empty( $field['class'] ) )
265
- $classes[] = $field['class'];
266
-
267
- printf(
268
- '<div class="%s"%s>%s</div>',
269
- implode( ' ', $classes ),
270
- $group,
271
- $html
272
- );
273
- }
274
-
275
- // Include validation settings for this meta-box
276
- if ( isset( $this->validation ) && $this->validation )
277
- {
278
- echo '
279
- <script type="text/javascript">
280
- if ( typeof rwmb == "undefined" )
281
- {
282
- var rwmb = {
283
- validationOptions : jQuery.parseJSON( \'' . json_encode( $this->validation ) . '\' ),
284
- summaryMessage : "' . __( 'Please correct the errors highlighted below and try again.', 'rwmb' ) . '"
285
- };
286
- }
287
- else
288
- {
289
- var tempOptions = jQuery.parseJSON( \'' . json_encode( $this->validation ) . '\' );
290
- jQuery.extend( true, rwmb.validationOptions, tempOptions );
291
- };
292
- </script>
293
- ';
294
- }
295
-
296
- // Allow users to add custom code after meta box content
297
- // 1st action applies to all meta boxes
298
- // 2nd action applies to only current meta box
299
- do_action( 'rwmb_after' );
300
- do_action( "rwmb_after_{$this->meta_box['id']}" );
301
- }
302
-
303
- /**
304
- * Show begin HTML markup for fields
305
- *
306
- * @param string $html
307
- * @param mixed $meta
308
- * @param array $field
309
- *
310
- * @return string
311
- */
312
- static function begin_html( $html, $meta, $field )
313
- {
314
- if ( empty( $field['name'] ) )
315
- return '<div class="rwmb-input">';
316
-
317
- return sprintf(
318
- '<div class="rwmb-label">
319
- <label for="%s">%s</label>
320
- </div>
321
- <div class="rwmb-input">',
322
- $field['id'],
323
- $field['name']
324
- );
325
- }
326
-
327
- /**
328
- * Show end HTML markup for fields
329
- *
330
- * @param string $html
331
- * @param mixed $meta
332
- * @param array $field
333
- *
334
- * @return string
335
- */
336
- static function end_html( $html, $meta, $field )
337
- {
338
- $id = $field['id'];
339
-
340
- $button = '';
341
- if ( $field['clone'] )
342
- $button = '<a href="#" class="rwmb-button button-primary add-clone">' . __( '+', 'rwmb' ) . '</a>';
343
-
344
- $desc = ! empty( $field['desc'] ) ? "<p id='{$id}_description' class='description'>{$field['desc']}</p>" : '';
345
-
346
- // Closes the container
347
- $html = "{$button}{$desc}</div>";
348
-
349
- return $html;
350
- }
351
-
352
- /**
353
- * Callback function to add clone buttons on demand
354
- * Hooks on the flight into the "rwmb_{$field_id}_html" filter before the closing div
355
- *
356
- * @param string $html
357
- * @param array $field
358
- * @param mixed $meta_data
359
- *
360
- * @return string $html
361
- */
362
- static function add_clone_buttons( $html, $field, $meta_data )
363
- {
364
- $button = '<a href="#" class="rwmb-button button remove-clone">' . __( '&#8211;', 'rwmb' ) . '</a>';
365
-
366
- return "{$html}{$button}";
367
- }
368
-
369
- /**
370
- * Standard meta retrieval
371
- *
372
- * @param mixed $meta
373
- * @param int $post_id
374
- * @param array $field
375
- * @param bool $saved
376
- *
377
- * @return mixed
378
- */
379
- static function meta( $meta, $post_id, $saved, $field )
380
- {
381
- $meta = get_post_meta( $post_id, $field['id'], !$field['multiple'] );
382
-
383
- // Use $field['std'] only when the meta box hasn't been saved (i.e. the first time we run)
384
- $meta = ( !$saved && '' === $meta || array() === $meta ) ? $field['std'] : $meta;
385
-
386
- // Escape attributes for non-wysiwyg fields
387
- if ( 'wysiwyg' !== $field['type'] )
388
- $meta = is_array( $meta ) ? array_map( 'esc_attr', $meta ) : esc_attr( $meta );
389
-
390
- return $meta;
391
- }
392
-
393
- /**************************************************
394
- SAVE META BOX
395
- **************************************************/
396
-
397
- /**
398
- * Save data from meta box
399
- *
400
- * @param int $post_id Post ID
401
- *
402
- * @return int|void
403
- */
404
- function save_post( $post_id )
405
- {
406
- // Get proper post type. @link http://www.deluxeblogtips.com/forums/viewtopic.php?id=161
407
- $post_type = null;
408
- $post = get_post( $post_id );
409
-
410
- if ( $post )
411
- $post_type = $post->post_type;
412
- elseif ( isset( $_POST['post_type'] ) && post_type_exists( $_POST['post_type'] ) )
413
- $post_type = $_POST['post_type'];
414
-
415
- $post_type_object = get_post_type_object( $post_type );
416
-
417
- // Check whether:
418
- // - the post is autosaved
419
- // - the post is a revision
420
- // - current post type is supported
421
- // - user has proper capability
422
- if (
423
- ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
424
- || ( ! isset( $_POST['post_ID'] ) || $post_id != $_POST['post_ID'] )
425
- || ( ! in_array( $post_type, $this->meta_box['pages'] ) )
426
- || ( ! current_user_can( $post_type_object->cap->edit_post, $post_id ) )
427
- )
428
- {
429
- return $post_id;
430
- }
431
-
432
- // Verify nonce
433
- check_admin_referer( "rwmb-save-{$this->meta_box['id']}", "nonce_{$this->meta_box['id']}" );
434
-
435
- foreach ( $this->fields as $field )
436
- {
437
- $name = $field['id'];
438
- $old = get_post_meta( $post_id, $name, !$field['multiple'] );
439
- $new = isset( $_POST[$name] ) ? $_POST[$name] : ( $field['multiple'] ? array() : '' );
440
-
441
- // Allow field class change the value
442
- $new = self::apply_field_class_filters( $field, 'value', $new, $old, $post_id );
443
-
444
- // Use filter to change field value
445
- // 1st filter applies to all fields with the same type
446
- // 2nd filter applies to current field only
447
- $new = apply_filters( "rwmb_{$field['type']}_value", $new, $field, $old );
448
- $new = apply_filters( "rwmb_{$name}_value", $new, $field, $old );
449
-
450
- // Call defined method to save meta value, if there's no methods, call common one
451
- self::do_field_class_actions( $field, 'save', $new, $old, $post_id );
452
- }
453
- }
454
-
455
- /**
456
- * Common functions for saving field
457
- *
458
- * @param mixed $new
459
- * @param mixed $old
460
- * @param int $post_id
461
- * @param array $field
462
- *
463
- * @return void
464
- */
465
- static function save( $new, $old, $post_id, $field )
466
- {
467
- $name = $field['id'];
468
-
469
- if ( '' === $new || array() === $new )
470
- {
471
- delete_post_meta( $post_id, $name );
472
- return;
473
- }
474
-
475
- if ( $field['multiple'] )
476
- {
477
- foreach ( $new as $new_value )
478
- {
479
- if ( !in_array( $new_value, $old ) )
480
- add_post_meta( $post_id, $name, $new_value, false );
481
- }
482
- foreach ( $old as $old_value )
483
- {
484
- if ( !in_array( $old_value, $new ) )
485
- delete_post_meta( $post_id, $name, $old_value );
486
- }
487
- }
488
- else
489
- {
490
- update_post_meta( $post_id, $name, $new );
491
- }
492
- }
493
-
494
- /**************************************************
495
- HELPER FUNCTIONS
496
- **************************************************/
497
-
498
- /**
499
- * Normalize parameters for meta box
500
- *
501
- * @param array $meta_box Meta box definition
502
- *
503
- * @return array $meta_box Normalized meta box
504
- */
505
- static function normalize( $meta_box )
506
- {
507
- // Set default values for meta box
508
- $meta_box = wp_parse_args( $meta_box, array(
509
- 'id' => sanitize_title( $meta_box['title'] ),
510
- 'context' => 'normal',
511
- 'priority' => 'high',
512
- 'pages' => array( 'post' )
513
- ) );
514
-
515
- // Set default values for fields
516
- foreach ( $meta_box['fields'] as &$field )
517
- {
518
- $field = wp_parse_args( $field, array(
519
- 'multiple' => false,
520
- 'clone' => false,
521
- 'std' => '',
522
- 'desc' => '',
523
- 'format' => '',
524
- ) );
525
-
526
- // Allow field class add/change default field values
527
- $field = self::apply_field_class_filters( $field, 'normalize_field', $field );
528
-
529
- // Allow field class to manually change field_name
530
- // @see taxonomy.php for example
531
- if ( ! isset( $field['field_name'] ) )
532
- $field['field_name'] = $field['id'];
533
- }
534
-
535
- return $meta_box;
536
- }
537
-
538
- /**
539
- * Get field class name
540
- *
541
- * @param array $field Field array
542
- *
543
- * @return bool|string Field class name OR false on failure
544
- */
545
- static function get_class_name( $field )
546
- {
547
- $type = ucwords( $field['type'] );
548
- $class = "RWMB_{$type}_Field";
549
-
550
- if ( class_exists( $class ) )
551
- return $class;
552
-
553
- return false;
554
- }
555
-
556
- /**
557
- * Apply filters by field class, fallback to RW_Meta_Box method
558
- *
559
- * @param array $field
560
- * @param string $method_name
561
- * @param mixed $value
562
- *
563
- * @return mixed $value
564
- */
565
- static function apply_field_class_filters( $field, $method_name, $value )
566
- {
567
- $args = array_slice( func_get_args(), 2 );
568
- $args[] = $field;
569
-
570
- // Call: field class method
571
- // Fallback: RW_Meta_Box method
572
- $class = self::get_class_name( $field );
573
- if ( method_exists( $class, $method_name ) )
574
- {
575
- $value = call_user_func_array( array( $class, $method_name ), $args );
576
- }
577
- elseif ( method_exists( __CLASS__, $method_name ) )
578
- {
579
- $value = call_user_func_array( array( __CLASS__, $method_name ), $args );
580
- }
581
-
582
- return $value;
583
- }
584
-
585
- /**
586
- * Call field class method for actions, fallback to RW_Meta_Box method
587
- *
588
- * @param array $field
589
- * @param string $method_name
590
- *
591
- * @return mixed
592
- */
593
- static function do_field_class_actions( $field, $method_name )
594
- {
595
- $args = array_slice( func_get_args(), 2 );
596
- $args[] = $field;
597
-
598
- // Call: field class method
599
- // Fallback: RW_Meta_Box method
600
- $class = self::get_class_name( $field );
601
- if ( method_exists( $class, $method_name ) )
602
- {
603
- call_user_func_array( array( $class, $method_name ), $args );
604
- }
605
- elseif ( method_exists( __CLASS__, $method_name ) )
606
- {
607
- call_user_func_array( array( __CLASS__, $method_name ), $args );
608
- }
609
- }
610
-
611
- /**
612
- * Format Ajax response
613
- *
614
- * @param string $message
615
- * @param string $status
616
- *
617
- * @return void
618
- */
619
- static function ajax_response( $message, $status )
620
- {
621
- $response = array( 'what' => 'meta-box' );
622
- $response['data'] = 'error' === $status ? new WP_Error( 'error', $message ) : $message;
623
- $x = new WP_Ajax_Response( $response );
624
- $x->send();
625
- }
626
-
627
- /**
628
- * Check if meta box has been saved
629
- * This helps saving empty value in meta fields (for text box, check box, etc.)
630
- *
631
- * @param int $post_id
632
- * @param array $fields
633
- *
634
- * @return bool
635
- */
636
- static function has_been_saved( $post_id, $fields )
637
- {
638
- $saved = false;
639
- foreach ( $fields as $field )
640
- {
641
- if ( get_post_meta( $post_id, $field['id'], !$field['multiple'] ) )
642
- {
643
- $saved = true;
644
- break;
645
- }
646
- }
647
- return $saved;
648
- }
649
- }
650
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ // Meta Box Class
6
+ if ( ! class_exists( 'RW_Meta_Box' ) )
7
+ {
8
+ /**
9
+ * A class to rapid develop meta boxes for custom & built in content types
10
+ * Piggybacks on WordPress
11
+ *
12
+ * @author Rilwis
13
+ * @author Co-Authors @see https://github.com/rilwis/meta-box
14
+ * @license GNU GPL2+
15
+ * @package RW Meta Box
16
+ */
17
+ class RW_Meta_Box
18
+ {
19
+ /**
20
+ * Meta box information
21
+ */
22
+ var $meta_box;
23
+
24
+ /**
25
+ * Fields information
26
+ */
27
+ var $fields;
28
+
29
+ /**
30
+ * Contains all field types of current meta box
31
+ */
32
+ var $types;
33
+
34
+ /**
35
+ * Validation information
36
+ */
37
+ var $validation;
38
+
39
+ /**
40
+ * Create meta box based on given data
41
+ *
42
+ * @see demo/demo.php file for details
43
+ *
44
+ * @param array $meta_box Meta box definition
45
+ *
46
+ * @return \RW_Meta_Box
47
+ */
48
+ function __construct( $meta_box )
49
+ {
50
+ // Run script only in admin area
51
+ if ( ! is_admin() )
52
+ return;
53
+
54
+ // Assign meta box values to local variables and add it's missed values
55
+ $this->meta_box = self::normalize( $meta_box );
56
+ $this->fields = &$this->meta_box['fields'];
57
+ $this->validation = &$this->meta_box['validation'];
58
+
59
+ // Enqueue common styles and scripts
60
+ add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
61
+
62
+ // Add additional actions for fields
63
+ foreach ( $this->fields as $field )
64
+ {
65
+ $class = self::get_class_name( $field );
66
+
67
+ if ( method_exists( $class, 'add_actions' ) )
68
+ call_user_func( array( $class, 'add_actions' ) );
69
+ }
70
+
71
+ // Add meta box
72
+ foreach ( $this->meta_box['pages'] as $page )
73
+ {
74
+ add_action( "add_meta_boxes_{$page}", array( $this, 'add_meta_boxes' ) );
75
+ }
76
+
77
+ // Save post meta
78
+ add_action( 'save_post', array( $this, 'save_post' ) );
79
+ }
80
+
81
+ /**
82
+ * Enqueue common styles
83
+ *
84
+ * @return void
85
+ */
86
+ function admin_enqueue_scripts()
87
+ {
88
+ $screen = get_current_screen();
89
+
90
+ // Enqueue scripts and styles for registered pages (post types) only
91
+ if ( 'post' != $screen->base || ! in_array( $screen->post_type, $this->meta_box['pages'] ) )
92
+ return;
93
+
94
+ wp_enqueue_style( 'rwmb', RWMB_CSS_URL . 'style.css', array(), RWMB_VER );
95
+
96
+ // Load clone script conditionally
97
+ $has_clone = false;
98
+ foreach ( $this->fields as $field )
99
+ {
100
+ if ( $field['clone'] )
101
+ $has_clone = true;
102
+
103
+ // Enqueue scripts and styles for fields
104
+ $class = self::get_class_name( $field );
105
+ if ( method_exists( $class, 'admin_enqueue_scripts' ) )
106
+ call_user_func( array( $class, 'admin_enqueue_scripts' ) );
107
+ }
108
+
109
+ if ( $has_clone )
110
+ wp_enqueue_script( 'rwmb-clone', RWMB_JS_URL . 'clone.js', array( 'jquery' ), RWMB_VER, true );
111
+
112
+ if ( $this->validation )
113
+ {
114
+ wp_enqueue_script( 'jquery-validate', RWMB_JS_URL . 'jquery.validate.min.js', array( 'jquery' ), RWMB_VER, true );
115
+ wp_enqueue_script( 'rwmb-validate', RWMB_JS_URL . 'validate.js', array( 'jquery-validate' ), RWMB_VER, true );
116
+ }
117
+ }
118
+
119
+ /**************************************************
120
+ SHOW META BOX
121
+ **************************************************/
122
+
123
+ /**
124
+ * Add meta box for multiple post types
125
+ *
126
+ * @return void
127
+ */
128
+ function add_meta_boxes()
129
+ {
130
+ foreach ( $this->meta_box['pages'] as $page )
131
+ {
132
+ // Allow users to show/hide meta boxes
133
+ // 1st action applies to all meta boxes
134
+ // 2nd action applies to only current meta box
135
+ $show = true;
136
+ $show = apply_filters( 'rwmb_show', $show, $this->meta_box );
137
+ $show = apply_filters( "rwmb_show_{$this->meta_box['id']}", $show, $this->meta_box );
138
+ if ( !$show )
139
+ continue;
140
+
141
+ add_meta_box(
142
+ $this->meta_box['id'],
143
+ $this->meta_box['title'],
144
+ array( $this, 'show' ),
145
+ $page,
146
+ $this->meta_box['context'],
147
+ $this->meta_box['priority']
148
+ );
149
+ }
150
+ }
151
+
152
+ /**
153
+ * Callback function to show fields in meta box
154
+ *
155
+ * @return void
156
+ */
157
+ public function show()
158
+ {
159
+ global $post;
160
+
161
+ $saved = self::has_been_saved( $post->ID, $this->fields );
162
+
163
+ wp_nonce_field( "rwmb-save-{$this->meta_box['id']}", "nonce_{$this->meta_box['id']}" );
164
+
165
+ // Allow users to add custom code before meta box content
166
+ // 1st action applies to all meta boxes
167
+ // 2nd action applies to only current meta box
168
+ do_action( 'rwmb_before' );
169
+ do_action( "rwmb_before_{$this->meta_box['id']}" );
170
+
171
+ foreach ( $this->fields as $field )
172
+ {
173
+ $group = ''; // Empty the clone-group field
174
+ $type = $field['type'];
175
+ $id = $field['id'];
176
+ $meta = self::apply_field_class_filters( $field, 'meta', '', $post->ID, $saved );
177
+ $meta = apply_filters( "rwmb_{$type}_meta", $meta );
178
+ $meta = apply_filters( "rwmb_{$id}_meta", $meta );
179
+
180
+ $begin = self::apply_field_class_filters( $field, 'begin_html', '', $meta );
181
+
182
+ // Apply filter to field begin HTML
183
+ // 1st filter applies to all fields
184
+ // 2nd filter applies to all fields with the same type
185
+ // 3rd filter applies to current field only
186
+ $begin = apply_filters( 'rwmb_begin_html', $begin, $field, $meta );
187
+ $begin = apply_filters( "rwmb_{$type}_begin_html", $begin, $field, $meta );
188
+ $begin = apply_filters( "rwmb_{$id}_begin_html", $begin, $field, $meta );
189
+
190
+ // Separate code for cloneable and non-cloneable fields to make easy to maintain
191
+
192
+ // Cloneable fields
193
+ if ( $field['clone'] )
194
+ {
195
+ if ( isset( $field['clone-group'] ) )
196
+ $group = " clone-group='{$field['clone-group']}'";
197
+
198
+ $meta = (array) $meta;
199
+
200
+ $field_html = '';
201
+
202
+ foreach ( $meta as $index => $meta_data )
203
+ {
204
+ $sub_field = $field;
205
+ $sub_field['field_name'] = $field['field_name'] . "[{$index}]";
206
+ if ( $field['multiple'] )
207
+ $sub_field['field_name'] .= '[]';
208
+
209
+ add_filter( "rwmb_{$id}_html", array( $this, 'add_clone_buttons' ), 10, 3 );
210
+
211
+ // Wrap field HTML in a div with class="rwmb-clone" if needed
212
+ $input_html = '<div class="rwmb-clone">';
213
+
214
+ // Call separated methods for displaying each type of field
215
+ $input_html .= self::apply_field_class_filters( $sub_field, 'html', '', $meta_data );
216
+
217
+ // Apply filter to field HTML
218
+ // 1st filter applies to all fields with the same type
219
+ // 2nd filter applies to current field only
220
+ $input_html = apply_filters( "rwmb_{$type}_html", $input_html, $field, $meta_data );
221
+ $input_html = apply_filters( "rwmb_{$id}_html", $input_html, $field, $meta_data );
222
+
223
+ $input_html .= '</div>';
224
+
225
+ $field_html .= $input_html;
226
+ }
227
+ }
228
+ // Non-cloneable fields
229
+ else
230
+ {
231
+ // Call separated methods for displaying each type of field
232
+ $field_html = self::apply_field_class_filters( $field, 'html', '', $meta );
233
+
234
+ // Apply filter to field HTML
235
+ // 1st filter applies to all fields with the same type
236
+ // 2nd filter applies to current field only
237
+ $field_html = apply_filters( "rwmb_{$type}_html", $field_html, $field, $meta );
238
+ $field_html = apply_filters( "rwmb_{$id}_html", $field_html, $field, $meta );
239
+ }
240
+
241
+ $end = self::apply_field_class_filters( $field, 'end_html', '', $meta );
242
+
243
+ // Apply filter to field end HTML
244
+ // 1st filter applies to all fields
245
+ // 2nd filter applies to all fields with the same type
246
+ // 3rd filter applies to current field only
247
+ $end = apply_filters( 'rwmb_end_html', $end, $field, $meta );
248
+ $end = apply_filters( "rwmb_{$type}_end_html", $end, $field, $meta );
249
+ $end = apply_filters( "rwmb_{$id}_end_html", $end, $field, $meta );
250
+
251
+ // Apply filter to field wrapper
252
+ // This allow users to change whole HTML markup of the field wrapper (i.e. table row)
253
+ // 1st filter applies to all fields with the same type
254
+ // 2nd filter applies to current field only
255
+ $html = apply_filters( "rwmb_{$type}_wrapper_html", "{$begin}{$field_html}{$end}", $field, $meta );
256
+ $html = apply_filters( "rwmb_{$id}_wrapper_html", $html, $field, $meta );
257
+
258
+ // Display label and input in DIV and allow user-defined classes to be appended
259
+ $classes = array( 'rwmb-field', "rwmb-{$field['type']}-wrapper" );
260
+ if ( 'hidden' === $field['type'] )
261
+ $classes[] = 'hidden';
262
+ if ( !empty( $field['required'] ) )
263
+ $classes[] = 'required';
264
+ if ( !empty( $field['class'] ) )
265
+ $classes[] = $field['class'];
266
+
267
+ printf(
268
+ $field['before'] . '<div class="%s"%s>%s</div>' . $field['after'],
269
+ implode( ' ', $classes ),
270
+ $group,
271
+ $html
272
+ );
273
+ }
274
+
275
+ // Include validation settings for this meta-box
276
+ if ( isset( $this->validation ) && $this->validation )
277
+ {
278
+ echo '
279
+ <script type="text/javascript">
280
+ if ( typeof rwmb == "undefined" )
281
+ {
282
+ var rwmb = {
283
+ validationOptions : jQuery.parseJSON( \'' . json_encode( $this->validation ) . '\' ),
284
+ summaryMessage : "' . __( 'Please correct the errors highlighted below and try again.', 'rwmb' ) . '"
285
+ };
286
+ }
287
+ else
288
+ {
289
+ var tempOptions = jQuery.parseJSON( \'' . json_encode( $this->validation ) . '\' );
290
+ jQuery.extend( true, rwmb.validationOptions, tempOptions );
291
+ };
292
+ </script>
293
+ ';
294
+ }
295
+
296
+ // Allow users to add custom code after meta box content
297
+ // 1st action applies to all meta boxes
298
+ // 2nd action applies to only current meta box
299
+ do_action( 'rwmb_after' );
300
+ do_action( "rwmb_after_{$this->meta_box['id']}" );
301
+ }
302
+
303
+ /**
304
+ * Show begin HTML markup for fields
305
+ *
306
+ * @param string $html
307
+ * @param mixed $meta
308
+ * @param array $field
309
+ *
310
+ * @return string
311
+ */
312
+ static function begin_html( $html, $meta, $field )
313
+ {
314
+ if ( empty( $field['name'] ) )
315
+ return '<div class="rwmb-input">';
316
+
317
+ return sprintf(
318
+ '<div class="rwmb-label">
319
+ <label for="%s">%s</label>
320
+ </div>
321
+ <div class="rwmb-input">',
322
+ $field['id'],
323
+ $field['name']
324
+ );
325
+ }
326
+
327
+ /**
328
+ * Show end HTML markup for fields
329
+ *
330
+ * @param string $html
331
+ * @param mixed $meta
332
+ * @param array $field
333
+ *
334
+ * @return string
335
+ */
336
+ static function end_html( $html, $meta, $field )
337
+ {
338
+ $id = $field['id'];
339
+
340
+ $button = '';
341
+ if ( $field['clone'] )
342
+ $button = '<a href="#" class="rwmb-button button-primary add-clone">' . __( '+', 'rwmb' ) . '</a>';
343
+
344
+ $desc = ! empty( $field['desc'] ) ? "<p id='{$id}_description' class='description'>{$field['desc']}</p>" : '';
345
+
346
+ // Closes the container
347
+ $html = "{$button}{$desc}</div>";
348
+
349
+ return $html;
350
+ }
351
+
352
+ /**
353
+ * Callback function to add clone buttons on demand
354
+ * Hooks on the flight into the "rwmb_{$field_id}_html" filter before the closing div
355
+ *
356
+ * @param string $html
357
+ * @param array $field
358
+ * @param mixed $meta_data
359
+ *
360
+ * @return string $html
361
+ */
362
+ static function add_clone_buttons( $html, $field, $meta_data )
363
+ {
364
+ $button = '<a href="#" class="rwmb-button button remove-clone">' . __( '&#8211;', 'rwmb' ) . '</a>';
365
+
366
+ return "{$html}{$button}";
367
+ }
368
+
369
+ /**
370
+ * Standard meta retrieval
371
+ *
372
+ * @param mixed $meta
373
+ * @param int $post_id
374
+ * @param array $field
375
+ * @param bool $saved
376
+ *
377
+ * @return mixed
378
+ */
379
+ static function meta( $meta, $post_id, $saved, $field )
380
+ {
381
+ $meta = get_post_meta( $post_id, $field['id'], !$field['multiple'] );
382
+
383
+ // Use $field['std'] only when the meta box hasn't been saved (i.e. the first time we run)
384
+ $meta = ( !$saved && '' === $meta || array() === $meta ) ? $field['std'] : $meta;
385
+
386
+ // Escape attributes for non-wysiwyg fields
387
+ if ( 'wysiwyg' !== $field['type'] )
388
+ $meta = is_array( $meta ) ? array_map( 'esc_attr', $meta ) : esc_attr( $meta );
389
+
390
+ return $meta;
391
+ }
392
+
393
+ /**************************************************
394
+ SAVE META BOX
395
+ **************************************************/
396
+
397
+ /**
398
+ * Save data from meta box
399
+ *
400
+ * @param int $post_id Post ID
401
+ *
402
+ * @return void
403
+ */
404
+ function save_post( $post_id )
405
+ {
406
+ // Get proper post type. @link http://www.deluxeblogtips.com/forums/viewtopic.php?id=161
407
+ $post_type = null;
408
+ $post = get_post( $post_id );
409
+
410
+ if ( $post )
411
+ $post_type = $post->post_type;
412
+ elseif ( isset( $_POST['post_type'] ) && post_type_exists( $_POST['post_type'] ) )
413
+ $post_type = $_POST['post_type'];
414
+
415
+ $post_type_object = get_post_type_object( $post_type );
416
+
417
+ // Check whether:
418
+ // - the post is autosaved
419
+ // - the post is a revision
420
+ // - current post type is supported
421
+ // - user has proper capability
422
+ // - in Quick edit mode, @link http://wordpress.org/support/topic/quick-edit-not-working-and-problem-located
423
+ if (
424
+ ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
425
+ || ( ! isset( $_POST['post_ID'] ) || $post_id != $_POST['post_ID'] )
426
+ || ( ! in_array( $post_type, $this->meta_box['pages'] ) )
427
+ || ( ! current_user_can( $post_type_object->cap->edit_post, $post_id ) )
428
+ || ( 'inline-save' == $_POST['action'] )
429
+ )
430
+ {
431
+ return;
432
+ }
433
+
434
+ // Verify nonce
435
+ check_admin_referer( "rwmb-save-{$this->meta_box['id']}", "nonce_{$this->meta_box['id']}" );
436
+
437
+ //Save post action removed to prevent infinite loops
438
+ remove_action( 'save_post', array( $this, 'save_post' ) );
439
+
440
+ //Before save actions
441
+ do_action("rwmb_before_save_post", $post_id);
442
+ do_action("rwmb_{$this->meta_box['id']}_before_save_post", $post_id);
443
+
444
+
445
+ foreach ( $this->fields as $field )
446
+ {
447
+ $name = $field['id'];
448
+ $old = get_post_meta( $post_id, $name, !$field['multiple'] );
449
+ $new = isset( $_POST[$name] ) ? $_POST[$name] : ( $field['multiple'] ? array() : '' );
450
+
451
+ // Allow field class change the value
452
+ $new = self::apply_field_class_filters( $field, 'value', $new, $old, $post_id );
453
+
454
+ // Use filter to change field value
455
+ // 1st filter applies to all fields with the same type
456
+ // 2nd filter applies to current field only
457
+ $new = apply_filters( "rwmb_{$field['type']}_value", $new, $field, $old );
458
+ $new = apply_filters( "rwmb_{$name}_value", $new, $field, $old );
459
+
460
+ // Call defined method to save meta value, if there's no methods, call common one
461
+ self::do_field_class_actions( $field, 'save', $new, $old, $post_id );
462
+ }
463
+
464
+ //After save sctions
465
+ do_action("rwmb_after_save_post", $post_id);
466
+ do_action("rwmb_{$this->meta_box['id']}_after_save_post", $post_id);
467
+
468
+ //Reinstate save_post action
469
+ add_action( 'save_post', array( $this, 'save_post' ) );
470
+ }
471
+
472
+ /**
473
+ * Common functions for saving field
474
+ *
475
+ * @param mixed $new
476
+ * @param mixed $old
477
+ * @param int $post_id
478
+ * @param array $field
479
+ *
480
+ * @return void
481
+ */
482
+ static function save( $new, $old, $post_id, $field )
483
+ {
484
+ $name = $field['id'];
485
+
486
+ if ( '' === $new || array() === $new )
487
+ {
488
+ delete_post_meta( $post_id, $name );
489
+ return;
490
+ }
491
+
492
+ if ( $field['multiple'] )
493
+ {
494
+ foreach ( $new as $new_value )
495
+ {
496
+ if ( !in_array( $new_value, $old ) )
497
+ add_post_meta( $post_id, $name, $new_value, false );
498
+ }
499
+ foreach ( $old as $old_value )
500
+ {
501
+ if ( !in_array( $old_value, $new ) )
502
+ delete_post_meta( $post_id, $name, $old_value );
503
+ }
504
+ }
505
+ else
506
+ {
507
+ update_post_meta( $post_id, $name, $new );
508
+ }
509
+ }
510
+
511
+ /**************************************************
512
+ HELPER FUNCTIONS
513
+ **************************************************/
514
+
515
+ /**
516
+ * Normalize parameters for meta box
517
+ *
518
+ * @param array $meta_box Meta box definition
519
+ *
520
+ * @return array $meta_box Normalized meta box
521
+ */
522
+ static function normalize( $meta_box )
523
+ {
524
+ // Set default values for meta box
525
+ $meta_box = wp_parse_args( $meta_box, array(
526
+ 'id' => sanitize_title( $meta_box['title'] ),
527
+ 'context' => 'normal',
528
+ 'priority' => 'high',
529
+ 'pages' => array( 'post' )
530
+ ) );
531
+
532
+ // Set default values for fields
533
+ foreach ( $meta_box['fields'] as &$field )
534
+ {
535
+ $field = wp_parse_args( $field, array(
536
+ 'multiple' => false,
537
+ 'clone' => false,
538
+ 'std' => '',
539
+ 'desc' => '',
540
+ 'format' => '',
541
+ 'before' => '',
542
+ 'after' => '',
543
+ ) );
544
+
545
+ // Allow field class add/change default field values
546
+ $field = self::apply_field_class_filters( $field, 'normalize_field', $field );
547
+
548
+ // Allow field class to manually change field_name
549
+ // @see taxonomy.php for example
550
+ if ( ! isset( $field['field_name'] ) )
551
+ $field['field_name'] = $field['id'];
552
+ }
553
+
554
+ return $meta_box;
555
+ }
556
+
557
+ /**
558
+ * Get field class name
559
+ *
560
+ * @param array $field Field array
561
+ *
562
+ * @return bool|string Field class name OR false on failure
563
+ */
564
+ static function get_class_name( $field )
565
+ {
566
+ $type = ucwords( $field['type'] );
567
+ $class = "RWMB_{$type}_Field";
568
+
569
+ if ( class_exists( $class ) )
570
+ return $class;
571
+
572
+ return false;
573
+ }
574
+
575
+ /**
576
+ * Apply filters by field class, fallback to RW_Meta_Box method
577
+ *
578
+ * @param array $field
579
+ * @param string $method_name
580
+ * @param mixed $value
581
+ *
582
+ * @return mixed $value
583
+ */
584
+ static function apply_field_class_filters( $field, $method_name, $value )
585
+ {
586
+ $args = array_slice( func_get_args(), 2 );
587
+ $args[] = $field;
588
+
589
+ // Call: field class method
590
+ // Fallback: RW_Meta_Box method
591
+ $class = self::get_class_name( $field );
592
+ if ( method_exists( $class, $method_name ) )
593
+ {
594
+ $value = call_user_func_array( array( $class, $method_name ), $args );
595
+ }
596
+ elseif ( method_exists( __CLASS__, $method_name ) )
597
+ {
598
+ $value = call_user_func_array( array( __CLASS__, $method_name ), $args );
599
+ }
600
+
601
+ return $value;
602
+ }
603
+
604
+ /**
605
+ * Call field class method for actions, fallback to RW_Meta_Box method
606
+ *
607
+ * @param array $field
608
+ * @param string $method_name
609
+ *
610
+ * @return mixed
611
+ */
612
+ static function do_field_class_actions( $field, $method_name )
613
+ {
614
+ $args = array_slice( func_get_args(), 2 );
615
+ $args[] = $field;
616
+
617
+ // Call: field class method
618
+ // Fallback: RW_Meta_Box method
619
+ $class = self::get_class_name( $field );
620
+ if ( method_exists( $class, $method_name ) )
621
+ {
622
+ call_user_func_array( array( $class, $method_name ), $args );
623
+ }
624
+ elseif ( method_exists( __CLASS__, $method_name ) )
625
+ {
626
+ call_user_func_array( array( __CLASS__, $method_name ), $args );
627
+ }
628
+ }
629
+
630
+ /**
631
+ * Format Ajax response
632
+ *
633
+ * @param string $message
634
+ * @param string $status
635
+ *
636
+ * @return void
637
+ */
638
+ static function ajax_response( $message, $status )
639
+ {
640
+ $response = array( 'what' => 'meta-box' );
641
+ $response['data'] = 'error' === $status ? new WP_Error( 'error', $message ) : $message;
642
+ $x = new WP_Ajax_Response( $response );
643
+ $x->send();
644
+ }
645
+
646
+ /**
647
+ * Check if meta box has been saved
648
+ * This helps saving empty value in meta fields (for text box, check box, etc.)
649
+ *
650
+ * @param int $post_id
651
+ * @param array $fields
652
+ *
653
+ * @return bool
654
+ */
655
+ static function has_been_saved( $post_id, $fields )
656
+ {
657
+ $saved = false;
658
+ foreach ( $fields as $field )
659
+ {
660
+ if ( get_post_meta( $post_id, $field['id'], !$field['multiple'] ) )
661
+ {
662
+ $saved = true;
663
+ break;
664
+ }
665
+ }
666
+ return $saved;
667
+ }
668
+ }
669
+ }
inc/fields/file_single.php DELETED
@@ -1,198 +0,0 @@
1
- <?php
2
- // Prevent loading this file directly
3
- defined( 'ABSPATH' ) || exit;
4
-
5
- if ( ! class_exists( 'RWMB_File_Field' ) )
6
- {
7
- class RWMB_File_Field
8
- {
9
- /**
10
- * Enqueue scripts and styles
11
- *
12
- * @return void
13
- */
14
- static function admin_enqueue_scripts()
15
- {
16
- wp_enqueue_script( 'rwmb-file', RWMB_JS_URL . 'file.js', array( 'jquery', 'wp-ajax-response' ), RWMB_VER, true );
17
- }
18
-
19
- /**
20
- * Add actions
21
- *
22
- * @return void
23
- */
24
- static function add_actions()
25
- {
26
- // Add data encoding type for file uploading
27
- add_action( 'post_edit_form_tag', array( __CLASS__, 'post_edit_form_tag' ) );
28
-
29
- // Delete file via Ajax
30
- add_action( 'wp_ajax_rwmb_delete_file', array( __CLASS__, 'wp_ajax_delete_file' ) );
31
- }
32
-
33
- /**
34
- * Add data encoding type for file uploading
35
- *
36
- * @return void
37
- */
38
- static function post_edit_form_tag()
39
- {
40
- echo ' enctype="multipart/form-data"';
41
- }
42
-
43
- /**
44
- * Ajax callback for deleting files.
45
- * Modified from a function used by "Verve Meta Boxes" plugin
46
- *
47
- * @link http://goo.gl/LzYSq
48
- * @return void
49
- */
50
- static function wp_ajax_delete_file()
51
- {
52
- $post_id = isset( $_POST['post_id'] ) ? intval( $_POST['post_id'] ) : 0;
53
- $field_id = isset( $_POST['field_id'] ) ? $_POST['field_id'] : 0;
54
- $attachment_id = isset( $_POST['attachment_id'] ) ? intval( $_POST['attachment_id'] ) : 0;
55
-
56
- check_admin_referer( "rwmb-delete-file_{$field_id}" );
57
-
58
- delete_post_meta( $post_id, $field_id, $attachment_id );
59
- $ok = wp_delete_attachment( $attachment_id );
60
-
61
- if ( $ok )
62
- RW_Meta_Box::ajax_response( '', 'success' );
63
- else
64
- RW_Meta_Box::ajax_response( __( 'Error: Cannot delete file', 'rwmb' ), 'error' );
65
- }
66
-
67
- /**
68
- * Get field HTML
69
- *
70
- * @param string $html
71
- * @param mixed $meta
72
- * @param array $field
73
- *
74
- * @return string
75
- */
76
- static function html( $html, $meta, $field )
77
- {
78
- $i18n_delete = _x( 'Delete', 'file upload', 'rwmb' );
79
-
80
- $html = wp_nonce_field( "rwmb-delete-file_{$field['id']}", "nonce-delete-file_{$field['id']}", false, false );
81
-
82
- if ( $meta )
83
- {
84
- $html .= '<ol class="rwmb-uploaded">';
85
- $li = '<li>%s (<a title="%s" class="rwmb-delete-file" href="#" data-field_id="%s" data-attachment_id="%s">%s</a>)</li>';
86
-
87
- $attachment = wp_get_attachment_link( $meta );
88
- $html .= sprintf(
89
- $li,
90
- $attachment,
91
- $i18n_delete,
92
- $field['id'],
93
- $meta,
94
- $i18n_delete
95
- );
96
-
97
- $html .= '</ol>';
98
- }
99
-
100
- // Show form upload
101
- $html .= sprintf(
102
- '<input type="file" name="%s" />',
103
- $field['field_name']
104
- );
105
-
106
- return $html;
107
- }
108
-
109
- /**
110
- * Get meta values to save
111
- *
112
- * @param mixed $new
113
- * @param mixed $old
114
- * @param int $post_id
115
- * @param array $field
116
- *
117
- * @return array|mixed
118
- */
119
- static function value( $new, $old, $post_id, $field )
120
- {
121
- $name = $field['id'];
122
- if ( empty( $_FILES[$name] ) )
123
- return $new;
124
-
125
- $new = array();
126
- if ( $field['clone'] )
127
- $files = self::fix_file_array( $_FILES[$name] );
128
- else
129
- $files = array( $_FILES[$name] );
130
-
131
- foreach ( $files as $file_item )
132
- {
133
- $file = wp_handle_upload( $file_item, array( 'test_form' => false ) );
134
-
135
- if ( ! isset( $file['file'] ) )
136
- continue;
137
-
138
- $file_name = $file['file'];
139
-
140
- $attachment = array(
141
- 'post_mime_type' => $file['type'],
142
- 'guid' => $file['url'],
143
- 'post_parent' => $post_id,
144
- 'post_title' => preg_replace( '/\.[^.]+$/', '', basename( $file_name ) ),
145
- 'post_content' => '',
146
- );
147
- $id = wp_insert_attachment( $attachment, $file_name, $post_id );
148
-
149
- if ( ! is_wp_error( $id ) )
150
- {
151
- wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file_name ) );
152
-
153
- // Save file ID in meta field
154
- $new[] = $id;
155
- }
156
- }
157
-
158
- return $field['clone'] ? $new : array_shift( $new );
159
- }
160
-
161
- /**
162
- * Fixes the odd indexing of multiple file uploads from the format:
163
- * $_FILES['field']['key']['index']
164
- * To the more standard and appropriate:
165
- * $_FILES['field']['index']['key']
166
- *
167
- * @param array $files
168
- *
169
- * @return array
170
- */
171
- static function fix_file_array( $files )
172
- {
173
- $output = array();
174
- foreach ( $files as $key => $list )
175
- {
176
- foreach ( $list as $index => $value )
177
- {
178
- $output[$index][$key] = $value;
179
- }
180
- }
181
- return $output;
182
- }
183
-
184
- /**
185
- * Normalize parameters for field
186
- *
187
- * @param array $field
188
- *
189
- * @return array
190
- */
191
- // static function normalize_field( $field )
192
- // {
193
- // $field['multiple'] = true;
194
- // $field['std'] = empty( $field['std'] ) ? array() : $field['std'];
195
- // return $field;
196
- // }
197
- }
198
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/fields/map.php CHANGED
@@ -14,7 +14,7 @@ if ( !class_exists( 'RWMB_Map_Field' ) )
14
  static function admin_enqueue_scripts()
15
  {
16
  wp_enqueue_script( 'googlemap', 'http://maps.google.com/maps/api/js?sensor=false', array(), '', true );
17
- wp_enqueue_script( 'rwmb-map', RWMB_JS_URL . 'map.js', array( 'jquery', 'googlemap' ), RWMB_VER, true );
18
  }
19
 
20
  /**
14
  static function admin_enqueue_scripts()
15
  {
16
  wp_enqueue_script( 'googlemap', 'http://maps.google.com/maps/api/js?sensor=false', array(), '', true );
17
+ wp_enqueue_script( 'rwmb-map', RWMB_JS_URL . 'map.js', array( 'jquery', 'jquery-ui-autocomplete', 'googlemap' ), RWMB_VER, true );
18
  }
19
 
20
  /**
inc/fields/number.php CHANGED
@@ -1,46 +1,46 @@
1
- <?php
2
- // Prevent loading this file directly
3
- defined( 'ABSPATH' ) || exit;
4
-
5
- if ( !class_exists( 'RWMB_Number_Field' ) )
6
- {
7
- class RWMB_Number_Field
8
- {
9
- /**
10
- * Get field HTML
11
- *
12
- * @param string $html
13
- * @param mixed $meta
14
- * @param array $field
15
- *
16
- * @return string
17
- */
18
- static function html( $html, $meta, $field )
19
- {
20
- return sprintf(
21
- '<input type="number" class="rwmb-number" name="%s" id="%s" value="%s" step="%s" min="%s" />',
22
- $field['field_name'],
23
- empty( $field['clone'] ) ? $field['id'] : '',
24
- $meta,
25
- $field['step'],
26
- $field['min']
27
- );
28
- }
29
-
30
- /**
31
- * Normalize parameters for field
32
- *
33
- * @param array $field
34
- *
35
- * @return array
36
- */
37
- static function normalize_field( $field )
38
- {
39
- $field = wp_parse_args( $field, array(
40
- 'step' => 1,
41
- 'min' => 0,
42
- ) );
43
- return $field;
44
- }
45
- }
46
  }
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ if ( !class_exists( 'RWMB_Number_Field' ) )
6
+ {
7
+ class RWMB_Number_Field
8
+ {
9
+ /**
10
+ * Get field HTML
11
+ *
12
+ * @param string $html
13
+ * @param mixed $meta
14
+ * @param array $field
15
+ *
16
+ * @return string
17
+ */
18
+ static function html( $html, $meta, $field )
19
+ {
20
+ return sprintf(
21
+ '<input type="number" class="rwmb-number" name="%s" id="%s" value="%s" step="%s" min="%s" />',
22
+ $field['field_name'],
23
+ empty( $field['clone'] ) ? $field['id'] : '',
24
+ $meta,
25
+ $field['step'],
26
+ $field['min']
27
+ );
28
+ }
29
+
30
+ /**
31
+ * Normalize parameters for field
32
+ *
33
+ * @param array $field
34
+ *
35
+ * @return array
36
+ */
37
+ static function normalize_field( $field )
38
+ {
39
+ $field = wp_parse_args( $field, array(
40
+ 'step' => 1,
41
+ 'min' => 0,
42
+ ) );
43
+ return $field;
44
+ }
45
+ }
46
  }
inc/fields/select-advanced.php CHANGED
@@ -1,87 +1,88 @@
1
- <?php
2
- // Prevent loading this file directly
3
- defined( 'ABSPATH' ) || exit;
4
-
5
- // Make sure "select" field is loaded
6
- require_once RWMB_FIELDS_DIR . 'select.php';
7
-
8
- if ( !class_exists( 'RWMB_Select_Advanced_Field' ) )
9
- {
10
- class RWMB_Select_Advanced_Field extends RWMB_Select_Field
11
- {
12
- /**
13
- * Enqueue scripts and styles
14
- *
15
- * @return void
16
- */
17
- static function admin_enqueue_scripts()
18
- {
19
- wp_enqueue_style( 'select2', RWMB_CSS_URL . 'select2/select2.css', array(), '3.2' );
20
- wp_enqueue_style( 'rwmb-select-advanced', RWMB_CSS_URL . 'select-advanced.css', array(), RWMB_VER );
21
-
22
- wp_register_script( 'select2', RWMB_JS_URL . 'select2/select2.min.js', array(), '3.2', true );
23
- wp_enqueue_script( 'rwmb-select-advanced', RWMB_JS_URL . 'select-advanced.js', array( 'select2' ), RWMB_VER, true );
24
- }
25
-
26
- /**
27
- * Get field HTML
28
- *
29
- * @param string $html
30
- * @param mixed $meta
31
- * @param array $field
32
- *
33
- * @return string
34
- */
35
- static function html( $html, $meta, $field )
36
- {
37
- $html = sprintf(
38
- '<select class="rwmb-select-advanced" name="%s" id="%s"%s data-options="%s">',
39
- $field['field_name'],
40
- $field['id'],
41
- $field['multiple'] ? ' multiple="multiple"' : '',
42
- esc_attr( json_encode( $field['js_options'] ) )
43
- );
44
- if ( !empty( $field['js_options']['placeholder'] ) )
45
- $html .= '<option></option>';
46
-
47
- $option = '<option value="%s" %s>%s</option>';
48
-
49
- foreach ( $field['options'] as $value => $label )
50
- {
51
- $html .= sprintf(
52
- $option,
53
- $value,
54
- selected( in_array( $value, $meta ), true, false ),
55
- $label
56
- );
57
- }
58
- $html .= '</select>';
59
-
60
- return $html;
61
- }
62
-
63
- /**
64
- * Normalize parameters for field
65
- *
66
- * @param array $field
67
- *
68
- * @return array
69
- */
70
- static function normalize_field( $field )
71
- {
72
- $field = parent::normalize_field( $field );
73
-
74
- $field = wp_parse_args( $field, array(
75
- 'js_options' => array(),
76
- ) );
77
-
78
- $field['js_options'] = wp_parse_args( $field['js_options'], array(
79
- 'allowClear' => true,
80
- 'width' => 'resolve',
81
- 'placeholder' => __( 'Select a value', 'rwmb' )
82
- ) );
83
-
84
- return $field;
85
- }
86
- }
 
87
  }
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ // Make sure "select" field is loaded
6
+ require_once RWMB_FIELDS_DIR . 'select.php';
7
+
8
+ if ( !class_exists( 'RWMB_Select_Advanced_Field' ) )
9
+ {
10
+ class RWMB_Select_Advanced_Field extends RWMB_Select_Field
11
+ {
12
+ /**
13
+ * Enqueue scripts and styles
14
+ *
15
+ * @return void
16
+ */
17
+ static function admin_enqueue_scripts()
18
+ {
19
+ wp_enqueue_style( 'select2', RWMB_CSS_URL . 'select2/select2.css', array(), '3.2' );
20
+ wp_enqueue_style( 'rwmb-select-advanced', RWMB_CSS_URL . 'select-advanced.css', array(), RWMB_VER );
21
+
22
+ wp_register_script( 'select2', RWMB_JS_URL . 'select2/select2.min.js', array(), '3.2', true );
23
+ wp_enqueue_script( 'rwmb-select-advanced', RWMB_JS_URL . 'select-advanced.js', array( 'select2' ), RWMB_VER, true );
24
+ }
25
+
26
+ /**
27
+ * Get field HTML
28
+ *
29
+ * @param string $html
30
+ * @param mixed $meta
31
+ * @param array $field
32
+ *
33
+ * @return string
34
+ */
35
+ static function html( $html, $meta, $field )
36
+ {
37
+ $html = sprintf(
38
+ '<select class="rwmb-select-advanced" name="%s" id="%s"%s data-options="%s">',
39
+ $field['field_name'],
40
+ $field['id'],
41
+ $field['multiple'] ? ' multiple="multiple"' : '',
42
+ esc_attr( json_encode( $field['js_options'] ) )
43
+ );
44
+ if ( !empty( $field['js_options']['placeholder'] ) )
45
+ $html .= '<option></option>';
46
+
47
+ $option = '<option value="%s" %s>%s</option>';
48
+
49
+ foreach ( $field['options'] as $value => $label )
50
+ {
51
+ $html .= sprintf(
52
+ $option,
53
+ $value,
54
+ selected( in_array( $value, $meta ), true, false ),
55
+ $label
56
+ );
57
+ }
58
+ $html .= '</select>';
59
+
60
+ return $html;
61
+ }
62
+
63
+ /**
64
+ * Normalize parameters for field
65
+ *
66
+ * @param array $field
67
+ *
68
+ * @return array
69
+ */
70
+ static function normalize_field( $field )
71
+ {
72
+ $field = parent::normalize_field( $field );
73
+
74
+
75
+ $field = wp_parse_args( $field, array(
76
+ 'js_options' => array(),
77
+ ) );
78
+
79
+ $field['js_options'] = wp_parse_args( $field['js_options'], array(
80
+ 'allowClear' => true,
81
+ 'width' => 'resolve',
82
+ 'placeholder' => __( 'Select a value', 'rwmb' )
83
+ ) );
84
+
85
+ return $field;
86
+ }
87
+ }
88
  }
inc/fields/select.php CHANGED
@@ -40,7 +40,8 @@ if ( !class_exists( 'RWMB_Select_Field' ) )
40
  $html .= sprintf(
41
  $option,
42
  $value,
43
- selected( in_array( $value, $meta ), true, false ),
 
44
  $label
45
  );
46
  }
40
  $html .= sprintf(
41
  $option,
42
  $value,
43
+ /* selected( in_array( $value, $meta ), true, false ),*/
44
+ selected( in_array( $value, (array)$meta ), true, false ),
45
  $label
46
  );
47
  }
inc/fields/taxonomy.php CHANGED
@@ -1,305 +1,259 @@
1
- <?php
2
- // Prevent loading this file directly
3
- defined( 'ABSPATH' ) || exit;
4
-
5
- if ( ! class_exists( 'RWMB_Taxonomy_Field' ) )
6
- {
7
- class RWMB_Taxonomy_Field
8
- {
9
- /**
10
- * Enqueue scripts and styles
11
- *
12
- * @return void
13
- */
14
- static function admin_enqueue_scripts()
15
- {
16
- wp_enqueue_style( 'select2', RWMB_CSS_URL . 'select2-css/select2.css', array(), '3.2' );
17
- wp_enqueue_style( 'rwmb-select-advanced', RWMB_CSS_URL . 'select-advanced.css', array(), RWMB_VER );
18
- wp_register_script( 'select2', RWMB_JS_URL . 'select2-js/select2.js', array(), '3.2', true );
19
- wp_register_script( 'select_advanced', RWMB_JS_URL . 'select-advanced.js', array('select2'), RWMB_VER, true );
20
- wp_enqueue_style( 'rwmb-taxonomy', RWMB_CSS_URL . 'taxonomy.css', array(), RWMB_VER );
21
- wp_enqueue_script( 'rwmb-taxonomy', RWMB_JS_URL . 'taxonomy.js', array( 'jquery', 'select_advanced', 'wp-ajax-response' ), RWMB_VER, true );
22
- }
23
-
24
- /**
25
- * Add default value for 'taxonomy' field
26
- *
27
- * @param $field
28
- *
29
- * @return array
30
- */
31
- static function normalize_field( $field )
32
- {
33
- $field = wp_parse_args( $field, array(
34
- 'js_options' => array(),
35
- ) );
36
-
37
- $field['js_options'] = wp_parse_args( $field['js_options'], array(
38
- 'allowClear' => true,
39
- 'width' => 'resolve',
40
- 'placeholder' => "Select a Value"
41
- ) );
42
- // Default query arguments for get_terms() function
43
- $default_args = array(
44
- 'hide_empty' => false,
45
- );
46
-
47
- if ( ! isset( $field['options']['args'] ) )
48
- $field['options']['args'] = $default_args;
49
- else
50
- $field['options']['args'] = wp_parse_args( $field['options']['args'], $default_args );
51
-
52
- // Show field as checkbox list by default
53
- if ( ! isset( $field['options']['type'] ) )
54
- $field['options']['type'] = 'checkbox_list';
55
-
56
- // If field is shown as checkbox list, add multiple value
57
- if ( in_array( $field['options']['type'], array( 'checkbox_list', 'checkbox_tree' ) ) )
58
- {
59
- $field['multiple'] = true;
60
- $field['field_name'] = "{$field['id']}[]";
61
- }
62
-
63
- // For select tree: display it as a normal select box (no multiple attribute), but allows to save multiple values
64
- if ( 'select_tree' == $field['options']['type'] || ('select_advanced' == $field['options']['type'] && $field['multiple'] == true) )
65
- $field['field_name'] = "{$field['id']}[]";
66
-
67
- if ( in_array( $field['options']['type'], array( 'checkbox_tree', 'select_tree' ) ) )
68
- {
69
- if ( isset( $field['options']['args']['parent'] ) )
70
- {
71
- $field['options']['parent'] = $field['options']['args']['parent'];
72
- unset( $field['options']['args']['parent'] );
73
- }
74
- else
75
- {
76
- $field['options']['parent'] = 0;
77
- }
78
- }
79
-
80
- return $field;
81
- }
82
-
83
- /**
84
- * Get field HTML
85
- *
86
- * @param $html
87
- * @param $field
88
- * @param $meta
89
- *
90
- * @return string
91
- */
92
- static function html( $html, $meta, $field )
93
- {
94
-
95
- $options = $field['options'];
96
- $terms = get_terms( $options['taxonomy'], $options['args'] );
97
-
98
- $html = '';
99
- // Checkbox LIST
100
- if ( 'checkbox_list' === $options['type'] )
101
- {
102
- $html = array();
103
- $tpl = '<label><input type="checkbox" name="%s" value="%s" %s /> %s</label>';
104
- foreach ( $terms as $term )
105
- {
106
- $html[] = sprintf(
107
- $tpl,
108
- $field['field_name'],
109
- $term->slug,
110
- checked( in_array( $term->slug, $meta ), true, false ),
111
- $term->name
112
- );
113
- }
114
- $html = implode( '<br />', $html );
115
- }
116
- // Checkbox TREE
117
- elseif ( 'checkbox_tree' === $options['type'] )
118
- {
119
- $elements = self::process_terms( $terms );
120
- $html .= self::walk_checkbox_tree( $meta, $field, $elements, $field['options']['parent'], true );
121
- }
122
- // Select TREE
123
- elseif ( 'select_tree' === $options['type'] )
124
- {
125
- $elements = self::process_terms( $terms );
126
- $html .= self::walk_select_tree( $meta, $field, $elements, $field['options']['parent'], '', true );
127
- }
128
- // Select
129
- elseif ( 'select_advanced' === $options['type'] ) {
130
- $html = sprintf(
131
- '<select class="rwmb-select-advanced" name="%s" id="%s"%s data-options ="%s">',
132
- $field['field_name'],
133
- $field['id'],
134
- $field['multiple'] ? ' multiple="multiple"' : '',
135
- esc_attr( json_encode( $field['js_options'] ))
136
- );
137
- $option = '<option value="%s" %s>%s</option>';
138
-
139
- foreach ( $terms as $term )
140
- {
141
- $html .= sprintf(
142
- $option,
143
- $term->slug,
144
- selected( in_array( $term->slug, $meta ), true, false ),
145
- $term->name
146
- );
147
- }
148
- $html .= '</select>';
149
- }
150
- else
151
- {
152
- $multiple = $field['multiple'] ? " multiple='multiple' style='height: auto;'" : '';
153
- $html .= "<select name='{$field['field_name']}'{$multiple}>";
154
- $option = '<option value="%s" %s>%s</option>';
155
- foreach ( $terms as $term )
156
- {
157
- $html .= sprintf(
158
- $option,
159
- $term->slug,
160
- selected( in_array( $term->slug, $meta ), true, false ),
161
- $term->name
162
- );
163
- }
164
- $html .= '</select>';
165
- }
166
-
167
- return $html;
168
- }
169
-
170
- /**
171
- * Walker for displaying checkboxes in treeformat
172
- *
173
- * @param $meta
174
- * @param $field
175
- * @param $elements
176
- * @param int $parent
177
- * @param bool $active
178
- *
179
- * @return string
180
- */
181
- static function walk_checkbox_tree( $meta, $field, $elements, $parent = 0, $active = false )
182
- {
183
- if ( ! isset( $elements[$parent] ) )
184
- return;
185
- $terms = $elements[$parent];
186
- $hidden = ( !$active ? 'hidden' : '' );
187
-
188
- $html = "<ul class = 'rw-taxonomy-tree {$hidden}'>";
189
- $li = '<li><label><input type="checkbox" name="%s" value="%s" %s /> %s</label>';
190
- foreach ( $terms as $term )
191
- {
192
- $html .= sprintf(
193
- $li,
194
- $field['field_name'],
195
- $term->slug,
196
- checked( in_array( $term->slug, $meta ), true, false ),
197
- $term->name
198
- );
199
- $html .= self::walk_checkbox_tree( $meta, $field, $elements, $term->term_id, ( in_array( $term->slug, $meta ) ) && $active ) . '</li>';
200
- }
201
- $html .= '</ul>';
202
-
203
- return $html;
204
- }
205
-
206
- /**
207
- * Walker for displaying select in treeformat
208
- *
209
- * @param $meta
210
- * @param $field
211
- * @param $elements
212
- * @param int $parent
213
- * @param string $parent_slug
214
- * @param bool $active
215
- *
216
- * @return string
217
- */
218
- static function walk_select_tree( $meta, $field, $elements, $parent = 0, $parent_slug = '', $active = false )
219
- {
220
- if ( ! isset( $elements[$parent] ) )
221
- return;
222
- $terms = $elements[$parent];
223
- $hidden = $active ? 'active' : 'disabled';
224
- $disabled = disabled( $active, false, false );
225
- $multiple = $field['multiple'] ? " multiple='multiple' style='height: auto;'" : '';
226
- $id = empty( $parent_slug ) ? '' : " id='rwmb-taxonomy-{$parent_slug}'";
227
-
228
- $html = "<div{$id} class='rw-taxonomy-tree {$hidden}'>";
229
- $html .= "<select name='{$field['field_name']}'{$disabled}{$multiple}>";
230
- $html .= "<option value=''>None</option>";
231
-
232
- $option = '<option value="%s" %s>%s</option>';
233
- foreach ( $terms as $term )
234
- {
235
- $html .= sprintf(
236
- $option,
237
- $term->slug,
238
- selected( in_array( $term->slug, $meta ), true, false ),
239
- $term->name
240
- );
241
- }
242
- $html .= '</select>';
243
- foreach ( $terms as $term )
244
- {
245
- $html .= self::walk_select_tree( $meta, $field, $elements, $term->term_id, $term->slug, in_array( $term->slug, $meta ) && $active ) . '</li>';
246
- }
247
- $html .= '</div>';
248
-
249
- return $html;
250
- }
251
-
252
- /**
253
- * Processes terms into indexed array for walker functions
254
- *
255
- * @param $terms
256
- *
257
- * @internal param $field
258
- * @return array
259
- */
260
- static function process_terms( $terms )
261
- {
262
- $elements = array();
263
- foreach ( $terms as $term )
264
- {
265
- $elements[$term->parent][] = $term;
266
- }
267
- return $elements;
268
- }
269
-
270
- /**
271
- * Save post taxonomy
272
- *
273
- * @param $post_id
274
- * @param $field
275
- * @param $old
276
- *
277
- * @param $new
278
- */
279
- static function save( $new, $old, $post_id, $field )
280
- {
281
- wp_set_object_terms( $post_id, $new, $field['options']['taxonomy'] );
282
- }
283
-
284
- /**
285
- * Standard meta retrieval
286
- *
287
- * @param mixed $meta
288
- * @param int $post_id
289
- * @param array $field
290
- * @param bool $saved
291
- *
292
- * @return mixed
293
- */
294
- static function meta( $meta, $post_id, $saved, $field )
295
- {
296
- $options = $field['options'];
297
-
298
- $meta = wp_get_post_terms( $post_id, $options['taxonomy'] );
299
- $meta = is_array( $meta ) ? $meta : (array) $meta;
300
- $meta = wp_list_pluck( $meta, 'slug' );
301
-
302
- return $meta;
303
- }
304
- }
305
- }
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+ require_once RWMB_FIELDS_DIR . 'select-advanced.php';
5
+ require_once RWMB_FIELDS_DIR . 'checkbox-list.php';
6
+
7
+ if ( ! class_exists( 'RWMB_Taxonomy_Field' ) )
8
+ {
9
+ class RWMB_Taxonomy_Field
10
+ {
11
+ /**
12
+ * Enqueue scripts and styles
13
+ *
14
+ * @return void
15
+ */
16
+ static function admin_enqueue_scripts()
17
+ {
18
+ RWMB_Select_Advanced_Field::admin_enqueue_scripts();
19
+ wp_enqueue_style( 'rwmb-taxonomy', RWMB_CSS_URL . 'taxonomy.css', array(), RWMB_VER );
20
+ wp_enqueue_script( 'rwmb-taxonomy', RWMB_JS_URL . 'taxonomy.js', array( 'jquery', 'rwmb-select-advanced', 'wp-ajax-response' ), RWMB_VER, true );
21
+ }
22
+
23
+ /**
24
+ * Add default value for 'taxonomy' field
25
+ *
26
+ * @param $field
27
+ *
28
+ * @return array
29
+ */
30
+ static function normalize_field( $field )
31
+ {
32
+ $default_args = array(
33
+ 'hide_empty' => false,
34
+ );
35
+
36
+ //Set default args
37
+ $field['options']['args'] = ( ! isset( $field['options']['args'] ) ) ? $default_args : wp_parse_args( $field['options']['args'], $default_args );
38
+
39
+ //Field name be an array by default
40
+ $field['field_name'] = "{$field['id']}[]";
41
+
42
+ switch( $field['options']['type'] )
43
+ {
44
+ case 'select_advanced':
45
+ $field = RWMB_Select_Advanced_Field::normalize_field( $field );
46
+ break;
47
+ case 'checkbox_list':
48
+ case 'checkbox_tree':
49
+ $field = RWMB_Checkbox_List_Field::normalize_field( $field );
50
+ break;
51
+ case 'select':
52
+ case 'select_tree':
53
+ $field = RWMB_Select_Field::normalize_field( $field );
54
+ break;
55
+ default:
56
+ $field['options']['type'] = 'select';
57
+ $field = RWMB_Select_Field::normalize_field( $field );
58
+ }
59
+
60
+ if ( in_array( $field['options']['type'], array( 'checkbox_tree', 'select_tree' ) ) )
61
+ {
62
+ if ( isset( $field['options']['args']['parent'] ) )
63
+ {
64
+ $field['options']['parent'] = $field['options']['args']['parent'];
65
+ unset( $field['options']['args']['parent'] );
66
+ }
67
+ else
68
+ {
69
+ $field['options']['parent'] = 0;
70
+ }
71
+ }
72
+
73
+ return $field;
74
+ }
75
+
76
+ /**
77
+ * Get field HTML
78
+ *
79
+ * @param $html
80
+ * @param $field
81
+ * @param $meta
82
+ *
83
+ * @return string
84
+ */
85
+ static function html( $html, $meta, $field )
86
+ {
87
+
88
+ $options = $field['options'];
89
+ $terms = get_terms( $options['taxonomy'], $options['args'] );
90
+
91
+ $field['options'] = self::get_options( $terms );
92
+
93
+ $html = '';
94
+
95
+ switch( $options['type'] )
96
+ {
97
+ case 'checkbox_list':
98
+ $html = RWMB_Checkbox_List_Field::html( $html, $meta, $field );
99
+ break;
100
+ case 'checkbox_tree':
101
+ $elements = self::process_terms( $terms );
102
+ $html .= self::walk_checkbox_tree( $meta, $field, $elements, $options['parent'], true );
103
+ break;
104
+ case 'select_tree':
105
+ $elements = self::process_terms( $terms );
106
+ $html .= self::walk_select_tree( $meta, $field, $elements, $options['parent'], '', true );
107
+ break;
108
+ case 'select_advanced':
109
+ $html = RWMB_Select_Advanced_Field::html( $html, $meta, $field );
110
+ break;
111
+ case 'select':
112
+ default:
113
+ $html = RWMB_Select_Field::html( $html, $meta, $field );
114
+ }
115
+
116
+ return $html;
117
+ }
118
+
119
+ /**
120
+ * Walker for displaying checkboxes in treeformat
121
+ *
122
+ * @param $meta
123
+ * @param $field
124
+ * @param $elements
125
+ * @param int $parent
126
+ * @param bool $active
127
+ *
128
+ * @return string
129
+ */
130
+ static function walk_checkbox_tree( $meta, $field, $elements, $parent = 0, $active = false )
131
+ {
132
+ if ( ! isset( $elements[$parent] ) )
133
+ return;
134
+ $terms = $elements[$parent];
135
+ $field['options'] = self::get_options( $terms );
136
+ $hidden = ( !$active ? 'hidden' : '' );
137
+
138
+ $html = "<ul class = 'rw-taxonomy-tree {$hidden}'>";
139
+ $li = '<li><label><input type="checkbox" name="%s" value="%s" %s /> %s</label>';
140
+ foreach ( $terms as $term )
141
+ {
142
+ $html .= sprintf(
143
+ $li,
144
+ $field['field_name'],
145
+ $term->slug,
146
+ checked( in_array( $term->slug, $meta ), true, false ),
147
+ $term->name
148
+ );
149
+ $html .= self::walk_checkbox_tree( $meta, $field, $elements, $term->term_id, ( in_array( $term->slug, $meta ) ) && $active ) . '</li>';
150
+ }
151
+ $html .= '</ul>';
152
+
153
+ return $html;
154
+ }
155
+
156
+ /**
157
+ * Walker for displaying select in treeformat
158
+ *
159
+ * @param $meta
160
+ * @param $field
161
+ * @param $elements
162
+ * @param int $parent
163
+ * @param string $parent_slug
164
+ * @param bool $active
165
+ *
166
+ * @return string
167
+ */
168
+ static function walk_select_tree( $meta, $field, $elements, $parent = 0, $parent_slug = '', $active = false )
169
+ {
170
+ if ( ! isset( $elements[$parent] ) )
171
+ return;
172
+ $terms = $elements[$parent];
173
+ $field['options'] = self::get_options( $terms );
174
+ $hidden = $active ? 'active' : 'disabled';
175
+ $disabled = disabled( $active, false, false );
176
+ $id = empty( $parent_slug ) ? '' : " id='rwmb-taxonomy-{$parent_slug}'";
177
+
178
+ $html = "<div{$id} class='rw-taxonomy-tree {$hidden}'>";
179
+ $html .= RWMB_Select_Field::html( $html, $meta, $field );
180
+ foreach ( $terms as $term )
181
+ {
182
+ $html .= self::walk_select_tree( $meta, $field, $elements, $term->term_id, $term->slug, in_array( $term->slug, $meta ) && $active ) . '</li>';
183
+ }
184
+ $html .= '</div>';
185
+
186
+ return $html;
187
+ }
188
+
189
+ /**
190
+ * Processes terms into indexed array for walker functions
191
+ *
192
+ * @param $terms
193
+ *
194
+ * @internal param $field
195
+ * @return array
196
+ */
197
+ static function process_terms( $terms )
198
+ {
199
+ $elements = array();
200
+ foreach ( $terms as $term )
201
+ {
202
+ $elements[$term->parent][] = $term;
203
+ }
204
+ return $elements;
205
+ }
206
+
207
+ /**
208
+ * Get options for selects, checkbox list, etc via the terms
209
+ *
210
+ * @param $terms array of term objects
211
+ *
212
+ * @param $options array
213
+ */
214
+ static function get_options( $terms = array() )
215
+ {
216
+ $options = array();
217
+ foreach( $terms as $term )
218
+ {
219
+ $options[$term->slug] = $term->name;
220
+ }
221
+ return $options;
222
+ }
223
+
224
+ /**
225
+ * Save post taxonomy
226
+ *
227
+ * @param $post_id
228
+ * @param $field
229
+ * @param $old
230
+ *
231
+ * @param $new
232
+ */
233
+ static function save( $new, $old, $post_id, $field )
234
+ {
235
+ wp_set_object_terms( $post_id, $new, $field['options']['taxonomy'] );
236
+ }
237
+
238
+ /**
239
+ * Standard meta retrieval
240
+ *
241
+ * @param mixed $meta
242
+ * @param int $post_id
243
+ * @param array $field
244
+ * @param bool $saved
245
+ *
246
+ * @return mixed
247
+ */
248
+ static function meta( $meta, $post_id, $saved, $field )
249
+ {
250
+ $options = $field['options'];
251
+
252
+ $meta = wp_get_post_terms( $post_id, $options['taxonomy'] );
253
+ $meta = is_array( $meta ) ? $meta : (array) $meta;
254
+ $meta = wp_list_pluck( $meta, 'slug' );
255
+
256
+ return $meta;
257
+ }
258
+ }
259
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/fields/url.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Prevent loading this file directly
3
+ defined( 'ABSPATH' ) || exit;
4
+
5
+ // Make sure "text" field is loaded
6
+ require_once RWMB_FIELDS_DIR . 'text.php';
7
+
8
+ if ( ! class_exists( 'RWMB_URL_Field' ) )
9
+ {
10
+ class RWMB_URL_Field extends RWMB_Text_Field
11
+ {
12
+ /**
13
+ * Get field HTML
14
+ *
15
+ * @param string $html
16
+ * @param mixed $meta
17
+ * @param array $field
18
+ *
19
+ * @return string
20
+ */
21
+ static function html( $html, $meta, $field )
22
+ {
23
+ return sprintf(
24
+ '<input type="url" class="rwmb-url" name="%s" id="%s" value="%s" size="%s" />',
25
+ $field['field_name'],
26
+ $field['id'],
27
+ $meta,
28
+ $field['size']
29
+ );
30
+ }
31
+
32
+
33
+ /**
34
+ * Sanitizes url
35
+ *
36
+ * @param $post_id
37
+ * @param $field
38
+ * @param $old
39
+ * @param $new
40
+ *
41
+ * @return $new
42
+ */
43
+ static function value( $new, $old, $post_id, $field)
44
+ {
45
+ $new = esc_url($new);
46
+ return $new;
47
+ }
48
+ }
49
+ }
js/map.js CHANGED
@@ -1,69 +1,120 @@
1
- var marker, map, geocoder;
2
-
3
- jQuery( document ).ready( function ()
4
- {
5
- var latlng = new google.maps.LatLng( 53.346881, -6.258860 );
6
- map = new google.maps.Map( jQuery( '.rwmb-map-canvas' )[0], {zoom: 8, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP} );
7
- marker = new google.maps.Marker( {position: latlng, map: map, draggable: true} );
8
- geocoder = new google.maps.Geocoder();
9
- google.maps.event.addListener( map, 'click', function ( event )
10
- {
11
- marker.setPosition( event.latLng );
12
- updatePositionInput( event.latLng );
13
- } );
14
- google.maps.event.addListener( marker, 'drag', function ( event )
15
- {
16
- updatePositionInput( event.latLng );
17
- } );
18
- updatePositionMarker();
19
- } );
20
-
21
- function updatePositionInput( latLng )
22
- {
23
- jQuery( '#rwmb-map-coordinate' ).val( latLng.lat() + ',' + latLng.lng() );
24
- }
25
-
26
- function updatePositionMarker()
27
- {
28
- var coord = jQuery( '#rwmb-map-coordinate' ).val(),
29
- addressField = jQuery( '#rwmb-map-goto-address-button' ).val(),
30
- l, zoom;
31
-
32
- if ( coord )
33
- {
34
- l = coord.split( ',' );
35
- marker.setPosition( new google.maps.LatLng( l[0], l[1] ) );
36
- zoom = l.length > 2 ? parseInt( l[2] ) : 15;
37
-
38
- map.setCenter( marker.position );
39
- map.setZoom( zoom );
40
- }
41
- else
42
- if ( addressField )
43
- geocodeAddress( addressField );
44
- }
45
-
46
- function geocodeAddress( addressField )
47
- {
48
- var address = '',
49
- fieldList = addressField.split( ',' ),
50
- loop;
51
-
52
- for ( loop = 0; loop < fieldList.length; loop++ )
53
- {
54
- address += jQuery( '#' + fieldList[loop] ).val();
55
- }
56
-
57
- address = address.replace( /\n/g, ',' );
58
- address = address.replace( /,,/g, ',' );
59
- geocoder.geocode( {'address': address}, function ( results, status )
60
- {
61
- if ( status == google.maps.GeocoderStatus.OK )
62
- {
63
- updatePositionInput( results[0].geometry.location );
64
- marker.setPosition( results[0].geometry.location );
65
- map.setCenter( marker.position );
66
- map.setZoom( 15 );
67
- }
68
- } );
69
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ var marker, map, geocoder;
3
+
4
+ jQuery( document ).ready( function ()
5
+ {
6
+ /*jshint jquery: true, devel:true, browser: true, newcap: true, noempty: true, strict: true, undef: true */
7
+ "use strict";
8
+ var latlng = new window.google.maps.LatLng( 53.346881, -6.258860 );
9
+ map = new window.google.maps.Map( jQuery( '.rwmb-map-canvas' )[0], {
10
+ zoom : 8,
11
+ center : latlng,
12
+ streetViewControl : 0,
13
+ mapTypeId : window.google.maps.MapTypeId.ROADMAP
14
+ });
15
+ marker = new window.google.maps.Marker( {position: latlng, map: map, draggable: true} );
16
+ geocoder = new window.google.maps.Geocoder();
17
+
18
+ window.google.maps.event.addListener( map, 'click', function ( event )
19
+ {
20
+ marker.setPosition( event.latLng );
21
+ updatePositionInput( event.latLng );
22
+ } );
23
+ window.google.maps.event.addListener( marker, 'drag', function ( event )
24
+ {
25
+ updatePositionInput( event.latLng );
26
+ } );
27
+ updatePositionMarker();
28
+
29
+ autoCompleteAddress();
30
+
31
+ function updatePositionInput( latLng )
32
+ {
33
+ jQuery( '#rwmb-map-coordinate' ).val( latLng.lat() + ',' + latLng.lng() );
34
+ }
35
+
36
+ function updatePositionMarker()
37
+ {
38
+ var coord = jQuery( '#rwmb-map-coordinate' ).val(),
39
+ addressField = jQuery( '#rwmb-map-goto-address-button' ).val(),
40
+ l, zoom;
41
+
42
+ if ( coord )
43
+ {
44
+ l = coord.split( ',' );
45
+ marker.setPosition( new window.google.maps.LatLng( l[0], l[1] ) );
46
+
47
+ zoom = l.length > 2 ? parseInt( l[2], 10 ) : 15;
48
+
49
+ map.setCenter( marker.position );
50
+ map.setZoom( zoom );
51
+ }
52
+ else
53
+ if ( addressField ){
54
+ geocodeAddress( addressField );
55
+ }
56
+ }
57
+
58
+ function geocodeAddress( addressField )
59
+ {
60
+ console.log(addressField);
61
+ var address = '',
62
+ fieldList = addressField.split( ',' ),
63
+ loop;
64
+
65
+ for ( loop = 0; loop < fieldList.length; loop++ )
66
+ {
67
+ address += jQuery( '#' + fieldList[loop] ).val();
68
+ }
69
+
70
+ address = address.replace( /\n/g, ',' );
71
+ address = address.replace( /,,/g, ',' );
72
+ geocoder.geocode( {'address': address}, function ( results, status )
73
+ {
74
+ if ( status == window.google.maps.GeocoderStatus.OK )
75
+ {
76
+ updatePositionInput( results[0].geometry.location );
77
+ marker.setPosition( results[0].geometry.location );
78
+ map.setCenter( marker.position );
79
+ map.setZoom( 15 );
80
+ }
81
+ } );
82
+ }
83
+
84
+
85
+ function autoCompleteAddress(){
86
+ var addressField = jQuery( '#rwmb-map-goto-address-button' ).val();
87
+ if (!addressField) return null;
88
+
89
+ jQuery( '#' + addressField).autocomplete({
90
+ source: function(request, response) {
91
+ // TODO: add 'region' option, to help bias geocoder.
92
+ geocoder.geocode( {'address': request.term }, function(results, status) {
93
+ response(jQuery.map(results, function(item) {
94
+ return {
95
+ label : item.formatted_address,
96
+ value : item.formatted_address,
97
+ latitude : item.geometry.location.lat(),
98
+ longitude : item.geometry.location.lng()
99
+ };
100
+ }));
101
+ });
102
+ },
103
+ select: function(event, ui) {
104
+
105
+ jQuery("#rwmb-map-coordinate").val(ui.item.latitude + ',' + ui.item.longitude );
106
+
107
+ var location = new window.google.maps.LatLng(ui.item.latitude, ui.item.longitude);
108
+
109
+ map.setCenter(location);
110
+ // Drop the Marker
111
+ setTimeout( function(){
112
+ marker.setValues({
113
+ position : location,
114
+ animation : window.google.maps.Animation.DROP
115
+ });
116
+ }, 1500);
117
+ }
118
+ });
119
+ }
120
+ } );
lang/ar.mo ADDED
Binary file
lang/ar.po ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Meta Box Script For WordPress\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-06-03 15:09+0700\n"
6
+ "PO-Revision-Date: 2012-12-29 23:40-0500\n"
7
+ "Last-Translator: Adel Qalieh <aqalieh95@gmail.com>\n"
8
+ "Language-Team: Adel Qalieh <aqalieh95@gmail.com>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e;_x:2c,1;_n:1,2;_n_noop:1,2;_nx:1,2;"
13
+ "_nx_noop:1,2\n"
14
+ "X-Poedit-Basepath: .\n"
15
+ "X-Poedit-SourceCharset: UTF-8\n"
16
+ "Plural-Forms: nplurals=6; plural= n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
17
+ "&& n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
18
+ "X-Language: ar\n"
19
+ "X-Source-Language: en\n"
20
+ "Language: ar\n"
21
+ "X-Poedit-SearchPath-0: ..\n"
22
+ "X-Poedit-SearchPath-1: ../inc/fields\n"
23
+
24
+ #: ../meta-box.php:79
25
+ msgid "RW_Meta_Box Debug:"
26
+ msgstr "RW_Meta_Box Debug:"
27
+
28
+ #: ../inc/classes/meta-box.php:316
29
+ msgid "+"
30
+ msgstr "+"
31
+
32
+ #: ../inc/classes/meta-box.php:340
33
+ msgid "&#8211;"
34
+ msgstr "&#8211;"
35
+
36
+ #: ../inc/fields/file.php:69
37
+ msgid "Error: Cannot delete file"
38
+ msgstr "خطأ: لا يمكن حذف الملف"
39
+
40
+ #: ../inc/fields/file.php:83
41
+ msgctxt "file upload"
42
+ msgid "Uploaded files"
43
+ msgstr "ملفات محملة"
44
+
45
+ #: ../inc/fields/file.php:84
46
+ msgctxt "file upload"
47
+ msgid "Delete this file"
48
+ msgstr "حذف هذا الملف"
49
+
50
+ #: ../inc/fields/file.php:85
51
+ msgctxt "file upload"
52
+ msgid "Delete"
53
+ msgstr "حذف"
54
+
55
+ #: ../inc/fields/file.php:86
56
+ msgctxt "file upload"
57
+ msgid "Upload files"
58
+ msgstr "تحميل الملفات"
59
+
60
+ #: ../inc/fields/file.php:87
61
+ msgctxt "file upload"
62
+ msgid "+ Add new file"
63
+ msgstr "+ إضافة ملف جديد"
64
+
65
+ #: ../inc/fields/image.php:75
66
+ msgid "Order saved"
67
+ msgstr "حفظ الترتيب"
68
+
69
+ #: ../inc/fields/image.php:91 ../inc/fields/plupload-image.php:156
70
+ msgctxt "image upload"
71
+ msgid "Uploaded files"
72
+ msgstr "ملفات محملة"
73
+
74
+ #: ../inc/fields/image.php:92 ../inc/fields/plupload-image.php:112
75
+ msgctxt "image upload"
76
+ msgid "Delete this file"
77
+ msgstr "حذف هذا الملف"
78
+
79
+ #: ../inc/fields/image.php:93 ../inc/fields/plupload-image.php:113
80
+ msgctxt "image upload"
81
+ msgid "Delete"
82
+ msgstr "حذف"
83
+
84
+ #: ../inc/fields/image.php:94 ../inc/fields/plupload-image.php:114
85
+ msgctxt "image upload"
86
+ msgid "Edit"
87
+ msgstr "حرر"
88
+
89
+ #: ../inc/fields/image.php:95 ../inc/fields/plupload-image.php:157
90
+ msgctxt "image upload"
91
+ msgid "Upload files"
92
+ msgstr "تحميل الملفات"
93
+
94
+ #: ../inc/fields/image.php:96
95
+ msgctxt "image upload"
96
+ msgid "+ Add new image"
97
+ msgstr "إضافة صورة جديدة"
98
+
99
+ #: ../inc/fields/plupload-image.php:95
100
+ msgctxt "image upload"
101
+ msgid "Allowed Image Files"
102
+ msgstr "أنواع الصور المسموحة"
103
+
104
+ #: ../inc/fields/plupload-image.php:160
105
+ msgctxt "image upload"
106
+ msgid "Drop images here"
107
+ msgstr "إفلت الصور هنا"
108
+
109
+ #: ../inc/fields/plupload-image.php:161
110
+ msgctxt "image upload"
111
+ msgid "or"
112
+ msgstr "أو"
113
+
114
+ #: ../inc/fields/plupload-image.php:162
115
+ msgctxt "image upload"
116
+ msgid "Select Files"
117
+ msgstr "إختر الملفات"
118
+
119
+ #: ../inc/fields/thickbox-image.php:45
120
+ msgctxt "image upload"
121
+ msgid "Upload image"
122
+ msgstr "حمل الصورة"
lang/default.po CHANGED
@@ -1,124 +1,124 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Meta Box Script For WordPress\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2012-06-03 15:09+0700\n"
6
- "PO-Revision-Date: 2012-06-03 15:09+0700\n"
7
- "Last-Translator: Rilwis <rilwis@gmail.com>\n"
8
- "Language-Team: Rilwis <rilwis@gmail.com>\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Poedit-KeywordsList: __;_e;_x:2c,1;_n:1,2;_n_noop:1,2;_nx:1,2;_nx_noop:1,2\n"
13
- "X-Poedit-Basepath: .\n"
14
- "X-Poedit-Language: English\n"
15
- "X-Poedit-Country: VIET NAM\n"
16
- "X-Poedit-SourceCharset: utf-8\n"
17
- "X-Poedit-SearchPath-0: ..\n"
18
- "X-Poedit-SearchPath-1: ../inc/fields\n"
19
-
20
- #: ../meta-box.php:79
21
- msgid "RW_Meta_Box Debug:"
22
- msgstr ""
23
-
24
- #: ../inc/classes/meta-box.php:316
25
- msgid "+"
26
- msgstr ""
27
-
28
- #: ../inc/classes/meta-box.php:340
29
- msgid "&#8211;"
30
- msgstr ""
31
-
32
- #: ../inc/fields/file.php:69
33
- msgid "Error: Cannot delete file"
34
- msgstr ""
35
-
36
- #: ../inc/fields/file.php:83
37
- msgctxt "file upload"
38
- msgid "Uploaded files"
39
- msgstr ""
40
-
41
- #: ../inc/fields/file.php:84
42
- msgctxt "file upload"
43
- msgid "Delete this file"
44
- msgstr ""
45
-
46
- #: ../inc/fields/file.php:85
47
- msgctxt "file upload"
48
- msgid "Delete"
49
- msgstr ""
50
-
51
- #: ../inc/fields/file.php:86
52
- msgctxt "file upload"
53
- msgid "Upload files"
54
- msgstr ""
55
-
56
- #: ../inc/fields/file.php:87
57
- msgctxt "file upload"
58
- msgid "+ Add new file"
59
- msgstr ""
60
-
61
- #: ../inc/fields/image.php:75
62
- msgid "Order saved"
63
- msgstr ""
64
-
65
- #: ../inc/fields/image.php:91
66
- #: ../inc/fields/plupload-image.php:156
67
- msgctxt "image upload"
68
- msgid "Uploaded files"
69
- msgstr ""
70
-
71
- #: ../inc/fields/image.php:92
72
- #: ../inc/fields/plupload-image.php:112
73
- msgctxt "image upload"
74
- msgid "Delete this file"
75
- msgstr ""
76
-
77
- #: ../inc/fields/image.php:93
78
- #: ../inc/fields/plupload-image.php:113
79
- msgctxt "image upload"
80
- msgid "Delete"
81
- msgstr ""
82
-
83
- #: ../inc/fields/image.php:94
84
- #: ../inc/fields/plupload-image.php:114
85
- msgctxt "image upload"
86
- msgid "Edit"
87
- msgstr ""
88
-
89
- #: ../inc/fields/image.php:95
90
- #: ../inc/fields/plupload-image.php:157
91
- msgctxt "image upload"
92
- msgid "Upload files"
93
- msgstr ""
94
-
95
- #: ../inc/fields/image.php:96
96
- msgctxt "image upload"
97
- msgid "+ Add new image"
98
- msgstr ""
99
-
100
- #: ../inc/fields/plupload-image.php:95
101
- msgctxt "image upload"
102
- msgid "Allowed Image Files"
103
- msgstr ""
104
-
105
- #: ../inc/fields/plupload-image.php:160
106
- msgctxt "image upload"
107
- msgid "Drop images here"
108
- msgstr ""
109
-
110
- #: ../inc/fields/plupload-image.php:161
111
- msgctxt "image upload"
112
- msgid "or"
113
- msgstr ""
114
-
115
- #: ../inc/fields/plupload-image.php:162
116
- msgctxt "image upload"
117
- msgid "Select Files"
118
- msgstr ""
119
-
120
- #: ../inc/fields/thickbox-image.php:45
121
- msgctxt "image upload"
122
- msgid "Upload image"
123
- msgstr ""
124
-
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Meta Box Script For WordPress\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-06-03 15:09+0700\n"
6
+ "PO-Revision-Date: 2012-06-03 15:09+0700\n"
7
+ "Last-Translator: Rilwis <rilwis@gmail.com>\n"
8
+ "Language-Team: Rilwis <rilwis@gmail.com>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e;_x:2c,1;_n:1,2;_n_noop:1,2;_nx:1,2;_nx_noop:1,2\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-Language: English\n"
15
+ "X-Poedit-Country: VIET NAM\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "X-Poedit-SearchPath-0: ..\n"
18
+ "X-Poedit-SearchPath-1: ../inc/fields\n"
19
+
20
+ #: ../meta-box.php:79
21
+ msgid "RW_Meta_Box Debug:"
22
+ msgstr ""
23
+
24
+ #: ../inc/classes/meta-box.php:316
25
+ msgid "+"
26
+ msgstr ""
27
+
28
+ #: ../inc/classes/meta-box.php:340
29
+ msgid "&#8211;"
30
+ msgstr ""
31
+
32
+ #: ../inc/fields/file.php:69
33
+ msgid "Error: Cannot delete file"
34
+ msgstr ""
35
+
36
+ #: ../inc/fields/file.php:83
37
+ msgctxt "file upload"
38
+ msgid "Uploaded files"
39
+ msgstr ""
40
+
41
+ #: ../inc/fields/file.php:84
42
+ msgctxt "file upload"
43
+ msgid "Delete this file"
44
+ msgstr ""
45
+
46
+ #: ../inc/fields/file.php:85
47
+ msgctxt "file upload"
48
+ msgid "Delete"
49
+ msgstr ""
50
+
51
+ #: ../inc/fields/file.php:86
52
+ msgctxt "file upload"
53
+ msgid "Upload files"
54
+ msgstr ""
55
+
56
+ #: ../inc/fields/file.php:87
57
+ msgctxt "file upload"
58
+ msgid "+ Add new file"
59
+ msgstr ""
60
+
61
+ #: ../inc/fields/image.php:75
62
+ msgid "Order saved"
63
+ msgstr ""
64
+
65
+ #: ../inc/fields/image.php:91
66
+ #: ../inc/fields/plupload-image.php:156
67
+ msgctxt "image upload"
68
+ msgid "Uploaded files"
69
+ msgstr ""
70
+
71
+ #: ../inc/fields/image.php:92
72
+ #: ../inc/fields/plupload-image.php:112
73
+ msgctxt "image upload"
74
+ msgid "Delete this file"
75
+ msgstr ""
76
+
77
+ #: ../inc/fields/image.php:93
78
+ #: ../inc/fields/plupload-image.php:113
79
+ msgctxt "image upload"
80
+ msgid "Delete"
81
+ msgstr ""
82
+
83
+ #: ../inc/fields/image.php:94
84
+ #: ../inc/fields/plupload-image.php:114
85
+ msgctxt "image upload"
86
+ msgid "Edit"
87
+ msgstr ""
88
+
89
+ #: ../inc/fields/image.php:95
90
+ #: ../inc/fields/plupload-image.php:157
91
+ msgctxt "image upload"
92
+ msgid "Upload files"
93
+ msgstr ""
94
+
95
+ #: ../inc/fields/image.php:96
96
+ msgctxt "image upload"
97
+ msgid "+ Add new image"
98
+ msgstr ""
99
+
100
+ #: ../inc/fields/plupload-image.php:95
101
+ msgctxt "image upload"
102
+ msgid "Allowed Image Files"
103
+ msgstr ""
104
+
105
+ #: ../inc/fields/plupload-image.php:160
106
+ msgctxt "image upload"
107
+ msgid "Drop images here"
108
+ msgstr ""
109
+
110
+ #: ../inc/fields/plupload-image.php:161
111
+ msgctxt "image upload"
112
+ msgid "or"
113
+ msgstr ""
114
+
115
+ #: ../inc/fields/plupload-image.php:162
116
+ msgctxt "image upload"
117
+ msgid "Select Files"
118
+ msgstr ""
119
+
120
+ #: ../inc/fields/thickbox-image.php:45
121
+ msgctxt "image upload"
122
+ msgid "Upload image"
123
+ msgstr ""
124
+
lang/es.mo ADDED
Binary file
lang/es.po ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Meta Box Script For WordPress\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-06-03 15:09+0700\n"
6
+ "PO-Revision-Date: 2012-12-29 23:42-0500\n"
7
+ "Last-Translator: Adel Qalieh <aqalieh95@gmail.com>\n"
8
+ "Language-Team: Adel Qalieh <aqalieh95@gmail.com>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e;_x:2c,1;_n:1,2;_n_noop:1,2;_nx:1,2;"
13
+ "_nx_noop:1,2\n"
14
+ "X-Poedit-Basepath: .\n"
15
+ "X-Poedit-SourceCharset: UTF-8\n"
16
+ "Plural-Forms: nplurals=2; plural=(n != 1)\n"
17
+ "X-Language: es\n"
18
+ "X-Source-Language: en\n"
19
+ "Language: es\n"
20
+ "X-Poedit-SearchPath-0: ..\n"
21
+ "X-Poedit-SearchPath-1: ../inc/fields\n"
22
+
23
+ #: ../meta-box.php:79
24
+ msgid "RW_Meta_Box Debug:"
25
+ msgstr "RW_Meta_Box Debug:"
26
+
27
+ #: ../inc/classes/meta-box.php:316
28
+ msgid "+"
29
+ msgstr "+"
30
+
31
+ #: ../inc/classes/meta-box.php:340
32
+ msgid "&#8211;"
33
+ msgstr "&#8211;"
34
+
35
+ #: ../inc/fields/file.php:69
36
+ msgid "Error: Cannot delete file"
37
+ msgstr "Error: No se puede eliminar el archivo"
38
+
39
+ #: ../inc/fields/file.php:83
40
+ msgctxt "file upload"
41
+ msgid "Uploaded files"
42
+ msgstr "Archivos subidos"
43
+
44
+ #: ../inc/fields/file.php:84
45
+ msgctxt "file upload"
46
+ msgid "Delete this file"
47
+ msgstr "Eliminar este archivo"
48
+
49
+ #: ../inc/fields/file.php:85
50
+ msgctxt "file upload"
51
+ msgid "Delete"
52
+ msgstr "Eliminar"
53
+
54
+ #: ../inc/fields/file.php:86
55
+ msgctxt "file upload"
56
+ msgid "Upload files"
57
+ msgstr "Subir archivos"
58
+
59
+ #: ../inc/fields/file.php:87
60
+ msgctxt "file upload"
61
+ msgid "+ Add new file"
62
+ msgstr "+ Añadir un archivo nuevo"
63
+
64
+ #: ../inc/fields/image.php:75
65
+ msgid "Order saved"
66
+ msgstr "El orden guardado"
67
+
68
+ #: ../inc/fields/image.php:91 ../inc/fields/plupload-image.php:156
69
+ msgctxt "image upload"
70
+ msgid "Uploaded files"
71
+ msgstr "Archivos subidos"
72
+
73
+ #: ../inc/fields/image.php:92 ../inc/fields/plupload-image.php:112
74
+ msgctxt "image upload"
75
+ msgid "Delete this file"
76
+ msgstr "Eliminar este archivo"
77
+
78
+ #: ../inc/fields/image.php:93 ../inc/fields/plupload-image.php:113
79
+ msgctxt "image upload"
80
+ msgid "Delete"
81
+ msgstr "Eliminar"
82
+
83
+ #: ../inc/fields/image.php:94 ../inc/fields/plupload-image.php:114
84
+ msgctxt "image upload"
85
+ msgid "Edit"
86
+ msgstr "Edit"
87
+
88
+ #: ../inc/fields/image.php:95 ../inc/fields/plupload-image.php:157
89
+ msgctxt "image upload"
90
+ msgid "Upload files"
91
+ msgstr "Subir archivos"
92
+
93
+ #: ../inc/fields/image.php:96
94
+ msgctxt "image upload"
95
+ msgid "+ Add new image"
96
+ msgstr "+ Añadir un archivo nuevo"
97
+
98
+ #: ../inc/fields/plupload-image.php:95
99
+ msgctxt "image upload"
100
+ msgid "Allowed Image Files"
101
+ msgstr "Archivos de imágenes permitidos"
102
+
103
+ #: ../inc/fields/plupload-image.php:160
104
+ msgctxt "image upload"
105
+ msgid "Drop images here"
106
+ msgstr "Soltar imágenes aquí"
107
+
108
+ #: ../inc/fields/plupload-image.php:161
109
+ msgctxt "image upload"
110
+ msgid "or"
111
+ msgstr "o"
112
+
113
+ #: ../inc/fields/plupload-image.php:162
114
+ msgctxt "image upload"
115
+ msgid "Select Files"
116
+ msgstr "Seleccionar Archivos"
117
+
118
+ #: ../inc/fields/thickbox-image.php:45
119
+ msgctxt "image upload"
120
+ msgid "Upload image"
121
+ msgstr "Subir imágenes"
lang/sv_SE.po CHANGED
@@ -1,118 +1,118 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Meta Box Script For WordPress\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2012-06-03 15:09+0700\n"
6
- "PO-Revision-Date: 2012-08-09 16:15+0100\n"
7
- "Last-Translator: \n"
8
- "Language-Team: Rilwis <rilwis@gmail.com>\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Poedit-KeywordsList: __;_e;_x:2c,1;_n:1,2;_n_noop:1,2;_nx:1,2;"
13
- "_nx_noop:1,2\n"
14
- "X-Poedit-Basepath: .\n"
15
- "X-Poedit-SourceCharset: utf-8\n"
16
- "Language: en_VN\n"
17
- "X-Poedit-SearchPath-0: ..\n"
18
- "X-Poedit-SearchPath-1: ../inc/fields\n"
19
-
20
- #: ../meta-box.php:79
21
- msgid "RW_Meta_Box Debug:"
22
- msgstr ""
23
-
24
- #: ../inc/classes/meta-box.php:316
25
- msgid "+"
26
- msgstr ""
27
-
28
- #: ../inc/classes/meta-box.php:340
29
- msgid "&#8211;"
30
- msgstr ""
31
-
32
- #: ../inc/fields/file.php:69
33
- msgid "Error: Cannot delete file"
34
- msgstr "Fel: Kan inte radera filen"
35
-
36
- #: ../inc/fields/file.php:83
37
- msgctxt "file upload"
38
- msgid "Uploaded files"
39
- msgstr "Uppladdade filer"
40
-
41
- #: ../inc/fields/file.php:84
42
- msgctxt "file upload"
43
- msgid "Delete this file"
44
- msgstr "Radera den här filen"
45
-
46
- #: ../inc/fields/file.php:85
47
- msgctxt "file upload"
48
- msgid "Delete"
49
- msgstr "Radera"
50
-
51
- #: ../inc/fields/file.php:86
52
- msgctxt "file upload"
53
- msgid "Upload files"
54
- msgstr "Ladda upp"
55
-
56
- #: ../inc/fields/file.php:87
57
- msgctxt "file upload"
58
- msgid "+ Add new file"
59
- msgstr "+ Lägg till ny fil"
60
-
61
- #: ../inc/fields/image.php:75
62
- msgid "Order saved"
63
- msgstr "Ordning sparad"
64
-
65
- #: ../inc/fields/image.php:91 ../inc/fields/plupload-image.php:156
66
- msgctxt "image upload"
67
- msgid "Uploaded files"
68
- msgstr "Uppladdade filer"
69
-
70
- #: ../inc/fields/image.php:92 ../inc/fields/plupload-image.php:112
71
- msgctxt "image upload"
72
- msgid "Delete this file"
73
- msgstr "Radera den här filen"
74
-
75
- #: ../inc/fields/image.php:93 ../inc/fields/plupload-image.php:113
76
- msgctxt "image upload"
77
- msgid "Delete"
78
- msgstr "Radera"
79
-
80
- #: ../inc/fields/image.php:94 ../inc/fields/plupload-image.php:114
81
- msgctxt "image upload"
82
- msgid "Edit"
83
- msgstr "Redigera"
84
-
85
- #: ../inc/fields/image.php:95 ../inc/fields/plupload-image.php:157
86
- msgctxt "image upload"
87
- msgid "Upload files"
88
- msgstr "Ladda upp filer"
89
-
90
- #: ../inc/fields/image.php:96
91
- msgctxt "image upload"
92
- msgid "+ Add new image"
93
- msgstr "+ Lägg till ny bild"
94
-
95
- #: ../inc/fields/plupload-image.php:95
96
- msgctxt "image upload"
97
- msgid "Allowed Image Files"
98
- msgstr "Tillåtna bildformat"
99
-
100
- #: ../inc/fields/plupload-image.php:160
101
- msgctxt "image upload"
102
- msgid "Drop images here"
103
- msgstr "Släpp bilder här"
104
-
105
- #: ../inc/fields/plupload-image.php:161
106
- msgctxt "image upload"
107
- msgid "or"
108
- msgstr "eller"
109
-
110
- #: ../inc/fields/plupload-image.php:162
111
- msgctxt "image upload"
112
- msgid "Select Files"
113
- msgstr "Välj filer"
114
-
115
- #: ../inc/fields/thickbox-image.php:45
116
- msgctxt "image upload"
117
- msgid "Upload image"
118
- msgstr "Ladda upp bild"
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Meta Box Script For WordPress\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-06-03 15:09+0700\n"
6
+ "PO-Revision-Date: 2012-08-09 16:15+0100\n"
7
+ "Last-Translator: \n"
8
+ "Language-Team: Rilwis <rilwis@gmail.com>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e;_x:2c,1;_n:1,2;_n_noop:1,2;_nx:1,2;"
13
+ "_nx_noop:1,2\n"
14
+ "X-Poedit-Basepath: .\n"
15
+ "X-Poedit-SourceCharset: utf-8\n"
16
+ "Language: en_VN\n"
17
+ "X-Poedit-SearchPath-0: ..\n"
18
+ "X-Poedit-SearchPath-1: ../inc/fields\n"
19
+
20
+ #: ../meta-box.php:79
21
+ msgid "RW_Meta_Box Debug:"
22
+ msgstr ""
23
+
24
+ #: ../inc/classes/meta-box.php:316
25
+ msgid "+"
26
+ msgstr ""
27
+
28
+ #: ../inc/classes/meta-box.php:340
29
+ msgid "&#8211;"
30
+ msgstr ""
31
+
32
+ #: ../inc/fields/file.php:69
33
+ msgid "Error: Cannot delete file"
34
+ msgstr "Fel: Kan inte radera filen"
35
+
36
+ #: ../inc/fields/file.php:83
37
+ msgctxt "file upload"
38
+ msgid "Uploaded files"
39
+ msgstr "Uppladdade filer"
40
+
41
+ #: ../inc/fields/file.php:84
42
+ msgctxt "file upload"
43
+ msgid "Delete this file"
44
+ msgstr "Radera den här filen"
45
+
46
+ #: ../inc/fields/file.php:85
47
+ msgctxt "file upload"
48
+ msgid "Delete"
49
+ msgstr "Radera"
50
+
51
+ #: ../inc/fields/file.php:86
52
+ msgctxt "file upload"
53
+ msgid "Upload files"
54
+ msgstr "Ladda upp"
55
+
56
+ #: ../inc/fields/file.php:87
57
+ msgctxt "file upload"
58
+ msgid "+ Add new file"
59
+ msgstr "+ Lägg till ny fil"
60
+
61
+ #: ../inc/fields/image.php:75
62
+ msgid "Order saved"
63
+ msgstr "Ordning sparad"
64
+
65
+ #: ../inc/fields/image.php:91 ../inc/fields/plupload-image.php:156
66
+ msgctxt "image upload"
67
+ msgid "Uploaded files"
68
+ msgstr "Uppladdade filer"
69
+
70
+ #: ../inc/fields/image.php:92 ../inc/fields/plupload-image.php:112
71
+ msgctxt "image upload"
72
+ msgid "Delete this file"
73
+ msgstr "Radera den här filen"
74
+
75
+ #: ../inc/fields/image.php:93 ../inc/fields/plupload-image.php:113
76
+ msgctxt "image upload"
77
+ msgid "Delete"
78
+ msgstr "Radera"
79
+
80
+ #: ../inc/fields/image.php:94 ../inc/fields/plupload-image.php:114
81
+ msgctxt "image upload"
82
+ msgid "Edit"
83
+ msgstr "Redigera"
84
+
85
+ #: ../inc/fields/image.php:95 ../inc/fields/plupload-image.php:157
86
+ msgctxt "image upload"
87
+ msgid "Upload files"
88
+ msgstr "Ladda upp filer"
89
+
90
+ #: ../inc/fields/image.php:96
91
+ msgctxt "image upload"
92
+ msgid "+ Add new image"
93
+ msgstr "+ Lägg till ny bild"
94
+
95
+ #: ../inc/fields/plupload-image.php:95
96
+ msgctxt "image upload"
97
+ msgid "Allowed Image Files"
98
+ msgstr "Tillåtna bildformat"
99
+
100
+ #: ../inc/fields/plupload-image.php:160
101
+ msgctxt "image upload"
102
+ msgid "Drop images here"
103
+ msgstr "Släpp bilder här"
104
+
105
+ #: ../inc/fields/plupload-image.php:161
106
+ msgctxt "image upload"
107
+ msgid "or"
108
+ msgstr "eller"
109
+
110
+ #: ../inc/fields/plupload-image.php:162
111
+ msgctxt "image upload"
112
+ msgid "Select Files"
113
+ msgstr "Välj filer"
114
+
115
+ #: ../inc/fields/thickbox-image.php:45
116
+ msgctxt "image upload"
117
+ msgid "Upload image"
118
+ msgstr "Ladda upp bild"
lang/vi.po CHANGED
@@ -1,131 +1,131 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Meta Box Script For WordPress\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2012-06-03 15:10+0700\n"
6
- "PO-Revision-Date: 2012-06-03 15:10+0700\n"
7
- "Last-Translator: Rilwis <rilwis@gmail.com>\n"
8
- "Language-Team: Rilwis <rilwis@gmail.com>\n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Poedit-KeywordsList: __;_e;_x:2c,1;_n:1,2;_n_noop:1,2;_nx:1,2;_nx_noop:1,2\n"
13
- "X-Poedit-Basepath: .\n"
14
- "X-Poedit-Language: English\n"
15
- "X-Poedit-Country: VIET NAM\n"
16
- "X-Poedit-SourceCharset: utf-8\n"
17
- "X-Poedit-SearchPath-0: ..\n"
18
- "X-Poedit-SearchPath-1: ../inc/fields\n"
19
-
20
- #: ../meta-box.php:79
21
- msgid "RW_Meta_Box Debug:"
22
- msgstr ""
23
-
24
- #: ../inc/classes/meta-box.php:316
25
- msgid "+"
26
- msgstr ""
27
-
28
- #: ../inc/classes/meta-box.php:340
29
- msgid "&#8211;"
30
- msgstr ""
31
-
32
- #: ../inc/fields/file.php:69
33
- msgid "Error: Cannot delete file"
34
- msgstr "Lỗi: Không xóa được file"
35
-
36
- #: ../inc/fields/file.php:83
37
- msgctxt "file upload"
38
- msgid "Uploaded files"
39
- msgstr "Các file đã tải lên"
40
-
41
- #: ../inc/fields/file.php:84
42
- msgctxt "file upload"
43
- msgid "Delete this file"
44
- msgstr "Xóa file"
45
-
46
- #: ../inc/fields/file.php:85
47
- msgctxt "file upload"
48
- msgid "Delete"
49
- msgstr "Xóa"
50
-
51
- #: ../inc/fields/file.php:86
52
- msgctxt "file upload"
53
- msgid "Upload files"
54
- msgstr "Tải file"
55
-
56
- #: ../inc/fields/file.php:87
57
- msgctxt "file upload"
58
- msgid "+ Add new file"
59
- msgstr "+ Thêm file mới"
60
-
61
- #: ../inc/fields/image.php:75
62
- msgid "Order saved"
63
- msgstr "Đã lưu thứ tự"
64
-
65
- #: ../inc/fields/image.php:91
66
- #: ../inc/fields/plupload-image.php:156
67
- msgctxt "image upload"
68
- msgid "Uploaded files"
69
- msgstr "Các file đã tải lên"
70
-
71
- #: ../inc/fields/image.php:92
72
- #: ../inc/fields/plupload-image.php:112
73
- msgctxt "image upload"
74
- msgid "Delete this file"
75
- msgstr "Xóa file"
76
-
77
- #: ../inc/fields/image.php:93
78
- #: ../inc/fields/plupload-image.php:113
79
- msgctxt "image upload"
80
- msgid "Delete"
81
- msgstr "Xóa"
82
-
83
- #: ../inc/fields/image.php:94
84
- #: ../inc/fields/plupload-image.php:114
85
- msgctxt "image upload"
86
- msgid "Edit"
87
- msgstr "Sửa"
88
-
89
- #: ../inc/fields/image.php:95
90
- #: ../inc/fields/plupload-image.php:157
91
- msgctxt "image upload"
92
- msgid "Upload files"
93
- msgstr "Tải file"
94
-
95
- #: ../inc/fields/image.php:96
96
- msgctxt "image upload"
97
- msgid "+ Add new image"
98
- msgstr "+ Thêm hình mới"
99
-
100
- #: ../inc/fields/plupload-image.php:95
101
- msgctxt "image upload"
102
- msgid "Allowed Image Files"
103
- msgstr "Các file hình ảnh được cho phép"
104
-
105
- #: ../inc/fields/plupload-image.php:160
106
- msgctxt "image upload"
107
- msgid "Drop images here"
108
- msgstr "Kéo thả hình ảnh vào đây"
109
-
110
- #: ../inc/fields/plupload-image.php:161
111
- msgctxt "image upload"
112
- msgid "or"
113
- msgstr "hoặc"
114
-
115
- #: ../inc/fields/plupload-image.php:162
116
- msgctxt "image upload"
117
- msgid "Select Files"
118
- msgstr "Chọn file"
119
-
120
- #: ../inc/fields/thickbox-image.php:45
121
- #, fuzzy
122
- msgctxt "image upload"
123
- msgid "Upload image"
124
- msgstr "Tải file"
125
-
126
- #~ msgid "Select a color"
127
- #~ msgstr "Chọn một màu"
128
- #~ msgctxt "image upload"
129
-
130
- #~ msgid "Add another file"
131
- #~ msgstr "Thêm file mới"
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Meta Box Script For WordPress\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2012-06-03 15:10+0700\n"
6
+ "PO-Revision-Date: 2012-06-03 15:10+0700\n"
7
+ "Last-Translator: Rilwis <rilwis@gmail.com>\n"
8
+ "Language-Team: Rilwis <rilwis@gmail.com>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Poedit-KeywordsList: __;_e;_x:2c,1;_n:1,2;_n_noop:1,2;_nx:1,2;_nx_noop:1,2\n"
13
+ "X-Poedit-Basepath: .\n"
14
+ "X-Poedit-Language: English\n"
15
+ "X-Poedit-Country: VIET NAM\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "X-Poedit-SearchPath-0: ..\n"
18
+ "X-Poedit-SearchPath-1: ../inc/fields\n"
19
+
20
+ #: ../meta-box.php:79
21
+ msgid "RW_Meta_Box Debug:"
22
+ msgstr ""
23
+
24
+ #: ../inc/classes/meta-box.php:316
25
+ msgid "+"
26
+ msgstr ""
27
+
28
+ #: ../inc/classes/meta-box.php:340
29
+ msgid "&#8211;"
30
+ msgstr ""
31
+
32
+ #: ../inc/fields/file.php:69
33
+ msgid "Error: Cannot delete file"
34
+ msgstr "Lỗi: Không xóa được file"
35
+
36
+ #: ../inc/fields/file.php:83
37
+ msgctxt "file upload"
38
+ msgid "Uploaded files"
39
+ msgstr "Các file đã tải lên"
40
+
41
+ #: ../inc/fields/file.php:84
42
+ msgctxt "file upload"
43
+ msgid "Delete this file"
44
+ msgstr "Xóa file"
45
+
46
+ #: ../inc/fields/file.php:85
47
+ msgctxt "file upload"
48
+ msgid "Delete"
49
+ msgstr "Xóa"
50
+
51
+ #: ../inc/fields/file.php:86
52
+ msgctxt "file upload"
53
+ msgid "Upload files"
54
+ msgstr "Tải file"
55
+
56
+ #: ../inc/fields/file.php:87
57
+ msgctxt "file upload"
58
+ msgid "+ Add new file"
59
+ msgstr "+ Thêm file mới"
60
+
61
+ #: ../inc/fields/image.php:75
62
+ msgid "Order saved"
63
+ msgstr "Đã lưu thứ tự"
64
+
65
+ #: ../inc/fields/image.php:91
66
+ #: ../inc/fields/plupload-image.php:156
67
+ msgctxt "image upload"
68
+ msgid "Uploaded files"
69
+ msgstr "Các file đã tải lên"
70
+
71
+ #: ../inc/fields/image.php:92
72
+ #: ../inc/fields/plupload-image.php:112
73
+ msgctxt "image upload"
74
+ msgid "Delete this file"
75
+ msgstr "Xóa file"
76
+
77
+ #: ../inc/fields/image.php:93
78
+ #: ../inc/fields/plupload-image.php:113
79
+ msgctxt "image upload"
80
+ msgid "Delete"
81
+ msgstr "Xóa"
82
+
83
+ #: ../inc/fields/image.php:94
84
+ #: ../inc/fields/plupload-image.php:114
85
+ msgctxt "image upload"
86
+ msgid "Edit"
87
+ msgstr "Sửa"
88
+
89
+ #: ../inc/fields/image.php:95
90
+ #: ../inc/fields/plupload-image.php:157
91
+ msgctxt "image upload"
92
+ msgid "Upload files"
93
+ msgstr "Tải file"
94
+
95
+ #: ../inc/fields/image.php:96
96
+ msgctxt "image upload"
97
+ msgid "+ Add new image"
98
+ msgstr "+ Thêm hình mới"
99
+
100
+ #: ../inc/fields/plupload-image.php:95
101
+ msgctxt "image upload"
102
+ msgid "Allowed Image Files"
103
+ msgstr "Các file hình ảnh được cho phép"
104
+
105
+ #: ../inc/fields/plupload-image.php:160
106
+ msgctxt "image upload"
107
+ msgid "Drop images here"
108
+ msgstr "Kéo thả hình ảnh vào đây"
109
+
110
+ #: ../inc/fields/plupload-image.php:161
111
+ msgctxt "image upload"
112
+ msgid "or"
113
+ msgstr "hoặc"
114
+
115
+ #: ../inc/fields/plupload-image.php:162
116
+ msgctxt "image upload"
117
+ msgid "Select Files"
118
+ msgstr "Chọn file"
119
+
120
+ #: ../inc/fields/thickbox-image.php:45
121
+ #, fuzzy
122
+ msgctxt "image upload"
123
+ msgid "Upload image"
124
+ msgstr "Tải file"
125
+
126
+ #~ msgid "Select a color"
127
+ #~ msgstr "Chọn một màu"
128
+ #~ msgctxt "image upload"
129
+
130
+ #~ msgid "Add another file"
131
+ #~ msgstr "Thêm file mới"
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.2.3
7
  Author: Rilwis
8
  Author URI: http://www.deluxeblogtips.com
9
  License: GPL2+
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.2.4
7
  Author: Rilwis
8
  Author URI: http://www.deluxeblogtips.com
9
  License: GPL2+
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: rilwis, franz-josef-kaiser, Omnicia, funkedgeek, PerWiklander, rua
3
  Donate link: http://www.deluxeblogtips.com/donate
4
  Tags: meta-box, custom-fields, custom-field, meta, meta-boxes
5
  Requires at least: 3.0
6
- Tested up to: 3.4.2
7
- Stable tag: 4.2.3
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
 
@@ -41,6 +41,7 @@ Meta Box plugin provides an API to easily implement custom meta boxes in editing
41
  - textarea
42
  - thickbox_image
43
  - time
 
44
  - wysiwyg
45
 
46
  [Project Page](http://www.deluxeblogtips.com/meta-box/) | [Getting Started](http://www.deluxeblogtips.com/meta-box/getting-started/) | [Support Forums](http://www.deluxeblogtips.com/forums/) | [Donate](http://www.deluxeblogtips.com/donate/)
@@ -61,6 +62,17 @@ To getting started with the plugin API, please read [this tutorial](http://www.d
61
 
62
  == Changelog ==
63
 
 
 
 
 
 
 
 
 
 
 
 
64
  = 4.2.3 =
65
  * Bug fix: clone date field. [Link](http://www.deluxeblogtips.com/forums/viewtopic.php?id=299)
66
 
3
  Donate link: http://www.deluxeblogtips.com/donate
4
  Tags: meta-box, custom-fields, custom-field, meta, meta-boxes
5
  Requires at least: 3.0
6
+ Tested up to: 3.5.1
7
+ Stable tag: 4.2.4
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
 
41
  - textarea
42
  - thickbox_image
43
  - time
44
+ - url
45
  - wysiwyg
46
 
47
  [Project Page](http://www.deluxeblogtips.com/meta-box/) | [Getting Started](http://www.deluxeblogtips.com/meta-box/getting-started/) | [Support Forums](http://www.deluxeblogtips.com/forums/) | [Donate](http://www.deluxeblogtips.com/donate/)
62
 
63
  == Changelog ==
64
 
65
+ = 4.2.4 =
66
+ * Bug fix: path to Select2 JS and CSS. [Link](http://wordpress.org/support/topic/missing-files-5)
67
+ * Bug fix: `taxonomy.js` loading
68
+ * Bug fix: saving in quick mode edit
69
+ * Improvement: add `before` and `after` attributes to fields that can be used to display custom text
70
+ * Improvement: add Arabic and Spanish languages
71
+ * Improvement: add `rwmb*_before_save_post` and `rwmb*_before_save_post` actions before and after save post
72
+ * Improvement: add autocomplete for geo location in `map` field, add fancy animation to drop marker
73
+ * Improvemnet: add `url` field
74
+
75
+
76
  = 4.2.3 =
77
  * Bug fix: clone date field. [Link](http://www.deluxeblogtips.com/forums/viewtopic.php?id=299)
78