Custom Field Template - Version 0.6

Version Description

Download this release

Release Info

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

Code changes from version 0.5.3 to 0.6

custom-field-template-ja.mo CHANGED
Binary file
custom-field-template-ja.po CHANGED
@@ -2,8 +2,8 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Custom Field Template\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2008-11-05 19:01+0900\n"
6
- "PO-Revision-Date: 2008-11-05 19:02+0900\n"
7
  "Last-Translator: \n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
@@ -16,123 +16,131 @@ msgstr ""
16
  "X-Poedit-Basepath: ../\n"
17
  "X-Poedit-SearchPath-0: custom-field-template\n"
18
 
19
- #: custom-field-template/custom-field-template.php:76
20
- #: custom-field-template/custom-field-template.php:77
21
- #: custom-field-template/custom-field-template.php:153
22
- #: custom-field-template/custom-field-template.php:190
23
- #: custom-field-template/custom-field-template.php:620
24
  msgid "Custom Field Template"
25
  msgstr "カスタムフィールドテンプレート"
26
 
27
- #: custom-field-template/custom-field-template.php:88
28
  msgid "Settings"
29
  msgstr "設定"
30
 
31
- #: custom-field-template/custom-field-template.php:99
32
  msgid "Default Template"
33
  msgstr "デフォルトテンプレート"
34
 
35
- #: custom-field-template/custom-field-template.php:170
36
- #: custom-field-template/custom-field-template.php:174
37
  msgid "Options updated."
38
  msgstr "オプションは更新されました。"
39
 
40
- #: custom-field-template/custom-field-template.php:179
41
  msgid "Options resetted."
42
  msgstr "オプションはリセットされました。"
43
 
44
- #: custom-field-template/custom-field-template.php:183
45
  msgid "Options deleted."
46
  msgstr "オプションは削除されました。"
47
 
48
- #: custom-field-template/custom-field-template.php:195
49
  msgid "Custom Field Template Options"
50
  msgstr "カスタムフィールドテンプレートオプション"
51
 
52
- #: custom-field-template/custom-field-template.php:204
53
  #, php-format
54
  msgid "Template Title %d"
55
  msgstr "テンプレートタイトル %d"
56
 
57
- #: custom-field-template/custom-field-template.php:206
58
  #, php-format
59
  msgid "Template Content %d"
60
  msgstr "テンプレートコンテンツ %d"
61
 
62
- #: custom-field-template/custom-field-template.php:213
63
  msgid "In case that you would like to insert multiple images at once in use of the custom field media buttons"
64
  msgstr "カスタムフィールへの画像挿入を一度に複数枚実行する場合"
65
 
66
- #: custom-field-template/custom-field-template.php:214
67
  msgid "Use multiple image inset"
68
  msgstr "複数画像挿入を利用する"
69
 
70
- #: custom-field-template/custom-field-template.php:214
71
  msgid "Caution:"
72
  msgstr "ご注意:"
73
 
74
- #: custom-field-template/custom-field-template.php:214
75
  msgid "You need to edit `wp-admin/includes/media.php`. Delete or comment out the code in the function media_send_to_editor at around line 88-96."
76
  msgstr "`wp-admin/includes/media.php`を編集する必要があります。88-96行目の media_send_to_editor関数の中身を削除するかコメントアウトしてください。"
77
 
78
- #: custom-field-template/custom-field-template.php:218
79
- #: custom-field-template/custom-field-template.php:238
 
 
 
 
 
 
 
 
80
  msgid "Update Options »"
81
  msgstr "オプションを更新する »"
82
 
83
- #: custom-field-template/custom-field-template.php:229
84
  msgid "Admin CSS"
85
  msgstr ""
86
 
87
- #: custom-field-template/custom-field-template.php:249
88
  msgid "Option List"
89
  msgstr "オプションリスト"
90
 
91
- #: custom-field-template/custom-field-template.php:303
92
  msgid "Reset Options"
93
  msgstr "オプションをリセットする"
94
 
95
- #: custom-field-template/custom-field-template.php:305
96
  msgid "Are you sure to reset options? Options you set will be reset to the default settings."
