Smart Custom Fields - Version 3.1.5

Version Description

  • Fixed a bug that disappeared layout when introducing description in relation field. #56 (by @mayukojpn )
  • Update item delete button style in relation field.
  • Fix bug when using smart-cf-register-fields hook.
Download this release

Release Info

Developer inc2734
Plugin Icon wp plugin Smart Custom Fields
Version 3.1.5
Comparing to
See all releases

Code changes from version 3.1.4 to 3.1.5

classes/fields/class.field-related-posts.php CHANGED
@@ -195,7 +195,8 @@ class Smart_Custom_Fields_Field_Related_Posts extends Smart_Custom_Fields_Field_
195
  %s
196
  </div>
197
  </div>
198
- <div class="%s"><ul>%s</ul></div>',
 
199
  SCF_Config::PREFIX . 'relation-left',
200
  implode( ',', $post_type ),
201
  $limit,
195
  %s
196
  </div>
197
  </div>
198
+ <div class="%s"><ul>%s</ul></div>
199
+ <div class="clear"></div>',
200
  SCF_Config::PREFIX . 'relation-left',
201
  implode( ',', $post_type ),
202
  $limit,
classes/fields/class.field-related-terms.php CHANGED
@@ -198,7 +198,8 @@ class Smart_Custom_Fields_Field_Related_Terms extends Smart_Custom_Fields_Field_
198
  %s
199
  </div>
200
  </div>
201
- <div class="%s"><ul>%s</ul></div>',
 
202
  SCF_Config::PREFIX . 'relation-left',
203
  implode( ',', $taxonomies ),
204
  $limit,
198
  %s
199
  </div>
200
  </div>
201
+ <div class="%s"><ul>%s</ul></div>
202
+ <div class="clear"></div>',
203
  SCF_Config::PREFIX . 'relation-left',
204
  implode( ',', $taxonomies ),
205
  $limit,
classes/models/class.meta.php CHANGED
@@ -452,6 +452,8 @@ class Smart_Custom_Fields_Meta {
452
  }
453
 
454
  $settings = SCF::get_settings( $this->object );
 
 
