Meta Box - Version 4.12.4

Version Description

Download this release

Release Info

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

Code changes from version 4.12.1 to 4.12.4

css/datepicker.css CHANGED
@@ -1,7 +1,7 @@
1
  /* Fix empty block below admin footer (issue #24) */
2
  #ui-datepicker-div {
3
  display: none;
4
- z-index: 9999 !important;
5
  }
6
 
7
  /* Style for multiple months */
1
  /* Fix empty block below admin footer (issue #24) */
2
  #ui-datepicker-div {
3
  display: none;
4
+ z-index: 99999 !important;
5
  }
6
 
7
  /* Style for multiple months */
css/media.css CHANGED
@@ -1,4 +1,8 @@
1
- .rwmb-media-list {
 
 
 
 
2
  margin: -8px 0 0 -8px;
3
  overflow: hidden;
4
  }
1
+ .rwmb-media-list:empty {
2
+ display: none;
3
+ }
4
+ .rwmb-media-list:not(:empty) {
5
+ display: block;
6
  margin: -8px 0 0 -8px;
7
  overflow: hidden;
8
  }
inc/autoloader.php CHANGED
@@ -84,6 +84,10 @@ class RWMB_Autoloader {
84
  'clone',
85
  'meta-box',
86
  'meta-box-registry',
 
 
 
 
87
  'validation',
88
  'sanitizer',
89
  'media-modal',
84
  'clone',
85
  'meta-box',
86
  'meta-box-registry',
87
+ 'storage-registry',
88
+ 'interfaces/storage.php',
89
+ 'storages/base.php',
90
+ 'storages/post.php',
91
  'validation',
92
  'sanitizer',
93
  'media-modal',
inc/core.php CHANGED
@@ -18,7 +18,9 @@ class RWMB_Core {
18
  load_plugin_textdomain( 'meta-box', false, plugin_basename( RWMB_DIR ) . '/languages/' );
19
 
20
  add_filter( 'plugin_action_links_meta-box/meta-box.php', array( $this, 'plugin_links' ) );
21
- add_action( 'init', array( $this, 'register_meta_boxes' ) );
 
 
22
  add_action( 'edit_page_form', array( $this, 'fix_page_template' ) );
23
  }
24
 
@@ -44,11 +46,11 @@ class RWMB_Core {
44
  public function register_meta_boxes() {
45
  $configs = apply_filters( 'rwmb_meta_boxes', array() );
46
  $meta_boxes = rwmb_get_registry( 'meta_box' );
47
- $fields = rwmb_get_registry( 'field' );
48
  foreach ( $configs as $config ) {
49
- $meta_box = new RW_Meta_Box( $config );
50
  $meta_boxes->add( $meta_box );
51
- $fields->add_from_meta_box( $meta_box );
52
  }
53
  }
54
 
18
  load_plugin_textdomain( 'meta-box', false, plugin_basename( RWMB_DIR ) . '/languages/' );
19
 
20
  add_filter( 'plugin_action_links_meta-box/meta-box.php', array( $this, 'plugin_links' ) );
21
+
22
+ // Uses priority 20 to support custom port types registered using the default priority.
23
+ add_action( 'init', array( $this, 'register_meta_boxes' ), 20 );
24
  add_action( 'edit_page_form', array( $this, 'fix_page_template' ) );
25
  }
26
 
46
  public function register_meta_boxes() {
47
  $configs = apply_filters( 'rwmb_meta_boxes', array() );
48
  $meta_boxes = rwmb_get_registry( 'meta_box' );
49
+
50
  foreach ( $configs as $config ) {
51
+ $meta_box = rwmb_get_meta_box( $config );
52
  $meta_boxes->add( $meta_box );
53
+ $meta_box->register_fields();
54
  }
55
  }
56
 
inc/field-registry.php CHANGED
@@ -17,19 +17,6 @@ class RWMB_Field_Registry {
17
  */
18
  private $data = array();
19
 
20
- /**
21
- * Add all fields in a meta box to the registry.
22
- *
23
- * @param RW_Meta_Box $meta_box Meta box object.
24
- */
25
- public function add_from_meta_box( RW_Meta_Box $meta_box ) {
26
- foreach ( $meta_box->fields as $field ) {
27
- foreach ( $meta_box->post_types as $post_type ) {
28
- $this->add( $field, $post_type );
29
- }
30
- }
31
- }
32
-
33
  /**
34
  * Add a single field to the registry.
35
  *
17
  */
18
  private $data = array();
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  /**
21
  * Add a single field to the registry.
22
  *
inc/field.php CHANGED
@@ -350,10 +350,11 @@ abstract class RWMB_Field {
350
  'field_name' => isset( $field['id'] ) ? $field['id'] : '',
351
  'placeholder' => '',
352
 
353
- 'clone' => false,
354
- 'max_clone' => 0,
355
- 'sort_clone' => false,
356
- 'add_button' => __( '+ Add more', 'meta-box' ),
 
357
 
358
  'class' => '',
359
  'disabled' => false,
@@ -362,6 +363,13 @@ abstract class RWMB_Field {
362
  'attributes' => array(),
363
  ) );
364
 
 
 
 
 
 
 
 
365
  return $field;
366
  }
367
 
@@ -468,6 +476,11 @@ abstract class RWMB_Field {
468
  */
469
  public static function the_value( $field, $args = array(), $post_id = null ) {
470
  $value = self::call( 'get_value', $field, $args, $post_id );
 
 
 
 
 
471
  return self::call( 'format_value', $field, $value );
472
  }
473
 
350
  'field_name' => isset( $field['id'] ) ? $field['id'] : '',
351
  'placeholder' => '',
352
 
353
+ 'clone' => false,
354
+ 'max_clone' => 0,
355
+ 'sort_clone' => false,
356
+ 'add_button' => __( '+ Add more', 'meta-box' ),
357
+ 'clone_default' => false,
358
 
359
  'class' => '',
360
  'disabled' => false,
363
  'attributes' => array(),
364
  ) );
365
 
366
+ if ( $field['clone_default'] ) {
367
+ $field['attributes'] = wp_parse_args( $field['attributes'], array(
368
+ 'data-default' => $field['std'],
369
+ 'data-clone-default' => 'true',
370
+ ) );
371
+ }
372
+
373
  return $field;
374
  }
375
 
476
  */
477
  public static function the_value( $field, $args = array(), $post_id = null ) {
478
  $value = self::call( 'get_value', $field, $args, $post_id );
479
+
480
+ if ( false === $value ) {
481
+ return '';
482
+ }
483
+
484
  return self::call( 'format_value', $field, $value );
485
  }
486
 