97
  msgstr "本当にオプションをリセットしてもよろしいですか?設定したオプションはデフォルトの状態に戻ります。"
98
 
99
- #: custom-field-template/custom-field-template.php:309
100
  msgid "Unset Options »"
101
  msgstr "オプションをリセットする »"
102
 
103
- #: custom-field-template/custom-field-template.php:320
104
  msgid "Delete Options"
105
  msgstr "オプションを削除する"
106
 
107
- #: custom-field-template/custom-field-template.php:322
108
  msgid "Are you sure to delete options? Options you set will be deleted."
109
  msgstr "本当にオプションを削除してもよろしいですか?設定したオプションは削除されます。"
110
 
111
- #: custom-field-template/custom-field-template.php:326
112
  msgid "Delete Options »"
113
  msgstr "オプションを削除する »"
114
 
115
- #: custom-field-template/custom-field-template.php:443
116
  msgid "Clear"
117
  msgstr "解除"
118
 
119
- #: custom-field-template/custom-field-template.php:527
120
  msgid "Add Media"
121
  msgstr ""
122
 
123
- #: custom-field-template/custom-field-template.php:529
124
  msgid "Add an Image"
125
  msgstr ""
126
 
127
- #: custom-field-template/custom-field-template.php:531
128
  msgid "Add Video"
129
  msgstr ""
130
 
131
- #: custom-field-template/custom-field-template.php:533
132
  msgid "Add Audio"
133
  msgstr ""
134
 
135
- #: custom-field-template/custom-field-template.php:544
136
  msgid "Toggle"
137
  msgstr "切り替え"
138
 
2
  msgstr ""
3
  "Project-Id-Version: Custom Field Template\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2008-11-17 00:19+0900\n"
6
+ "PO-Revision-Date: 2008-11-17 00:19+0900\n"
7
  "Last-Translator: \n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
16
  "X-Poedit-Basepath: ../\n"
17
  "X-Poedit-SearchPath-0: custom-field-template\n"
18
 
19
+ #: custom-field-template/custom-field-template.php:80
20
+ #: custom-field-template/custom-field-template.php:81
21
+ #: custom-field-template/custom-field-template.php:157
22
+ #: custom-field-template/custom-field-template.php:195
23
+ #: custom-field-template/custom-field-template.php:660
24
  msgid "Custom Field Template"
25
  msgstr "カスタムフィールドテンプレート"
26
 
27
+ #: custom-field-template/custom-field-template.php:92
28
  msgid "Settings"
29
  msgstr "設定"
30
 
31
+ #: custom-field-template/custom-field-template.php:103
32
  msgid "Default Template"
33
  msgstr "デフォルトテンプレート"
34
 
35
+ #: custom-field-template/custom-field-template.php:175
36
+ #: custom-field-template/custom-field-template.php:179
37
  msgid "Options updated."
38
  msgstr "オプションは更新されました。"
39
 
40
+ #: custom-field-template/custom-field-template.php:184
41
  msgid "Options resetted."
42
  msgstr "オプションはリセットされました。"
43
 
44
+ #: custom-field-template/custom-field-template.php:188
45
  msgid "Options deleted."
46
  msgstr "オプションは削除されました。"
47
 
48
+ #: custom-field-template/custom-field-template.php:200
49
  msgid "Custom Field Template Options"
50
  msgstr "カスタムフィールドテンプレートオプション"
51
 
52
+ #: custom-field-template/custom-field-template.php:209
53
  #, php-format
54
  msgid "Template Title %d"
55
  msgstr "テンプレートタイトル %d"
56
 
57
+ #: custom-field-template/custom-field-template.php:211
58
  #, php-format
59
  msgid "Template Content %d"
60
  msgstr "テンプレートコンテンツ %d"
61
 
62
+ #: custom-field-template/custom-field-template.php:218
63
  msgid "In case that you would like to insert multiple images at once in use of the custom field media buttons"
64
  msgstr "カスタムフィールへの画像挿入を一度に複数枚実行する場合"
65
 
