Custom Field Template - Version 1.4.6

Version Description

  • Bugfix: checkbox id and save.
Download this release

Release Info

Developer Hiroaki Miyashita
Plugin Icon 128x128 Custom Field Template
Version 1.4.6
Comparing to
See all releases

Code changes from version 1.4.5 to 1.4.6

Files changed (2) hide show
  1. custom-field-template.php +14 -10
  2. readme.txt +4 -1
custom-field-template.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Custom Field Template
4
  Plugin URI: http://wpgogo.com/development/custom-field-template.html
5
  Description: This plugin adds the default custom fields on the Write Post/Page.
6
  Author: Hiroaki Miyashita
7
- Version: 1.4.5
8
  Author URI: http://wpgogo.com/
9
  */
10
 
@@ -1386,13 +1386,13 @@ jQuery(this).addClass("closed");
1386
  if ( $val )
1387
  $event_output .= " " . $key . '="' . stripcslashes(trim($val)) . '"';
1388
  endforeach;
1389
-
 
 
1390
  $out .=
1391
- '<dl id="dl_' . $name . $sid . '">' .
1392
  '<dt><span' . $hide . '>' . $title . '</span></dt>' .
1393
  '<dd>';
1394
-
1395
- $id = $name . $sid . '_' . $this->sanitize_name( $value );
1396
 
1397
  if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] && $cftnum == 0 )
1398
  $out .= '<p class="label">' . stripcslashes($label) . '</p>';
@@ -2273,7 +2273,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
2273
  unset($_FILES);
2274
 
2275
  foreach( $fields as $field_key => $field_val) :
2276
- foreach( $field_val as $title => $data) :
2277
  if ( is_numeric($data['parentSN']) ) $field_key = $data['parentSN'];
2278
  $name = $this->sanitize_name( $title );
2279
  $title = $wpdb->escape(stripcslashes(trim($title)));
@@ -2304,8 +2304,12 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
2304
  elseif ( $data['blank'] == true ) :
2305
  $save_value[$title][] = '';
2306
  else :
2307
- $value = $this->get_post_meta( $id, $title, false );
2308
- delete_post_meta($id, $title, $value[$data['cftnum']]);
 
 
 
 
2309
  endif;
2310
 
2311
  if ( $data['type'] == 'file' ) :
@@ -2734,7 +2738,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
2734
  eval(stripcslashes($options['php'][$rval['searchCode']]));
2735
  endif;
2736
  if ( count($values) > 1 ) :
2737
- $replace_val[$rkey] .= '<ul>';
2738
  $j=0;
2739
  foreach( $values as $metavalue ) :
2740
  $checked = '';
@@ -2773,7 +2777,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";*/
2773
  eval(stripcslashes($options['php'][$rval['searchCode']]));
2774
  endif;
2775
  if ( count($values) > 1 ) :
2776
- $replace_val[$rkey] .= '<ul>';
2777
  $j=0;
2778
  foreach ( $values as $metavalue ) :
2779
  $checked = '';
4
  Plugin URI: http://wpgogo.com/development/custom-field-template.html
5
  Description: This plugin adds the default custom fields on the Write Post/Page.
6
  Author: Hiroaki Miyashita
7
+ Version: 1.4.6
8
  Author URI: http://wpgogo.com/
9
  */
10
 
1386
  if ( $val )
1387
  $event_output .= " " . $key . '="' . stripcslashes(trim($val)) . '"';
1388
  endforeach;
1389
+
1390
+ $id = $name . $sid . '_' . $cftnum . '_' . $this->sanitize_name( $value );
1391
+
1392
  $out .=
1393
+ '<dl id="dl_' . $id . '">' .
1394
  '<dt><span' . $hide . '>' . $title . '</span></dt>' .
1395
  '<dd>';
 
 
1396
 
1397
  if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] && $cftnum == 0 )
1398
  $out .= '<p class="label">' . stripcslashes($label) . '</p>';
2273
  unset($_FILES);
2274
 
2275
  foreach( $fields as $field_key => $field_val) :
2276
+ foreach( $field_val as $title => $data) :
2277
  if ( is_numeric($data['parentSN']) ) $field_key = $data['parentSN'];
2278
  $name = $this->sanitize_name( $title );
2279
  $title = $wpdb->escape(stripcslashes(trim($title)));
2304
  elseif ( $data['blank'] == true ) :
2305
  $save_value[$title][] = '';
2306
  else :
2307
+ $tmp_value = $this->get_post_meta( $id, $title, false );
2308
+ if ( $data['type'] == 'checkbox' ) :
2309
+ delete_post_meta($id, $title, $data['value']);
2310
+ else :
2311
+ delete_post_meta($id, $title, $tmp_value[$data['cftnum']]);
2312
+ endif;
2313
  endif;
2314
 
2315
  if ( $data['type'] == 'file' ) :
2738
  eval(stripcslashes($options['php'][$rval['searchCode']]));
2739
  endif;
2740
  if ( count($values) > 1 ) :
2741
+ $replace_val[$rkey] .= '<ul' . $class . '>';
2742
  $j=0;
2743
  foreach( $values as $metavalue ) :
2744
  $checked = '';
2777
  eval(stripcslashes($options['php'][$rval['searchCode']]));
2778
  endif;
2779
  if ( count($values) > 1 ) :
2780
+ $replace_val[$rkey] .= '<ul' . $class . '>';
2781
  $j=0;
2782
  foreach ( $values as $metavalue ) :
2783
  $checked = '';
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://wpgogo.com/development/custom-field-template.html
4
  Tags: custom, fields, field, template, meta, custom field, custom fields, custom field template
5
  Requires at least: 2.1
6
  Tested up to: 2.8.5
7
- Stable tag: 1.4.5
8
 
9
  This plugin adds the default custom fields on the Write Post/Page.
10
 
@@ -98,6 +98,9 @@ See the default template and modify it.
98
 
99
  == Changelog ==
100
 
 
 
 
101
  = 1.4.5 =
102
  * Bugfix: conflict with the cforms plugin.
103
  * Bugfix: delete the empty data.
4
  Tags: custom, fields, field, template, meta, custom field, custom fields, custom field template
5
  Requires at least: 2.1
6
  Tested up to: 2.8.5
7
+ Stable tag: 1.4.6
8
 
9
  This plugin adds the default custom fields on the Write Post/Page.
10
 
98
 
99
  == Changelog ==
100
 
101
+ = 1.4.6 =
102
+ * Bugfix: checkbox id and save.
103
+
104
  = 1.4.5 =
105
  * Bugfix: conflict with the cforms plugin.
106
  * Bugfix: delete the empty data.