inc/fields/input-list.php CHANGED
@@ -32,7 +32,7 @@ class RWMB_Input_List_Field extends RWMB_Choice_Field {
32
  $output = self::get_select_all_html( $field );
33
  $output .= sprintf( '<ul class="rwmb-input-list %s %s">',
34
  $field['collapse'] ? 'collapse' : '',
35
- $field['inline'] ? 'inline' : ''
36
  );
37
  $output .= $walker->walk( $options, $field['flatten'] ? - 1 : 0 );
38
  $output .= '</ul>';
32
  $output = self::get_select_all_html( $field );
33
  $output .= sprintf( '<ul class="rwmb-input-list %s %s">',
34
  $field['collapse'] ? 'collapse' : '',
35
+ $field['inline'] ? 'inline' : ''
36
  );
37
  $output .= $walker->walk( $options, $field['flatten'] ? - 1 : 0 );
38
  $output .= '</ul>';
inc/fields/map.php CHANGED
@@ -43,7 +43,11 @@ class RWMB_Map_Field extends RWMB_Field {
43
  * @return string
44
  */
45
  public static function html( $meta, $field ) {
46
- $html = '<div class="rwmb-map-field">';
 
 
 
 
47
 
48
  $html .= sprintf(
49
  '<div class="rwmb-map-canvas" data-default-loc="%s" data-region="%s"></div>
@@ -54,11 +58,9 @@ class RWMB_Map_Field extends RWMB_Field {
54
  esc_attr( $meta )
55
  );
56
 
57
- $address = $field['address_field'];
58
- if ( $address ) {
59
  $html .= sprintf(
60
- '<button class="button rwmb-map-goto-address-button" value="%s">%s</button>',
61
- is_array( $address ) ? implode( ',', $address ) : $address,
62
  esc_html__( 'Find Address', 'meta-box' )
63
  );
64
  }
43
  * @return string
44
  */
45
  public static function html( $meta, $field ) {
46
+ $address = is_array( $field['address_field'] ) ? implode( ',', $field['address_field'] ) : $field['address_field'];
47
+ $html = sprintf(
48
+ '<div class="rwmb-map-field" data-address-field="%s">',
49
+ esc_attr( $address )
50
+ );
51
 
52
  $html .= sprintf(
53
  '<div class="rwmb-map-canvas" data-default-loc="%s" data-region="%s"></div>
58
  esc_attr( $meta )
59
  );
60
 
61
+ if ( $field['address_field'] ) {
 
62
  $html .= sprintf(
63
+ '<button class="button rwmb-map-goto-address-button">%s</button>',
 
64
  esc_html__( 'Find Address', 'meta-box' )
65
  );
66
  }
inc/fields/media.php CHANGED
@@ -59,8 +59,7 @@ class RWMB_Media_Field extends RWMB_File_Field {
59
  $attributes = self::get_attributes( $field, $meta );
60
 
61
  $html = sprintf(
62
- '<input %s>
63
- <div class="rwmb-media-view" data-options="%s"></div>',
64
  self::render_attributes( $attributes ),
65
  esc_attr( wp_json_encode( $field['js_options'] ) )
66
  );
59
  $attributes = self::get_attributes( $field, $meta );
60
 
61
  $html = sprintf(
62
+ '<input %s data-options="%s">',
 
63
  self::render_attributes( $attributes ),
64
  esc_attr( wp_json_encode( $field['js_options'] ) )
65
  );
inc/fields/slider.php CHANGED
@@ -55,7 +55,7 @@ class RWMB_Slider_Field extends RWMB_Field {
55
  $field = wp_parse_args( $field, array(
56
  'prefix' => '',
57
  'suffix' => '',
58
- 'std' => '',
59
  'js_options' => array(),
60
  ) );
61
  $field['js_options'] = wp_parse_args( $field['js_options'], array(
55
  $field = wp_parse_args( $field, array(
56
  'prefix' => '',
57
  'suffix' => '',
58
+ 'std' => '',
59
  'js_options' => array(),
60
  ) );
61
  $field['js_options'] = wp_parse_args( $field['js_options'], array(
inc/fields/taxonomy-advanced.php CHANGED
@@ -77,7 +77,8 @@ class RWMB_Taxonomy_Advanced_Field extends RWMB_Taxonomy_Field {
77
  if ( empty( $meta ) ) {
78
  return $field['multiple'] ? array() : '';
79
  }
80
- $meta = array_filter( wp_parse_id_list( $meta ) );
 
81
 
82
  return $field['multiple'] ? $meta : reset( $meta );
83
  }
@@ -97,7 +98,8 @@ class RWMB_Taxonomy_Advanced_Field extends RWMB_Taxonomy_Field {
97
  $post_id = get_the_ID();
98
  }
99
 
100
- $value = self::meta( $post_id, '', $field );
 
101
  if ( empty( $value ) ) {
102
  return null;
103
  }
77
  if ( empty( $meta ) ) {
78
  return $field['multiple'] ? array() : '';
79
  }
80
+ $meta = is_array( $meta ) ? array_map( 'wp_parse_id_list', $meta ) : wp_parse_id_list( $meta );
81
+ $meta = array_filter( $meta );
82
 
83
  return $field['multiple'] ? $meta : reset( $meta );
84
  }
98
  $post_id = get_the_ID();
99
  }
100
 
101
+ // Get raw meta value in the database, no escape.
102
+ $value = self::call( $field, 'raw_meta', $post_id, $args );
103
  if ( empty( $value ) ) {
104
  return null;
105
  }
inc/functions.php CHANGED
@@ -217,7 +217,7 @@ if ( ! function_exists( 'rwmb_get_registry' ) ) {
217
  $class = 'RWMB_' . ucwords( $type ) . '_Registry';
218
  $class = str_replace( ' ', '_', $class );
219
  if ( ! isset( $data[ $type ] ) ) {
220
- $data[ $type ] = new $class;
221
  }
222
 
223
  return $data[ $type ];
@@ -249,12 +249,34 @@ if ( ! function_exists( 'rwmb_get_storage' ) ) {
249
  /**
250
  * Get storage instance.
251
  *
252
- * @param string $object_type Object type. Use post or term.
 
253
  * @return RWMB_Storage_Interface
254
  */
255
- function rwmb_get_storage( $object_type ) {
256
  $class_name = rwmb_get_storage_class_name( $object_type );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
 
258
- return rwmb_get_registry( 'storage' )->get( $class_name );
259
  }
260
  }
217
  $class = 'RWMB_' . ucwords( $type ) . '_Registry';
218
  $class = str_replace( ' ', '_', $class );
219
  if ( ! isset( $data[ $type ] ) ) {
220
+ $data[ $type ] = new $class();
221
  }
222
 
223
  return $data[ $type ];
249
  /**
250
  * Get storage instance.
251
  *
252
+ * @param string $object_type Object type. Use post or term.
253
+ * @param RW_Meta_Box $meta_box Meta box object. Optional.
254
  * @return RWMB_Storage_Interface
255
  */
256
+ function rwmb_get_storage( $object_type, $meta_box = null ) {
257
  $class_name = rwmb_get_storage_class_name( $object_type );
258
+ $storage = rwmb_get_registry( 'storage' )->get( $class_name );
259
+
260
+ return apply_filters( 'rwmb_get_storage', $storage, $object_type, $meta_box );
261
+ }
262
+ }
263
+
264
+ if ( ! function_exists( 'rwmb_get_meta_box' ) ) {
265
+ /**
266
+ * Get meta box object from meta box data.
267
+ *
268
+ * @param array $meta_box Array of meta box data.
269
+ * @return RW_Meta_Box
270
+ */
271
+ function rwmb_get_meta_box( $meta_box ) {
272
+ /**
273
+ * Allow filter meta box class name.
274
+ *
275
+ * @var string Meta box class name.
276
+ * @var array Meta box data.
277
+ */
278
+ $class_name = apply_filters( 'rwmb_meta_box_class_name', 'RW_Meta_Box', $meta_box );
279
 
280
+ return new $class_name( $meta_box );
281
  }
282
  }
inc/loader.php CHANGED
@@ -18,7 +18,7 @@ class RWMB_Loader {
18
  */
19
  protected function constants() {
20
  // Script version, used to add version for scripts and styles.
21
- define( 'RWMB_VER', '4.12.1' );
22
 
23
  list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
24
 
@@ -72,7 +72,7 @@ class RWMB_Loader {
72
 
73
  // Register autoload for classes.
74
  require_once RWMB_INC_DIR . 'autoloader.php';
75
- $autoloader = new RWMB_Autoloader;
76
  $autoloader->add( RWMB_INC_DIR, 'RW_' );
77
  $autoloader->add( RWMB_INC_DIR, 'RWMB_' );
78
  $autoloader->add( RWMB_INC_DIR . 'fields', 'RWMB_', '_Field' );
@@ -82,20 +82,20 @@ class RWMB_Loader {
82
  $autoloader->register();
83
 
84
  // Plugin core.
85
- $core = new RWMB_Core;
86
  $core->init();
87
 
88
  // Validation module.
89
- new RWMB_Validation;
90
 
91
- $sanitize = new RWMB_Sanitizer;
92
  $sanitize->init();
93
 
94
- $media_modal = new RWMB_Media_Modal;
95
  $media_modal->init();
96
 
97
  // WPML Compatibility.
98
- $wpml = new RWMB_WPML;
99
  $wpml->init();
100
 
101
  // Public functions.
18
  */
19
  protected function constants() {
20
  // Script version, used to add version for scripts and styles.
21
+ define( 'RWMB_VER', '4.12.4' );
22
 
23
  list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
24
 
72
 
73
  // Register autoload for classes.
74
  require_once RWMB_INC_DIR . 'autoloader.php';
75
+ $autoloader = new RWMB_Autoloader();
76
  $autoloader->add( RWMB_INC_DIR, 'RW_' );
77
  $autoloader->add( RWMB_INC_DIR, 'RWMB_' );
78
  $autoloader->add( RWMB_INC_DIR . 'fields', 'RWMB_', '_Field' );
82
  $autoloader->register();
83
 
84
  // Plugin core.
85
+ $core = new RWMB_Core();
86
  $core->init();
87
 
88
  // Validation module.
89
+ new RWMB_Validation();
90
 
91
+ $sanitize = new RWMB_Sanitizer();
92
  $sanitize->init();
93
 
94
+ $media_modal = new RWMB_Media_Modal();
95
  $media_modal->init();
96
 
97
  // WPML Compatibility.
98
+ $wpml = new RWMB_WPML();
99
  $wpml->init();
100
 
101
  // Public functions.
inc/meta-box.php CHANGED
@@ -49,22 +49,34 @@ class RW_Meta_Box {
49
  * @param array $meta_box Meta box definition.
50
  */
51
  public function __construct( $meta_box ) {
 
 
 
52
  $storage = $this->get_storage();
53
  if ( ! $storage ) {
54
  return;
55
  }
56
 
57
- $meta_box = self::normalize( $meta_box );
58
- $meta_box['fields'] = self::normalize_fields( $meta_box['fields'], $storage );
59
-
60
- $this->meta_box = $meta_box;
61
-
62
  if ( $this->is_shown() ) {
63
  $this->global_hooks();
64
  $this->object_hooks();
65
  }
66
  }
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  /**
69
  * Conditional check for whether initializing meta box.
70
  *
@@ -191,7 +203,7 @@ class RW_Meta_Box {
191
  * Callback function to show fields in meta box
192
  */
193
  public function show() {
194
- $this->set_object_id();
195
  $saved = $this->is_saved();
196
 
197
  // Container.
@@ -235,9 +247,11 @@ class RW_Meta_Box {
235
  $this->saved = true;
236
 
237
  // Make sure meta is added to the post, not a revision.
238
- $the_post = wp_is_post_revision( $post_id );
239
- if ( $the_post ) {
240
- $post_id = $the_post;
 
 
241
  }
242
 
243
  // Before save action.
@@ -412,7 +426,7 @@ class RW_Meta_Box {
412
  */
413
  public function set_object_id( $id = null ) {
414
  if ( null === $this->object_id ) {
415
- $this->object_id = null === $id ? get_the_ID() : $id;
416
  }
417
  }
418
 
@@ -430,7 +444,16 @@ class RW_Meta_Box {
430
  *
431
  * @return RWMB_Storage_Interface
432
  */
433
- protected function get_storage() {
434
- return rwmb_get_storage( $this->object_type );
 
 
 
 
 
 
 
 
 
435
  }
436
  }
49
  * @param array $meta_box Meta box definition.
50
  */
51
  public function __construct( $meta_box ) {
52
+ $meta_box = self::normalize( $meta_box );
53
+ $this->meta_box = $meta_box;
54
+
55
  $storage = $this->get_storage();
56
  if ( ! $storage ) {
57
  return;
58
  }
59
 
60
+ $this->meta_box['fields'] = self::normalize_fields( $meta_box['fields'], $storage );
 
 
 
 
61
  if ( $this->is_shown() ) {
62
  $this->global_hooks();
63
  $this->object_hooks();
64
  }
65
  }
66
 
67
+ /**
68
+ * Add fields to field registry.
69
+ */
70
+ public function register_fields() {
71
+ $field_registry = rwmb_get_registry( 'field' );
72
+
73
+ foreach ( $this->post_types as $post_type ) {
74
+ foreach ( $this->fields as $field ) {
75
+ $field_registry->add( $field, $post_type );
76
+ }
77
+ }
78
+ }
79
+
80
  /**
81
  * Conditional check for whether initializing meta box.
82
  *
203
  * Callback function to show fields in meta box
204
  */
205
  public function show() {
206
+ $this->set_object_id( $this->get_current_object_id() );
207
  $saved = $this->is_saved();
208
 
209
  // Container.
247
  $this->saved = true;
248
 
249
  // Make sure meta is added to the post, not a revision.
250
+ if ( 'post' === $this->object_type ) {
251
+ $the_post = wp_is_post_revision( $post_id );
252
+ if ( $the_post ) {
253
+ $post_id = $the_post;
254
+ }
255
  }
256
 
257
  // Before save action.
426
  */
427
  public function set_object_id( $id = null ) {
428
  if ( null === $this->object_id ) {
429
+ $this->object_id = $id;
430
  }
431
  }
432
 
444
  *
445
  * @return RWMB_Storage_Interface
446
  */
447
+ public function get_storage() {
448
+ return rwmb_get_storage( $this->object_type, $this );
449
+ }
450
+
451
+ /**
452
+ * Get current object id.
453
+ *
454
+ * @return int|string
455
+ */
456
+ protected function get_current_object_id() {
457
+ return get_the_ID();
458
  }
459
  }
inc/storages/base.php CHANGED
@@ -22,7 +22,7 @@ class RWMB_Base_Storage implements RWMB_Storage_Interface {
22
  *
23
  * @param int $object_id ID of the object metadata is for.
24
  * @param string $meta_key Optional. Metadata key. If not specified, retrieve all metadata for
25
- * the specified object.
26
  * @param bool|array $args Optional, default is false.
27
  * If true, return only the first value of the specified meta_key.
28
  * If is array, use the `single` element.
@@ -66,7 +66,7 @@ class RWMB_Base_Storage implements RWMB_Storage_Interface {
66
  * @param string $meta_key Metadata key.
67
  * @param mixed $meta_value Metadata value. Must be serializable if non-scalar.
68
  * @param mixed $prev_value Optional. If specified, only update existing metadata entries with
69
- * the specified value. Otherwise, update all entries.
70
  * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
71
  *
72
  * @see update_metadata()
22
  *
23
  * @param int $object_id ID of the object metadata is for.
24
  * @param string $meta_key Optional. Metadata key. If not specified, retrieve all metadata for
25
+ * the specified object.
26
  * @param bool|array $args Optional, default is false.
27
  * If true, return only the first value of the specified meta_key.
28
  * If is array, use the `single` element.
66
  * @param string $meta_key Metadata key.
67
  * @param mixed $meta_value Metadata value. Must be serializable if non-scalar.
68
  * @param mixed $prev_value Optional. If specified, only update existing metadata entries with
69
+ * the specified value. Otherwise, update all entries.
70
  * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
71
  *
72
  * @see update_metadata()
inc/wpml.php CHANGED
@@ -53,7 +53,7 @@ class RWMB_WPML {
53
  }
54
 
55
  $field = rwmb_get_registry( 'field' )->get( $meta_data['key'], get_post_type( $meta_data['master_post_id'] ) );
56
- if ( false !== $field || ! in_array( $field['type'], $this->field_types, true ) ) {
57
  return $value;
58
  }
59
 
53
  }
54
 
55
  $field = rwmb_get_registry( 'field' )->get( $meta_data['key'], get_post_type( $meta_data['master_post_id'] ) );
56
+ if ( false === $field || ! in_array( $field['type'], $this->field_types, true ) ) {
57
  return $value;
58
  }
59
 
js/autocomplete.js CHANGED
@@ -39,11 +39,11 @@ jQuery( function ( $ ) {
39
  }
40
 
41
  $( '.rwmb-autocomplete-wrapper input[type="hidden"]' ).each( updateAutocomplete );
42
- $( '.rwmb-input' ).on( 'clone', ':input.rwmb-autocomplete', updateAutocomplete );
43
-
44
- // Handle remove action
45
- $( document ).on( 'click', '.rwmb-autocomplete-result .actions', function () {
46
- // remove result
47
- $( this ).parent().remove();
48
- } );
49
  } );
39
  }
40
 
41
  $( '.rwmb-autocomplete-wrapper input[type="hidden"]' ).each( updateAutocomplete );
42
+ $( document )
43
+ .on( 'clone', '.rwmb-autocomplete', updateAutocomplete )
44
+ // Handle remove action
45
+ .on( 'click', '.rwmb-autocomplete-result .actions', function () {
46
+ // remove result
47
+ $( this ).parent().remove();
48
+ } );
49
  } );
js/autosave.js CHANGED
@@ -1,14 +1,16 @@
1
- jQuery( function ( $ ) {
2
  'use strict';
3
 
4
- $( document ).ajaxSend( function ( e, xhr, s ) {
5
- if ( typeof s.data !== 'undefined' && - 1 !== s.data.indexOf( 'action=autosave' ) ) {
6
- $( '.rwmb-meta-box' ).each( function () {
7
- var $meta_box = $( this );
8
- if ( $meta_box.data( 'autosave' ) === true ) {
9
- s.data += '&' + $meta_box.find( ':input' ).serialize();
10
- }
11
- } );
12
  }
 
 
 
 
 
 
 
13
  } );
14
- } );
1
+ ( function ( $, document ) {
2
  'use strict';
3
 
4
+ $( document ).ajaxSend( function ( event, xhr, settings ) {
5
+ if ( typeof settings.data === 'undefined' || -1 === settings.data.indexOf( 'wp_autosave' ) ) {
6
+ return;
 
 
 
 
 
7
  }
8
+ var inputSelectors = 'input[class*="rwmb"], textarea[class*="rwmb"], select[class*="rwmb"], button[class*="rwmb"], input[name^="nonce_"]';
9
+ $( '.rwmb-meta-box' ).each( function () {
10
+ var $meta_box = $( this );
11
+ if ( true === $meta_box.data( 'autosave' ) ) {
12
+ settings.data += '&' + $meta_box.find( inputSelectors ).serialize();
13
+ }
14
+ } );
15
  } );
16
+ } )( jQuery, document );
js/clone.js CHANGED
@@ -6,11 +6,11 @@ jQuery( function ( $ ) {
6
  var cloneIndex = {
7
  /**
8
  * Set index for fields in a .rwmb-clone
9
- * @param $clone .rwmb-clone element
10
  * @param index Index value
11
  */
12
- set: function ( $clone, index ) {
13
- $clone.find( ':input[class|="rwmb"]' ).each( function () {
14
  var $field = $( this );
15
 
16
  // Name attribute
@@ -29,7 +29,7 @@ jQuery( function ( $ ) {
29
  } );
30
 
31
  // Address button's value attribute
32
- var $address = $clone.find( '.rwmb-map-goto-address-button' );
33
  if ( $address.length ) {
34
  var value = $address.attr( 'value' );
35
  $address.attr( 'value', cloneIndex.replace( index, value, '_' ) );
@@ -43,6 +43,7 @@ jQuery( function ( $ ) {
43
  * @param before String before returned value
44
  * @param after String after returned value
45
  * @param alternative Check if attribute does not contain any integer, will reset the attribute?
 
46
  * @return string
47
  */
48
  replace: function ( index, value, before, after, alternative, isEnd ) {
@@ -83,31 +84,63 @@ jQuery( function ( $ ) {
83
  }
84
  };
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  /**
87
  * Clone fields
88
  * @param $container A div container which has all fields
89
- * @return void
90
  */
91
  function clone( $container ) {
92
- var $last = $container.children( '.rwmb-clone:last' ),
93
  $clone = $last.clone(),
94
- $input = $clone.find( ':input[class|="rwmb"]' ),
 
95
  nextIndex = cloneIndex.nextIndex( $container );
96
 
97
  // Reset value for fields
98
- $input.each( function () {
99
- var $field = $( this );
100
- if ( $field.is( ':radio' ) || $field.is( ':checkbox' ) ) {
101
- // Reset 'checked' attribute
102
- $field.prop( 'checked', false );
103
- } else if ( $field.is( 'select' ) ) {
104
- // Reset select
105
- $field.prop( 'selectedIndex', - 1 )
106
- } else if ( ! $field.hasClass( 'rwmb-hidden' ) ) {
107
- // Reset value
108
- $field.val( '' );
109
- }
110
- } );
111
 
112
  // Insert Clone
113
  $clone.insertAfter( $last );
@@ -116,18 +149,16 @@ jQuery( function ( $ ) {
116
  $clone.trigger( 'clone_instance', nextIndex );
117
 
118
  // Set fields index. Must run before trigger clone event.
119
- cloneIndex.set( $clone, nextIndex );
120
 
121
  // Trigger custom clone event
122
- $input.trigger( 'clone', nextIndex );
123
  }
124
 
125
  /**
126
  * Hide remove buttons when there's only 1 of them
127
  *
128
  * @param $container .rwmb-input container
129
- *
130
- * @return void
131
  */
132
  function toggleRemoveButtons( $container ) {
133
  var $clones = $container.children( '.rwmb-clone' );
@@ -144,8 +175,6 @@ jQuery( function ( $ ) {
144
  * Used with [data-max-clone] attribute. When max clone is reached, the add button is hid and vice versa
145
  *
146
  * @param $container .rwmb-input container
147
- *
148
- * @return void
149
  */
150
  function toggleAddButton( $container ) {
151
  var $button = $container.find( '.add-clone' ),
6
  var cloneIndex = {
7
  /**
8
  * Set index for fields in a .rwmb-clone
9
+ * @param $inputs .rwmb-clone element
10
  * @param index Index value
11
  */
12
+ set: function ( $inputs, index ) {
13
+ $inputs.each( function () {
14
  var $field = $( this );
15
 
16
  // Name attribute
29
  } );
30
 
31
  // Address button's value attribute
32
+ var $address = $inputs.filter( '.rwmb-map-goto-address-button' );
33
  if ( $address.length ) {
34
  var value = $address.attr( 'value' );
35
  $address.attr( 'value', cloneIndex.replace( index, value, '_' ) );
43
  * @param before String before returned value
44
  * @param after String after returned value
45
  * @param alternative Check if attribute does not contain any integer, will reset the attribute?
46
+ * @param isEnd Check if we find string at the end?
47
  * @return string
48
  */
49
  replace: function ( index, value, before, after, alternative, isEnd ) {
84
  }
85
  };
86
 
87
+ // Object holds all method related to fields' value when clone.
88
+ var cloneValue = {
89
+ /**
90
+ * Reset field value when clone. Expect this = current input.
91
+ */
92
+ reset: function() {
93
+ cloneValue.$field = $( this );
94
+ cloneValue.type = cloneValue.$field.attr( 'type' );
95
+
96
+ if ( true === cloneValue.$field.data( 'clone-default' ) ) {
97
+ cloneValue.resetToDefault();
98
+ } else {
99
+ cloneValue.clear();
100
+ }
101
+ },
102
+ /**
103
+ * Reset field value to its default.
104
+ */
105
+ resetToDefault: function() {
106
+ var defaultValue = cloneValue.$field.data( 'default' );
107
+ if ( 'radio' === cloneValue.type ) {
108
+ cloneValue.$field.prop( 'checked', cloneValue.$field.val() === defaultValue );
109
+ } else if ( 'checkbox' === cloneValue.type ) {
110
+ cloneValue.$field.prop( 'checked', !!defaultValue );
111
+ } else if ( 'select' === cloneValue.type ) {
112
+ cloneValue.$field.find( 'option[value="' + defaultValue + '"]' ).prop( 'selected', true );
113
+ } else if ( 'hidden' !== cloneValue.type ) {
114
+ cloneValue.$field.val( defaultValue );
115
+ }
116
+ },
117
+ /**
118
+ * Clear field value.
119
+ */
120
+ clear: function() {
121
+ if ( 'radio' === cloneValue.type || 'checkbox' === cloneValue.type ) {
122
+ cloneValue.$field.prop( 'checked', false );
123
+ } else if ( 'select' === cloneValue.type ) {
124
+ cloneValue.$field.prop( 'selectedIndex', - 1 );
125
+ } else if ( 'hidden' !== cloneValue.type ) {
126
+ cloneValue.$field.val( '' );
127
+ }
128
+ }
129
+ };
130
+
131
  /**
132
  * Clone fields
133
  * @param $container A div container which has all fields
 
134
  */
135
  function clone( $container ) {
136
+ var $last = $container.children( '.rwmb-clone' ).last(),
137
  $clone = $last.clone(),
138
+ inputSelectors = 'input[class*="rwmb"], textarea[class*="rwmb"], select[class*="rwmb"], button[class*="rwmb"]',
139
+ $inputs = $clone.find( inputSelectors ),
140
  nextIndex = cloneIndex.nextIndex( $container );
141
 
142
  // Reset value for fields
143
+ $inputs.each( cloneValue.reset );
 
 
 
 
 
 
 
 
 
 
 
 
144
 
145
  // Insert Clone
146
  $clone.insertAfter( $last );
149
  $clone.trigger( 'clone_instance', nextIndex );
150
 
151
  // Set fields index. Must run before trigger clone event.
152
+ cloneIndex.set( $inputs, nextIndex );
153
 
154
  // Trigger custom clone event
155
+ $inputs.trigger( 'clone', nextIndex );
156
  }
157
 
158
  /**
159
  * Hide remove buttons when there's only 1 of them
160
  *
161
  * @param $container .rwmb-input container
 
 
162
  */
163
  function toggleRemoveButtons( $container ) {
164
  var $clones = $container.children( '.rwmb-clone' );
175
  * Used with [data-max-clone] attribute. When max clone is reached, the add button is hid and vice versa
176
  *
177
  * @param $container .rwmb-input container
 
 
178
  */
179
  function toggleAddButton( $container ) {
180
  var $button = $container.find( '.add-clone' ),
js/date.js CHANGED
@@ -55,6 +55,6 @@ jQuery( function ( $ ) {
55
  return Math.floor( milliseconds / 1000 );
56
  }
57
 
58
- $( ':input.rwmb-date' ).each( update );
59
- $( '.rwmb-input' ).on( 'clone', ':input.rwmb-date', update );
60
  } );
55
  return Math.floor( milliseconds / 1000 );
56
  }
57
 
58
+ $( '.rwmb-date' ).each( update );
59
+ $( document ).on( 'clone', '.rwmb-date', update );
60
  } );
js/datetime.js CHANGED
@@ -64,6 +64,6 @@ jQuery( function ( $ ) {
64
  $.timepicker.setDefaults( $.timepicker.regional[RWMB_Datetime.localeShort] );
65
  }
66
 
67
- $( ':input.rwmb-datetime' ).each( update );
68
- $( '.rwmb-input' ).on( 'clone', ':input.rwmb-datetime', update );
69
  } );
64
  $.timepicker.setDefaults( $.timepicker.regional[RWMB_Datetime.localeShort] );
65
  }
66
 
67
+ $( '.rwmb-datetime' ).each( update );
68
+ $( document ).on( 'clone', '.rwmb-datetime', update );
69
  } );
js/file-upload.js CHANGED
@@ -179,10 +179,12 @@ jQuery( function ( $ ) {
179
  * @return void
180
  */
181
  function init() {
182
- new FileUploadField( {input: this, el: $( this ).siblings( 'div.rwmb-media-view' )} );
 
 
 
183
  }
184
 
185
- $( ':input.rwmb-file_upload' ).each( init );
186
- $( '.rwmb-input' )
187
- .on( 'clone', ':input.rwmb-file_upload', init )
188
  } );
179
  * @return void
180
  */
181
  function init() {
182
+ var view = new FileUploadField( { input: this } );
183
+ //Remove old then add new
184
+ $( this ).siblings( 'div.rwmb-media-view' ).remove();
185
+ $( this ).after( view.el );
186
  }
187
 
188
+ $( '.rwmb-file_upload' ).each( init );
189
+ $( document ).on( 'clone', '.rwmb-file_upload', init )
 
190
  } );
js/image-advanced.js CHANGED
@@ -29,7 +29,10 @@ jQuery( function ( $ ) {
29
  * Initialize image fields
30
  */
31
  function initImageField() {
32
- new ImageField( {input: this, el: $( this ).siblings( 'div.rwmb-media-view' )} );
 
 
 
33
  }
34
 
35
  $( 'input.rwmb-image_advanced' ).each( initImageField );
29
  * Initialize image fields
30
  */
31
  function initImageField() {
32
+ var view = new ImageField( { input: this } );
33
+ //Remove old then add new
34
+ $( this ).siblings( 'div.rwmb-media-view' ).remove();
35
+ $( this ).after( view.el );
36
  }
37
 
38
  $( 'input.rwmb-image_advanced' ).each( initImageField );
js/image-upload.js CHANGED
@@ -19,10 +19,13 @@ jQuery( function ( $ ) {
19
  * @return void
20
  */
21
  function init() {
22
- new ImageUploadField( {input: this, el: $( this ).siblings( 'div.rwmb-media-view' )} );
 
 
 
23
  }
24
 
25
- $( ':input.rwmb-image_upload, :input.rwmb-plupload_image' ).each( init );
26
- $( '.rwmb-input' )
27
- .on( 'clone', ':input.rwmb-image_upload, :input.rwmb-plupload_image', init )
28
  } );
19
  * @return void
20
  */
21
  function init() {
22
+ var view = new ImageUploadField( { input: this } );
23
+ //Remove old then add new
24
+ $( this ).siblings( 'div.rwmb-media-view' ).remove();
25
+ $( this ).after( view.el );
26
  }
27
 
28
+ $( '.rwmb-image_upload, .rwmb-plupload_image' ).each( init );
29
+ $( document )
30
+ .on( 'clone', '.rwmb-image_upload, .rwmb-plupload_image', init )
31
  } );
js/map.js CHANGED
@@ -1,4 +1,6 @@
1
- (function ( $ ) {
 
 
2
  'use strict';
3
 
4
  // Use function construction to store map & DOM elements separately for each instance
@@ -6,6 +8,9 @@
6
  this.$container = $container;
7
  };
8
 
 
 
 
9
  // Use prototype for better performance
10
  MapField.prototype = {
11
  // Initialize everything
@@ -24,7 +29,7 @@
24
  this.canvas = this.$canvas[0];
25
  this.$coordinate = this.$container.find( '.rwmb-map-coordinate' );
26
  this.$findButton = this.$container.find( '.rwmb-map-goto-address-button' );
27
- this.addressField = this.$findButton.val();
28
  },
29
 
30
  // Initialize map elements
@@ -42,20 +47,19 @@
42
  mapTypeId: google.maps.MapTypeId.ROADMAP
43
  } );
44
  this.marker = new google.maps.Marker( {position: latLng, map: this.map, draggable: true} );
45
- this.geocoder = new google.maps.Geocoder();
46
  },
47
 
48
  // Initialize marker position
49
  initMarkerPosition: function () {
50
- var coord = this.$coordinate.val(),
51
- l,
52
  zoom;
53
 
54
- if ( coord ) {
55
- l = coord.split( ',' );
56
- this.marker.setPosition( new google.maps.LatLng( l[0], l[1] ) );
57
 
58
- zoom = l.length > 2 ? parseInt( l[2], 10 ) : 14;
59
 
60
  this.map.setCenter( this.marker.position );
61
  this.map.setZoom( zoom );
@@ -90,8 +94,7 @@
90
  * Add a custom event that allows other scripts to refresh the maps when needed
91
  * For example: when maps is in tabs or hidden div (this is known issue of Google Maps)
92
  *
93
- * @see https://developers.google.com/maps/documentation/javascript/reference
94
- * ('resize' Event)
95
  */
96
  $( window ).on( 'rwmb_map_refresh', function () {
97
  that.refresh();
@@ -144,7 +147,7 @@
144
  'address': request.term,
145
  'region': that.$canvas.data( 'region' )
146
  };
147
- that.geocoder.geocode( options, function ( results ) {
148
  response( $.map( results, function ( item ) {
149
  return {
150
  label: item.formatted_address,
@@ -180,39 +183,38 @@
180
  that = this;
181
 
182
  for ( loop = 0; loop < fieldList.length; loop ++ ) {
183
- addressList[loop] = jQuery( '#' + fieldList[loop] ).val();
184
  }
185
 
186
  address = addressList.join( ',' ).replace( /\n/g, ',' ).replace( /,,/g, ',' );
187
 
188
- if ( address ) {
189
- this.geocoder.geocode( {'address': address}, function ( results, status ) {
190
- if ( status === google.maps.GeocoderStatus.OK ) {
191
- that.map.setCenter( results[0].geometry.location );
192
- that.marker.setPosition( results[0].geometry.location );
193
- that.updateCoordinate( results[0].geometry.location );
194
- }
195
- } );
196
  }
 
 
 
 
 
 
 
 
 
197
  }
198
  };
199
 
200
- $( function () {
201
  $( '.rwmb-map-field' ).each( function () {
202
  var field = new MapField( $( this ) );
203
  field.init();
204
 
205
  $( this ).data( 'mapController', field );
206
  } );
 
207
 
208
- $( '.rwmb-input' ).on( 'clone', function () {
209
- $( '.rwmb-map-field' ).each( function () {
210
- var field = new MapField( $( this ) );
211
- field.init();
212
-
213
- $( this ).data( 'mapController', field );
214
- } );
215
- } );
216
  } );
217
 
218
- })( jQuery );
1
+ /* global google */
2
+
3
+ (function ( $, document, window, google ) {
4
  'use strict';
5
 
6
  // Use function construction to store map & DOM elements separately for each instance
8
  this.$container = $container;
9
  };
10
 
11
+ // Geocoder service.
12
+ var geocoder = new google.maps.Geocoder();
13
+
14
  // Use prototype for better performance
15
  MapField.prototype = {
16
  // Initialize everything
29
  this.canvas = this.$canvas[0];
30
  this.$coordinate = this.$container.find( '.rwmb-map-coordinate' );
31
  this.$findButton = this.$container.find( '.rwmb-map-goto-address-button' );
32
+ this.addressField = this.$container.data( 'address-field' );
33
  },
34
 
35
  // Initialize map elements
47
  mapTypeId: google.maps.MapTypeId.ROADMAP
48
  } );
49
  this.marker = new google.maps.Marker( {position: latLng, map: this.map, draggable: true} );
 
50
  },
51
 
52
  // Initialize marker position
53
  initMarkerPosition: function () {
54
+ var coordinate = this.$coordinate.val(),
55
+ location,
56
  zoom;
57
 
58
+ if ( coordinate ) {
59
+ location = coordinate.split( ',' );
60
+ this.marker.setPosition( new google.maps.LatLng( location[0], location[1] ) );
61
 
62
+ zoom = location.length > 2 ? parseInt( location[2], 10 ) : 14;
63
 
64
  this.map.setCenter( this.marker.position );
65
  this.map.setZoom( zoom );
94
  * Add a custom event that allows other scripts to refresh the maps when needed
95
  * For example: when maps is in tabs or hidden div (this is known issue of Google Maps)
96
  *
97
+ * @see https://developers.google.com/maps/documentation/javascript/reference ('resize' Event)
 
98
  */
99
  $( window ).on( 'rwmb_map_refresh', function () {
100
  that.refresh();
147
  'address': request.term,
148
  'region': that.$canvas.data( 'region' )
149
  };
150
+ geocoder.geocode( options, function ( results ) {
151
  response( $.map( results, function ( item ) {
152
  return {
153
  label: item.formatted_address,
183
  that = this;
184
 
185
  for ( loop = 0; loop < fieldList.length; loop ++ ) {
186
+ addressList[loop] = $( '#' + fieldList[loop] ).val();
187
  }
188
 
189
  address = addressList.join( ',' ).replace( /\n/g, ',' ).replace( /,,/g, ',' );
190
 
191
+ if ( ! address ) {
192
+ return;
 
 
 
 
 
 
193
  }
194
+
195
+ geocoder.geocode( {'address': address}, function ( results, status ) {
196
+ if ( status !== google.maps.GeocoderStatus.OK ) {
197
+ return;
198
+ }
199
+ that.map.setCenter( results[0].geometry.location );
200
+ that.marker.setPosition( results[0].geometry.location );
201
+ that.updateCoordinate( results[0].geometry.location );
202
+ } );
203
  }
204
  };
205
 
206
+ function update() {
207
  $( '.rwmb-map-field' ).each( function () {
208
  var field = new MapField( $( this ) );
209
  field.init();
210
 
211
  $( this ).data( 'mapController', field );
212
  } );
213
+ }
214
 
215
+ $( function () {
216
+ update();
217
+ $( '.rwmb-input' ).on( 'clone', update );
 
 
 
 
 
218
  } );
219
 
220
+ })( jQuery, document, window, google );
js/media.js CHANGED
@@ -31,13 +31,13 @@ jQuery( function ( $ ) {
31
  if ( max > 0 && left <= 0 ) {
32
  return this;
33
  }
34
-
35
- if ( ! models.hasOwnProperty( 'length' ) ) {
36
- models = [models];
37
- } else if ( models instanceof media.model.Attachments ) {
38
- models = models.models;
 
39
  }
40
-
41
  if ( left > 0 ) {
42
  models = _.difference( models, this.models );
43
  models = _.first( models, left );
@@ -118,6 +118,7 @@ jQuery( function ( $ ) {
118
  * Sets up media field view and subviews
119
  */
120
  MediaField = views.MediaField = Backbone.View.extend( {
 
121
  initialize: function ( options ) {
122
  var that = this;
123
  this.$input = $( options.input );
@@ -126,7 +127,7 @@ jQuery( function ( $ ) {
126
  fieldName: this.$input.attr( 'name' ) + '[]',
127
  ids: this.$input.val().split( ',' )
128
  },
129
- this.$el.data( 'options' )
130
  ) );
131
 
132
  // Create views
@@ -142,7 +143,11 @@ jQuery( function ( $ ) {
142
 
143
  // Listen for destroy event on input
144
  this.$input.on( 'remove', function () {
145
- this.controller.destroy();
 
 
 
 
146
  } );
147
 
148
  this.controller.get( 'items' ).on( 'add remove reset', _.debounce( function () {
@@ -208,6 +213,7 @@ jQuery( function ( $ ) {
208
 
209
  this.listenTo( this.collection, 'add', this.addItemView );
210
  this.listenTo( this.collection, 'remove', this.removeItemView );
 
211
 
212
  // Sort media using sortable
213
  this.initSortable();
@@ -244,6 +250,16 @@ jQuery( function ( $ ) {
244
  this.collection.remove( item );
245
  },
246
 
 
 
 
 
 
 
 
 
 
 
247
  switchItem: function ( item ) {
248
  if ( this._switchFrame ) {
249
  //this.stopListening( this._frame );
@@ -304,22 +320,14 @@ jQuery( function ( $ ) {
304
  initSortable: function () {
305
  var collection = this.controller.get( 'items' );
306
  this.$el.sortable( {
307
- // Change the position of the attachment as soon as the
308
- // mouse pointer overlaps a thumbnail.
309
- tolerance: 'pointer',
310
 
311
  // Record the initial `index` of the dragged model.
312
  start: function ( event, ui ) {
313
  ui.item.data( 'sortableIndexStart', ui.item.index() );
314
  },
315
 
316
- // Stop trigger 'click' on item. 'click' means reselect.
317
- stop: function ( event ) {
318
- $( event.originalEvent.target ).one( 'click', function ( e ) {
319
- e.stopImmediatePropagation();
320
- } );
321
- },
322
-
323
  // Update the model's index in the collection.
324
  // Do so silently, as the view is already accurate.
325
  update: function ( event, ui ) {
@@ -361,6 +369,7 @@ jQuery( function ( $ ) {
361
 
362
  // Re-render if changes happen in controller
363
  this.listenTo( this.controller.get( 'items' ), 'update', this.render );
 
364
 
365
  // Render
366
  this.render();
@@ -591,7 +600,10 @@ jQuery( function ( $ ) {
591
  * @return void
592
  */
593
  function initMediaField() {
594
- new MediaField( {input: this, el: $( this ).siblings( 'div.rwmb-media-view' )} );
 
 
 
595
  }
596
 
597
  $( '.rwmb-file_advanced' ).each( initMediaField );
31
  if ( max > 0 && left <= 0 ) {
32
  return this;
33
  }
34
+ if( models) {
35
+ if ( ! models.hasOwnProperty( 'length' ) ) {
36
+ models = [models];
37
+ } else if ( models instanceof media.model.Attachments ) {
38
+ models = models.models;
39
+ }
40
  }
 
41
  if ( left > 0 ) {
42
  models = _.difference( models, this.models );
43
  models = _.first( models, left );
118
  * Sets up media field view and subviews
119
  */
120
  MediaField = views.MediaField = Backbone.View.extend( {
121
+ className: 'rwmb-media-view',
122
  initialize: function ( options ) {
123
  var that = this;
124
  this.$input = $( options.input );
127
  fieldName: this.$input.attr( 'name' ) + '[]',
128
  ids: this.$input.val().split( ',' )
129
  },
130
+ this.$input.data( 'options' )
131
  ) );
132
 
133
  // Create views
143
 
144
  // Listen for destroy event on input
145
  this.$input.on( 'remove', function () {
146
+ that.controller.destroy();
147
+ } );
148
+
149
+ this.$input.on( 'media:reset', function() {
150
+ that.controller.get( 'items' ).reset();
151
  } );
152
 
153
  this.controller.get( 'items' ).on( 'add remove reset', _.debounce( function () {
213
 
214
  this.listenTo( this.collection, 'add', this.addItemView );
215
  this.listenTo( this.collection, 'remove', this.removeItemView );
216
+ this.listenTo( this.collection, 'reset', this.resetItemViews );
217
 
218
  // Sort media using sortable
219
  this.initSortable();
250
  this.collection.remove( item );
251
  },
252
 
253
+ resetItemViews: function( items, options ){
254
+ var that = this;
255
+ _.each( options.previousModels, function( item ){
256
+ that.removeItemView( item );
257
+ } );
258
+ items.each( function( item ) {
259
+ that.addItemView( item );
260
+ } );
261
+ },
262
+
263
  switchItem: function ( item ) {
264
  if ( this._switchFrame ) {
265
  //this.stopListening( this._frame );
320
  initSortable: function () {
321
  var collection = this.controller.get( 'items' );
322
  this.$el.sortable( {
323
+ // Clone the element and the clone will be dragged. Prevent trigger click on the image, which means reselect.
324
+ helper : 'clone',
 
325
 
326
  // Record the initial `index` of the dragged model.
327
  start: function ( event, ui ) {
328
  ui.item.data( 'sortableIndexStart', ui.item.index() );
329
  },
330
 
 
 
 
 
 
 
 
331
  // Update the model's index in the collection.
332
  // Do so silently, as the view is already accurate.
333
  update: function ( event, ui ) {
369
 
370
  // Re-render if changes happen in controller
371
  this.listenTo( this.controller.get( 'items' ), 'update', this.render );
372
+ this.listenTo( this.controller.get( 'items' ), 'reset', this.render );
373
 
374
  // Render
375
  this.render();
600
  * @return void
601
  */
602
  function initMediaField() {
603
+ var view = new MediaField( { input: this } );
604
+ //Remove old then add new
605
+ $( this ).siblings( 'div.rwmb-media-view' ).remove();
606
+ $( this ).after( view.el );
607
  }
608
 
609
  $( '.rwmb-file_advanced' ).each( initMediaField );
js/range.js CHANGED
@@ -15,6 +15,6 @@ jQuery( function ( $ ) {
15
 
16
  }
17
 
18
- $( ':input.rwmb-range' ).each( update );
19
- $( '.rwmb-input' ).on( 'clone', 'input.rwmb-range', update );
20
  } );
15
 
16
  }
17
 
18
+ $( '.rwmb-range' ).each( update );
19
+ $( document ).on( 'clone', '.rwmb-range', update );
20
  } );
js/select-advanced.js CHANGED
@@ -16,6 +16,6 @@ jQuery( function ( $ ) {
16
  rwmbSelect.bindEvents( $this );
17
  }
18
 
19
- $( ':input.rwmb-select_advanced' ).each( update );
20
- $( '.rwmb-input' ).on( 'clone', ':input.rwmb-select_advanced', update );
21
  } );
16
  rwmbSelect.bindEvents( $this );
17
  }
18
 
19
+ $( '.rwmb-select_advanced' ).each( update );
20
+ $( document ).on( 'clone', '.rwmb-select_advanced', update );
21
  } );
js/select.js CHANGED
@@ -67,6 +67,6 @@ jQuery( function ( $ ) {
67
  }
68
 
69
  // Run for select field
70
- $( ':input.rwmb-select' ).each( update );
71
- $( '.rwmb-input' ).on( 'clone', ':input.rwmb-select', update );
72
  } );
67
  }
68
 
69
  // Run for select field
70
+ $( '.rwmb-select' ).each( update );
71
+ $( document ).on( 'clone', '.rwmb-select', update );
72
  } );
js/slider.js CHANGED
@@ -30,6 +30,6 @@ jQuery( function ( $ ) {
30
  $slider.slider( options );
31
  }
32
 
33
- $( ':input.rwmb-slider-value' ).each( rwmb_update_slider );
34
- $( '.rwmb-input' ).on( 'clone', ':input.rwmb-slider-value', rwmb_update_slider );
35
  } );
30
  $slider.slider( options );
31
  }
32
 
33
+ $( '.rwmb-slider-value' ).each( rwmb_update_slider );
34
+ $( document ).on( 'clone', '.rwmb-slider-value', rwmb_update_slider );
35
  } );
js/video.js CHANGED
@@ -35,9 +35,12 @@ jQuery( function ( $ )
35
  */
36
  function initVideoField()
37
  {
38
- new VideoField( { input: this, el: $( this ).siblings( 'div.rwmb-media-view' ) } );
 
 
 
39
  }
40
- $( ':input.rwmb-video' ).each( initVideoField );
41
- $( '.rwmb-input' )
42
- .on( 'clone', ':input.rwmb-video', initVideoField )
43
  } );
35
  */
36
  function initVideoField()
37
  {
38
+ var view = new VideoField( { input: this } );
39
+ //Remove old then add new
40
+ $( this ).siblings( 'div.rwmb-media-view' ).remove();
41
+ $( this ).after( view.el );
42
  }
43
+ $( '.rwmb-video' ).each( initVideoField );
44
+ $( document )
45
+ .on( 'clone', '.rwmb-video', initVideoField )
46
  } );
js/wysiwyg.js CHANGED
@@ -89,6 +89,6 @@ jQuery( function ( $ ) {
89
  .find( '.quicktags-toolbar' ).attr( 'id', 'qt_' + id + '_toolbar' ).html( '' );
90
  }
91
 
92
- $( ':input.rwmb-wysiwyg' ).each( update );
93
- $( '.rwmb-input' ).on( 'clone', ':input.rwmb-wysiwyg', update );
94
  } );
89
  .find( '.quicktags-toolbar' ).attr( 'id', 'qt_' + id + '_toolbar' ).html( '' );
90
  }
91
 
92
+ $( '.rwmb-wysiwyg' ).each( update );
93
+ $( document ).on( 'clone', '.rwmb-wysiwyg', update );
94
  } );
languages/meta-box-fr_FR.mo CHANGED
Binary file
languages/meta-box-fr_FR.po CHANGED
@@ -1,456 +1,217 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Meta Box\n"
4
- "POT-Creation-Date: 2015-02-27 16:16+0100\n"
5
- "PO-Revision-Date: 2015-02-28 09:09+0100\n"
6
- "Last-Translator: \n"
7
- "Language-Team: Frédéric Serva <fred.serva@gmail.com>\n"
8
- "Language: fr\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 1.7.4\n"
13
  "X-Poedit-Basepath: ..\n"
14
  "X-Poedit-SourceCharset: UTF-8\n"
15
  "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
16
- "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;"
17
- "_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
18
- "Plural-Forms: nplurals=2; plural=(n > 1);\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
  "X-Poedit-SearchPathExcluded-0: *.js\n"
 
21
 
22
- #: demo/all-custom-post-types.php:15
23
- msgid "Personal Information"
24
- msgstr "Informations personnelles"
25
 
26
- #: demo/all-custom-post-types.php:20
27
- msgid "Full name"
28
- msgstr "Nom et prénom"
29
 
30
- #: demo/better-include.php:16 demo/include-by-ID-or-page-template.php:8
31
- msgid "Meta Box Title"
32
- msgstr "Titre de la Meta Box"
33
 
34
- #: demo/better-include.php:19 demo/include-by-ID-or-page-template.php:14
35
- msgid "Your images"
36
- msgstr "Vos images"
37
 
38
- #: demo/date-time-js-options.php:8
39
- msgid "Date Time Picker With JS Options"
40
- msgstr "Sélecteur Date et Heure avec Options JS"
 
41
 
42
- #: demo/date-time-js-options.php:12
43
- msgid "Date"
44
- msgstr "Date"
 
45
 
46
- #: demo/date-time-js-options.php:18 demo/demo.php:193
47
- msgid "(yyyy-mm-dd)"
48
- msgstr "(yyyy-mm-dd)"
 
49
 
50
- #: demo/date-time-js-options.php:20
51
- msgid "Select Date"
52
- msgstr "Sélectionnez la date"
53
-
54
- #: demo/date-time-js-options.php:21 demo/demo.php:194
55
- msgid "yy-mm-dd"
56
- msgstr "yy-mm-dd"
57
-
58
- #: demo/date-time-js-options.php:27
59
- msgid "Datetime"
60
- msgstr "Date & Heure combinées"
61
-
62
- #: demo/date-time-js-options.php:38
63
- msgid "Time"
64
- msgstr "Heure"
65
-
66
- #: demo/demo.php:42
67
- msgid "Standard Fields"
68
- msgstr "Champs standards"
69
-
70
- #: demo/demo.php:61
71
- msgid "Text"
72
- msgstr "Texte"
73
-
74
- #: demo/demo.php:65
75
- msgid "Text description"
76
- msgstr "Description du texte"
77
-
78
- #: demo/demo.php:68
79
- msgid "Default text value"
80
- msgstr "Valeur texte par défaut"
81
-
82
- #: demo/demo.php:74
83
- msgid "Checkbox"
84
- msgstr "Case à cocher"
85
-
86
- #: demo/demo.php:82
87
- msgid "Radio"
88
- msgstr "Bouton Radio"
89
-
90
- #: demo/demo.php:88 demo/demo.php:99 demo/demo.php:242 demo/demo.php:253
91
- #: demo/demo.php:302
92
- msgid "Label1"
93
- msgstr "Étiquette1"
94
-
95
- #: demo/demo.php:89 demo/demo.php:100 demo/demo.php:243 demo/demo.php:254
96
- #: demo/demo.php:303
97
- msgid "Label2"
98
- msgstr "Étiquette2"
99
-
100
- #: demo/demo.php:94 demo/demo.php:297 inc/fields/file-input.php:40
101
- msgid "Select"
102
- msgstr "Choisissez"
103
-
104
- #: demo/demo.php:105 demo/demo.php:308 demo/demo.php:333
105
- msgid "Select an Item"
106
- msgstr "Choisissez un élément"
107
-
108
- #: demo/demo.php:112
109
- msgid "Hidden value"
110
- msgstr "Valeur cachée"
111
-
112
- #: demo/demo.php:116
113
- msgid "Password"
114
- msgstr "Mot de passe"
115
-
116
- #: demo/demo.php:122
117
- msgid "Textarea"
118
- msgstr "Zone de texte"
119
-
120
- #: demo/demo.php:123
121
- msgid "Textarea description"
122
- msgstr "Description de la zone de texte"
123
-
124
- #: demo/demo.php:140
125
- msgid "Password is required"
126
- msgstr "Mot de passe requis"
127
-
128
- #: demo/demo.php:141
129
- msgid "Password must be at least 7 characters"
130
- msgstr "Le mot de passe doit comporter au moins 7 caractères."
131
-
132
- #: demo/demo.php:149
133
- msgid "Advanced Fields"
134
- msgstr "Champs spéciaux"
135
-
136
- #: demo/demo.php:155
137
- msgid "Heading"
138
- msgstr "Intertitre"
139
-
140
- #: demo/demo.php:157
141
- msgid "Optional description for this heading"
142
- msgstr "Description facultative pour cet intertitre"
143
-
144
- #: demo/demo.php:161 demo/slider.php:9
145
- msgid "Slider"
146
- msgstr "Slider"
147
-
148
- #: demo/demo.php:166 demo/slider.php:14
149
- msgid "$"
150
- msgstr "$"
151
-
152
- #: demo/demo.php:167 demo/slider.php:15
153
- msgid " USD"
154
- msgstr " USD"
155
-
156
- #: demo/demo.php:178
157
- msgid "Number"
158
- msgstr "Nombre"
159
-
160
- #: demo/demo.php:187
161
- msgid "Date picker"
162
- msgstr "Sélecteur de date"
163
-
164
- #: demo/demo.php:202
165
- msgid "Datetime picker"
166
- msgstr "Sélecteur de Date & Heure combinées"
167
-
168
- #: demo/demo.php:216
169
- msgid "Time picker"
170
- msgstr "Sélecteur d'heure"
171
-
172
- #: demo/demo.php:231
173
- msgid "Color picker"
174
- msgstr "Sélecteur de couleur"
175
-
176
- #: demo/demo.php:237
177
- msgid "Checkbox list"
178
- msgstr "liste de cases à cocher"
179
-
180
- #: demo/demo.php:248
181
- msgid "Autocomplete"
182
- msgstr "Complétion automatique"
183
-
184
- #: demo/demo.php:263
185
- msgid "Email"
186
- msgstr "Email"
187
-
188
- #: demo/demo.php:265
189
- msgid "Email description"
190
- msgstr "Description de l'email"
191
-
192
- #: demo/demo.php:271
193
- msgid "Range"
194
- msgstr "Fourchette"
195
-
196
- #: demo/demo.php:273
197
- msgid "Range description"
198
- msgstr "Description de la fourchette"
199
-
200
- #: demo/demo.php:282
201
- msgid "URL"
202
- msgstr "URL"
203
-
204
- #: demo/demo.php:284
205
- msgid "URL description"
206
- msgstr "Description de l'URL"
207
-
208
- #: demo/demo.php:290
209
- msgid "oEmbed"
210
- msgstr "oEmbed"
211
-
212
- #: demo/demo.php:292
213
- msgid "oEmbed description"
214
- msgstr "Description oEmbed"
215
-
216
- #: demo/demo.php:312
217
- msgid "Taxonomy"
218
- msgstr "Taxonomie"
219
-
220
- #: demo/demo.php:326
221
- msgid "Posts (Pages)"
222
- msgstr "Articles (Pages)"
223
-
224
- #: demo/demo.php:342
225
- msgid "WYSIWYG / Rich Text Editor"
226
- msgstr "Éditeur de texte (WYSIWYG)"
227
-
228
- #: demo/demo.php:347
229
- msgid "WYSIWYG default value"
230
- msgstr "Valeur par défaut WYSIWYG"
231
 
232
- #: demo/demo.php:363 demo/force-delete.php:12
233
- msgid "File Upload"
234
- msgstr "Mise en ligne d'un fichier"
 
235
 
236
- #: demo/demo.php:369
237
- msgid "File Advanced Upload"
238
- msgstr "Mise en ligne avancée d'un fichier"
 
239
 
240
- #: demo/demo.php:377 demo/force-delete.php:19
241
- msgid "Image Upload"
242
- msgstr "Mise en ligne d'une image"
 
243
 
244
- #: demo/demo.php:383 demo/force-delete.php:25
245
- msgid "Thickbox Image Upload"
246
- msgstr "Mise en ligne d'une image (Thickbox)"
 
247
 
248
- #: demo/demo.php:389 demo/force-delete.php:32
249
- msgid "Plupload Image Upload"
250
- msgstr "Mise en ligne d'une image (Plupload)"
 
251
 
252
- #: demo/demo.php:396
253
- msgid "Image Advanced Upload"
254
- msgstr "Mise en ligne avancée d'une image"
 
255
 
256
- #: demo/force-delete.php:8
257
- msgid "Test Meta Box"
258
- msgstr "Test de Meta Box"
259
 
260
- #: demo/image-select.php:6
261
- msgid "Image Select Demo"
262
- msgstr "Démo de Sélection d'image"
263
 
264
- #: demo/image-select.php:10
265
- msgid "Layout"
266
- msgstr "Disposition:"
267
 
268
- #: demo/map.php:6
269
- msgid "Google Map"
270
- msgstr "Google Map"
271
 
272
- #: demo/map.php:10
273
- msgid "Address"
274
- msgstr "Adresse"
275
 
276
- #: demo/map.php:12
277
- msgid "Hanoi, Vietnam"
278
- msgstr "Hanoi, Vietnam"
279
 
280
- #: demo/map.php:16
281
- msgid "Location"
282
- msgstr "Localisation"
283
 
284
- #: demo/oembed.php:6
285
- msgid "oEmbed Demo"
286
- msgstr "oEmbed Démo"
287
 
288
- #: demo/oembed.php:10
289
- msgid "oEmbed(s)"
290
- msgstr "oEmbed (s)"
291
 
292
- #: demo/slider.php:6
293
- msgid "Slider Demo"
294
- msgstr "Démo de Slider"
295
 
296
- #: demo/url.php:6
297
- msgid "URL Demo"
298
- msgstr "Démo d'URL"
 
299
 
300
- #: demo/url.php:10
301
- msgid "URL(s)"
302
- msgstr "URL(s)"
303
 
304
- #: inc/common.php:53
305
  msgid "Documentation"
306
  msgstr "Documentation"
307
 
308
- #: inc/common.php:54
309
  msgid "Extensions"
310
  msgstr "Extensions"
311
 
312
- #: inc/field.php:225
313
- msgid "+"
314
- msgstr "+"
315
-
316
- #: inc/field.php:235
317
- msgid "&#8211;"
318
- msgstr "&#8211;"
319
-
320
- #: inc/fields/autocomplete.php:18 inc/fields/autocomplete.php:72
321
- msgid "Delete"
322
- msgstr "Supprimer"
323
-
324
- #: inc/fields/button.php:35
325
- msgid "Click me"
326
- msgstr "Cliquez-ici"
327
-
328
- #: inc/fields/file-advanced.php:23
329
- msgid "Select Files"
330
- msgstr "Sélectionnez les fichiers"
331
-
332
- #: inc/fields/file-advanced.php:66
333
- msgctxt "file upload"
334
- msgid "Select or Upload Files"
335
- msgstr "Sélectionnez ou mettez en ligne des fichiers"
336
-
337
- #: inc/fields/file-advanced.php:103 inc/fields/file.php:168
338
- msgctxt "file upload"
339
- msgid "Delete"
340
- msgstr "Supprimer"
341
-
342
- #: inc/fields/file-advanced.php:104 inc/fields/file.php:169
343
- msgctxt "file upload"
344
- msgid "Edit"
345
- msgstr "Modifier"
346
-
347
- #: inc/fields/file-input.php:17
348
- msgid "Select File"
349
- msgstr "Choisissez un fichier"
350
-
351
- #: inc/fields/file-input.php:42
352
- msgid "Remove"
353
- msgstr "Supprimer"
354
 
355
- #: inc/fields/file.php:19
356
  #, php-format
357
  msgid "You may only upload maximum %d file"
358
  msgstr "Vous ne pouvez mettre en ligne qu'un fichier de %d maximum"
359
 
360
- #: inc/fields/file.php:20
361
  #, php-format
362
  msgid "You may only upload maximum %d files"
363
  msgstr "Vous ne pouvez mettre en ligne que des fichiers de %d maximum"
364
 
365
- #: inc/fields/file.php:98
366
  msgid "Error: Cannot delete file"
367
  msgstr "Erreur : Impossible de supprimer le fichier"
368
 
369
- #: inc/fields/file.php:111
370
- msgctxt "file upload"
371
- msgid "Upload Files"
372
- msgstr "Mettez en ligne des fichiers"
373
-
374
- #: inc/fields/file.php:112
375
  msgctxt "file upload"
376
  msgid "+ Add new file"
377
  msgstr "+ Ajouter un nouveau fichier"
378
 
379
- #: inc/fields/image-advanced.php:23
380
- msgid "Select Images"
381
- msgstr "Sélectionner des images"
382
-
383
- #: inc/fields/image-advanced.php:71
384
- msgctxt "image upload"
385
- msgid "Select or Upload Images"
386
- msgstr "Sélectionnez ou mettez en ligne des images"
387
-
388
- #: inc/fields/image-advanced.php:108 inc/fields/image.php:136
389
- msgctxt "image upload"
390
  msgid "Delete"
391
  msgstr "Supprimer"
392
 
393
- #: inc/fields/image-advanced.php:109 inc/fields/image.php:137
394
- msgctxt "image upload"
395
  msgid "Edit"
396
  msgstr "Modifier"
397
 
398
- #: inc/fields/image.php:70 inc/fields/thickbox-image.php:34
399
- msgctxt "image upload"
400
- msgid "Upload Images"
401
- msgstr "Mettez en ligne des images"
402
-
403
- #: inc/fields/image.php:71
404
- msgctxt "image upload"
405
- msgid "+ Add new image"
406
- msgstr "+ Ajouter une nouvelle image"
407
-
408
- #: inc/fields/map.php:48
409
- msgid "Find Address"
410
- msgstr "Trouver une adresse"
411
-
412
- #: inc/fields/oembed.php:55
413
  msgid "Embed HTML not available."
414
  msgstr "Intégration du code HTML non disponible."
415
 
416
- #: inc/fields/oembed.php:77
417
- msgid "Preview"
418
- msgstr "Aperçu"
419
-
420
- #: inc/fields/plupload-image.php:105
421
- msgctxt "image upload"
422
- msgid "Drop images here"
423
- msgstr "Déposez des images ici"
424
-
425
- #: inc/fields/plupload-image.php:106
426
- msgctxt "image upload"
427
- msgid "or"
428
- msgstr "ou"
429
-
430
- #: inc/fields/plupload-image.php:107
431
- msgctxt "image upload"
432
- msgid "Select Files"
433
- msgstr "Sélectionnez des fichiers"
434
 
435
- #: inc/fields/plupload-image.php:182
436
  msgctxt "image upload"
437
- msgid "Allowed Image Files"
438
- msgstr "Types d'images autorisés"
439
-
440
- #: inc/fields/post.php:52
441
- msgid "Post"
442
- msgstr "Article"
443
 
444
- #: inc/fields/post.php:66 inc/fields/taxonomy.php:40 inc/fields/user.php:62
445
  #, php-format
446
  msgid "Select a %s"
447
  msgstr "Choisissez un %s"
448
 
449
- #: inc/fields/user.php:54
450
- msgid "User"
451
- msgstr "Utilisateur"
452
 
453
- #: inc/meta-box.php:245
454
- msgid "Please correct the errors highlighted below and try again."
455
- msgstr ""
456
- "Merci de corriger les erreurs mises en évidence ci-dessous et de réessayer."
 
 
 
 
 
 
 
 
 
 
 
 
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Meta Box\n"
4
+ "POT-Creation-Date: 2017-08-11 10:11+0000\n"
5
+ "PO-Revision-Date: 2017-08-11 10:17+0000\n"
6
+ "Last-Translator: Ludovic <me@ludovicmeyer.com>\n"
7
+ "Language-Team: French (France)\n"
8
+ "Language: fr-FR\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Loco - https://localise.biz/\n"
13
  "X-Poedit-Basepath: ..\n"
14
  "X-Poedit-SourceCharset: UTF-8\n"
15
  "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
16
+ "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
17
+ "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
18
+ "Plural-Forms: nplurals=2; plural=n > 1\n"
19
  "X-Poedit-SearchPath-0: .\n"
20
  "X-Poedit-SearchPathExcluded-0: *.js\n"
21
+ "Report-Msgid-Bugs-To: "
22
 
23
+ #: inc/field.php:356
24
+ msgid "+ Add more"
25
+ msgstr "+ Ajouter"
26
 
27
+ #: inc/fields/input-list.php:90
28
+ msgid "Select All / None"
29
+ msgstr "Sélectionner tout / acucun"
30
 
31
+ #: inc/fields/select.php:87
32
+ msgid "All"
33
+ msgstr "Tout"
34
 
35
+ #: inc/fields/select.php:87
36
+ msgid "None"
37
+ msgstr "Aucun"
38
 
39
+ #: inc/fields/media.php:24
40
+ msgctxt "media"
41
+ msgid "+ Add Media"
42
+ msgstr "+ Ajouter un média"
43
 
44
+ #: inc/fields/media.php:25
45
+ msgctxt "media"
46
+ msgid " file"
47
+ msgstr "fichier"
48
 
49
+ #: inc/fields/media.php:26
50
+ msgctxt "media"
51
+ msgid " files"
52
+ msgstr "fichiers"
53
 
54
+ #: inc/fields/media.php:27
55
+ msgctxt "media"
56
+ msgid "Remove"
57
+ msgstr "Supprimer"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
+ #: inc/fields/media.php:28
60
+ msgctxt "media"
61
+ msgid "Edit"
62
+ msgstr "Éditer"
63
 
64
+ #: inc/fields/media.php:29
65
+ msgctxt "media"
66
+ msgid "View"
67
+ msgstr "Voir"
68
 
69
+ #: inc/fields/media.php:30
70
+ msgctxt "media"
71
+ msgid "No Title"
72
+ msgstr "Pas de titre"
73
 
74
+ #: inc/fields/media.php:33
75
+ msgctxt "media"
76
+ msgid "Select Files"
77
+ msgstr "Sélectionner un fichier"
78
 
79
+ #: inc/fields/media.php:34
80
+ msgctxt "media"
81
+ msgid "or"
82
+ msgstr "ou"
83
 
84
+ #: inc/fields/media.php:35
85
+ msgctxt "media"
86
+ msgid "Drop files here to upload"
87
+ msgstr "Déposer un fichier ici pour l'envoyer"
88
 
89
+ #: inc/fields/post.php:36
90
+ msgid "Select a post"
91
+ msgstr "Sélectionner un article"
92
 
93
+ #: inc/fields/checkbox.php:50
94
+ msgid "Yes"
95
+ msgstr "Oui"
96
 
97
+ #: inc/fields/checkbox.php:50
98
+ msgid "No"
99
+ msgstr "Non"
100
 
101
+ #: inc/fields/user.php:30
102
+ msgid "Select an user"
103
+ msgstr "Sélectionner un utilisateur"
104
 
105
+ #: inc/fields/select-advanced.php:45
106
+ msgid "Select an item"
107
+ msgstr "Sélectionner un élément"
108
 
109
+ #: inc/fields/key-value.php:126
110
+ msgid "Key"
111
+ msgstr "Clé"
112
 
113
+ #: inc/fields/key-value.php:127
114
+ msgid "Value"
115
+ msgstr "Valeur"
116
 
117
+ #: inc/fields/taxonomy.php:47
118
+ msgid "Select a term"
119
+ msgstr "Sélectionner un terme"
120
 
121
+ #. Name of the plugin
122
+ msgid "Meta Box"
123
+ msgstr ""
124
 
125
+ #. Description of the plugin
126
+ msgid "Create custom meta boxes and custom fields in WordPress."
127
+ msgstr ""
128
 
129
+ #. URI of the plugin
130
+ #. Author URI of the plugin
131
+ msgid "https://metabox.io"
132
+ msgstr ""
133
 
134
+ #. Author of the plugin
135
+ msgid "MetaBox.io"
136
+ msgstr ""
137
 
138
+ #: inc/core.php:33
139
  msgid "Documentation"
140
  msgstr "Documentation"
141
 
142
+ #: inc/core.php:34
143
  msgid "Extensions"
144
  msgstr "Extensions"
145
 
146
+ #: inc/validation.php:47
147
+ msgid "Please correct the errors highlighted below and try again."
148
+ msgstr ""
149
+ "Merci de corriger les erreurs mises en évidence ci-dessous et de réessayer."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
 
151
+ #: inc/fields/file.php:21
152
  #, php-format
153
  msgid "You may only upload maximum %d file"
154
  msgstr "Vous ne pouvez mettre en ligne qu'un fichier de %d maximum"
155
 
156
+ #: inc/fields/file.php:23
157
  #, php-format
158
  msgid "You may only upload maximum %d files"
159
  msgstr "Vous ne pouvez mettre en ligne que des fichiers de %d maximum"
160
 
161
+ #: inc/fields/file.php:83
162
  msgid "Error: Cannot delete file"
163
  msgstr "Erreur : Impossible de supprimer le fichier"
164
 
165
+ #: inc/fields/file.php:97
 
 
 
 
 
166
  msgctxt "file upload"
167
  msgid "+ Add new file"
168
  msgstr "+ Ajouter un nouveau fichier"
169
 
170
+ #: inc/fields/file.php:147
171
+ msgctxt "file upload"
 
 
 
 
 
 
 
 
 
172
  msgid "Delete"
173
  msgstr "Supprimer"
174
 
175
+ #: inc/fields/file.php:148
176
+ msgctxt "file upload"
177
  msgid "Edit"
178
  msgstr "Modifier"
179
 
180
+ #: inc/fields/oembed.php:64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  msgid "Embed HTML not available."
182
  msgstr "Intégration du code HTML non disponible."
183
 
184
+ #: inc/fields/select.php:87 inc/fields/file-input.php:38
185
+ msgid "Select"
186
+ msgstr "Choisissez"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
 
188
+ #: inc/fields/thickbox-image.php:55
189
  msgctxt "image upload"
190
+ msgid "Upload Images"
191
+ msgstr "Mettez en ligne des images"
 
 
 
 
192
 
193
+ #: inc/fields/post.php:41 inc/fields/taxonomy.php:52
194
  #, php-format
195
  msgid "Select a %s"
196
  msgstr "Choisissez un %s"
197
 
198
+ #: inc/fields/button.php:32
199
+ msgid "Click me"
200
+ msgstr "Cliquez-ici"
201
 
202
+ #: inc/fields/autocomplete.php:20 inc/fields/autocomplete.php:81
203
+ #: inc/fields/autocomplete.php:93
204
+ msgid "Delete"
205
+ msgstr "Supprimer"
206
+
207
+ #: inc/fields/map.php:62
208
+ msgid "Find Address"
209
+ msgstr "Trouver une adresse"
210
+
211
+ #: inc/fields/file-input.php:19
212
+ msgid "Select File"
213
+ msgstr "Choisissez un fichier"
214
+
215
+ #: inc/fields/file-input.php:40
216
+ msgid "Remove"
217
+ msgstr "Supprimer"
meta-box.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Meta Box
4
  * Plugin URI: https://metabox.io
5
  * Description: Create custom meta boxes and custom fields in WordPress.
6
- * Version: 4.12.1
7
  * Author: MetaBox.io
8
  * Author URI: https://metabox.io
9
  * License: GPL2+
@@ -15,6 +15,6 @@
15
 
16
  if ( defined( 'ABSPATH' ) && ! defined( 'RWMB_VER' ) ) {
17
  require_once dirname( __FILE__ ) . '/inc/loader.php';
18
- $loader = new RWMB_Loader;
19
  $loader->init();
20
  }
3
  * Plugin Name: Meta Box
4
  * Plugin URI: https://metabox.io
5
  * Description: Create custom meta boxes and custom fields in WordPress.
6
+ * Version: 4.12.4
7
  * Author: MetaBox.io
8
  * Author URI: https://metabox.io
9
  * License: GPL2+
15
 
16
  if ( defined( 'ABSPATH' ) && ! defined( 'RWMB_VER' ) ) {
17
  require_once dirname( __FILE__ ) . '/inc/loader.php';
18
+ $loader = new RWMB_Loader();
19
  $loader->init();
20
  }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: metabox, rilwis, fitwp, f-j-kaiser, funkatronic, PerWiklander, rua
3
  Donate link: http://paypal.me/anhtnt
4
  Tags: meta-box, custom fields, custom field, meta, meta-boxes, admin, advanced, custom, edit, field, file, image, magic fields, matrix, more fields, Post, repeater, simple fields, text, textarea, type, cms, fields post
5
  Requires at least: 4.1
6
- Tested up to: 4.8
7
- Stable tag: 4.12.1
8
  License: GPLv2 or later
9
 
10
  Meta Box plugin is a powerful, professional developer toolkit to create custom meta boxes and custom fields for WordPress.
@@ -66,6 +66,7 @@ See more documentation [here](https://metabox.io/docs/).
66
 
67
  #### Free Extensions
68
 
 
69
  - [MB Custom Post Type](https://wordpress.org/plugins/mb-custom-post-type/): Create and manage custom post types and taxonomies easily in WordPress with an easy-to-use interface.
70
  - [MB Custom Taxonomy](https://metabox.io/plugins/custom-taxonomy/): Create and manage custom taxonomies with an easy-to-use interface in WordPress.
71
  - [Meta Box Yoast SEO](https://wordpress.org/plugins/meta-box-yoast-seo/): Add content of custom fields to Yoast SEO Content Analysis to have better/correct SEO score.
@@ -74,6 +75,8 @@ See more documentation [here](https://metabox.io/docs/).
74
 
75
  #### Premium Extensions
76
 
 
 
77
  - [MB Frontend Submission](https://metabox.io/plugins/mb-frontend-submission/): Create frontend forms for users to submit custom content. Embed everywhere with shortcode.
78
  - [MB User Meta](https://metabox.io/plugins/mb-user-meta/): Add custom fields to user profile (user meta) quickly with simple syntax.
79
  - [Meta Box Geolocation](https://metabox.io/plugins/meta-box-geolocation/): Automatically and instantly populate location data with the power of Google Maps Geolocation API.
@@ -128,26 +131,6 @@ To getting started with the plugin, please read [this tutorial](https://metabox.
128
 
129
  == Changelog ==
130
 
131
- = 4.12.1 - 2017-07-05 =
132
- #### Fixed
133
- - Helper function doesn't work. #1144.
134
-
135
- = 4.12 - 2017-07-04 =
136
- #### Added
137
- - Completed the storage abstraction. All the actions add/get/update/delete post meta now use the storage methods. Make it easy to extend for other extensions for term/user meta and settings pages.
138
- - Added `autofocus`, `autocomplete` HTML5 attribute to inputs.
139
- - Added `alpha_channel` to `color` field. Set it to `true` to allow picking colors with opacity.
140
- - Click on the image will open a popup for re-select image. Works for `image_advanced` and `image_upload` (`plupload_image`) fields.
141
-
142
- #### Changed
143
- - Auto display oembed media when pasting the URL, without click "Preview" button (and it's removed).
144
- - Better styles for media fields. Use the loading icon from WordPress.
145
-
146
- #### Fixed
147
- - Fix cloning an editor inside a group in WordPress 4.8. Caused by updated version of TinyMCE using Promise.
148
- - Modals created by media fields now exclude already selected media. This was a previous feature, but it had caused problems with uploading.
149
- - Fixed Google map doesn't use custom style
150
-
151
- [See changelog for all versions](https://github.com/rilwis/meta-box/blob/master/CHANGELOG.md).
152
 
153
  == Upgrade Notice ==
3
  Donate link: http://paypal.me/anhtnt
4
  Tags: meta-box, custom fields, custom field, meta, meta-boxes, admin, advanced, custom, edit, field, file, image, magic fields, matrix, more fields, Post, repeater, simple fields, text, textarea, type, cms, fields post
5
  Requires at least: 4.1
6
+ Tested up to: 4.8.2
7
+ Stable tag: 4.12.4
8
  License: GPLv2 or later
9
 
10
  Meta Box plugin is a powerful, professional developer toolkit to create custom meta boxes and custom fields for WordPress.
66
 
67
  #### Free Extensions
68
 
69
+ - [MB Comment Meta](https://wordpress.org/plugins/mb-comment-meta/): Add custom fields to comments in WordPress. Support all field types and options.
70
  - [MB Custom Post Type](https://wordpress.org/plugins/mb-custom-post-type/): Create and manage custom post types and taxonomies easily in WordPress with an easy-to-use interface.
71
  - [MB Custom Taxonomy](https://metabox.io/plugins/custom-taxonomy/): Create and manage custom taxonomies with an easy-to-use interface in WordPress.
72
  - [Meta Box Yoast SEO](https://wordpress.org/plugins/meta-box-yoast-seo/): Add content of custom fields to Yoast SEO Content Analysis to have better/correct SEO score.
75
 
76
  #### Premium Extensions
77
 
78
+ - [MB Custom Table](https://metabox.io/plugins/mb-custom-table/): Save custom fields data to custom table instead of the default meta tables. Reduce database size and increase performance.
79
+ - [MB Revision](https://metabox.io/plugins/mb-revision/): Track changes of custom fields with WordPress revision. Save, compare, restore the changes easily.
80
  - [MB Frontend Submission](https://metabox.io/plugins/mb-frontend-submission/): Create frontend forms for users to submit custom content. Embed everywhere with shortcode.
81
  - [MB User Meta](https://metabox.io/plugins/mb-user-meta/): Add custom fields to user profile (user meta) quickly with simple syntax.
82
  - [Meta Box Geolocation](https://metabox.io/plugins/meta-box-geolocation/): Automatically and instantly populate location data with the power of Google Maps Geolocation API.
131
 
132
  == Changelog ==
133
 
134
+ [See full changelog here](https://github.com/rilwis/meta-box/blob/master/CHANGELOG.md).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
 
136
  == Upgrade Notice ==