Meta Box - Version 5.2.5

Version Description

Download this release

Release Info

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

Code changes from version 5.2.4 to 5.2.5

css/input.css CHANGED
@@ -11,4 +11,25 @@
11
  }
12
  .rwmb-input-group input {
13
  margin: 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  }
11
  }
12
  .rwmb-input-group input {
13
  margin: 0;
14
+ }
15
+
16
+ /* Dark version for WordPress >= 5.3 */
17
+ .rwmb-input-dark .rwmb-input-group-append,
18
+ .rwmb-input-dark .rwmb-input-group-prepend {
19
+ border: 1px solid #7e8993;
20
+ }
21
+ .rwmb-input-dark .rwmb-input-group-append {
22
+ border-radius: 0 4px 4px 0;
23
+ }
24
+ .rwmb-input-dark .rwmb-input-group-prepend {
25
+ border-radius: 4px 0 0 4px;
26
+ }
27
+ .rwmb-input-dark input {
28
+ border-right-width: 0;
29
+ border-radius: 4px 0 0 4px;
30
+ }
31
+ .rwmb-input-dark .rwmb-input-group-prepend + input {
32
+ border-left: none;
33
+ border-right-width: 1px;
34
+ border-radius: 0 4px 4px 0;
35
  }
inc/about/css/about.css CHANGED
@@ -165,8 +165,6 @@
165
  }
166
  .newsletter.newsletter input {
167
  width: 145px;
168
- min-height: 28px;
169
- line-height: 26px;
170
  }
171
 
172
  /* Upgrade */
165
  }
166
  .newsletter.newsletter input {
167
  width: 145px;
 
 
168
  }
169
 
170
  /* Upgrade */
inc/fields/image.php CHANGED
@@ -144,7 +144,7 @@ class RWMB_Image_Field extends RWMB_File_Field {
144
  $info['srcset'] = wp_get_attachment_image_srcset( $file, $args['size'] );
145
  }
146
 
147
- $info = wp_parse_args( $info, wp_get_attachment_metadata( $file ) );
148
 
149
  // Do not overwrite width and height by returned value of image meta.
150
  $info['width'] = $image[1];
@@ -152,4 +152,20 @@ class RWMB_Image_Field extends RWMB_File_Field {
152
 
153
  return $info;
154
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
155
  }
144
  $info['srcset'] = wp_get_attachment_image_srcset( $file, $args['size'] );
145
  }
146
 
147
+ $info = wp_parse_args( $info, self::get_image_meta_data( $file ) );
148
 
149
  // Do not overwrite width and height by returned value of image meta.
150
  $info['width'] = $image[1];
152
 
153
  return $info;
154
  }
155
+
156
+ /**
157
+ * Get image meta data.
158
+ *
159
+ * @param int $attachment_id Attachment ID.
160
+ * @return array
161
+ */
162
+ protected static function get_image_meta_data( $attachment_id ) {
163
+ $metadata = wp_get_attachment_metadata( $attachment_id );
164
+ $dir_url = dirname( wp_get_attachment_url( $attachment_id ) );
165
+
166
+ foreach ( $metadata['sizes'] as &$size ) {
167
+ $size['url'] = "{$dir_url}/{$size['file']}";
168
+ }
169
+ return $metadata;
170
+ }
171
  }
