Smart Custom Fields - Version 1.6.0

Version Description

  • Added search feature in the relation field.
  • Changed when the object isn't saved, default value is active.
  • Remove filter hook smart-cf-is_use_default_when_not_saved.
  • Fixed a bug that isn't displayed meta data in preview when using custom fields settings with post id.
Download this release

Release Info

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

Code changes from version 1.5.2 to 1.6.0

Files changed (43) hide show
  1. classes/class.config.php +2 -2
  2. classes/class.scf.php +39 -46
  3. classes/controller/class.controller-base.php +14 -20
  4. classes/controller/class.editor.php +2 -2
  5. classes/controller/class.profile.php +2 -2
  6. classes/controller/class.settings.php +2 -2
  7. classes/controller/class.taxonomy.php +2 -2
  8. classes/fields/class.field-boolean.php +2 -2
  9. classes/fields/class.field-check.php +2 -2
  10. classes/fields/class.field-colorpicker.php +2 -2
  11. classes/fields/class.field-datepicker.php +2 -2
  12. classes/fields/class.field-file.php +2 -2
  13. classes/fields/class.field-image.php +2 -2
  14. classes/fields/class.field-radio.php +2 -2
  15. classes/fields/class.field-relation.php +42 -17
  16. classes/fields/class.field-select.php +2 -2
  17. classes/fields/class.field-text.php +2 -2
  18. classes/fields/class.field-textarea.php +2 -2
  19. classes/fields/class.field-wysiwyg.php +2 -2
  20. classes/models/class.abstract-field-base.php +2 -2
  21. classes/models/class.ajax.php +5 -5
  22. classes/models/class.group.php +16 -3
  23. classes/models/class.meta.php +91 -70
  24. classes/models/class.revisions.php +2 -2
  25. classes/models/class.setting.php +35 -3
  26. css/editor.css +15 -5
  27. css/profile.css +2 -2
  28. css/settings.css +2 -2
  29. css/taxonomy.css +2 -2
  30. css/wysiwyg.css +2 -2
  31. js/editor-colorpicker.js +2 -2
  32. js/editor-datepicker.js +2 -2
  33. js/editor-relation.js +80 -38
  34. js/editor-wysiwyg.js +2 -2
  35. js/editor.js +7 -6
  36. js/settings-colorpicker.js +2 -2
  37. js/settings-datepicker.js +2 -2
  38. js/settings.js +2 -2
  39. languages/smart-custom-fields-ja.mo +0 -0
  40. languages/smart-custom-fields-ja.po +32 -38
  41. languages/smart-custom-fields.pot +17 -12
  42. readme.txt +12 -3
  43. smart-custom-fields.php +4 -4
classes/class.config.php CHANGED
@@ -2,10 +2,10 @@
2
  /**
3
  * SCF_Config
4
  * Version : 1.0.1
5
- * Author : Takashi Kitajima
6
  * Created : September 23, 2014
7
  * Modified : March 16, 2015
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class SCF_Config {
2
  /**
3
  * SCF_Config
4
  * Version : 1.0.1
5
+ * Author : inc2734
6
  * Created : September 23, 2014
7
  * Modified : March 16, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class SCF_Config {
classes/class.scf.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
3
  * SCF
4
- * Version : 1.2.0
5
- * Author : Takashi Kitajima
6
  * Created : September 23, 2014
7
- * Modified : March 27, 2015
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class SCF {
@@ -159,27 +159,23 @@ class SCF {
159
 
160
  $settings = self::get_settings( $object );
161
  foreach ( $settings as $Setting ) {
 
 
 
 
 
 
 
 
 
162
  $groups = $Setting->get_groups();
163
  foreach ( $groups as $Group ) {
164
- // グループ名と一致する場合はそのグループ内のフィールドを配列で返す
165
- $is_repeatable = $Group->is_repeatable();
166
- $group_name = $Group->get_name();
167
- if ( $is_repeatable && $group_name && $group_name === $name ) {
168
- $values_by_group = self::get_values_by_group( $object, $Group );
169
- self::save_cache( $object, $group_name, $values_by_group );
170
- return $values_by_group;
171
- }
172
- // グループ名と一致しない場合は一致するフィールドを返す
173
- else {
174
- $fields = $Group->get_fields();
175
- foreach ( $fields as $Field ) {
176
- $field_name = $Field->get( 'name' );
177
- if ( $field_name === $name ) {
178
- $value_by_field = self::get_value_by_field( $object, $Field, $is_repeatable );
179
- self::save_cache( $object, $Field->get( 'name' ), $value_by_field );
180
- return $value_by_field;
181
- }
182
- }
183
  }
184
  }
185
  }
@@ -209,7 +205,7 @@ class SCF {
209
  foreach ( $fields as $Field ) {
210
  $field_name = $Field->get( 'name' );
211
  $value_by_field = self::get_value_by_field( $object, $Field, $is_repeatable );
212
- self::save_cache( $object, $Field->get( 'name' ), $value_by_field );
213
  $post_meta[$field_name] = $value_by_field;
214
  }
215
  }
@@ -335,7 +331,7 @@ class SCF {
335
  $field_type = $Field->get_attribute( 'type' );
336
  $repeat_multiple_data = self::get_repeat_multiple_data( $object );
337
  if ( is_array( $repeat_multiple_data ) && isset( $repeat_multiple_data[$field_name] ) ) {
338
- if ( $Meta->is_saved_by_key( $field_name ) || !$Meta->is_use_default_when_not_saved() ) {
339
  $_meta = $Meta->get( $field_name );
340
  } else {
341
  $_meta = self::get_default_value( $Field );
@@ -348,30 +344,22 @@ class SCF {
348
  $value = array_slice( $_meta, $start, $repeat_multiple_value );
349
  $start += $repeat_multiple_value;
350
  }
351
- if ( $Meta->is_saved_by_key( $field_name ) || $Meta->is_use_default_when_not_saved() ) {
352
- $value = apply_filters( SCF_Config::PREFIX . 'validate-get-value', $value, $field_type );
353
- }
354
  $meta[$repeat_multiple_key] = $value;
355
  }
356
  }
357
  // それ以外
358
  else {
 
359
  if ( $Field->get_attribute( 'allow-multiple-data' ) || $is_repeatable ) {
360
- if ( $Meta->is_saved_by_key( $field_name ) || !$Meta->is_use_default_when_not_saved() ) {
361
- $meta = $Meta->get( $field_name );
362
- } else {
363
- $meta = self::get_default_value( $Field );
364
- }
365
- } else {
366
- if ( $Meta->is_saved_by_key( $field_name ) || !$Meta->is_use_default_when_not_saved() ) {
367
- $meta = $Meta->get( $field_name, true );
368
- } else {
369
- $meta = self::get_default_value( $Field, true );
370
- }
371
  }
372
- if ( $Meta->is_saved_by_key( $field_name ) || $Meta->is_use_default_when_not_saved() ) {
373
- $meta = apply_filters( SCF_Config::PREFIX . 'validate-get-value', $meta, $field_type );
 
 
374
  }
 
375
  }
376
  return $meta;
377
  }
@@ -578,6 +566,13 @@ class SCF {
578
  $id = $Meta->get_id();
579
  $type = $Meta->get_type( false );
580
  $meta_type = $Meta->get_meta_type();
 
 
 
 
 
 
 
581
 
582
  $settings = array();
583
  if ( !empty( $type ) ) {
@@ -808,11 +803,9 @@ class SCF {
808
  foreach ( $settings as $Setting ) {
809
  $groups = $Setting->get_groups();
810
  foreach ( $groups as $Group ) {
811
- $fields = $Group->get_fields();
812
- foreach ( $fields as $Field ) {
813
- if ( !is_null( $Field ) && $Field->get( 'name' ) === $field_name ) {
814
- return $Field;
815
- }
816
  }
817
  }
818
  }
1
  <?php
2
  /**
3
  * SCF
4
+ * Version : 1.3.0
5
+ * Author : inc2734
6
  * Created : September 23, 2014
7
+ * Modified : November 12, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class SCF {
159
 
160
  $settings = self::get_settings( $object );
161
  foreach ( $settings as $Setting ) {
162
+ // グループ名と一致する場合はそのグループ内のフィールドを配列で返す
163
+ $Group = $Setting->get_group( $name );
164
+ if ( $Group ) {
165
+ $values_by_group = self::get_values_by_group( $object, $Group );
166
+ self::save_cache( $object, $name, $values_by_group );
167
+ return $values_by_group;
168
+ }
169
+
170
+ // グループ名と一致しない場合は一致するフィールドを返す
171
  $groups = $Setting->get_groups();
172
  foreach ( $groups as $Group ) {
173
+ $Field = $Group->get_field( $name );
174
+ if ( $Field ) {
175
+ $is_repeatable = $Group->is_repeatable();
176
+ $value_by_field = self::get_value_by_field( $object, $Field, $is_repeatable );
177
+ self::save_cache( $object, $name, $value_by_field );
178
+ return $value_by_field;
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  }
180
  }
181
  }
205
  foreach ( $fields as $Field ) {
206
  $field_name = $Field->get( 'name' );
207
  $value_by_field = self::get_value_by_field( $object, $Field, $is_repeatable );
208
+ self::save_cache( $object, $field_name, $value_by_field );
209
  $post_meta[$field_name] = $value_by_field;
210
  }
211
  }
331
  $field_type = $Field->get_attribute( 'type' );
332
  $repeat_multiple_data = self::get_repeat_multiple_data( $object );
333
  if ( is_array( $repeat_multiple_data ) && isset( $repeat_multiple_data[$field_name] ) ) {
334
+ if ( $Meta->is_saved() ) {
335
  $_meta = $Meta->get( $field_name );
336
  } else {
337
  $_meta = self::get_default_value( $Field );
344
  $value = array_slice( $_meta, $start, $repeat_multiple_value );
345
  $start += $repeat_multiple_value;
346
  }
347
+ $value = apply_filters( SCF_Config::PREFIX . 'validate-get-value', $value, $field_type );
 
 
348
  $meta[$repeat_multiple_key] = $value;
349
  }
350
  }
351
  // それ以外
352
  else {
353
+ $single = true;
354
  if ( $Field->get_attribute( 'allow-multiple-data' ) || $is_repeatable ) {
355
+ $single = false;
 
 
 
 
 
 
 
 
 
 
356
  }
357
+ if ( $Meta->is_saved() ) {
358
+ $meta = $Meta->get( $field_name, $single );
359
+ } else {
360
+ $meta = self::get_default_value( $Field, $single );
361
  }
362
+ $meta = apply_filters( SCF_Config::PREFIX . 'validate-get-value', $meta, $field_type );
363
  }
364
  return $meta;
365
  }
566
  $id = $Meta->get_id();
567
  $type = $Meta->get_type( false );
568
  $meta_type = $Meta->get_meta_type();
569
+
570
+ // 投稿IDで出し分けされているカスタムフィールド設定を持つ投稿の場合、
571
+ // プレビュー画面ではIDが変わって表示されなくなってしまうため、
572
+ // プレビュー画面の場合は元の投稿(プレビューの親)から設定の再取得が必要
573
+ if ( $meta_type === 'post' && $object->post_type === 'revision' ) {
574
+ $object = get_post( $object->post_parent );
575
+ }
576
 
577
  $settings = array();
578
  if ( !empty( $type ) ) {
803
  foreach ( $settings as $Setting ) {
804
  $groups = $Setting->get_groups();
805
  foreach ( $groups as $Group ) {
806
+ $Field = $Group->get_field( $field_name );
807
+ if ( $Field ) {
808
+ return $Field;
 
 
809
  }
810
  }
811
  }
classes/controller/class.controller-base.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
3
  * Smart_Custom_Fields_Controller_Base
4
- * Version : 1.0.0
5
- * Author : Takashi Kitajima
6
  * Created : April 27, 2015
7
- * Modified :
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Controller_Base {
@@ -108,13 +108,12 @@ class Smart_Custom_Fields_Controller_Base {
108
  /**
109
  * カスタムフィールドを出力するための配列を生成
110
  *
111
- * @param WP_Post|WP_User $object
112
  * @param array $groups カスタムフィールド設定ページで保存した設定
113
  * @return array $tables カスタムフィールド表示用のテーブルを出力するための配列
114
  */