66
+ #: custom-field-template/custom-field-template.php:219
67
  msgid "Use multiple image inset"
68
  msgstr "複数画像挿入を利用する"
69
 
70
+ #: custom-field-template/custom-field-template.php:219
71
  msgid "Caution:"
72
  msgstr "ご注意:"
73
 
74
+ #: custom-field-template/custom-field-template.php:219
75
  msgid "You need to edit `wp-admin/includes/media.php`. Delete or comment out the code in the function media_send_to_editor at around line 88-96."
76
  msgstr "`wp-admin/includes/media.php`を編集する必要があります。88-96行目の media_send_to_editor関数の中身を削除するかコメントアウトしてください。"
77
 
78
+ #: custom-field-template/custom-field-template.php:223
79
+ msgid "In case that you would like to replace custom keys by labels if `label` is set"
80
+ msgstr "`label`がセットされていて、カスタムフィールドのキーの代わりにラベルを表示したい場合"
81
+
82
+ #: custom-field-template/custom-field-template.php:224
83
+ msgid "Use labels in place of custom keys"
84
+ msgstr "カスタムフィールドのキーの代わりにラベルを使用する"
85
+
86
+ #: custom-field-template/custom-field-template.php:228
87
+ #: custom-field-template/custom-field-template.php:248
88
  msgid "Update Options »"
89
  msgstr "オプションを更新する »"
90
 
91
+ #: custom-field-template/custom-field-template.php:239
92
  msgid "Admin CSS"
93
  msgstr ""
94
 
95
+ #: custom-field-template/custom-field-template.php:259
96
  msgid "Option List"
97
  msgstr "オプションリスト"
98
 
99
+ #: custom-field-template/custom-field-template.php:313
100
  msgid "Reset Options"
101
  msgstr "オプションをリセットする"
102
 
103
+ #: custom-field-template/custom-field-template.php:315
104
  msgid "Are you sure to reset options? Options you set will be reset to the default settings."
105
  msgstr "本当にオプションをリセットしてもよろしいですか?設定したオプションはデフォルトの状態に戻ります。"
106
 
107
+ #: custom-field-template/custom-field-template.php:319
108
  msgid "Unset Options »"
109
  msgstr "オプションをリセットする »"
110
 
111
+ #: custom-field-template/custom-field-template.php:330
112
  msgid "Delete Options"
113
  msgstr "オプションを削除する"
114
 
115
+ #: custom-field-template/custom-field-template.php:332
116
  msgid "Are you sure to delete options? Options you set will be deleted."
117
  msgstr "本当にオプションを削除してもよろしいですか?設定したオプションは削除されます。"
118
 
119
+ #: custom-field-template/custom-field-template.php:336
120
  msgid "Delete Options »"
121
  msgstr "オプションを削除する »"
122
 
123
+ #: custom-field-template/custom-field-template.php:470
124
  msgid "Clear"
125
  msgstr "解除"
126
 
127
+ #: custom-field-template/custom-field-template.php:563
128
  msgid "Add Media"
129
  msgstr ""
130
 
131
+ #: custom-field-template/custom-field-template.php:565
132
  msgid "Add an Image"
133
  msgstr ""
134
 
135
+ #: custom-field-template/custom-field-template.php:567
136
  msgid "Add Video"
137
  msgstr ""
138
 
139
+ #: custom-field-template/custom-field-template.php:569
140
  msgid "Add Audio"
141
  msgstr ""
142
 
143
+ #: custom-field-template/custom-field-template.php:580
144
  msgid "Toggle"
145
  msgstr "切り替え"
146
 
custom-field-template.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Custom Field Template
4
  Plugin URI: http://wordpressgogo.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: 0.5.3
8
  Author URI: http://wordpressgogo.com/
9
  */
10
 