inc/fields/input.php CHANGED
@@ -26,8 +26,13 @@ abstract class RWMB_Input_Field extends RWMB_Field {
26
  public static function html( $meta, $field ) {
27
  $output = '';
28
 
 
 
 
 
 
29
  if ( $field['prepend'] || $field['append'] ) {
30
- $output = '<div class="rwmb-input-group">';
31
  }
32
 
33
  if ( $field['prepend'] ) {
26
  public static function html( $meta, $field ) {
27
  $output = '';
28
 
29
+ $wrapper_class = 'rwmb-input-group';
30
+ if ( version_compare( get_bloginfo( 'version' ), '5.3', '>=' ) ) {
31
+ $wrapper_class .= ' rwmb-input-dark';
32
+ }
33
+
34
  if ( $field['prepend'] || $field['append'] ) {
35
+ $output = "<div class='$wrapper_class'>";
36
  }
37
 
38
  if ( $field['prepend'] ) {
inc/update/checker.php CHANGED
@@ -74,6 +74,7 @@ class RWMB_Update_Checker {
74
  $extensions = array(
75
  'mb-admin-columns',
76
  'mb-blocks',
 
77
  'mb-custom-table',
78
  'mb-frontend-submission',
79
  'mb-revision',
74
  $extensions = array(
75
  'mb-admin-columns',
76
  'mb-blocks',
77
+ 'mb-core',
78
  'mb-custom-table',
79
  'mb-frontend-submission',
80
  'mb-revision',
js/map.js CHANGED
@@ -97,17 +97,16 @@
97
  } );
98
 
99
  /**
100
- * Add a custom event that allows other scripts to refresh the maps when needed
101
- * For example: when maps is in tabs or hidden div.
102
- *
103
  * @see https://developers.google.com/maps/documentation/javascript/reference ('resize' Event)
104
  */
105
- $( window ).on( 'rwmb_map_refresh', that.refresh );
 
106
 
107
  // Refresh on meta box hide and show
108
- rwmb.$document.on( 'postbox-toggled', that.refresh );
109
  // Refresh on sorting meta boxes
110
- $( '.meta-box-sortables' ).on( 'sortstop', that.refresh );
111
  },
112
 
113
  refresh: function () {
@@ -246,7 +245,7 @@
246
  }
247
  };
248
 
249
- function initMap() {
250
  var $this = $( this ),
251
  controller = $this.data( 'mapController' );
252
  if ( controller ) {
@@ -259,11 +258,11 @@
259
  }
260
 
261
  function init( e ) {
262
- $( e.target ).find( '.rwmb-map-field' ).each( initMap );
263
  }
264
 
265
  function restart() {
266
- $( '.rwmb-map-field' ).each( initMap );
267
  }
268
 
269
  rwmb.$document
97
  } );
98
 
99
  /**
100
+ * Custom event to refresh maps when in hidden divs.
 
 
101
  * @see https://developers.google.com/maps/documentation/javascript/reference ('resize' Event)
102
  */
103
+ var refresh = that.refresh.bind( this );
104
+ $( window ).on( 'rwmb_map_refresh', refresh );
105
 
106
  // Refresh on meta box hide and show
107
+ rwmb.$document.on( 'postbox-toggled', refresh );
108
  // Refresh on sorting meta boxes
109
+ $( '.meta-box-sortables' ).on( 'sortstop', refresh );
110
  },
111
 
112
  refresh: function () {
245
  }
246
  };
247
 
248
+ function createController() {
249
  var $this = $( this ),
250
  controller = $this.data( 'mapController' );
251
  if ( controller ) {
258
  }
259
 
260
  function init( e ) {
261
+ $( e.target ).find( '.rwmb-map-field' ).each( createController );
262
  }
263
 
264
  function restart() {
265
+ $( '.rwmb-map-field' ).each( createController );
266
  }
267
 
268
  rwmb.$document
js/media.js CHANGED
@@ -300,13 +300,7 @@
300
  this._editFrame = new EditMedia( {
301
  frame: 'edit-attachments',
302
  controller: {
303
- // Needed to trick Edit modal to think there is a gridRouter.
304
- gridRouter: {
305
- navigate: function ( destination ) {
306
- },
307
- baseUrl: function ( url ) {
308
- }
309
- }
310
  },
311
  library: this.collection,
312
  model: item
@@ -423,20 +417,17 @@
423
  },
424
 
425
  events: {
426
- 'click .rwmb-image-overlay': function () {
 
427
  this.trigger( 'click:switch', this.model );
428
- return false;
429
  },
430
-
431
- // Event when remove button clicked
432
- 'click .rwmb-remove-media': function () {
433
  this.trigger( 'click:remove', this.model );
434
- return false;
435
  },
436
-
437
- 'click .rwmb-edit-media': function () {
438
  this.trigger( 'click:edit', this.model );
439
- return false;
440
  }
441
  },
442
 
@@ -563,7 +554,8 @@
563
  controller: this,
564
  model: this.model
565
  } ) );
566
- }
 
567
  } );
568
 
569
  function initMediaField() {
300
  this._editFrame = new EditMedia( {
301
  frame: 'edit-attachments',
302
  controller: {
303
+ gridRouter: new wp.media.view.MediaFrame.Manage.Router()
 
 
 
 
 
 
304
  },
305
  library: this.collection,
306
  model: item
417
  },
418
 
419
  events: {
420
+ 'click .rwmb-image-overlay': function ( e ) {
421
+ e.preventDefault();
422
  this.trigger( 'click:switch', this.model );
 
423
  },
424
+ 'click .rwmb-remove-media': function ( e ) {
425
+ e.preventDefault();
 
426
  this.trigger( 'click:remove', this.model );
 
427
  },
428
+ 'click .rwmb-edit-media': function ( e ) {
429
+ e.preventDefault();
430
  this.trigger( 'click:edit', this.model );
 
431
  }
432
  },
433
 
554
  controller: this,
555
  model: this.model
556
  } ) );