115
  protected function get_tables( $object, $groups ) {
116
  $Meta = new Smart_Custom_Fields_Meta( $object );
117
- $id = $Meta->get_id();
118
 
119
  $repeat_multiple_data = SCF::get_repeat_multiple_data( $object );
120
  $tables = array();
@@ -164,28 +163,24 @@ class Smart_Custom_Fields_Controller_Base {
164
  /**
165
  * 複数許可フィールドのメタデータを取得
166
  *
167
- * @param WP_Post|WP_Post $object
168
  * @param Smart_Custom_Fields_Field_Base $Field
169
  * @param int $index
170
  * @return array or null
171
  */
172
  public function get_multiple_data_field_value( $object, $Field, $index ) {
173
  $Meta = new Smart_Custom_Fields_Meta( $object );
174
- $id = $Meta->get_id();
175
  $field_name = $Field->get( 'name' );
176
 
177
  if ( is_null( $index ) ) {
178
  return SCF::get_default_value( $Field );
179
  }
180
-
181
- if ( $Meta->is_saved_by_key( $field_name ) || !$Meta->is_use_default_when_not_saved() ) {
182
- $value = $Meta->get( $field_name );
183
- if ( !isset( $value[$index] ) ) {
184
- return SCF::get_default_value( $Field );
185
- }
186
- } else {
187
  return SCF::get_default_value( $Field );
188
  }
 
 
189
 
190
  // ループのとき
191
  $repeat_multiple_data = SCF::get_repeat_multiple_data( $object );
@@ -210,25 +205,25 @@ class Smart_Custom_Fields_Controller_Base {
210
  /**
211
  * 非複数許可フィールドのメタデータを取得
212
  *
213
- * @param int $id 投稿ID or ユーザーID
214
  * @param Smart_Custom_Fields_Field_Base $Field
215
  * @param int $index
216
  * @return string or null
217
  */
218
  public function get_single_data_field_value( $object, $Field, $index ) {
219
  $Meta = new Smart_Custom_Fields_Meta( $object );
220
- $id = $Meta->get_id();
221
  $field_name = $Field->get( 'name' );
222
 
223
  if ( is_null( $index ) ) {
224
  return SCF::get_default_value( $Field, true );
225
  }
226
 
227
- if ( $Meta->is_saved_by_key( $field_name ) || !$Meta->is_use_default_when_not_saved() ) {
228
  $value = $Meta->get( $field_name );
229
  if ( isset( $value[$index] ) ) {
230
  return $value[$index];
231
  }
 
232
  }
233
  return SCF::get_default_value( $Field, true );
234
  }
@@ -236,14 +231,13 @@ class Smart_Custom_Fields_Controller_Base {
236
  /**
237
  * カスタムフィールド表示 table で使用する各 tr を出力
238
  *
239
- * @param WP_Post|WP_User $object
240
  * @param bool $is_repeat
241
  * @param array $fields
242
  * @param int, null $index
243
  */
244
  protected function display_tr( $object, $is_repeat, $fields, $index = null ) {
245
  $Meta = new Smart_Custom_Fields_Meta( $object );
246
- $id = $Meta->get_id();
247
 
248
  $btn_repeat = '';
249
  if ( $is_repeat ) {
1
  <?php
2
  /**
3
  * Smart_Custom_Fields_Controller_Base
4
+ * Version : 1.2.0
5
+ * Author : inc2734
6
  * Created : April 27, 2015
7
+ * Modified : November 12, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Controller_Base {
108
  /**
109
  * カスタムフィールドを出力するための配列を生成
110
  *
111
+ * @param WP_Post|WP_User|object $object
112
  * @param array $groups カスタムフィールド設定ページで保存した設定
113
  * @return array $tables カスタムフィールド表示用のテーブルを出力するための配列
114
  */
115
  protected function get_tables( $object, $groups ) {
116
  $Meta = new Smart_Custom_Fields_Meta( $object );
 
117
 
118
  $repeat_multiple_data = SCF::get_repeat_multiple_data( $object );
119
  $tables = array();
163
  /**
164
  * 複数許可フィールドのメタデータを取得
165
  *
166
+ * @param WP_Post|WP_User|object $object
167
  * @param Smart_Custom_Fields_Field_Base $Field
168
  * @param int $index
169
  * @return array or null
170
  */
171
  public function get_multiple_data_field_value( $object, $Field, $index ) {
172
  $Meta = new Smart_Custom_Fields_Meta( $object );
 
173
  $field_name = $Field->get( 'name' );
174
 
175
  if ( is_null( $index ) ) {
176
  return SCF::get_default_value( $Field );
177
  }
178
+
179
+ if ( !$Meta->is_saved() ) {
 
 
 
 
 
180
  return SCF::get_default_value( $Field );
181
  }
182
+
183
+ $value = $Meta->get( $field_name );
184
 
185
  // ループのとき
186
  $repeat_multiple_data = SCF::get_repeat_multiple_data( $object );
205
  /**
206
  * 非複数許可フィールドのメタデータを取得
207
  *
208
+ * @param WP_Post|WP_User|object $object
209
  * @param Smart_Custom_Fields_Field_Base $Field
210
  * @param int $index
211
  * @return string or null
212
  */
213
  public function get_single_data_field_value( $object, $Field, $index ) {
214
  $Meta = new Smart_Custom_Fields_Meta( $object );
 
215
  $field_name = $Field->get( 'name' );
216
 
217
  if ( is_null( $index ) ) {
218
  return SCF::get_default_value( $Field, true );
219
  }
220
 
221
+ if ( $Meta->is_saved() ) {
222
  $value = $Meta->get( $field_name );
223
  if ( isset( $value[$index] ) ) {
224
  return $value[$index];
225
  }
226
+ return '';
227
  }
228
  return SCF::get_default_value( $Field, true );
229
  }
231
  /**
232
  * カスタムフィールド表示 table で使用する各 tr を出力
233
  *
234
+ * @param WP_Post|WP_User|object $object
235
  * @param bool $is_repeat
236
  * @param array $fields
237
  * @param int, null $index
238
  */
239
  protected function display_tr( $object, $is_repeat, $fields, $index = null ) {
240
  $Meta = new Smart_Custom_Fields_Meta( $object );
 
241
 
242
  $btn_repeat = '';
243
  if ( $is_repeat ) {
classes/controller/class.editor.php CHANGED
@@ -2,10 +2,10 @@
2
  /**
3
  * Smart_Custom_Fields_Controller_Editor
4
  * Version : 1.1.0
5
- * Author : Takashi Kitajima
6
  * Created : September 23, 2014
7
  * Modified : April 28, 2015
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Controller_Editor extends Smart_Custom_Fields_Controller_Base {
2
  /**
3
  * Smart_Custom_Fields_Controller_Editor
4
  * Version : 1.1.0
5
+ * Author : inc2734
6
  * Created : September 23, 2014
7
  * Modified : April 28, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Controller_Editor extends Smart_Custom_Fields_Controller_Base {
classes/controller/class.profile.php CHANGED
@@ -2,10 +2,10 @@
2
  /**
3
  * Smart_Custom_Fields_Controller_Profile
4
  * Version : 1.0.1
5
- * Author : Takashi Kitajima
6
  * Created : March 16, 2015
7
  * Modified : April 26, 2015
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Controller_Profile extends Smart_Custom_Fields_Controller_Base {
2
  /**
3
  * Smart_Custom_Fields_Controller_Profile
4
  * Version : 1.0.1
5
+ * Author : inc2734
6
  * Created : March 16, 2015
7
  * Modified : April 26, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Controller_Profile extends Smart_Custom_Fields_Controller_Base {
classes/controller/class.settings.php CHANGED
@@ -2,10 +2,10 @@
2
  /**
3
  * Smart_Custom_Fields_Controller_Settings
4
  * Version : 1.2.0
5
- * Author : Takashi Kitajima
6
  * Created : September 23, 2014
7
  * Modified : April 26, 2015
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Controller_Settings {
2
  /**
3
  * Smart_Custom_Fields_Controller_Settings
4
  * Version : 1.2.0
5
+ * Author : inc2734
6
  * Created : September 23, 2014
7
  * Modified : April 26, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Controller_Settings {
classes/controller/class.taxonomy.php CHANGED
@@ -2,10 +2,10 @@
2
  /**
3
  * Smart_Custom_Fields_Controller_Taxonomy
4
  * Version : 1.0.0
5
- * Author : Takashi Kitajima
6
  * Created : April 26, 2015
7
  * Modified :
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Controller_Taxonomy extends Smart_Custom_Fields_Controller_Base {
2
  /**
3
  * Smart_Custom_Fields_Controller_Taxonomy
4
  * Version : 1.0.0
5
+ * Author : inc2734
6
  * Created : April 26, 2015
7
  * Modified :
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Controller_Taxonomy extends Smart_Custom_Fields_Controller_Base {
classes/fields/class.field-boolean.php CHANGED
@@ -3,10 +3,10 @@
3
  /**
4
  * Smart_Custom_Fields_Field_Boolean
5
  * Version : 1.0.1
6
- * Author : Toro_Unit, Takashi Kitajima
7
  * Created : April 6, 2015
8
  * Modified : April 11, 2015
9
- * License : GPLv2
10
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
  */
12
 
3
  /**
4
  * Smart_Custom_Fields_Field_Boolean
5
  * Version : 1.0.1
6
+ * Author : Toro_Unit, inc2734
7
  * Created : April 6, 2015
8
  * Modified : April 11, 2015
9
+ * License : GPLv2 or later
10
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
  */
12
 
classes/fields/class.field-check.php CHANGED
@@ -2,10 +2,10 @@
2
  /**
3
  * Smart_Custom_Fields_Field_Check
4
  * Version : 1.2.0
5
- * Author : Takashi Kitajima
6
  * Created : October 7, 2014
7
  * Modified : April 24, 2015
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Field_Check extends Smart_Custom_Fields_Field_Base {
2
  /**
3
  * Smart_Custom_Fields_Field_Check
4
  * Version : 1.2.0
5
+ * Author : inc2734
6
  * Created : October 7, 2014
7
  * Modified : April 24, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Field_Check extends Smart_Custom_Fields_Field_Base {
classes/fields/class.field-colorpicker.php CHANGED
@@ -2,10 +2,10 @@
2
  /**
3
  * Smart_Custom_Fields_Field_Colorpicker
4
  * Version : 1.1.0
5
- * Author : Takashi Kitajima
6
  * Created : October 21, 2014
7
  * Modified : February 27, 2015
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Field_Colorpicker extends Smart_Custom_Fields_Field_Base {
2
  /**
3
  * Smart_Custom_Fields_Field_Colorpicker
4
  * Version : 1.1.0
5
+ * Author : inc2734
6
  * Created : October 21, 2014
7
  * Modified : February 27, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Field_Colorpicker extends Smart_Custom_Fields_Field_Base {
classes/fields/class.field-datepicker.php CHANGED
@@ -2,10 +2,10 @@
2
  /**
3
  * Smart_Custom_Fields_Field_Datepicker
4
  * Version : 1.1.0
5
- * Author : Takashi Kitajima
6
  * Created : January 17, 2015
7
  * Modified : February 27, 2015
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Field_Datepicker extends Smart_Custom_Fields_Field_Base {
2
  /**
3
  * Smart_Custom_Fields_Field_Datepicker
4
  * Version : 1.1.0
5
+ * Author : inc2734
6
  * Created : January 17, 2015
7
  * Modified : February 27, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Field_Datepicker extends Smart_Custom_Fields_Field_Base {
classes/fields/class.field-file.php CHANGED
@@ -2,10 +2,10 @@
2
  /**
3
  * Smart_Custom_Fields_Field_File
4
  * Version : 1.1.0
5
- * Author : Takashi Kitajima
6
  * Created : October 7, 2014
7
  * Modified : February 27, 2015
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Field_File extends Smart_Custom_Fields_Field_Base {
2
  /**
3
  * Smart_Custom_Fields_Field_File
4
  * Version : 1.1.0
5
+ * Author : inc2734
6
  * Created : October 7, 2014
7
  * Modified : February 27, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Field_File extends Smart_Custom_Fields_Field_Base {
classes/fields/class.field-image.php CHANGED
@@ -2,10 +2,10 @@
2
  /**
3
  * Smart_Custom_Fields_Field_Image
4
  * Version : 1.1.0
5
- * Author : Takashi Kitajima
6
  * Created : October 7, 2014
7
  * Modified : February 27, 2015
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Field_Image extends Smart_Custom_Fields_Field_Base {
2
  /**
3
  * Smart_Custom_Fields_Field_Image
4
  * Version : 1.1.0
5
+ * Author : inc2734
6
  * Created : October 7, 2014
7
  * Modified : February 27, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Field_Image extends Smart_Custom_Fields_Field_Base {
classes/fields/class.field-radio.php CHANGED
@@ -2,10 +2,10 @@
2
  /**
3
  * Smart_Custom_Fields_Field_Radio
4
  * Version : 1.2.0
5
- * Author : Takashi Kitajima
6
  * Created : October 7, 2014
7
  * Modified : April 24, 2015
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Field_Radio extends Smart_Custom_Fields_Field_Base {
2
  /**
3
  * Smart_Custom_Fields_Field_Radio
4
  * Version : 1.2.0
5
+ * Author : inc2734
6
  * Created : October 7, 2014
7
  * Modified : April 24, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Field_Radio extends Smart_Custom_Fields_Field_Base {
classes/fields/class.field-relation.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
3
  * Smart_Custom_Fields_Field_Relation
4
- * Version : 1.2.1
5
- * Author : Takashi Kitajima
6
  * Created : October 7, 2014
7
- * Modified : September 3, 2015
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Field_Relation extends Smart_Custom_Fields_Field_Base {
@@ -67,17 +67,37 @@ class Smart_Custom_Fields_Field_Relation extends Smart_Custom_Fields_Field_Base
67
  public function relational_posts_search() {
68
  check_ajax_referer( SCF_Config::NAME . '-relation', 'nonce' );
69
  $_posts = array();
70
- if ( isset( $_POST['post_types'], $_POST['click_count' ] ) ) {
 
71
  $post_type = explode( ',', $_POST['post_types'] );
72
- $posts_per_page = get_option( 'posts_per_page' );
73
- $offset = $_POST['click_count'] * $posts_per_page;
74
- $_posts = get_posts( array(
75
- 'post_type' => $post_type,
76
- 'offset' => $offset,
77
- 'order' => 'ASC',
78
- 'orderby' => 'ID',
79
- 'posts_per_page' => $posts_per_page,
80
- ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  }
82
  header( 'Content-Type: application/json; charset=utf-8' );
83
  echo json_encode( $_posts );
@@ -153,20 +173,25 @@ class Smart_Custom_Fields_Field_Relation extends Smart_Custom_Fields_Field_Base
153
  }
154
 
155
  return sprintf(
156
- '<div class="%s">
 
 
 
157
  <div class="%s">
158
  <ul>%s</ul>
159
- <p class="load-relation-posts %s" data-post-types="%s">%s</p>
160
  <input type="hidden" name="%s" %s />
161
  %s
162
  </div>
163
  </div>
164
  <div class="%s"><ul>%s</ul></div>',
165
  SCF_Config::PREFIX . 'relation-left',
 
 
 
166
  SCF_Config::PREFIX . 'relation-children-select',
167
  implode( '', $choices_li ),
168
  $hide_class,
169
- implode( ',', $post_type ),
170
  esc_html__( 'Load more', 'smart-custom-fields' ),
171
  esc_attr( $name ),
172
  disabled( true, $disabled, false ),
1
  <?php
2
  /**
3
  * Smart_Custom_Fields_Field_Relation
4
+ * Version : 1.3.0
5
+ * Author : inc2734
6
  * Created : October 7, 2014
7
+ * Modified : November 12, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Field_Relation extends Smart_Custom_Fields_Field_Base {
67
  public function relational_posts_search() {
68
  check_ajax_referer( SCF_Config::NAME . '-relation', 'nonce' );
69
  $_posts = array();
70
+ $args = array();
71
+ if ( isset( $_POST['post_types'] ) ) {
72
  $post_type = explode( ',', $_POST['post_types'] );
73
+ $args = array(
74
+ 'post_type' => $post_type,
75
+ 'order' => 'ASC',
76
+ 'orderby' => 'ID',
77
+ 'posts_per_page' => -1,
78
+ );
79
+
80
+ if ( isset( $_POST['click_count'] ) ) {
81
+ $posts_per_page = get_option( 'posts_per_page' );
82
+ $offset = $_POST['click_count'] * $posts_per_page;
83
+ $args = array_merge(
84
+ $args,
85
+ array(
86
+ 'offset' => $offset,
87
+ 'posts_per_page' => $posts_per_page,
88
+ )
89
+ );
90
+ }
91
+
92
+ if ( isset( $_POST['s'] ) ) {
93
+ $args = array_merge(
94
+ $args,
95
+ array(
96
+ 's' => $_POST['s'],
97
+ )
98
+ );
99
+ }
100
+ $_posts = get_posts( $args );
101
  }
102
  header( 'Content-Type: application/json; charset=utf-8' );
103
  echo json_encode( $_posts );
173
  }
174
 
175
  return sprintf(
176
+ '<div class="%s" data-post-types="%s">
177
+ <div class="%s">
178
+ <input type="text" class="widefat search-input" name="search-input" placeholder="%s" />
179
+ </div>
180
  <div class="%s">
181
  <ul>%s</ul>
182
+ <p class="load-relation-posts %s">%s</p>
183
  <input type="hidden" name="%s" %s />
184
  %s
185
  </div>
186
  </div>
187
  <div class="%s"><ul>%s</ul></div>',
188
  SCF_Config::PREFIX . 'relation-left',
189
+ implode( ',', $post_type ),
190
+ SCF_Config::PREFIX . 'search',
191
+ esc_attr__( 'Search...', 'smart-custom-fields' ),
192
  SCF_Config::PREFIX . 'relation-children-select',
193
  implode( '', $choices_li ),
194
  $hide_class,
 
195
  esc_html__( 'Load more', 'smart-custom-fields' ),
196
  esc_attr( $name ),
197
  disabled( true, $disabled, false ),
classes/fields/class.field-select.php CHANGED
@@ -2,10 +2,10 @@
2
  /**
3
  * Smart_Custom_Fields_Field_Select
4
  * Version : 1.1.0
5
- * Author : Takashi Kitajima
6
  * Created : October 7, 2014
7
  * Modified : February 27, 2015
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Field_Select extends Smart_Custom_Fields_Field_Base {
2
  /**
3
  * Smart_Custom_Fields_Field_Select
4
  * Version : 1.1.0
5
+ * Author : inc2734
6
  * Created : October 7, 2014
7
  * Modified : February 27, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Field_Select extends Smart_Custom_Fields_Field_Base {
classes/fields/class.field-text.php CHANGED
@@ -2,10 +2,10 @@
2
  /**
3
  * Smart_Custom_Fields_Field_Text
4
  * Version : 1.1.0
5
- * Author : Takashi Kitajima
6
  * Created : October 7, 2014
7
  * Modified : February 27, 2015
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Field_Text extends Smart_Custom_Fields_Field_Base {
2
  /**
3
  * Smart_Custom_Fields_Field_Text
4
  * Version : 1.1.0
5
+ * Author : inc2734
6
  * Created : October 7, 2014
7
  * Modified : February 27, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Field_Text extends Smart_Custom_Fields_Field_Base {
classes/fields/class.field-textarea.php CHANGED
@@ -2,10 +2,10 @@
2
  /**
3
  * Smart_Custom_Fields_Field_Textarea
4
  * Version : 1.1.0
5
- * Author : Takashi Kitajima
6
  * Created : October 7, 2014
7
  * Modified : February 27, 2015
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Field_Textarea extends Smart_Custom_Fields_Field_Base {
2
  /**
3
  * Smart_Custom_Fields_Field_Textarea
4
  * Version : 1.1.0
5
+ * Author : inc2734
6
  * Created : October 7, 2014
7
  * Modified : February 27, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Field_Textarea extends Smart_Custom_Fields_Field_Base {
classes/fields/class.field-wysiwyg.php CHANGED
@@ -2,10 +2,10 @@
2
  /**
3
  * Smart_Custom_Fields_Field_Wysiwyg
4
  * Version : 1.1.3
5
- * Author : Takashi Kitajima
6
  * Created : October 7, 2014
7
  * Modified : September 28, 2015
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Field_Wysiwyg extends Smart_Custom_Fields_Field_Base {
2
  /**
3
  * Smart_Custom_Fields_Field_Wysiwyg
4
  * Version : 1.1.3
5
+ * Author : inc2734
6
  * Created : October 7, 2014
7
  * Modified : September 28, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Field_Wysiwyg extends Smart_Custom_Fields_Field_Base {
classes/models/class.abstract-field-base.php CHANGED
@@ -2,10 +2,10 @@
2
  /**
3
  * Smart_Custom_Fields_Field_Base
4
  * Version : 1.1.0
5
- * Author : Takashi Kitajima
6
  * Created : October 7, 2014
7
  * Modified : February 28, 2015
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  abstract class Smart_Custom_Fields_Field_Base {
2
  /**
3
  * Smart_Custom_Fields_Field_Base
4
  * Version : 1.1.0
5
+ * Author : inc2734
6
  * Created : October 7, 2014
7
  * Modified : February 28, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  abstract class Smart_Custom_Fields_Field_Base {
classes/models/class.ajax.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
3
  * Smart_Custom_Fields_Ajax
4
- * Version : 1.1.0
5
- * Author : Takashi Kitajima
6
  * Created : April 27, 2015
7
- * Modified :
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Ajax {
@@ -29,6 +29,6 @@ class Smart_Custom_Fields_Ajax {
29
  */
30
  public function delete_term( $term_id, $term_taxonomy_id, $taxonomy, $deleted_term ) {
31
  $Meta = new Smart_Custom_Fields_Meta( $deleted_term );
32
- $Meta->delete();
33
  }
34
  }
1
  <?php
2
  /**
3
  * Smart_Custom_Fields_Ajax
4
+ * Version : 1.2.0
5
+ * Author : inc2734
6
  * Created : April 27, 2015
7
+ * Modified : December 12, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Ajax {
29
  */
30
  public function delete_term( $term_id, $term_taxonomy_id, $taxonomy, $deleted_term ) {
31
  $Meta = new Smart_Custom_Fields_Meta( $deleted_term );
32
+ $Meta->delete_term_meta_for_wp43();
33
  }
34
  }
classes/models/class.group.php CHANGED
@@ -2,10 +2,10 @@
2
  /**
3
  * Smart_Custom_Fields_Group
4
  * Version : 1.0.0
5
- * Author : Takashi Kitajima
6
  * Created : September 23, 2014
7
  * Modified : February 27, 2015
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Group {
@@ -49,7 +49,7 @@ class Smart_Custom_Fields_Group {
49
  }
50
 
51
  if ( !empty( $Field ) ) {
52
- $fields[] = $Field;
53
  }
54
  }
55
  $this->fields = $fields;
@@ -75,6 +75,19 @@ class Smart_Custom_Fields_Group {
75
  public function get_fields() {
76
  return $this->fields;
77
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
78
 
79
  /**
80
  * 繰り返しグループかどうか
2
  /**
3
  * Smart_Custom_Fields_Group
4
  * Version : 1.0.0
5
+ * Author : inc2734
6
  * Created : September 23, 2014
7
  * Modified : February 27, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Group {
49
  }
50
 
51
  if ( !empty( $Field ) ) {
52
+ $fields[$Field->get( 'name' )] = $Field;
53
  }
54
  }
55
  $this->fields = $fields;
75
  public function get_fields() {
76
  return $this->fields;
77
  }
78
+
79
+ /**
80
+ * フィールドを返す
81
+ *
82
+ * @param string $field_name フィールド名
83
+ * @return Smart_Custom_Fields_Field_Base|null
84
+ */
85
+ public function get_field( $field_name ) {
86
+ $fields = $this->get_fields();
87
+ if ( isset( $fields[$field_name] ) ) {
88
+ return $fields[$field_name];
89
+ }
90
+ }
91
 
92
  /**
93
  * 繰り返しグループかどうか
classes/models/class.meta.php CHANGED
@@ -1,11 +1,11 @@
1
  <?php
2
  /**
3
  * Smart_Custom_Fields_Meta
4
- * Version : 1.1.0
5
- * Author : Takashi Kitajima
6
  * Created : March 17, 2015
7
- * Modified : April 26, 2015
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Meta {
@@ -114,52 +114,24 @@ class Smart_Custom_Fields_Meta {
114
  }
115
  return $this->type;
116
  }
117
-
118
  /**
119
- * 指定されたキーのカスタムフィールドが既に保存されているか
 
 
 
 
120
  *
121
- * @param string $key
122
  * @return bool
123
  */
124
- public function is_saved_by_key( $key ) {
125
- if ( _get_meta_table( $this->meta_type ) ) {
126
- if ( $this->meta_type === 'post' ) {
127
- $meta = get_post_custom_values( $key, $this->id );
128
- if ( !is_null( $meta ) ) {
129
- return true;
130
- }
131
- }
132
- elseif ( $this->meta_type === 'user' ) {
133
- $meta = get_user_option( $key, $this->id );
134
- if ( $meta !== false ) {
135
- return true;
136
- }
137
- }
138
- } else {
139
- $meta = get_option( $this->get_option_name() );
140
- if ( isset( $meta[$key] ) ) {
141
- return true;
142
- }
143
  }
144
- return false;
145
- }
146
-
147
- /**
148
- * $is_use_default_when_not_saved が true = true // 1.3.x までは false
149
- * $is_use_default_when_not_saved が false で meta_type が post で post_status が auto-draft = true
150
- *
151
- * @return bool
152
- */
153
- public function is_use_default_when_not_saved() {
154
- $use_default_when_not_saved = apply_filters( SCF_Config::PREFIX . 'is_use_default_when_not_saved', true );
155
- if (
156
- $use_default_when_not_saved !== false
157
- ||
158
- $use_default_when_not_saved === false && $this->meta_type === 'post' && in_array( get_post_status( $this->object ), array( 'auto-draft' ) )
159
- ) {
160
- return true;
161
  }
162
- return false;
163
  }
164
 
165
  /**
@@ -170,8 +142,53 @@ class Smart_Custom_Fields_Meta {
170
  * @return string|array
171
  */
172
  public function get( $key = '', $single = false ) {
173
- if ( _get_meta_table( $this->meta_type ) ) {
174
- return get_metadata( $this->meta_type, $this->id, $key, $single );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  } else {
176
  $option = get_option( $this->get_option_name() );
177
  if ( $key !=='' && isset( $option[$key] ) ) {
@@ -280,12 +297,11 @@ class Smart_Custom_Fields_Meta {
280
  return delete_metadata( $this->meta_type, $this->id, $key, $value );
281
  }
282
  } else {
283
- $option_name = $this->get_option_name();
284
-
285
  if ( !$key ) {
286
- return delete_option( $option_name );
287
  }
288
-
 
289
  $option = get_option( $option_name );
290
 
291
  if ( isset( $option[$key] ) && $value === '' ) {
@@ -303,6 +319,14 @@ class Smart_Custom_Fields_Meta {
303
  }
304
  }
305
  }
 
 
 
 
 
 
 
 
306
 
307
  /**
308
  * 送信されたデータをもとにメタデータを保存
@@ -406,29 +430,26 @@ class Smart_Custom_Fields_Meta {
406
 
407
  $settings = SCF::get_settings( $object );
408
  foreach ( $settings as $Setting ) {
409
- $groups = $Setting->get_groups();
410
- foreach ( $groups as $Group ) {
411
- $fields = $Group->get_fields();
412
- foreach ( $fields as $Field ) {
413
- $field_name = $Field->get( 'name' );
414
- $this->delete( $field_name );
415
- $value = SCF::get( $field_name, $revision->ID );
416
- if ( is_array( $value ) ) {
417
- foreach ( $value as $val ) {
418
- if ( is_array( $val ) ) {
419
- foreach ( $val as $v ) {
420
- // ループ内複数値項目
421
- $this->add( $field_name, $v );
422
- }
423
- } else {
424
- // ループ内単一項目 or ループ外複数値項目
425
- $this->add( $field_name, $val );
426
  }
 
 
 
427
  }
428
- } else {
429
- // ループ外単一項目
430
- $this->add( $field_name, $value );
431
  }
 
 
 
432
  }
433
  }
434
  }
1
  <?php
2
  /**
3
  * Smart_Custom_Fields_Meta
4
+ * Version : 1.2.0
5
+ * Author : inc2734
6
  * Created : March 17, 2015
7
+ * Modified : November 12, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Meta {
114
  }
115
  return $this->type;
116
  }
117
+
118
  /**
119
+ * このメタデータを持つオブジェクトが保存済みかどうか
120
+ * 投稿は auto-draft のときは保存されていない(新規投稿中)
121
+ * タクソノミー・ユーザーのカスタムフィールドは保存後にしか表示されないので
122
+ * そのままだとデフォルト値を表示できない
123
+ * そこで、全てのメタデータが全く空の場合は保存されていないと判断する
124
  *
 
125
  * @return bool
126
  */
127
+ public function is_saved() {
128
+ if ( $this->meta_type === 'post' && get_post_status( $this->get_id() ) === 'auto-draft' ) {
129
+ return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  }
131
+ if ( !$this->get() ) {
132
+ return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
133
  }
134
+ return true;
135
  }
136
 
137
  /**
142
  * @return string|array
143
  */
144
  public function get( $key = '', $single = false ) {
145
+ // under WP 4.4 compatibility
146
+ $maybe_4_3_term_meta = false;
147
+ if ( $this->meta_type === 'term' ) {
148
+ $meta = get_metadata( $this->meta_type, $this->id );
149
+ if ( !$meta ) {
150
+ $maybe_4_3_term_meta = true;
151
+ }
152
+ }
153
+
154
+ if ( _get_meta_table( $this->meta_type ) && !$maybe_4_3_term_meta ) {
155
+ $meta = get_metadata( $this->meta_type, $this->id, $key, $single );
156
+
157
+ if ( $key === SCF_Config::PREFIX . 'repeat-multiple-data' ) {
158
+ return $meta;
159
+ }
160
+
161
+ $settings = SCF::get_settings( $this->object );
162
+ if ( $key ) {
163
+ foreach ( $settings as $Setting ) {
164
+ $groups = $Setting->get_groups();
165
+ foreach ( $groups as $Group ) {
166
+ $Field = $Group->get_field( $key );
167
+ if ( $Field ) {
168
+ return $meta;
169
+ }
170
+ }
171
+ }
172
+ } else {
173
+ if ( is_array( $meta ) ) {
174
+ foreach ( $settings as $Setting ) {
175
+ $fields = $Setting->get_fields();
176
+ }
177
+ foreach ( $meta as $meta_key => $meta_value ) {
178
+ if ( isset( $fields[$meta_key] ) ) {
179
+ $metas[$meta_key] = $meta[$meta_key];
180
+ }
181
+ }
182
+ }
183
+ }
184
+
185
+ if ( isset( $metas ) ) {
186
+ return $metas;
187
+ }
188
+ if ( $single ) {
189
+ return '';
190
+ }
191
+ return array();
192
  } else {
193
  $option = get_option( $this->get_option_name() );
194
  if ( $key !=='' && isset( $option[$key] ) ) {
297
  return delete_metadata( $this->meta_type, $this->id, $key, $value );
298
  }
299
  } else {
 
 
300
  if ( !$key ) {
301
+ return false;
302
  }
303
+
304
+ $option_name = $this->get_option_name();
305
  $option = get_option( $option_name );
306
 
307
  if ( isset( $option[$key] ) && $value === '' ) {
319
  }
320
  }
321
  }
322
+
323
+ /**
324
+ * Delete all term meta for less than WordPress 4.3
325
+ */
326
+ public function delete_term_meta_for_wp43() {
327
+ $option_name = $this->get_option_name();
328
+ return delete_option( $option_name );
329
+ }
330
 
331
  /**
332
  * 送信されたデータをもとにメタデータを保存
430
 
431
  $settings = SCF::get_settings( $object );
432
  foreach ( $settings as $Setting ) {
433
+ $fields = $Setting->get_fields();
434
+ foreach ( $fields as $Field ) {
435
+ $field_name = $Field->get( 'name' );
436
+ $this->delete( $field_name );
437
+ $value = SCF::get( $field_name, $revision->ID );
438
+ if ( is_array( $value ) ) {
439
+ foreach ( $value as $val ) {
440
+ if ( is_array( $val ) ) {
441
+ foreach ( $val as $v ) {
442
+ // ループ内複数値項目
443
+ $this->add( $field_name, $v );
 
 
 
 
 
 
444
  }
445
+ } else {
446
+ // ループ内単一項目 or ループ外複数値項目
447
+ $this->add( $field_name, $val );
448
  }
 
 
 
449
  }
450
+ } else {
451
+ // ループ外単一項目
452
+ $this->add( $field_name, $value );
453
  }
454
  }
455
  }
classes/models/class.revisions.php CHANGED
@@ -2,10 +2,10 @@
2
  /**
3
  * Smart_Custom_Fields_Revisions
4
  * Version : 1.1.2
5
- * Author : Takashi Kitajima
6
  * Created : September 23, 2014
7
  * Modified : March 19, 2015
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Revisions {
2
  /**
3
  * Smart_Custom_Fields_Revisions
4
  * Version : 1.1.2
5
+ * Author : inc2734
6
  * Created : September 23, 2014
7
  * Modified : March 19, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Revisions {
classes/models/class.setting.php CHANGED
@@ -2,10 +2,10 @@
2
  /**
3
  * Smart_Custom_Fields_Setting
4
  * Version : 1.0.0
5
- * Author : Takashi Kitajima
6
  * Created : September 23, 2014
7
  * Modified : February 27, 2015
8
- * License : GPLv2
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Setting {
@@ -83,6 +83,20 @@ class Smart_Custom_Fields_Setting {
83
  public function get_groups() {
84
  return $this->groups;
85
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
 
87
  /**
88
  * グループを最後に追加。引数なしで空のグループを追加
@@ -93,7 +107,25 @@ class Smart_Custom_Fields_Setting {
93
  */
94
  public function add_group( $group_name = null, $repeat = false, array $fields = array() ) {
95
  $Group = $this->new_group( $group_name, $repeat, $fields );
96
- $this->groups[] = $Group;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
  }
98
 
99
  /**
2
  /**
3
  * Smart_Custom_Fields_Setting
4
  * Version : 1.0.0
5
+ * Author : inc2734
6
  * Created : September 23, 2014
7
  * Modified : February 27, 2015
8
+ * License : GPLv2 or later
9
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
  */
11
  class Smart_Custom_Fields_Setting {
83
  public function get_groups() {
84
  return $this->groups;
85
  }
86
+
87
+ /**
88
+ * この設定ページに保存されている各グループのフィールドをまとめて取得
89
+ *
90
+ * @return array
91
+ */
92
+ public function get_fields() {
93
+ $groups = $this->get_groups();
94
+ $fields = array();
95
+ foreach ( $groups as $Group ) {
96
+ $fields = array_merge( $fields, $Group->get_fields() );
97
+ }
98
+ return $fields;
99
+ }
100
 
101
  /**
102
  * グループを最後に追加。引数なしで空のグループを追加
107
  */
108
  public function add_group( $group_name = null, $repeat = false, array $fields = array() ) {
109
  $Group = $this->new_group( $group_name, $repeat, $fields );
110
+ $group_name = $Group->get_name();
111
+ if ( $group_name ) {
112
+ $this->groups[$group_name] = $Group;
113
+ } else {
114
+ $this->groups[] = $Group;
115
+ }
116
+ }
117
+
118
+ /**
119
+ * グループを検索
120
+ *
121
+ * @param string $group_name グループ名
122
+ * @return Smart_Custom_Fields_Group|false
123
+ */
124
+ public function get_group( $group_name ) {
125
+ $groups = $this->get_groups();
126
+ if ( isset( $groups[$group_name] ) && $groups[$group_name]->is_repeatable() ) {
127
+ return $groups[$group_name];
128
+ }
129
  }
130
 
131
  /**
css/editor.css CHANGED
@@ -1,10 +1,10 @@
1
  /**
2
  * editor.css
3
- * Version : 1.1.0
4
- * Author : Takashi Kitajima
5
  * Created : September 23, 2014
6
- * Modified : April 24, 2015
7
- * License : GPLv2
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
 
@@ -86,7 +86,6 @@
86
  border: #ddd solid 1px;
87
  border-radius: 3px;
88
  height: 160px;
89
- overflow: auto;
90
  }
91
  .smart-cf-meta-box-table .smart-cf-relation-left ul,
92
  .smart-cf-meta-box-table .smart-cf-relation-right ul {
@@ -106,6 +105,16 @@
106
  .smart-cf-meta-box-table .smart-cf-relation-left {
107
  float: left;
108
  width: 47%;
 
 
 
 
 
 
 
 
 
 
109
  }
110
  .smart-cf-meta-box-table .smart-cf-relation-left ul li {
111
  cursor: pointer;
@@ -126,6 +135,7 @@
126
  .smart-cf-meta-box-table .smart-cf-relation-right {
127
  float: right;
128
  width: 50%;
 
129
  }
130
  .smart-cf-meta-box-table .smart-cf-relation-right ul li .relation-remove {
131
  cursor: pointer;
1
  /**
2
  * editor.css
3
+ * Version : 1.2.0
4
+ * Author : inc2734
5
  * Created : September 23, 2014
6
+ * Modified : November 12, 2015
7
+ * License : GPLv2 or later
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
 
86
  border: #ddd solid 1px;
87
  border-radius: 3px;
88
  height: 160px;
 
89
  }
90
  .smart-cf-meta-box-table .smart-cf-relation-left ul,
91
  .smart-cf-meta-box-table .smart-cf-relation-right ul {
105
  .smart-cf-meta-box-table .smart-cf-relation-left {
106
  float: left;
107
  width: 47%;
108
+ overflow: hidden;
109
+ }
110
+ .smart-cf-meta-box-table .smart-cf-relation-left .smart-cf-search {
111
+ background-color: #f5f5f5;
112
+ border-bottom: 1px solid #eee;
113
+ padding: 5px;
114
+ }
115
+ .smart-cf-meta-box-table .smart-cf-relation-left .smart-cf-relation-children-select {
116
+ overflow: auto;
117
+ height: 122px;
118
  }
119
  .smart-cf-meta-box-table .smart-cf-relation-left ul li {
120
  cursor: pointer;
135
  .smart-cf-meta-box-table .smart-cf-relation-right {
136
  float: right;
137
  width: 50%;
138
+ overflow: auto;
139
  }
140
  .smart-cf-meta-box-table .smart-cf-relation-right ul li .relation-remove {
141
  cursor: pointer;
css/profile.css CHANGED
@@ -1,10 +1,10 @@
1
  /**
2
  * profile.css
3
  * Version : 1.0.0
4
- * Author : Takashi Kitajima
5
  * Created : March 18, 2014
6
  * Modified :
7
- * License : GPLv2
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
 
1
  /**
2
  * profile.css
3
  * Version : 1.0.0
4
+ * Author : inc2734
5
  * Created : March 18, 2014
6
  * Modified :
7
+ * License : GPLv2 or later
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
 
css/settings.css CHANGED
@@ -1,10 +1,10 @@
1
  /**
2
  * settings.css
3
  * Version : 1.0.3
4
- * Author : Takashi Kitajima
5
  * Created : September 23, 2014
6
  * Modified : April 26, 2015
7
- * License : GPLv2
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
 
1
  /**
2
  * settings.css
3
  * Version : 1.0.3
4
+ * Author : inc2734
5
  * Created : September 23, 2014
6
  * Modified : April 26, 2015
7
+ * License : GPLv2 or later
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
 
css/taxonomy.css CHANGED
@@ -1,10 +1,10 @@
1
  /**
2
  * taxonomy.css
3
  * Version : 1.0.0
4
- * Author : Takashi Kitajima
5
  * Created : April 26, 2014
6
  * Modified :
7
- * License : GPLv2
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
 
1
  /**
2
  * taxonomy.css
3
  * Version : 1.0.0
4
+ * Author : inc2734
5
  * Created : April 26, 2014
6
  * Modified :
7
+ * License : GPLv2 or later
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
 
css/wysiwyg.css CHANGED
@@ -1,10 +1,10 @@
1
  /**
2
  * wysiwyg.css
3
  * Version : 1.0.0
4
- * Author : Takashi Kitajima
5
  * Created : April 11, 2015
6
  * Modified :
7
- * License : GPLv2
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
 
1
  /**
2
  * wysiwyg.css
3
  * Version : 1.0.0
4
+ * Author : inc2734
5
  * Created : April 11, 2015
6
  * Modified :
7
+ * License : GPLv2 or later
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
 
js/editor-colorpicker.js CHANGED
@@ -1,10 +1,10 @@
1
  /**
2
  * editor-colorpicker.js
3
  * Version : 1.0.0
4
- * Author : Takashi Kitajima
5
  * Created : October 21, 2014
6
  * Modified :
7
- * License : GPLv2
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
  jQuery( function( $ ) {
1
  /**
2
  * editor-colorpicker.js
3
  * Version : 1.0.0
4
+ * Author : inc2734
5
  * Created : October 21, 2014
6
  * Modified :
7
+ * License : GPLv2 or later
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
  jQuery( function( $ ) {
js/editor-datepicker.js CHANGED
@@ -1,10 +1,10 @@
1
  /**
2
  * editor-datepicker.js
3
  * Version : 1.0.0
4
- * Author : Takashi Kitajima
5
  * Created : January 18, 2015
6
  * Modified :
7
- * License : GPLv2
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
  jQuery( function( $ ) {
1
  /**
2
  * editor-datepicker.js
3
  * Version : 1.0.0
4
+ * Author : inc2734
5
  * Created : January 18, 2015
6
  * Modified :
7
+ * License : GPLv2 or later
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
  jQuery( function( $ ) {
js/editor-relation.js CHANGED
@@ -1,54 +1,96 @@
1
  /**
2
  * editor.js
3
- * Version : 1.0.2
4
- * Author : Takashi Kitajima
5
  * Created : September 30, 2014
6
- * Modified : September 2, 2015
7
- * License : GPLv2
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
  jQuery( function( $ ) {
11
 
12
  var table_class = '.smart-cf-meta-box-table';
13
-
14
  /**
15
- * 読み込みボタン
 
 
16
  */
17
- $( '.smart-cf-meta-box .load-relation-posts' )
18
  .data( 'click_count', 0 )
19
- .click( function() {
20
- var parent = $( this ).closest( '.smart-cf-meta-box-table' );
21
- var click_count = $( this ).data( 'click_count' );
22
- var post_types = $( this ).data( 'post-types' );
23
- var btn_load = $( this );
24
- click_count ++;
25
- btn_load.data( 'click_count', click_count );
26
- var btn_load_text = btn_load.text();
27
- btn_load.text( 'Now loading...' );
 
 
 
 
 
 
 
 
 
 
 
28
 
29
- $.post( smart_cf_relation.endpoint, {
30
- action : smart_cf_relation.action,
31
- nonce : smart_cf_relation.nonce,
32
- click_count: click_count,
33
- post_types : post_types
34
- },
35
- function( response ) {
36
- btn_load.addClass( 'hide' );
37
- $( response ).each( function( i, e ) {
38
- parent.find( '.smart-cf-relation-children-select ul' ).append(
39
- $( '<li />' )
40
- .attr( 'data-id', this.ID )
41
- .text( this.post_title )
42
- );
43
- } );
44
- if ( response ) {
45
- btn_load.text( btn_load_text );
46
- btn_load.removeClass( 'hide' );
47
- }
48
- }
49
- );
50
- return false;
 
 
 
 
 
 
 
 
 
51
  } );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
  /**
54
  * 選択肢
1
  /**
2
  * editor.js
3
+ * Version : 1.1.0
4
+ * Author : inc2734
5
  * Created : September 30, 2014
6
+ * Modified : November 12, 2015
7
+ * License : GPLv2 or later
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
  jQuery( function( $ ) {
11
 
12
  var table_class = '.smart-cf-meta-box-table';
13
+
14
  /**
15
+ * 初期化
16
+ * click_count はロードボタンを押すごとに加算。
17
+ * 検索ボックスが変更されるたびに 0 にリセットすること。
18
  */
19
+ $( '.smart-cf-meta-box .load-relation-posts' ).closest( '.smart-cf-meta-box-table' )
20
  .data( 'click_count', 0 )
21
+ .data( 'search_timer', null )
22
+ .data( 'recent_search_query', '' );
23
+
24
+ /**
25
+ * 検索ボタン
26
+ */
27
+ $( document ).on( 'keyup', '.smart-cf-meta-box .search-input', function() {
28
+ var parent = $( this ).closest( table_class );
29
+ var search_timer = parent.data( 'search_timer' );
30
+ clearTimeout( search_timer );
31
+
32
+ parent.data( 'click_count', 0 );
33
+ parent.find( '.smart-cf-relation-children-select ul li' ).remove();
34
+
35
+ var search_query = $( this ).val();
36
+ parent.data( 'recent_search_query', search_query );
37
+ parent.data( 'search_timer', setTimeout( function() {
38
+ get_posts( { s: search_query }, parent );
39
+ }, 2000 ) );
40
+ } );
41
 
42
+ /**
43
+ * 読み込みボタン
44
+ */
45
+ $( document ).on( 'click', '.smart-cf-meta-box .load-relation-posts', function() {
46
+ var parent = $( this ).closest( table_class );
47
+ var click_count = parent.data( 'click_count' );
48
+ click_count ++;
49
+ parent.data( 'click_count', click_count );
50
+ var search_query = parent.data( 'recent_search_query' );
51
+ if ( search_query ) {
52
+ get_posts( { s: search_query }, parent );
53
+ } else {
54
+ get_posts( {}, parent );
55
+ }
56
+ } );
57
+
58
+ /**
59
+ * クエリ
60
+ */
61
+ function get_posts( args, table ) {
62
+ var click_count = table.data( 'click_count' );
63
+ var post_types = table.find( '.smart-cf-relation-left' ).data( 'post-types' );
64
+ var btn_load = table.find( '.load-relation-posts' );
65
+ var btn_load_text = btn_load.text();
66
+ btn_load.text( 'Now loading...' );
67
+
68
+ args = $.extend( args, {
69
+ action : smart_cf_relation.action,
70
+ nonce : smart_cf_relation.nonce,
71
+ click_count: click_count,
72
+ post_types : post_types
73
  } );
74
+ $.post(
75
+ smart_cf_relation.endpoint,
76
+ args,
77
+ function( response ) {
78
+ btn_load.addClass( 'hide' );
79
+ $( response ).each( function( i, e ) {
80
+ table.find( '.smart-cf-relation-children-select ul' ).append(
81
+ $( '<li />' )
82
+ .attr( 'data-id', this.ID )
83
+ .text( this.post_title )
84
+ );
85
+ } );
86
+ if ( response ) {
87
+ btn_load.text( btn_load_text );
88
+ btn_load.removeClass( 'hide' );
89
+ }
90
+ }
91
+ );
92
+ return false;
93
+ }
94
 
95
  /**
96
  * 選択肢
js/editor-wysiwyg.js CHANGED
@@ -1,10 +1,10 @@
1
  /**
2
  * editor-wysiwyg.js
3
  * Version : 1.0.0
4
- * Author : Takashi Kitajima
5
  * Created : September 28, 2014
6
  * Modified :
7
- * License : GPLv2
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
  jQuery( function( $ ) {
1
  /**
2
  * editor-wysiwyg.js
3
  * Version : 1.0.0
4
+ * Author : inc2734
5
  * Created : September 28, 2014
6
  * Modified :
7
+ * License : GPLv2 or later
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
  jQuery( function( $ ) {
js/editor.js CHANGED
@@ -1,10 +1,10 @@
1
  /**
2
  * editor.js
3
- * Version : 1.3.0
4
- * Author : Takashi Kitajima
5
  * Created : September 23, 2014
6
- * Modified : September 28, 2015
7
- * License : GPLv2
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
  jQuery( function( $ ) {
@@ -15,13 +15,14 @@ jQuery( function( $ ) {
15
  var btn_remove_repeat_group = wrapper.find( '.btn-remove-repeat-group' );
16
  var table_class = '.smart-cf-meta-box-table';
17
  var cnt = wrapper.find( table_class ).length;
 
18
 
19
  /**
20
  * ロード時に wysiwyg エディター用のテキストエリアがあったら wysiwyg 化する。
21
  */
22
  wrapper.find( '.smart-cf-wp-editor' ).each( function( i, e ) {
23
  if ( $( this ).parents( table_class ).css( 'display' ) !== 'none' ) {
24
- $( this ).attr( 'id', 'smart-cf-wysiwyg-' + cnt + i );
25
  var editor_id = $( this ).attr( 'id' );
26
  $( this ).parents( '.wp-editor-wrap' ).find( 'a.add_media' ).attr( 'data-editor', editor_id );
27
 
@@ -92,7 +93,7 @@ jQuery( function( $ ) {
92
  } );
93
 
94
  clone.find( '.smart-cf-wp-editor' ).each( function( i, e ) {
95
- $( this ).attr( 'id', 'smart-cf-wysiwyg-' + cnt + i );
96
  } );
97
 
98
  button.parent().after( clone.fadeIn( 'fast' ) );
1
  /**
2
  * editor.js
3
+ * Version : 1.3.1
4
+ * Author : inc2734
5
  * Created : September 23, 2014
6
+ * Modified : October 6, 2015
7
+ * License : GPLv2 or later
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
  jQuery( function( $ ) {
15
  var btn_remove_repeat_group = wrapper.find( '.btn-remove-repeat-group' );
16
  var table_class = '.smart-cf-meta-box-table';
17
  var cnt = wrapper.find( table_class ).length;
18
+ var wrapper_index = i;
19
 
20
  /**
21
  * ロード時に wysiwyg エディター用のテキストエリアがあったら wysiwyg 化する。
22
  */
23
  wrapper.find( '.smart-cf-wp-editor' ).each( function( i, e ) {
24
  if ( $( this ).parents( table_class ).css( 'display' ) !== 'none' ) {
25
+ $( this ).attr( 'id', 'smart-cf-wysiwyg-' + wrapper_index + '-' + cnt + '-' + i );
26
  var editor_id = $( this ).attr( 'id' );
27
  $( this ).parents( '.wp-editor-wrap' ).find( 'a.add_media' ).attr( 'data-editor', editor_id );
28
 
93
  } );
94
 
95
  clone.find( '.smart-cf-wp-editor' ).each( function( i, e ) {
96
+ $( this ).attr( 'id', 'smart-cf-wysiwyg-' + wrapper_index + '-' + cnt + '-' + i );
97
  } );
98
 
99
  button.parent().after( clone.fadeIn( 'fast' ) );
js/settings-colorpicker.js CHANGED
@@ -1,10 +1,10 @@
1
  /**
2
  * settings-colorpicker.js
3
  * Version : 1.0.0
4
- * Author : Takashi Kitajima
5
  * Created : March 10, 2014
6
  * Modified :
7
- * License : GPLv2
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
  jQuery( function( $ ) {
1
  /**
2
  * settings-colorpicker.js
3
  * Version : 1.0.0
4
+ * Author : inc2734
5
  * Created : March 10, 2014
6
  * Modified :
7
+ * License : GPLv2 or later
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
  jQuery( function( $ ) {
js/settings-datepicker.js CHANGED
@@ -1,10 +1,10 @@
1
  /**
2
  * settings-datepicker.js
3
  * Version : 1.0.0
4
- * Author : Takashi Kitajima
5
  * Created : March 10, 2015
6
  * Modified :
7
- * License : GPLv2
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
  jQuery( function( $ ) {
1
  /**
2
  * settings-datepicker.js
3
  * Version : 1.0.0
4
+ * Author : inc2734
5
  * Created : March 10, 2015
6
  * Modified :
7
+ * License : GPLv2 or later
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
  jQuery( function( $ ) {
js/settings.js CHANGED
@@ -1,10 +1,10 @@
1
  /**
2
  * settings.js
3
  * Version : 1.1.0
4
- * Author : Takashi Kitajima
5
  * Created : September 23, 2014
6
  * Modified : March 10, 2015
7
- * License : GPLv2
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
  jQuery( function( $ ) {
1
  /**
2
  * settings.js
3
  * Version : 1.1.0
4
+ * Author : inc2734
5
  * Created : September 23, 2014
6
  * Modified : March 10, 2015
7
+ * License : GPLv2 or later
8
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
  */
10
  jQuery( function( $ ) {
languages/smart-custom-fields-ja.mo CHANGED
Binary file
languages/smart-custom-fields-ja.po CHANGED
@@ -2,19 +2,19 @@
2
  # This file is distributed under the same license as the Smart Custom Fields package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Smart Custom Fields 1.4.0\n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/smart-custom-fields\n"
7
- "POT-Creation-Date: 2015-04-29 04:43:41+00:00\n"
8
- "PO-Revision-Date: 2015-04-29 13:44+0900\n"
9
- "Last-Translator: Takashi Kitajima <inc@2inc.org>\n"
10
  "Language-Team: \n"
11
  "Language: ja\n"
12
  "MIME-Version: 1.0\n"
13
  "Content-Type: text/plain; charset=UTF-8\n"
14
  "Content-Transfer-Encoding: 8bit\n"
15
- "X-Generator: Poedit 1.7.6\n"
16
  "Plural-Forms: nplurals=1; plural=0;\n"
17
- "X-Poedit-KeywordsList: __;_e\n"
18
  "X-Poedit-Basepath: .\n"
19
  "X-Poedit-SearchPath-0: ..\n"
20
 
@@ -26,8 +26,7 @@ msgstr "画像設定"
26
  msgid "File setting"
27
  msgstr "ファイル設定"
28
 
29
- #: classes/controller/class.profile.php:43
30
- #: classes/controller/class.settings.php:76
31
  msgid "Custom Fields"
32
  msgstr "カスタムフィールド"
33
 
@@ -76,7 +75,7 @@ msgid "Add Field"
76
  msgstr "フィールド追加"
77
 
78
  #: classes/controller/class.settings.php:219
79
- #: classes/fields/class.field-relation.php:188
80
  msgid "Post Types"
81
  msgstr "投稿タイプ"
82
 
@@ -104,15 +103,12 @@ msgstr "はい"
104
  msgid "No"
105
  msgstr "いいえ"
106
 
107
- #: classes/fields/class.field-boolean.php:83
108
- #: classes/fields/class.field-check.php:112
109
  #: classes/fields/class.field-colorpicker.php:102
110
  #: classes/fields/class.field-datepicker.php:124
111
- #: classes/fields/class.field-radio.php:111
112
- #: classes/fields/class.field-select.php:85
113
- #: classes/fields/class.field-text.php:65
114
- #: classes/fields/class.field-textarea.php:65
115
- #: classes/fields/class.field-wysiwyg.php:107
116
  msgid "Default"
117
  msgstr "デフォルト"
118
 
@@ -128,14 +124,12 @@ msgstr "FALSE ラベル"
128
  #: classes/fields/class.field-check.php:121
129
  #: classes/fields/class.field-colorpicker.php:111
130
  #: classes/fields/class.field-datepicker.php:188
131
- #: classes/fields/class.field-file.php:92
132
- #: classes/fields/class.field-image.php:93
133
  #: classes/fields/class.field-radio.php:120
134
- #: classes/fields/class.field-relation.php:209
135
- #: classes/fields/class.field-select.php:94
136
- #: classes/fields/class.field-text.php:74
137
  #: classes/fields/class.field-textarea.php:74
138
- #: classes/fields/class.field-wysiwyg.php:116
139
  msgid "Notes"
140
  msgstr "注記"
141
 
@@ -143,24 +137,20 @@ msgstr "注記"
143
  msgid "Check"
144
  msgstr "チェックボックス"
145
 
146
- #: classes/fields/class.field-check.php:83
147
- #: classes/fields/class.field-radio.php:82
148
  #: classes/fields/class.field-select.php:76
149
  msgid "Choices"
150
  msgstr "選択肢"
151
 
152
- #: classes/fields/class.field-check.php:92
153
- #: classes/fields/class.field-radio.php:91
154
  msgid "Display Direction"
155
  msgstr "表示方向"
156
 
157
- #: classes/fields/class.field-check.php:96
158
- #: classes/fields/class.field-radio.php:95
159
  msgid "horizontal"
160
  msgstr "水平方向"
161
 
162
- #: classes/fields/class.field-check.php:97
163
- #: classes/fields/class.field-radio.php:96
164
  msgid "vertical"
165
  msgstr "垂直方向"
166
 
@@ -197,8 +187,7 @@ msgstr "最小日付"
197
  msgid "File"
198
  msgstr "ファイル"
199
 
200
- #: classes/fields/class.field-file.php:50
201
- #: classes/fields/class.field-image.php:51
202
  msgid "Delete"
203
  msgstr "削除"
204
 
@@ -226,7 +215,12 @@ msgstr "ラジオボタン"
226
  msgid "Relation"
227
  msgstr "リレーション"
228
 
229
- #: classes/fields/class.field-relation.php:170
 
 
 
 
 
230
  msgid "Load more"
231
  msgstr "さらに読み込む"
232
 
@@ -246,8 +240,8 @@ msgstr "テキストエリア"
246
  msgid "Wysiwyg"
247
  msgstr "WYSIWYG"
248
 
249
- #: classes/fields/class.field-wysiwyg.php:138
250
- #: classes/fields/class.field-wysiwyg.php:139
251
  msgid "Add Media"
252
  msgstr "メディアを追加"
253
 
@@ -319,8 +313,8 @@ msgid "Smart Custom Fields is a simple plugin that management custom fields."
319
  msgstr "Smart Custom Fields はカスタムフィールドを管理するシンプルなプラグインです。"
320
 
321
  #. Author of the plugin/theme
322
- msgid "Takashi Kitajima"
323
- msgstr "Takashi Kitajima"
324
 
325
  #. Author URI of the plugin/theme
326
  msgid "http://2inc.org"
2
  # This file is distributed under the same license as the Smart Custom Fields package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Smart Custom Fields 1.6.0\n"
6
+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/smart-custom-fields\n"
7
+ "POT-Creation-Date: 2015-11-12 16:13+0900\n"
8
+ "PO-Revision-Date: 2015-11-12 16:13+0900\n"
9
+ "Last-Translator: inc2734 <inc@2inc.org>\n"
10
  "Language-Team: \n"
11
  "Language: ja\n"
12
  "MIME-Version: 1.0\n"
13
  "Content-Type: text/plain; charset=UTF-8\n"
14
  "Content-Transfer-Encoding: 8bit\n"
15
+ "X-Generator: Poedit 1.8.4\n"
16
  "Plural-Forms: nplurals=1; plural=0;\n"
17
+ "X-Poedit-KeywordsList: __;_e;esc_html__;esc_html_e;esc_attr__;esc_attr_e\n"
18
  "X-Poedit-Basepath: .\n"
19
  "X-Poedit-SearchPath-0: ..\n"
20
 
26
  msgid "File setting"
27
  msgstr "ファイル設定"
28
 
29
+ #: classes/controller/class.profile.php:43 classes/controller/class.settings.php:76
 
30
  msgid "Custom Fields"
31
  msgstr "カスタムフィールド"
32
 
75
  msgstr "フィールド追加"
76
 
77
  #: classes/controller/class.settings.php:219
78
+ #: classes/fields/class.field-relation.php:212
79
  msgid "Post Types"
80
  msgstr "投稿タイプ"
81
 
103
  msgid "No"
104
  msgstr "いいえ"
105
 
106
+ #: classes/fields/class.field-boolean.php:83 classes/fields/class.field-check.php:112
 
107
  #: classes/fields/class.field-colorpicker.php:102
108
  #: classes/fields/class.field-datepicker.php:124
109
+ #: classes/fields/class.field-radio.php:111 classes/fields/class.field-select.php:85
110
+ #: classes/fields/class.field-text.php:65 classes/fields/class.field-textarea.php:65
111
+ #: classes/fields/class.field-wysiwyg.php:114
 
 
112
  msgid "Default"
113
  msgstr "デフォルト"
114
 
124
  #: classes/fields/class.field-check.php:121
125
  #: classes/fields/class.field-colorpicker.php:111
126
  #: classes/fields/class.field-datepicker.php:188
127
+ #: classes/fields/class.field-file.php:92 classes/fields/class.field-image.php:93
 
128
  #: classes/fields/class.field-radio.php:120
129
+ #: classes/fields/class.field-relation.php:233
130
+ #: classes/fields/class.field-select.php:94 classes/fields/class.field-text.php:74
 
131
  #: classes/fields/class.field-textarea.php:74
132
+ #: classes/fields/class.field-wysiwyg.php:123
133
  msgid "Notes"
134
  msgstr "注記"
135
 
137
  msgid "Check"
138
  msgstr "チェックボックス"
139
 
140
+ #: classes/fields/class.field-check.php:83 classes/fields/class.field-radio.php:82
 
141
  #: classes/fields/class.field-select.php:76
142
  msgid "Choices"
143
  msgstr "選択肢"
144
 
145
+ #: classes/fields/class.field-check.php:92 classes/fields/class.field-radio.php:91
 
146
  msgid "Display Direction"
147
  msgstr "表示方向"
148
 
149
+ #: classes/fields/class.field-check.php:96 classes/fields/class.field-radio.php:95
 
150
  msgid "horizontal"
151
  msgstr "水平方向"
152
 
153
+ #: classes/fields/class.field-check.php:97 classes/fields/class.field-radio.php:96
 
154
  msgid "vertical"
155
  msgstr "垂直方向"
156
 
187
  msgid "File"
188
  msgstr "ファイル"
189
 
190
+ #: classes/fields/class.field-file.php:50 classes/fields/class.field-image.php:51
 
191
  msgid "Delete"
192
  msgstr "削除"
193
 
215
  msgid "Relation"
216
  msgstr "リレーション"
217
 
218
+ #: classes/fields/class.field-relation.php:190
219
+ #, fuzzy
220
+ msgid "Search..."
221
+ msgstr "検索 …"
222
+
223
+ #: classes/fields/class.field-relation.php:194
224
  msgid "Load more"
225
  msgstr "さらに読み込む"
226
 
240
  msgid "Wysiwyg"
241
  msgstr "WYSIWYG"
242
 
243
+ #: classes/fields/class.field-wysiwyg.php:145
244
+ #: classes/fields/class.field-wysiwyg.php:146
245
  msgid "Add Media"
246
  msgstr "メディアを追加"
247
 
313
  msgstr "Smart Custom Fields はカスタムフィールドを管理するシンプルなプラグインです。"
314
 
315
  #. Author of the plugin/theme
316
+ msgid "inc2734"
317
+ msgstr "inc2734"
318
 
319
  #. Author URI of the plugin/theme
320
  msgid "http://2inc.org"
languages/smart-custom-fields.pot CHANGED
@@ -2,9 +2,10 @@
2
  # This file is distributed under the same license as the Smart Custom Fields package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Smart Custom Fields 1.4.0\n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/smart-custom-fields\n"
7
- "POT-Creation-Date: 2015-04-29 04:43:41+00:00\n"
 
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -70,7 +71,7 @@ msgid "Add Field"
70
  msgstr ""
71
 
72
  #: classes/controller/class.settings.php:219
73
- #: classes/fields/class.field-relation.php:188
74
  msgid "Post Types"
75
  msgstr ""
76
 
@@ -106,7 +107,7 @@ msgstr ""
106
  #: classes/fields/class.field-select.php:85
107
  #: classes/fields/class.field-text.php:65
108
  #: classes/fields/class.field-textarea.php:65
109
- #: classes/fields/class.field-wysiwyg.php:107
110
  msgid "Default"
111
  msgstr ""
112
 
@@ -125,11 +126,11 @@ msgstr ""
125
  #: classes/fields/class.field-file.php:92
126
  #: classes/fields/class.field-image.php:93
127
  #: classes/fields/class.field-radio.php:120
128
- #: classes/fields/class.field-relation.php:209
129
  #: classes/fields/class.field-select.php:94
130
  #: classes/fields/class.field-text.php:74
131
  #: classes/fields/class.field-textarea.php:74
132
- #: classes/fields/class.field-wysiwyg.php:116
133
  msgid "Notes"
134
  msgstr ""
135
 
@@ -220,7 +221,11 @@ msgstr ""
220
  msgid "Relation"
221
  msgstr ""
222
 
223
- #: classes/fields/class.field-relation.php:170
 
 
 
 
224
  msgid "Load more"
225
  msgstr ""
226
 
@@ -240,8 +245,8 @@ msgstr ""
240
  msgid "Wysiwyg"
241
  msgstr ""
242
 
243
- #: classes/fields/class.field-wysiwyg.php:138
244
- #: classes/fields/class.field-wysiwyg.php:139
245
  msgid "Add Media"
246
  msgstr ""
247
 
@@ -261,7 +266,7 @@ msgstr ""
261
  msgid "Group name"
262
  msgstr ""
263
 
264
- #. #-#-#-#-# smart-custom-fields.pot (Smart Custom Fields 1.4.0) #-#-#-#-#
265
  #. Plugin Name of the plugin/theme
266
  #: classes/models/class.revisions.php:117 smart-custom-fields.php:157
267
  #: smart-custom-fields.php:158 smart-custom-fields.php:159
@@ -314,7 +319,7 @@ msgid "Smart Custom Fields is a simple plugin that management custom fields."
314
  msgstr ""
315
 
316
  #. Author of the plugin/theme
317
- msgid "Takashi Kitajima"
318
  msgstr ""
319
 
320
  #. Author URI of the plugin/theme
2
  # This file is distributed under the same license as the Smart Custom Fields package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Smart Custom Fields 1.6.0\n"
6
+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/smart-custom-"
7
+ "fields\n"
8
+ "POT-Creation-Date: 2015-11-12 07:12:12+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
71
  msgstr ""
72
 
73
  #: classes/controller/class.settings.php:219
74
+ #: classes/fields/class.field-relation.php:212
75
  msgid "Post Types"
76
  msgstr ""
77
 
107
  #: classes/fields/class.field-select.php:85
108
  #: classes/fields/class.field-text.php:65
109
  #: classes/fields/class.field-textarea.php:65
110
+ #: classes/fields/class.field-wysiwyg.php:114
111
  msgid "Default"
112
  msgstr ""
113
 
126
  #: classes/fields/class.field-file.php:92
127
  #: classes/fields/class.field-image.php:93
128
  #: classes/fields/class.field-radio.php:120
129
+ #: classes/fields/class.field-relation.php:233
130
  #: classes/fields/class.field-select.php:94
131
  #: classes/fields/class.field-text.php:74
132
  #: classes/fields/class.field-textarea.php:74
133
+ #: classes/fields/class.field-wysiwyg.php:123
134
  msgid "Notes"
135
  msgstr ""
136
 
221
  msgid "Relation"
222
  msgstr ""
223
 
224
+ #: classes/fields/class.field-relation.php:190
225
+ msgid "Search..."
226
+ msgstr ""
227
+
228
+ #: classes/fields/class.field-relation.php:194
229
  msgid "Load more"
230
  msgstr ""
231
 
245
  msgid "Wysiwyg"
246
  msgstr ""
247
 
248
+ #: classes/fields/class.field-wysiwyg.php:145
249
+ #: classes/fields/class.field-wysiwyg.php:146
250
  msgid "Add Media"
251
  msgstr ""
252
 
266
  msgid "Group name"
267
  msgstr ""
268
 
269
+ #. #-#-#-#-# smart-custom-fields.pot (Smart Custom Fields 1.6.0) #-#-#-#-#
270
  #. Plugin Name of the plugin/theme
271
  #: classes/models/class.revisions.php:117 smart-custom-fields.php:157
272
  #: smart-custom-fields.php:158 smart-custom-fields.php:159
319
  msgstr ""
320
 
321
  #. Author of the plugin/theme
322
+ msgid "inc2734"
323
  msgstr ""
324
 
325
  #. Author URI of the plugin/theme
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: inc2734, toro_unit, mimosafa
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.3.1
7
- Stable tag: 1.5.2
8
- License: GPLv2
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
  Smart Custom Fields is a simple plugin that management custom fields.
@@ -86,6 +86,15 @@ You can send your own language pack to me.
86
 
87
  == Changelog ==
88
 
 
 
 
 
 
 
 
 
 
89
  = 1.5.2 =
90
  * Fixed a wysiwyg field bug.
91
 
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.4-beta3
7
+ Stable tag: 1.6.0
8
+ License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
  Smart Custom Fields is a simple plugin that management custom fields.
86
 
87
  == Changelog ==
88
 
89
+ = 1.6.0 =
90
+ * Added search feature in the relation field.
91
+ * Changed when the object isn't saved, default value is active.
92
+ * Remove filter hook smart-cf-is_use_default_when_not_saved.
93
+ * Fixed a bug that isn't displayed meta data in preview when using custom fields settings with post id.
94
+
95
+ = 1.5.3 =
96
+ * Fixed a wysiwyg field bug.
97
+
98
  = 1.5.2 =
99
  * Fixed a wysiwyg field bug.
100
 
smart-custom-fields.php CHANGED
@@ -3,14 +3,14 @@
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: 1.5.2
7
- * Author: Takashi Kitajima
8
  * Author URI: http://2inc.org
9
  * Created: October 9, 2014
10
- * Modified: September 28, 2015
11
  * Text Domain: smart-custom-fields
12
  * Domain Path: /languages
13
- * License: GPLv2
14
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
15
  */
16
  class Smart_Custom_Fields {
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: 1.6.0
7
+ * Author: inc2734
8
  * Author URI: http://2inc.org
9
  * Created: October 9, 2014
10
+ * Modified: Novermber 12, 2015
11
  * Text Domain: smart-custom-fields
12
  * Domain Path: /languages
13
+ * License: GPLv2 or later
14
  * License URI: http://www.gnu.org/licenses/gpl-2.0.html
15
  */
16
  class Smart_Custom_Fields {