@@ -51,7 +51,11 @@ class custom_field_template {
51
  global $wp_version;
52
 
53
  if ( function_exists('load_plugin_textdomain') ) {
54
- load_plugin_textdomain('custom-field-template', 'wp-content/plugins/custom-field-template');
 
 
 
 
55
  }
56
 
57
  if ( is_user_logged_in() && isset($_REQUEST['id']) && $_REQUEST['page'] == 'custom-field-template/custom-field-template.php' ) {
@@ -68,7 +72,7 @@ class custom_field_template {
68
  }
69
 
70
  if ( substr($wp_version, 0, 3) < '2.5' ) {
71
- add_action( 'simple_edit_form', array(&$this, 'insert_custome_field'), 1 );
72
  add_action( 'edit_form_advanced', array(&$this, 'insert_custom_field'), 1 );
73
  add_action( 'edit_page_form', array(&$this, 'insert_custom_field'), 1 );
74
  } else {
@@ -98,7 +102,7 @@ class custom_field_template {
98
  function install_custom_field_template_data() {
99
  $options['custom_fields'][0]['title'] = __('Default Template', 'custom-field-template');
100
  $options['custom_fields'][0]['content'] = '[Plan]
101
- type = textfield
102
  size = 35
103
  label = Where are you going to go?
104
 
@@ -158,6 +162,7 @@ mediaButton = true';
158
  if($_POST["custom_field_template_set_options_submit"]) :
159
  unset($options['custom_fields']);
160
  $j = 0;
 
161
  $options['custom_field_template_use_multiple_insert'] = $_POST['custom_field_template_use_multiple_insert'];
162
  for($i=0;$i<count($_POST["custom_field_template_content"]);$i++) {
163
  if( $_POST["custom_field_template_content"][$i] ) {
@@ -215,6 +220,11 @@ mediaButton = true';
215
  </td>
216
  </tr>
217
  <tr><td>
 
 
 
 
 
218
  <p><input type="submit" name="custom_field_template_set_options_submit" value="<?php _e('Update Options &raquo;', 'custom-field-template'); ?>" /></p>
219
  </td></tr>
220
  </tbody>
@@ -257,7 +267,7 @@ hideKey = true<br />
257
  <table class="form-table" style="margin-bottom:5px;">
258
  <thead>
259
  <tr>
260
- <th>type</th><th>textfield</th><th>checkbox</th><th>radio</th><th>select</th><th>textarea</th>
261
  </tr>
262
  </thead>
263
  <tbody>
@@ -366,6 +376,8 @@ jQuery(this).addClass("closed");
366
  }
367
 
368
  function make_textfield( $name, $sid, $size = 25, $hideKey, $label ) {
 
 
369
  $title = $name;
370
  $name = $this->sanitize_name( $name );
371
 
@@ -378,18 +390,24 @@ jQuery(this).addClass("closed");
378
 
379
  if ( $hideKey == true ) $hide = ' class="hideKey""';
380
 
 
 
 
381
  $out .=
382
  '<dl>' .
383
  '<dt><span' . $hide . '>' . $title . '</span></dt>' .
384
  '<dd>';
385
 
386
- if ( !empty($label) ) $out .= '<p class="label">' . stripcslashes($label) . '</p>';
387
- $out .= '<input id="' . $name . '" name="' . $name . '[]" value="' . attribute_escape($value) . '" type="textfield" size="' . $size . '" /></dd>' .
 
388
  '</dl>';
389
  return $out;
390
  }
391
 
392
  function make_checkbox( $name, $sid, $value, $checked, $hideKey, $label ) {
 
 
393
  $title = $name;
394
  $name = $this->sanitize_name( $name );
395
 
@@ -407,12 +425,16 @@ jQuery(this).addClass("closed");
407
 
408
  if ( $hideKey == true ) $hide = ' class="hideKey""';
409
 
 
 
 
410
  $out .=
411
  '<dl>' .
412
  '<dt><span' . $hide . '>' . $title . '</span></dt>' .
413
  '<dd>';
414
 
415
- if ( !empty($label) ) $out .= '<p class="label">' . stripcslashes($label) . '</p>';
 
416
  $out .= '<label for="' . $id . '" class="selectit"><input name="' . $name . '[' . $sid . ']" value="' . attribute_escape($value) . '" ' . $checked . ' type="checkbox" /> ' . stripcslashes($value) . '</label><br />';
417
 
418
  $out .= '</dd></dl>';
@@ -421,6 +443,8 @@ jQuery(this).addClass("closed");
421
  }
422
 
423
  function make_radio( $name, $sid, $values, $clearButton, $default, $hideKey, $label ) {
 
 
424
  $title = $name;
425
  $name = $this->sanitize_name( $name );
426
 
@@ -434,6 +458,9 @@ jQuery(this).addClass("closed");
434
 
435
  if ( $hideKey == true ) $hide = ' class="hideKey""';
436
 
 
 
 
437
  $out .=
438
  '<dl>' .
439
  '<dt><span' . $hide . '>' . $title . '</span>';
@@ -448,7 +475,8 @@ jQuery(this).addClass("closed");
448
  '</dt>' .
449
  '<dd>';
450
 
451
- if ( !empty($label) ) $out .= '<p class="label">' . stripcslashes($label) . '</p>';
 
452
  foreach( $values as $val ) {
453
  $id = $name . '_' . $this->sanitize_name( $val );
454
 
@@ -463,6 +491,8 @@ jQuery(this).addClass("closed");
463
  }
464
 
465
  function make_select( $name, $sid, $values, $default, $hideKey, $label ) {
 
 
466
  $title = $name;
467
  $name = $this->sanitize_name( $name );
468
 
@@ -477,13 +507,17 @@ jQuery(this).addClass("closed");
477
  }
478
 
479
  if ( $hideKey == true ) $hide = ' class="hideKey""';
 
 
 
480
 
481
  $out .=
482
  '<dl>' .
483
  '<dt><span' . $hide . '>' . $title . '</span></dt>' .
484
  '<dd>';
485
 
486
- if ( !empty($label) ) $out .= '<p class="label">' . stripcslashes($label) . '</p>';
 
487
  $out .= '<select name="' . $name . '[]">' .
488
  '<option value="" >Select</option>';
489
 
@@ -499,6 +533,8 @@ jQuery(this).addClass("closed");
499
  }
500
 
501
  function make_textarea( $name, $sid, $rows, $cols, $tinyMCE, $mediaButton, $hideKey, $label ) {
 
 
502
  global $wp_version;
503
 
504
  $title = $name;
@@ -515,7 +551,7 @@ jQuery(this).addClass("closed");
515
  $out = '<script type="text/javascript">' . "\n" .
516
  '// <![CDATA[' . "\n" .
517
  'if ( typeof tinyMCE != "undefined" )' . "\n" .
518
- 'jQuery(document).ready(function() {tinyMCE.execCommand("mceAddControl", false, "'. $name . $rand . '"); tinyMCEID.push("'. $name . $rand . '");});' . "\n" .
519
  '// ]]>' . "\n" .
520
  '</script>';
521
  }
@@ -548,14 +584,18 @@ EOF;
548
  }
549
 
550
  if ( $hideKey == true ) $hide = ' class="hideKey""';
 
 
 
551
 
552
  $out .=
553
  '<dl>' .
554
  '<dt><span' . $hide . '>' . $title . '</span><br />' . $media . $switch . '</dt>' .
555
  '<dd>';
556
 
557
- if ( !empty($label) ) $out .= '<p class="label">' . stripcslashes($label) . '</p>';
558
- $out .= '<textarea id="' . $name . $rand . '" name="' . $name . '[' . $sid . ']" type="textfield" rows="' .$rows. '" cols="' . $cols . '" style="color:#000000">' . attribute_escape($value) . '</textarea><input type="hidden" name="'.$name.'_rand['.$sid.']" value="'.$rand.'" /></dd>' .
 
559
  '</dl>';
560
  return $out;
561
  }
@@ -571,7 +611,7 @@ EOF;
571
  $out .= '<input type="hidden" name="custom-field-template-id" id="custom-field-template-id" value="' . $id . '" />';
572
  foreach( $fields as $title => $data ) {
573
  for($i = 0; $i<count($data); $i++) {
574
- if( $data[$i]['type'] == 'textfield' ) {
575
  $out .= $this->make_textfield( $title, $i, $data[$i]['size'], $data[$i]['hideKey'], $data[$i]['label'] );
576
  }
577
  else if( $data[$i]['type'] == 'checkbox' ) {
@@ -682,6 +722,7 @@ EOF;
682
  'function switchMode(id) {' . "\n" .
683
  ' var ed = tinyMCE.get(id);' . "\n" .
684
  ' if ( ! ed || ed.isHidden() ) {' . "\n" .
 
685
  ' if ( ed ) ed.show();' . "\n" .
686
  ' else tinyMCE.execCommand("mceAddControl", false, id);' . "\n" .
687
  ' } else {' . "\n" .
@@ -748,7 +789,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";
748
  function edit_meta_value( $id ) {
749
  global $wpdb;
750
  $options = $this->get_custom_field_template_data();
751
-
752
  if( !isset( $id ) )
753
  $id = $_REQUEST[ 'post_ID' ];
754
 
4
  Plugin URI: http://wordpressgogo.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: 0.6
8
  Author URI: http://wordpressgogo.com/
9
  */
10
 
51
  global $wp_version;
52
 
53
  if ( function_exists('load_plugin_textdomain') ) {
54
+ if ( !defined('WP_PLUGIN_DIR') ) {
55
+ load_plugin_textdomain('custom-field-template', str_replace( ABSPATH, '', dirname(__FILE__) ) );
56
+ } else {
57
+ load_plugin_textdomain('custom-field-template', false, dirname( plugin_basename(__FILE__) ) );
58
+ }
59
  }
60
 
61
  if ( is_user_logged_in() && isset($_REQUEST['id']) && $_REQUEST['page'] == 'custom-field-template/custom-field-template.php' ) {
72
  }
73
 
74
  if ( substr($wp_version, 0, 3) < '2.5' ) {
75
+ add_action( 'simple_edit_form', array(&$this, 'insert_custom_field'), 1 );
76
  add_action( 'edit_form_advanced', array(&$this, 'insert_custom_field'), 1 );
77
  add_action( 'edit_page_form', array(&$this, 'insert_custom_field'), 1 );
78
  } else {
102
  function install_custom_field_template_data() {
103
  $options['custom_fields'][0]['title'] = __('Default Template', 'custom-field-template');
104
  $options['custom_fields'][0]['content'] = '[Plan]
105
+ type = text
106
  size = 35
107
  label = Where are you going to go?
108
 
162
  if($_POST["custom_field_template_set_options_submit"]) :
163
  unset($options['custom_fields']);
164
  $j = 0;
165
+ $options['custom_field_template_replace_keys_by_labels'] = $_POST['custom_field_template_replace_keys_by_labels'];
166
  $options['custom_field_template_use_multiple_insert'] = $_POST['custom_field_template_use_multiple_insert'];
167
  for($i=0;$i<count($_POST["custom_field_template_content"]);$i++) {
168
  if( $_POST["custom_field_template_content"][$i] ) {
220
  </td>
221
  </tr>
222
  <tr><td>
223
+ <p><label for="custom_field_template_replace_keys_by_labels"><?php _e('In case that you would like to replace custom keys by labels if `label` is set', 'custom-field-template'); ?></label>:<br />
224
+ <input type="checkbox" name="custom_field_template_replace_keys_by_labels" id="custom_field_template_replace_keys_by_labels" value="1" <?php if ($options['custom_field_template_replace_keys_by_labels']) { echo 'checked="checked"'; } ?> /> <?php _e('Use labels in place of custom keys', 'custom-field-template'); ?></p>
225
+ </td>
226
+ </tr>
227
+ <tr><td>
228
  <p><input type="submit" name="custom_field_template_set_options_submit" value="<?php _e('Update Options &raquo;', 'custom-field-template'); ?>" /></p>
229
  </td></tr>
230
  </tbody>
267
  <table class="form-table" style="margin-bottom:5px;">
268
  <thead>
269
  <tr>
270
+ <th>type</th><th>text or textfield</th><th>checkbox</th><th>radio</th><th>select</th><th>textarea</th>
271
  </tr>
272
  </thead>
273
  <tbody>
376
  }
377
 
378
  function make_textfield( $name, $sid, $size = 25, $hideKey, $label ) {
379
+ $options = $this->get_custom_field_template_data();
380
+
381
  $title = $name;
382
  $name = $this->sanitize_name( $name );
383
 
390
 
391
  if ( $hideKey == true ) $hide = ' class="hideKey""';
392
 
393
+ if ( !empty($label) && $options['custom_field_template_replace_keys_by_labels'] )
394
+ $title = stripcslashes($label);
395
+
396
  $out .=
397
  '<dl>' .
398
  '<dt><span' . $hide . '>' . $title . '</span></dt>' .
399
  '<dd>';
400
 
401
+ if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
402
+ $out .= '<p class="label">' . stripcslashes($label) . '</p>';
403
+ $out .= '<input id="' . $name . '" name="' . $name . '[]" value="' . attribute_escape($value) . '" type="text" size="' . $size . '" /></dd>' .
404
  '</dl>';
405
  return $out;
406
  }
407
 
408
  function make_checkbox( $name, $sid, $value, $checked, $hideKey, $label ) {
409
+ $options = $this->get_custom_field_template_data();
410
+
411
  $title = $name;
412
  $name = $this->sanitize_name( $name );
413
 
425
 
426
  if ( $hideKey == true ) $hide = ' class="hideKey""';
427
 
428
+ if ( !empty($label) && $options['custom_field_template_replace_keys_by_labels'] )
429
+ $title = stripcslashes($label);
430
+
431
  $out .=
432
  '<dl>' .
433
  '<dt><span' . $hide . '>' . $title . '</span></dt>' .
434
  '<dd>';
435
 
436
+ if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
437
+ $out .= '<p class="label">' . stripcslashes($label) . '</p>';
438
  $out .= '<label for="' . $id . '" class="selectit"><input name="' . $name . '[' . $sid . ']" value="' . attribute_escape($value) . '" ' . $checked . ' type="checkbox" /> ' . stripcslashes($value) . '</label><br />';
439
 
440
  $out .= '</dd></dl>';
443
  }
444
 
445
  function make_radio( $name, $sid, $values, $clearButton, $default, $hideKey, $label ) {
446
+ $options = $this->get_custom_field_template_data();
447
+
448
  $title = $name;
449
  $name = $this->sanitize_name( $name );
450
 
458
 
459
  if ( $hideKey == true ) $hide = ' class="hideKey""';
460
 
461
+ if ( !empty($label) && $options['custom_field_template_replace_keys_by_labels'] )
462
+ $title = stripcslashes($label);
463
+
464
  $out .=
465
  '<dl>' .
466
  '<dt><span' . $hide . '>' . $title . '</span>';
475
  '</dt>' .
476
  '<dd>';
477
 
478
+ if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
479
+ $out .= '<p class="label">' . stripcslashes($label) . '</p>';
480
  foreach( $values as $val ) {
481
  $id = $name . '_' . $this->sanitize_name( $val );
482
 
491
  }
492
 
493
  function make_select( $name, $sid, $values, $default, $hideKey, $label ) {
494
+ $options = $this->get_custom_field_template_data();
495
+
496
  $title = $name;
497
  $name = $this->sanitize_name( $name );
498
 
507
  }
508
 
509
  if ( $hideKey == true ) $hide = ' class="hideKey""';
510
+
511
+ if ( !empty($label) && $options['custom_field_template_replace_keys_by_labels'] )
512
+ $title = stripcslashes($label);
513
 
514
  $out .=
515
  '<dl>' .
516
  '<dt><span' . $hide . '>' . $title . '</span></dt>' .
517
  '<dd>';
518
 
519
+ if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
520
+ $out .= '<p class="label">' . stripcslashes($label) . '</p>';
521
  $out .= '<select name="' . $name . '[]">' .
522
  '<option value="" >Select</option>';
523
 
533
  }
534
 
535
  function make_textarea( $name, $sid, $rows, $cols, $tinyMCE, $mediaButton, $hideKey, $label ) {
536
+ $options = $this->get_custom_field_template_data();
537
+
538
  global $wp_version;
539
 
540
  $title = $name;
551
  $out = '<script type="text/javascript">' . "\n" .
552
  '// <![CDATA[' . "\n" .
553
  'if ( typeof tinyMCE != "undefined" )' . "\n" .
554
+ 'jQuery(document).ready(function() {document.getElementById("'. $name . $rand . '").value = switchEditors.wpautop(document.getElementById("'. $name . $rand . '").value); tinyMCE.execCommand("mceAddControl", false, "'. $name . $rand . '"); tinyMCEID.push("'. $name . $rand . '");});' . "\n" .
555
  '// ]]>' . "\n" .
556
  '</script>';
557
  }
584
  }
585
 
586
  if ( $hideKey == true ) $hide = ' class="hideKey""';
587
+
588
+ if ( !empty($label) && $options['custom_field_template_replace_keys_by_labels'] )
589
+ $title = stripcslashes($label);
590
 
591
  $out .=
592
  '<dl>' .
593
  '<dt><span' . $hide . '>' . $title . '</span><br />' . $media . $switch . '</dt>' .
594
  '<dd>';
595
 
596
+ if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
597
+ $out .= '<p class="label">' . stripcslashes($label) . '</p>';
598
+ $out .= '<textarea id="' . $name . $rand . '" name="' . $name . '[' . $sid . ']" rows="' .$rows. '" cols="' . $cols . '" style="color:#000000">' . attribute_escape($value) . '</textarea><input type="hidden" name="'.$name.'_rand['.$sid.']" value="'.$rand.'" /></dd>' .
599
  '</dl>';
600
  return $out;
601
  }
611
  $out .= '<input type="hidden" name="custom-field-template-id" id="custom-field-template-id" value="' . $id . '" />';
612
  foreach( $fields as $title => $data ) {
613
  for($i = 0; $i<count($data); $i++) {
614
+ if( $data[$i]['type'] == 'textfield' || $data[$i]['type'] == 'text' ) {
615
  $out .= $this->make_textfield( $title, $i, $data[$i]['size'], $data[$i]['hideKey'], $data[$i]['label'] );
616
  }
617
  else if( $data[$i]['type'] == 'checkbox' ) {
722
  'function switchMode(id) {' . "\n" .
723
  ' var ed = tinyMCE.get(id);' . "\n" .
724
  ' if ( ! ed || ed.isHidden() ) {' . "\n" .
725
+ ' document.getElementById(id).value = switchEditors.wpautop(document.getElementById(id).value);' . "\n" .
726
  ' if ( ed ) ed.show();' . "\n" .
727
  ' else tinyMCE.execCommand("mceAddControl", false, id);' . "\n" .
728
  ' } else {' . "\n" .
789
  function edit_meta_value( $id ) {
790
  global $wpdb;
791
  $options = $this->get_custom_field_template_data();
792
+
793
  if( !isset( $id ) )
794
  $id = $_REQUEST[ 'post_ID' ];
795
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Hiroaki Miyashita
3
  Donate link: http://wordpressgogo.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.7 beta 2
7
- Stable tag: 0.5.3
8
 
9
  This plugin adds the default custom fields on the Write Post/Page.
10
 
@@ -19,7 +19,8 @@ The Custom Field Template plugin adds the default custom fields on the Write Pos
19
  * Support for multiple fields with the same key.
20
  * Support for hideKey and label options.
21
  * You can see the full option list in the setting page of the plugin.
22
- * You can customize the design of custom field template with css.
 
23
 
24
  == Installation ==
25
 
3
  Donate link: http://wordpressgogo.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.7 beta 3
7
+ Stable tag: 0.6
8
 
9
  This plugin adds the default custom fields on the Write Post/Page.
10
 
19
  * Support for multiple fields with the same key.
20
  * Support for hideKey and label options.
21
  * You can see the full option list in the setting page of the plugin.
22
+ * You can customize the design of custom field template with css.
23
+ * You can replace custom keys by labels.
24
 
25
  == Installation ==
26