557
+ },
558
+ resetRoute: function() {}
559
  } );
560
 
561
  function initMediaField() {
js/osm.js CHANGED
@@ -45,7 +45,6 @@
45
  zoom: 14
46
  } );
47
 
48
-
49
  L.tileLayer( 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
50
  attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
51
  } ).addTo( this.map );
@@ -105,18 +104,14 @@
105
  that.updateCoordinate( that.marker.getLatLng() );
106
  } );
107
 
108
- /**
109
- * Add a custom event that allows other scripts to refresh the maps when needed
110
- * For example: when maps is in tabs or hidden div (this is known issue of Google Maps)
111
- *
112
- * @see https://developers.google.com/maps/documentation/javascript/reference ('resize' Event)
113
- */
114
- $( window ).on( 'rwmb_map_refresh', that.refresh );
115
 
116
  // Refresh on meta box hide and show
117
- rwmb.$document.on( 'postbox-toggled', that.refresh );
118
  // Refresh on sorting meta boxes
119
- $( '.meta-box-sortables' ).on( 'sortstop', that.refresh );
120
  },
121
 
122
  refresh: function () {
@@ -260,7 +255,7 @@
260
  }
261
  };
262
 
263
- function initOsmMap() {
264
  var $this = $( this ),
265
  controller = $this.data( 'osmController' );
266
  if ( controller ) {
@@ -273,11 +268,11 @@
273
  }
274
 
275
  function init( e ) {
276
- $( e.target ).find( '.rwmb-osm-field' ).each( initOsmMap );
277
  }
278
 
279
  function restart() {
280
- $( '.rwmb-osm-field' ).each( initOsmMap );
281
  }
282
 
283
  rwmb.$document
45
  zoom: 14
46
  } );
47
 
 
48
  L.tileLayer( 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
49
  attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
50
  } ).addTo( this.map );
104
  that.updateCoordinate( that.marker.getLatLng() );
105
  } );
106
 
107
+ // Custom event to refresh maps when in hidden divs.
108
+ var refresh = that.refresh.bind( this );
109
+ $( window ).on( 'rwmb_map_refresh', refresh );
 
 
 
 
110
 
111
  // Refresh on meta box hide and show
112
+ rwmb.$document.on( 'postbox-toggled', refresh );
113
  // Refresh on sorting meta boxes
114
+ $( '.meta-box-sortables' ).on( 'sortstop', refresh );
115
  },
116
 
117
  refresh: function () {
255
  }
256
  };
257
 
258
+ function createController() {
259
  var $this = $( this ),
260
  controller = $this.data( 'osmController' );
261
  if ( controller ) {
268
  }
269
 
270
  function init( e ) {
271
+ $( e.target ).find( '.rwmb-osm-field' ).each( createController );
272
  }
273
 
274
  function restart() {
275
+ $( '.rwmb-osm-field' ).each( createController );
276
  }
277
 
278
  rwmb.$document
js/validate.js CHANGED
@@ -7,10 +7,15 @@ jQuery( function ( $ ) {
7
  $( '#publish' ).removeClass( 'button-primary-disabled' );
8
  $( '#ajax-loading' ).attr( 'style', '' );
9
  $form.siblings( '#message' ).remove();
10
- $form.before( '<div id="message" class="error"><p>' + rwmbValidate.summaryMessage + '</p></div>' );
 
 
 
 
 
11
  },
12
  ignore: ':not([class|="rwmb"])',
13
- errorPlacement: function(error, element) {
14
  error.appendTo( element.closest( '.rwmb-input' ) );
15
  },
16
  errorClass: 'rwmb-error',
7
  $( '#publish' ).removeClass( 'button-primary-disabled' );
8
  $( '#ajax-loading' ).attr( 'style', '' );
9
  $form.siblings( '#message' ).remove();
10
+ $form.before( '<div id="message" class="notice notice-error is-dismissible"><p>' + rwmbValidate.summaryMessage + '</p></div>' );
11
+
12
+ // Custom event for showing error fields inside tabs/hidden divs. Use setTimeout() to run after error class is added to inputs.
13
+ setTimeout( function() {
14
+ $form.trigger( 'after_validate' );
15
+ }, 200 );
16
  },
17
  ignore: ':not([class|="rwmb"])',
18
+ errorPlacement: function( error, element ) {
19
  error.appendTo( element.closest( '.rwmb-input' ) );
20
  },
21
  errorClass: 'rwmb-error',