455
  foreach ( $settings as $Setting ) {
456
  $groups = $Setting->get_groups();
457
  foreach ( $groups as $Group ) {
@@ -461,12 +463,15 @@ class Smart_Custom_Fields_Meta {
461
  if ( !isset( $POST[SCF_Config::NAME][$field_name] ) ) {
462
  continue;
463
  }
 
 
464
  $this->delete( $field_name );
465
  if ( $Field->get_attribute( 'allow-multiple-data' ) ) {
466
  $multiple_data_fields[] = $field_name;
467
  }
 
468
  if ( $Group->is_repeatable() && $Field->get_attribute( 'allow-multiple-data' ) ) {
469
- $repeat_multiple_data_fields = $POST[SCF_Config::NAME][$field_name];
470
  foreach ( $repeat_multiple_data_fields as $values ) {
471
  if ( is_array( $values ) ) {
472
  $repeat_multiple_data[$field_name][] = count( $values );
@@ -483,7 +488,7 @@ class Smart_Custom_Fields_Meta {
483
  $this->update( SCF_Config::PREFIX . 'repeat-multiple-data', $repeat_multiple_data );
484
  }
485
 
486
- foreach ( $POST[SCF_Config::NAME] as $name => $values ) {
487
  foreach ( $values as $value ) {
488
  if ( in_array( $name, $multiple_data_fields ) && $value === '' ) {
489
  continue;
452
  }
453
 
454
  $settings = SCF::get_settings( $this->object );
455
+ $saved_data = array();
456
+
457
  foreach ( $settings as $Setting ) {
458
  $groups = $Setting->get_groups();
459
  foreach ( $groups as $Group ) {
463
  if ( !isset( $POST[SCF_Config::NAME][$field_name] ) ) {
464
  continue;
465
  }
466
+ $saved_data[$field_name] = $POST[SCF_Config::NAME][$field_name];
467
+
468
  $this->delete( $field_name );
469
  if ( $Field->get_attribute( 'allow-multiple-data' ) ) {
470
  $multiple_data_fields[] = $field_name;
471
  }
472
+
473
  if ( $Group->is_repeatable() && $Field->get_attribute( 'allow-multiple-data' ) ) {
474
+ $repeat_multiple_data_fields = $saved_data[$field_name];
475
  foreach ( $repeat_multiple_data_fields as $values ) {
476
  if ( is_array( $values ) ) {
477
  $repeat_multiple_data[$field_name][] = count( $values );
488
  $this->update( SCF_Config::PREFIX . 'repeat-multiple-data', $repeat_multiple_data );
489
  }
490
 
491
+ foreach ( $saved_data as $name => $values ) {
492
  foreach ( $values as $value ) {
493
  if ( in_array( $name, $multiple_data_fields ) && $value === '' ) {
494
  continue;
css/editor.css CHANGED
@@ -54,6 +54,9 @@
54
  margin: 10px 0 0;
55
  color: #888;
56
  }
 
 
 
57
 
58
  /** ==================================================
59
  * .smart-cf-meta-box-repeat-tables
@@ -145,16 +148,31 @@
145
  width: 50%;
146
  overflow: auto;
147
  }
 
 
 
 
 
 
 
 
 
 
148
  .smart-cf-meta-box-table .smart-cf-relation-right ul li .relation-remove {
149
  cursor: pointer;
150
  display: block;
151
- padding: 2px 8px;
 
 
 
 
 
 
152
  position: absolute;
153
- top: 2px;
154
  right: 6px;
155
- }
156
- .smart-cf-meta-box-table .smart-cf-relation-right ul li {
157
- padding-right: 15px;
158
  }
159
 
160
  /** ==================================================
54
  margin: 10px 0 0;
55
  color: #888;
56
  }
57
+ .smart-cf-meta-box-table td .clear {
58
+ clear: both;
59
+ }
60
 
61
  /** ==================================================
62
  * .smart-cf-meta-box-repeat-tables
148
  width: 50%;
149
  overflow: auto;
150
  }
151
+ .smart-cf-meta-box-table .smart-cf-relation-right ul li {
152
+ padding-right: 30px;
153
+ padding-left: 30px;
154
+ }
155
+ .smart-cf-meta-box-table .smart-cf-relation-right ul li .smart-cf-icon-handle {
156
+ position: absolute;
157
+ top: 4px;
158
+ left: 5px;
159
+ margin: 0;
160
+ }
161
  .smart-cf-meta-box-table .smart-cf-relation-right ul li .relation-remove {
162
  cursor: pointer;
163
  display: block;
164
+ display: flex;
165
+ align-items: center;
166
+ justify-content: center;
167
+ height: 12px;
168
+ width: 12px;
169
+ line-height: 1;
170
+ border-radius: 3px;
171
  position: absolute;
172
+ top: 7px;
173
  right: 6px;
174
+ color: #fff;
175
+ background-color: #32373c;
 
176
  }
177
 
178
  /** ==================================================
js/editor-relation-common.js CHANGED
@@ -62,11 +62,15 @@ jQuery( function( $ ) {
62
  /**
63
  * sortable
64
  */
65
- $( '.smart-cf-meta-box .smart-cf-relation-right ul' ).sortable( {
66
- handle: '.smart-cf-icon-handle',
67
- update: function() {
68
- update_relation_value( $( this ).closest( 'tr' ) );
69
- }
70
- } );
 
 
 
 
71
 
72
  } );
62
  /**
63
  * sortable
64
  */
65
+ $( '.smart-cf-meta-box' ).find( '.smart-cf-relation-right ul' )
66
+ .on( 'mousedown', function( event ) {
67
+ event.stopPropagation();
68
+ } )
69
+ .sortable( {
70
+ handle: '.smart-cf-icon-handle',
71
+ update: function() {
72
+ update_relation_value( $( this ).closest( 'tr' ) );
73
+ }
74
+ } );
75
 
76
  } );
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: inc2734, toro_unit, mimosafa, hideokamoto, hisako-isaka, kurudrive
3
  Donate link: http://www.amazon.co.jp/registry/wishlist/39ANKRNSTNW40
4
  Tags: plugin, custom field, custom, field, meta, meta field, repeat, repeatable
5
  Requires at least: 3.9
6
- Tested up to: 4.8.0
7
- Stable tag: 3.1.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -127,6 +127,11 @@ You can translate this plugin into your language by using [GlotPress](https://tr
127
 
128
  == Changelog ==
129
 
 
 
 
 
 
130
  = 3.1.4 =
131
  * Remove no used codes.
132
  * Fixed a bug that name disappears when opening / closing a field. #51 (by [@yousan](https://github.com/yousan))
3
  Donate link: http://www.amazon.co.jp/registry/wishlist/39ANKRNSTNW40
4
  Tags: plugin, custom field, custom, field, meta, meta field, repeat, repeatable
5
  Requires at least: 3.9
6
+ Tested up to: 4.8.2
7
+ Stable tag: 3.1.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
127
 
128
  == Changelog ==
129
 
130
+ = 3.1.5 =
131
+ * Fixed a bug that disappeared layout when introducing description in relation field. #56 (by [@mayukojpn ](https://github.com/mayukojpn ))
132
+ * Update item delete button style in relation field.
133
+ * Fix bug when using smart-cf-register-fields hook.
134
+
135
  = 3.1.4 =
136
  * Remove no used codes.
137
  * Fixed a bug that name disappears when opening / closing a field. #51 (by [@yousan](https://github.com/yousan))
smart-custom-fields.php CHANGED
@@ -3,11 +3,11 @@
3
  * Plugin name: Smart Custom Fields
4
  * Plugin URI: https://github.com/inc2734/smart-custom-fields/
5
  * Description: Smart Custom Fields is a simple plugin that management custom fields.
6
- * Version: 3.1.4
7
  * Author: inc2734
8
  * Author URI: http://2inc.org
9
  * Created: October 9, 2014
10
- * Modified: June 29, 2017
11
  * Text Domain: smart-custom-fields
12
  * Domain Path: /languages
13
  * License: GPLv2 or later
3
  * Plugin name: Smart Custom Fields
4
  * Plugin URI: https://github.com/inc2734/smart-custom-fields/
5
  * Description: Smart Custom Fields is a simple plugin that management custom fields.
6
+ * Version: 3.1.5
7
  * Author: inc2734
8
  * Author URI: http://2inc.org
9
  * Created: October 9, 2014
10
+ * Modified: October 24, 2017
11
  * Text Domain: smart-custom-fields
12
  * Domain Path: /languages
13
  * License: GPLv2 or later