Custom Field Template - Version 1.0.2

Version Description

Download this release

Release Info

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

Code changes from version 1.0.1 to 1.0.2

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: 2009-01-26 14:36+0900\n"
6
- "PO-Revision-Date: 2009-01-26 14:37+0900\n"
7
  "Last-Translator: \n"
8
  "Language-Team: \n"
9
  "MIME-Version: 1.0\n"
@@ -16,247 +16,250 @@ msgstr ""
16
  "X-Poedit-Basepath: ../\n"
17
  "X-Poedit-SearchPath-0: custom-field-template\n"
18
 
19
- #: custom-field-template/custom-field-template.php:87
20
  #: custom-field-template/custom-field-template.php:88
21
- #: custom-field-template/custom-field-template.php:411
22
- #: custom-field-template/custom-field-template.php:511
23
- #: custom-field-template/custom-field-template.php:1199
 
24
  msgid "Custom Field Template"
25
  msgstr "カスタムフィールドテンプレート"
26
 
27
- #: custom-field-template/custom-field-template.php:269
28
  msgid "read more"
29
  msgstr "続きを表示"
30
 
31
- #: custom-field-template/custom-field-template.php:287
32
- #: custom-field-template/custom-field-template.php:297
33
  msgid "Custom Fields"
34
  msgstr "カスタムフィールド"
35
 
36
- #: custom-field-template/custom-field-template.php:327
37
  msgid "Settings"
38
  msgstr "設定"
39
 
40
- #: custom-field-template/custom-field-template.php:339
41
  msgid "Default Template"
42
  msgstr "デフォルトテンプレート"
43
 
44
- #: custom-field-template/custom-field-template.php:461
45
- #: custom-field-template/custom-field-template.php:465
46
- #: custom-field-template/custom-field-template.php:473
47
- #: custom-field-template/custom-field-template.php:481
48
- #: custom-field-template/custom-field-template.php:494
49
  msgid "Options updated."
50
  msgstr "オプションは更新されました。"
51
 
52
- #: custom-field-template/custom-field-template.php:499
53
  msgid "Options resetted."
54
  msgstr "オプションはリセットされました。"
55
 
56
- #: custom-field-template/custom-field-template.php:503
57
  msgid "Options deleted."
58
  msgstr "オプションは削除されました。"
59
 
60
- #: custom-field-template/custom-field-template.php:517
61
  msgid "Custom Field Template Options"
62
  msgstr "カスタムフィールドテンプレートオプション"
63
 
64
- #: custom-field-template/custom-field-template.php:527
65
  msgid "Template Title"
66
  msgstr "テンプレートタイトル"
67
 
68
- #: custom-field-template/custom-field-template.php:529
69
  msgid "Template Instruction"
70
  msgstr "テンプレートインストラクション"
71
 
72
- #: custom-field-template/custom-field-template.php:531
73
- #: custom-field-template/custom-field-template.php:661
74
  msgid "Category ID (comma-deliminated)"
75
  msgstr "カテゴリーID(カンマ区切り)"
76
 
77
- #: custom-field-template/custom-field-template.php:533
78
  msgid "Template Content"
79
  msgstr "テンプレートコンテンツ"
80
 
81
- #: custom-field-template/custom-field-template.php:540
82
  msgid "In case that you would like to insert multiple images at once in use of the custom field media buttons"
83
  msgstr "カスタムフィールへの画像挿入を一度に複数枚実行する場合"
84
 
85
- #: custom-field-template/custom-field-template.php:541
86
  msgid "Use multiple image inset"
87
  msgstr "複数画像挿入を利用する"
88
 
89
- #: custom-field-template/custom-field-template.php:541
90
  msgid "Caution:"
91
  msgstr "ご注意:"
92
 
93
- #: custom-field-template/custom-field-template.php:541
94
  msgid "You need to edit `wp-admin/includes/media.php`. Delete or comment out the code in the function media_send_to_editor."
95
  msgstr "`wp-admin/includes/media.php`を編集する必要があります。media_send_to_editor関数の中身を削除するかコメントアウトしてください。"
96
 
97
- #: custom-field-template/custom-field-template.php:545
98
  msgid "In case that you would like to replace custom keys by labels if `label` is set"
99
  msgstr "`label`がセットされていて、カスタムフィールドのキーの代わりにラベルを表示したい場合"
100
 
101
- #: custom-field-template/custom-field-template.php:546
102
  msgid "Use labels in place of custom keys"
103
  msgstr "カスタムフィールドのキーの代わりにラベルを使用する"
104
 
105
- #: custom-field-template/custom-field-template.php:549
106
  msgid "In case that you would like to add p and br tags in textareas automatically"
107
  msgstr "テキストエリアでpタグ、brタグを自動的に追加したい場合"
108
 
109
- #: custom-field-template/custom-field-template.php:550
110
  msgid "Use wpautop function"
111
  msgstr "wpautop関数を使用する"
112
 
113
- #: custom-field-template/custom-field-template.php:554
114
  msgid "In case that you would like to save values automatically in switching templates"
115
  msgstr "テンプレート切替時自動で保存したい場合"
116
 
117
- #: custom-field-template/custom-field-template.php:555
118
  msgid "Use the auto save in switching templates"
119
  msgstr "テンプレート切替時の自動保存を使用する"
120
 
121
- #: custom-field-template/custom-field-template.php:559
122
- #: custom-field-template/custom-field-template.php:578
123
- #: custom-field-template/custom-field-template.php:606
124
- #: custom-field-template/custom-field-template.php:637
125
- #: custom-field-template/custom-field-template.php:669
126
  msgid "Update Options »"
127
  msgstr "オプションを更新する »"
128
 
129
- #: custom-field-template/custom-field-template.php:568
130
- #: custom-field-template/custom-field-template.php:587
131
- #: custom-field-template/custom-field-template.php:615
132
- #: custom-field-template/custom-field-template.php:646
133
- #: custom-field-template/custom-field-template.php:678
134
- #: custom-field-template/custom-field-template.php:765
135
- #: custom-field-template/custom-field-template.php:781
136
- #: custom-field-template/custom-field-template.php:797
137
  msgid "Click to toggle"
138
  msgstr "クリックで切替"
139
 
140
- #: custom-field-template/custom-field-template.php:569
141
- msgid "CSS"
142
- msgstr "CSS"
143
 
144
- #: custom-field-template/custom-field-template.php:588
145
  msgid "[cft] and [cftsearch] Shortcode Format"
146
  msgstr "[cft] and [cftsearch] Shortcode Format"
147
 
148
- #: custom-field-template/custom-field-template.php:591
149
  msgid "For [cft], [key] will be converted into the value of [key]."
150
  msgstr "[cft]では、[key]は、[key]の値に置換されます。"
151
 
152
- #: custom-field-template/custom-field-template.php:592
153
  msgid "For [cftsearch], [key] will be converted into the input field."
154
  msgstr "[cftsearch]では、[key]は、インプットフィールドに置換されます。"
155
 
156
- #: custom-field-template/custom-field-template.php:616
157
  msgid "PHP CODE (Experimental Option)"
158
  msgstr "PHP CODE (Experimental Option)"
159
 
160
- #: custom-field-template/custom-field-template.php:618
161
  msgid "Are you sure to save PHP codes? Please do it at your own risk."
162
  msgstr "PHPコードを保存してよろしいですか?自己責任で実行してください。"
163
 
164
- #: custom-field-template/custom-field-template.php:619
165
  msgid "For `text` and `textarea`, you must set $value as an string."
166
  msgstr "`text`と`textarea`は$valueを文字列としてセットしてください。"
167
 
168
- #: custom-field-template/custom-field-template.php:621
169
  msgid "For `checkbox`, `radio`, and `select`, you must set $values as an array."
170
  msgstr "`checkbox`、`radio`、`select`では、配列として$valuesをセットしてください。"
171
 
172
- #: custom-field-template/custom-field-template.php:647
173
  msgid "Auto Hook of `the_content()` (Experimental Option)"
174
  msgstr "Auto Hook of `the_content()` (Experimental Option)"
175
 
176
- #: custom-field-template/custom-field-template.php:657
177
  msgid "Position"
178
  msgstr "位置"
179
 
180
- #: custom-field-template/custom-field-template.php:658
181
  msgid "Before the conetnt"
182
  msgstr "コンテンツの前"
183
 
184
- #: custom-field-template/custom-field-template.php:659
185
  msgid "After the conetnt"
186
  msgstr "コンテンツの後"
187
 
188
- #: custom-field-template/custom-field-template.php:663
189
  msgid "Content"
190
  msgstr "コンテンツ"
191
 
192
- #: custom-field-template/custom-field-template.php:679
193
  msgid "Option List"
194
  msgstr "オプションリスト"
195
 
196
- #: custom-field-template/custom-field-template.php:766
197
  msgid "Reset Options"
198
  msgstr "オプションをリセットする"
199
 
200
- #: custom-field-template/custom-field-template.php:768
201
  msgid "Are you sure to reset options? Options you set will be reset to the default settings."
202
  msgstr "本当にオプションをリセットしてもよろしいですか?設定したオプションはデフォルトの状態に戻ります。"
203
 
204
- #: custom-field-template/custom-field-template.php:772
205
  msgid "Unset Options »"
206
  msgstr "オプションをリセットする »"
207
 
208
- #: custom-field-template/custom-field-template.php:782
209
  msgid "Delete Options"
210
  msgstr "オプションを削除する"
211
 
212
- #: custom-field-template/custom-field-template.php:784
213
  msgid "Are you sure to delete options? Options you set will be deleted."
214
  msgstr "本当にオプションを削除してもよろしいですか?設定したオプションは削除されます。"
215
 
216
- #: custom-field-template/custom-field-template.php:788
217
  msgid "Delete Options »"
218
  msgstr "オプションを削除する »"
219
 
220
- #: custom-field-template/custom-field-template.php:798
221
  msgid "Donation"
222
  msgstr "寄付"
223
 
224
- #: custom-field-template/custom-field-template.php:800
225
  msgid "If you liked this plugin, please make a donation via paypal! Any amount is welcome. Your support is much appreciated."
226
  msgstr "このプラグインをお気に召しましたら、Paypalよりご寄付をよろしくお願いいたします。"
227
 
228
- #: custom-field-template/custom-field-template.php:963
229
  msgid "Clear"
230
  msgstr "解除"
231
 
232
- #: custom-field-template/custom-field-template.php:1085
233
  msgid "Add Media"
234
  msgstr ""
235
 
236
- #: custom-field-template/custom-field-template.php:1087
237
  msgid "Add an Image"
238
  msgstr ""
239
 
240
- #: custom-field-template/custom-field-template.php:1089
241
  msgid "Add Video"
242
  msgstr ""
243
 
244
- #: custom-field-template/custom-field-template.php:1091
245
  msgid "Add Audio"
246
  msgstr ""
247
 
248
- #: custom-field-template/custom-field-template.php:1102
249
  msgid "Toggle"
250
  msgstr "切り替え"
251
 
252
- #: custom-field-template/custom-field-template.php:1357
253
  msgid "Save"
254
  msgstr "保存"
255
 
256
- #: custom-field-template/custom-field-template.php:1676
 
257
  msgid "Search »"
258
  msgstr "検索 »"
259
 
 
 
260
  #~ msgid "Quick Edit"
261
  #~ msgstr "クイック編集"
262
  #~ msgid "Recent Posts Ext"
2
  msgstr ""
3
  "Project-Id-Version: Custom Field Template\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2009-01-29 01:52+0900\n"
6
+ "PO-Revision-Date: 2009-01-29 01:52+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:88
20
+ #: custom-field-template/custom-field-template.php:89
21
+ #: custom-field-template/custom-field-template.php:414
22
+ #: custom-field-template/custom-field-template.php:521
23
+ #: custom-field-template/custom-field-template.php:1209
24
  msgid "Custom Field Template"
25
  msgstr "カスタムフィールドテンプレート"
26
 
27
+ #: custom-field-template/custom-field-template.php:272
28
  msgid "read more"
29
  msgstr "続きを表示"
30
 
31
+ #: custom-field-template/custom-field-template.php:290
32
+ #: custom-field-template/custom-field-template.php:300
33
  msgid "Custom Fields"
34
  msgstr "カスタムフィールド"
35
 
36
+ #: custom-field-template/custom-field-template.php:330
37
  msgid "Settings"
38
  msgstr "設定"
39
 
40
+ #: custom-field-template/custom-field-template.php:342
41
  msgid "Default Template"
42
  msgstr "デフォルトテンプレート"
43
 
44
+ #: custom-field-template/custom-field-template.php:471
45
+ #: custom-field-template/custom-field-template.php:475
46
+ #: custom-field-template/custom-field-template.php:483
47
+ #: custom-field-template/custom-field-template.php:491
48
+ #: custom-field-template/custom-field-template.php:504
49
  msgid "Options updated."
50
  msgstr "オプションは更新されました。"
51
 
52
+ #: custom-field-template/custom-field-template.php:509
53
  msgid "Options resetted."
54
  msgstr "オプションはリセットされました。"
55
 
56
+ #: custom-field-template/custom-field-template.php:513
57
  msgid "Options deleted."
58
  msgstr "オプションは削除されました。"
59
 
60
+ #: custom-field-template/custom-field-template.php:527
61
  msgid "Custom Field Template Options"
62
  msgstr "カスタムフィールドテンプレートオプション"
63
 
64
+ #: custom-field-template/custom-field-template.php:537
65
  msgid "Template Title"
66
  msgstr "テンプレートタイトル"
67
 
68
+ #: custom-field-template/custom-field-template.php:539
69
  msgid "Template Instruction"
70
  msgstr "テンプレートインストラクション"
71
 
72
+ #: custom-field-template/custom-field-template.php:541
73
+ #: custom-field-template/custom-field-template.php:671
74
  msgid "Category ID (comma-deliminated)"
75
  msgstr "カテゴリーID(カンマ区切り)"
76
 
77
+ #: custom-field-template/custom-field-template.php:543
78
  msgid "Template Content"
79
  msgstr "テンプレートコンテンツ"
80
 
81
+ #: custom-field-template/custom-field-template.php:550
82
  msgid "In case that you would like to insert multiple images at once in use of the custom field media buttons"
83
  msgstr "カスタムフィールへの画像挿入を一度に複数枚実行する場合"
84
 
85
+ #: custom-field-template/custom-field-template.php:551
86
  msgid "Use multiple image inset"
87
  msgstr "複数画像挿入を利用する"
88
 
89
+ #: custom-field-template/custom-field-template.php:551
90
  msgid "Caution:"
91
  msgstr "ご注意:"
92
 
93
+ #: custom-field-template/custom-field-template.php:551
94
  msgid "You need to edit `wp-admin/includes/media.php`. Delete or comment out the code in the function media_send_to_editor."
95
  msgstr "`wp-admin/includes/media.php`を編集する必要があります。media_send_to_editor関数の中身を削除するかコメントアウトしてください。"
96
 
97
+ #: custom-field-template/custom-field-template.php:555
98
  msgid "In case that you would like to replace custom keys by labels if `label` is set"
99
  msgstr "`label`がセットされていて、カスタムフィールドのキーの代わりにラベルを表示したい場合"
100
 
101
+ #: custom-field-template/custom-field-template.php:556
102
  msgid "Use labels in place of custom keys"
103
  msgstr "カスタムフィールドのキーの代わりにラベルを使用する"
104
 
105
+ #: custom-field-template/custom-field-template.php:559
106
  msgid "In case that you would like to add p and br tags in textareas automatically"
107
  msgstr "テキストエリアでpタグ、brタグを自動的に追加したい場合"
108
 
109
+ #: custom-field-template/custom-field-template.php:560
110
  msgid "Use wpautop function"
111
  msgstr "wpautop関数を使用する"
112
 
113
+ #: custom-field-template/custom-field-template.php:564
114
  msgid "In case that you would like to save values automatically in switching templates"
115
  msgstr "テンプレート切替時自動で保存したい場合"
116
 
117
+ #: custom-field-template/custom-field-template.php:565
118
  msgid "Use the auto save in switching templates"
119
  msgstr "テンプレート切替時の自動保存を使用する"
120
 
121
+ #: custom-field-template/custom-field-template.php:569
122
+ #: custom-field-template/custom-field-template.php:588
123
+ #: custom-field-template/custom-field-template.php:616
124
+ #: custom-field-template/custom-field-template.php:647
125
+ #: custom-field-template/custom-field-template.php:679
126
  msgid "Update Options »"
127
  msgstr "オプションを更新する »"
128
 
129
+ #: custom-field-template/custom-field-template.php:578
130
+ #: custom-field-template/custom-field-template.php:597
131
+ #: custom-field-template/custom-field-template.php:625
132
+ #: custom-field-template/custom-field-template.php:656
133
+ #: custom-field-template/custom-field-template.php:688
134
+ #: custom-field-template/custom-field-template.php:775
135
+ #: custom-field-template/custom-field-template.php:791
136
+ #: custom-field-template/custom-field-template.php:807
137
  msgid "Click to toggle"
138
  msgstr "クリックで切替"
139
 
140
+ #: custom-field-template/custom-field-template.php:579
141
+ msgid "ADMIN CSS"
142
+ msgstr ""
143
 
144
+ #: custom-field-template/custom-field-template.php:598
145
  msgid "[cft] and [cftsearch] Shortcode Format"
146
  msgstr "[cft] and [cftsearch] Shortcode Format"
147
 
148
+ #: custom-field-template/custom-field-template.php:601
149
  msgid "For [cft], [key] will be converted into the value of [key]."
150
  msgstr "[cft]では、[key]は、[key]の値に置換されます。"
151
 
152
+ #: custom-field-template/custom-field-template.php:602
153
  msgid "For [cftsearch], [key] will be converted into the input field."
154
  msgstr "[cftsearch]では、[key]は、インプットフィールドに置換されます。"
155
 
156
+ #: custom-field-template/custom-field-template.php:626
157
  msgid "PHP CODE (Experimental Option)"
158
  msgstr "PHP CODE (Experimental Option)"
159
 
160
+ #: custom-field-template/custom-field-template.php:628
161
  msgid "Are you sure to save PHP codes? Please do it at your own risk."
162
  msgstr "PHPコードを保存してよろしいですか?自己責任で実行してください。"
163
 
164
+ #: custom-field-template/custom-field-template.php:629
165
  msgid "For `text` and `textarea`, you must set $value as an string."
166
  msgstr "`text`と`textarea`は$valueを文字列としてセットしてください。"
167
 
168
+ #: custom-field-template/custom-field-template.php:631
169
  msgid "For `checkbox`, `radio`, and `select`, you must set $values as an array."
170
  msgstr "`checkbox`、`radio`、`select`では、配列として$valuesをセットしてください。"
171
 
172
+ #: custom-field-template/custom-field-template.php:657
173
  msgid "Auto Hook of `the_content()` (Experimental Option)"
174
  msgstr "Auto Hook of `the_content()` (Experimental Option)"
175
 
176
+ #: custom-field-template/custom-field-template.php:667
177
  msgid "Position"
178
  msgstr "位置"
179
 
180
+ #: custom-field-template/custom-field-template.php:668
181
  msgid "Before the conetnt"
182
  msgstr "コンテンツの前"
183
 
184
+ #: custom-field-template/custom-field-template.php:669
185
  msgid "After the conetnt"
186
  msgstr "コンテンツの後"
187
 
188
+ #: custom-field-template/custom-field-template.php:673
189
  msgid "Content"
190
  msgstr "コンテンツ"
191
 
192
+ #: custom-field-template/custom-field-template.php:689
193
  msgid "Option List"
194
  msgstr "オプションリスト"
195
 
196
+ #: custom-field-template/custom-field-template.php:776
197
  msgid "Reset Options"
198
  msgstr "オプションをリセットする"
199
 
200
+ #: custom-field-template/custom-field-template.php:778
201
  msgid "Are you sure to reset options? Options you set will be reset to the default settings."
202
  msgstr "本当にオプションをリセットしてもよろしいですか?設定したオプションはデフォルトの状態に戻ります。"
203
 
204
+ #: custom-field-template/custom-field-template.php:782
205
  msgid "Unset Options »"
206
  msgstr "オプションをリセットする »"
207
 
208
+ #: custom-field-template/custom-field-template.php:792
209
  msgid "Delete Options"
210
  msgstr "オプションを削除する"
211
 
212
+ #: custom-field-template/custom-field-template.php:794
213
  msgid "Are you sure to delete options? Options you set will be deleted."
214
  msgstr "本当にオプションを削除してもよろしいですか?設定したオプションは削除されます。"
215
 
216
+ #: custom-field-template/custom-field-template.php:798
217
  msgid "Delete Options »"
218
  msgstr "オプションを削除する »"
219
 
220
+ #: custom-field-template/custom-field-template.php:808
221
  msgid "Donation"
222
  msgstr "寄付"
223
 
224
+ #: custom-field-template/custom-field-template.php:810
225
  msgid "If you liked this plugin, please make a donation via paypal! Any amount is welcome. Your support is much appreciated."
226
  msgstr "このプラグインをお気に召しましたら、Paypalよりご寄付をよろしくお願いいたします。"
227
 
228
+ #: custom-field-template/custom-field-template.php:973
229
  msgid "Clear"
230
  msgstr "解除"
231
 
232
+ #: custom-field-template/custom-field-template.php:1095
233
  msgid "Add Media"
234
  msgstr ""
235
 
236
+ #: custom-field-template/custom-field-template.php:1097
237
  msgid "Add an Image"
238
  msgstr ""
239
 
240
+ #: custom-field-template/custom-field-template.php:1099
241
  msgid "Add Video"
242
  msgstr ""
243
 
244
+ #: custom-field-template/custom-field-template.php:1101
245
  msgid "Add Audio"
246
  msgstr ""
247
 
248
+ #: custom-field-template/custom-field-template.php:1112
249
  msgid "Toggle"
250
  msgstr "切り替え"
251
 
252
+ #: custom-field-template/custom-field-template.php:1367
253
  msgid "Save"
254
  msgstr "保存"
255
 
256
+ #: custom-field-template/custom-field-template.php:1754
257
+ #: custom-field-template/custom-field-template.php:1823
258
  msgid "Search »"
259
  msgstr "検索 »"
260
 
261
+ #~ msgid "CSS"
262
+ #~ msgstr "CSS"
263
  #~ msgid "Quick Edit"
264
  #~ msgstr "クイック編集"
265
  #~ msgid "Recent Posts Ext"
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: 1.0.1
8
  Author URI: http://wordpressgogo.com/
9
  */
10
 
@@ -21,9 +21,9 @@ class custom_field_template {
21
  add_action( 'admin_print_scripts', array(&$this, 'custom_field_template_admin_scripts') );
22
  add_action( 'admin_head', array(&$this, 'custom_field_template_admin_head'), 100 );
23
 
24
- add_action( 'edit_post', array(&$this, 'edit_meta_value'), 100 );
25
  add_action( 'save_post', array(&$this, 'edit_meta_value'), 100 );
26
- add_action( 'publish_post', array(&$this, 'edit_meta_value'), 100 );
27
 
28
  add_filter( 'media_send_to_editor', array(&$this, 'media_send_to_custom_field'), 15 );
29
  add_filter( 'plugin_action_links', array(&$this, 'wpaq_filter_plugin_actions'), 10, 2 );
@@ -32,7 +32,6 @@ class custom_field_template {
32
 
33
  if ( $_REQUEST['cftsearch'] ) :
34
  add_filter( 'posts_where', array(&$this, 'custom_field_template_posts_where') );
35
- add_filter( 'posts_orderby', array(&$this, 'custom_field_template_posts_orderby') );
36
  endif;
37
 
38
  if ( function_exists('add_shortcode') ) :
@@ -93,44 +92,46 @@ class custom_field_template {
93
  }
94
 
95
  function add_quick_edit_custom_box($column_name, $type) {
96
- global $wp_version;
97
- $options = $this->get_custom_field_template_data();
 
98
 
99
- if( $options == null)
100
- return;
101
 
102
- if ( !$options['css'] ) {
103
- $this->install_custom_field_template_css();
104
- $options = $this->get_custom_field_template_data();
105
- }
106
-
107
- $out .= '<fieldset style="clear:both;">' . "\n";
108
- $out .= '<div class="inline-edit-group">';
109
- $out .= '<style type="text/css">' . "\n" .
110
- '<!--' . "\n";
111
- $out .= $options['css'] . "\n";
112
- $out .= '-->' . "\n" .
113
- '</style>';
114
 
115
- if ( count($options['custom_fields'])>1 ) {
116
- $out .= '<select id="custom_field_template_select" onchange="jQuery.ajax({type: \'GET\', url: \'?page=custom-field-template/custom-field-template.php&id=\'+jQuery(this).val()+\'&post=\'+jQuery(this).parent().parent().parent().parent().attr(\'id\').replace(\'edit-\',\'\'), success: function(html) {jQuery(\'#cft\').html(html);}});">';
117
- for ( $i=0; $i < count($options['custom_fields']); $i++ ) {
118
- if ( $i == $options['posts'][$_REQUEST['post']] ) {
119
- $out .= '<option value="' . $i . '" selected="selected">' . stripcslashes($options['custom_fields'][$i]['title']) . '</option>';
120
- } else
121
- $out .= '<option value="' . $i . '">' . stripcslashes($options['custom_fields'][$i]['title']) . '</option>';
 
 
122
  }
123
- $out .= '</select>';
124
- }
125
 
126
- $out .= '<input type="hidden" name="custom-field-template-verify-key" id="custom-field-template-verify-key" value="' . wp_create_nonce('custom-field-template') . '" />';
127
- $out .= '<div id="cft">';
128
- $out .= '</div>';
129
 
130
- $out .= '</div>' . "\n";
131
- $out .= '</fieldset>' . "\n";
132
 
133
- echo $out;
 
134
  }
135
 
136
  function custom_field_template_admin_head() {
@@ -522,7 +523,7 @@ mediaButton = true';
522
  <br class="clear"/>
523
 
524
  <div id="poststuff" class="meta-box-sortables" style="position: relative; margin-top:10px;">
525
- <div class="stuffbox">
526
  <h3><?php _e('Custom Field Template Options', 'custom-field-template'); ?></h3>
527
  <div class="inside">
528
  <form method="post">
@@ -534,13 +535,13 @@ mediaButton = true';
534
  <tr><td>
535
  <p><strong>TEMPLATE #<?php echo $i; ?></strong></p>
536
  <p><label for="custom_field_template_title[<?php echo $i; ?>]"><?php echo sprintf(__('Template Title', 'custom-field-template'), $i); ?></label>:<br />
537
- <input type="text" name="custom_field_template_title[<?php echo $i; ?>]" id="custom_field_template_title[<?php echo $i; ?>]" value="<?php echo stripcslashes($options['custom_fields'][$i]['title']); ?>" size="60" /></p>
538
  <p><label for="custom_field_template_instruction[<?php echo $i; ?>]"><a href="javascript:void(0);" onclick="jQuery(this).parent().next().next().toggle();"><?php echo sprintf(__('Template Instruction', 'custom-field-template'), $i); ?></a></label>:<br />
539
- <textarea name="custom_field_template_instruction[<?php echo $i; ?>]" id="custom_field_template_instruction[<?php echo $i; ?>]" rows="5" cols="60"<?php if ( empty($options['custom_fields'][$i]['instruction']) ) : echo ' style="display:none;"'; endif; ?>><?php echo stripcslashes($options['custom_fields'][$i]['instruction']); ?></textarea></p>
540
  <p><label for="custom_field_template_category[<?php echo $i; ?>]"><a href="javascript:void(0);" onclick="jQuery(this).parent().next().next().toggle();"><?php echo sprintf(__('Category ID (comma-deliminated)', 'custom-field-template'), $i); ?></a></label>:<br />
541
- <input type="text" name="custom_field_template_category[<?php echo $i; ?>]" id="custom_field_template_category[<?php echo $i; ?>]" value="<?php echo stripcslashes($options['custom_fields'][$i]['category']); ?>" size="60"<?php if ( empty($options['custom_fields'][$i]['category']) ) : echo ' style="display:none;"'; endif; ?> /></p>
542
  <p><label for="custom_field_template_content[<?php echo $i; ?>]"><?php echo sprintf(__('Template Content', 'custom-field-template'), $i); ?></label>:<br />
543
- <textarea name="custom_field_template_content[<?php echo $i; ?>]" id="custom_field_template_content[<?php echo $i; ?>]" rows="10" cols="60"><?php echo stripcslashes($options['custom_fields'][$i]['content']); ?></textarea></p>
544
  </td></tr>
545
  <?php
546
  }
@@ -581,7 +582,7 @@ mediaButton = true';
581
  <table class="form-table" style="margin-bottom:5px;">
582
  <tbody>
583
  <tr><td>
584
- <p><textarea name="custom_field_template_css" id="custom_field_template_css" rows="10" cols="60"><?php echo stripcslashes($options['css']); ?></textarea></p>
585
  </td></tr>
586
  <tr><td>
587
  <p><input type="submit" name="custom_field_template_css_submit" value="<?php _e('Update Options &raquo;', 'custom-field-template'); ?>" class="button-primary" /></p>
@@ -606,7 +607,7 @@ mediaButton = true';
606
  ?>
607
  <tr><th><strong>FORMAT #<?php echo $i; ?></strong></th></tr>
608
  <tr><td>
609
- <p><textarea name="custom_field_template_shortcode_format[]" rows="10" cols="60"><?php echo stripcslashes($options['shortcode_format'][$i]); ?></textarea></p>
610
  </td></tr>
611
  <?php
612
  endfor;
@@ -637,7 +638,7 @@ ex. `radio` and `select`:</dt><dd>$values = array('dog', 'cat', 'monkey'); $defa
637
  ?>
638
  <tr><th><strong>CODE #<?php echo $i; ?></strong></th></tr>
639
  <tr><td>
640
- <p><textarea name="custom_field_template_php[]" rows="10" cols="60"><?php echo stripcslashes($options['php'][$i]); ?></textarea></p>
641
  </td></tr>
642
  <?php
643
  endfor;
@@ -668,8 +669,8 @@ ex. `radio` and `select`:</dt><dd>$values = array('dog', 'cat', 'monkey'); $defa
668
  <input type="radio" name="custom_field_template_hook_position[<?php echo $i; ?>]" value="0" <?php if($options['hook'][$i]['position']==0) echo ' checked="checked"'; ?> /> <?php _e('After the conetnt', 'custom-field-template'); ?>
669
  </p>
670
  <p><label for="custom_field_template_hook_category[<?php echo $i; ?>]"><?php echo sprintf(__('Category ID (comma-deliminated)', 'custom-field-template'), $i); ?></label>:<br />
671
- <input type="text" name="custom_field_template_hook_category[<?php echo $i; ?>]" id="custom_field_template_hook_category[<?php echo $i; ?>]" value="<?php echo stripcslashes($options['hook'][$i]['category']); ?>" size="60" /></p>
672
- <p><label for="custom_field_template_hook_content[<?php echo $i; ?>]"><?php echo sprintf(__('Content', 'custom-field-template'), $i); ?></label>:<br /><textarea name="custom_field_template_hook_content[<?php echo $i; ?>]" rows="5" cols="60"><?php echo stripcslashes($options['hook'][$i]['content']); ?></textarea></p>
673
  </td></tr>
674
  <?php
675
  endfor;
@@ -1416,7 +1417,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";
1416
  if ( is_numeric($data[$i]['editCode']) ) :
1417
  eval(stripcslashes($options['php'][$data[$i]['editCode']]));
1418
  endif;
1419
- add_post_meta( $id, $title, $value );
1420
  if ( $data[$i]['insertTag'] == true ) $tags_input[] = $value;
1421
 
1422
  if ( $_REQUEST['TinyMCE_' . $name . trim($_REQUEST[ $name."_rand" ][$i]) . '_size'] ) {
@@ -1646,69 +1647,106 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";
1646
  for ($i=0;$i<$count;$i++) :
1647
  $fields = $this->get_custom_fields( $i );
1648
  foreach ( $fields as $key => $val ) :
1649
- $replace_val = "";
1650
- switch ( $val[0]['type'] ) :
1651
- case 'text':
1652
- case 'textarea':
1653
- $replace_val .= '<input type="text" name="cftsearch[' . urlencode($key) . ']" value="' . $_REQUEST['cftsearch'][urlencode($key)] . '" />';
1654
- break;
1655
- case 'checkbox':
1656
- if ( count($val) > 1 ) :
1657
- $replace_val .= '<ul>';
1658
- foreach( $val as $val2 ) :
1659
- $replace_val .= '<li><input type="checkbox" name="cftsearch[' . urlencode($key) . ']" value="' . attribute_escape($val2['value']) . '" /> ';
1660
- if ( $val2['valueLabel'] )
1661
- $replace_val .= stripcslashes($val2['valueLabel']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1662
  else
1663
- $replace_val .= stripcslashes($val2['value']);
1664
- $replace_val .= '</li>';
 
1665
  endforeach;
1666
- else :
1667
- $replace_val .= '<input type="checkbox" name="cftsearch[' . urlencode($key) . ']" value="' . attribute_escape($val[0]['value']) . '" /> ';
1668
- if ( $val[0]['valueLabel'] )
1669
- $replace_val .= stripcslashes($val[0]['valueLabel']);
1670
- else
1671
- $replace_val .= stripcslashes($val[0]['value']);
1672
- endif;
1673
- break;
1674
- case 'radio':
1675
- $values = explode( '#', $val[0]['value'] );
1676
- $valueLabels = explode( '#', $val[0]['valueLabel'] );
1677
- $j=0;
1678
- foreach ( $values as $metaval ) :
1679
- $metaval = trim($metaval);
1680
- $replace_val .= '<input type="radio" name="cftsearch[' . urlencode($key) . ']" value="' . attribute_escape($metaval) . '" /> ';
1681
- if ( $val[0]['valueLabel'] )
1682
- $replace_val .= stripcslashes(trim($valueLabels[$j]));
1683
- else
1684
- $replace_val .= stripcslashes($metaval);
1685
- $j++;
1686
- endforeach;
1687
- break;
1688
- case 'select':
1689
- $values = explode( '#', $val[0]['value'] );
1690
- $valueLabels = explode( '#', $val[0]['valueLabel'] );
1691
- $replace_val .= '<select name="cftsearch[' . urlencode($key) . ']">';
1692
- $replace_val .= '<option value=""></option>';
1693
- $j=0;
1694
- foreach ( $values as $metaval ) :
1695
- $metaval = trim($metaval);
1696
- if ( $_REQUEST['cftsearch'][urlencode($key)] == $metaval ) $selected = ' selected="selected"';
1697
- else $selected = "";
1698
- $replace_val .= '<option value="' . attribute_escape($metaval) . '"' . $selected . '>';
1699
- if ( $val[0]['valueLabel'] )
1700
- $replace_val .= stripcslashes(trim($valueLabels[$j]));
1701
- else
1702
- $replace_val .= stripcslashes($metaval);
1703
- $replace_val .= '</option>' . "\n";
1704
- $j++;
1705
- endforeach;
1706
- $replace_val .= '</select>' . "\n";
1707
- break;
1708
- endswitch;
1709
-
1710
  $key = preg_quote($key, '/');
1711
- $output = preg_replace('/\['.$key.'\]/', $replace_val, $output);
 
 
 
 
1712
  endforeach;
1713
  endfor;
1714
  endif;
@@ -1732,10 +1770,10 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";
1732
  switch ( $val2['type'] ) :
1733
  case 'text':
1734
  case 'textarea':
1735
- $output .= '<dd><input type="text" name="cftsearch[' . urlencode($key) . ']" value="' . $_REQUEST['cftsearch'][urlencode($key)] . '" /></dd>';
1736
  break;
1737
  case 'checkbox':
1738
- $output .= '<dd><input type="checkbox" name="cftsearch[' . urlencode($key) . ']" value="' . attribute_escape($val2['value']) . '" /> ';
1739
  if ( $val2['valueLabel'] )
1740
  $output .= stripcslashes($val2['valueLabel']);
1741
  else
@@ -1745,23 +1783,22 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";
1745
  case 'radio':
1746
  $values = explode( '#', $val2['value'] );
1747
  $valueLabels = explode( '#', $val2['valueLabel'] );
1748
- $output .= '<dd>';
1749
  $i=0;
1750
  foreach ( $values as $metaval ) :
1751
  $metaval = trim($metaval);
1752
- $output .= '<input type="radio" name="cftsearch[' . urlencode($key) . ']" value="' . attribute_escape($metaval) . '" /> ';
1753
  if ( $val2['valueLabel'] )
1754
  $output .= stripcslashes(trim($valueLabels[$i]));
1755
  else
1756
  $output .= stripcslashes($metaval);
1757
  $i++;
 
1758
  endforeach;
1759
- $output .= '</dd>' . "\n";
1760
  break;
1761
  case 'select':
1762
  $values = explode( '#', $val2['value'] );
1763
  $valueLabels = explode( '#', $val2['valueLabel'] );
1764
- $output .= '<dd><select name="cftsearch[' . urlencode($key) . ']">';
1765
  $output .= '<option value=""></option>';
1766
  $i=0;
1767
  foreach ( $values as $metaval ) :
@@ -1792,31 +1829,61 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";
1792
 
1793
  function custom_field_template_posts_where($where) {
1794
  global $wp_query, $wp_version, $wpdb;
 
1795
 
1796
  if ( isset($_REQUEST['ss']) ) :
1797
  $wp_query->query_vars['s'] = $_REQUEST['ss'];
1798
  endif;
1799
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1800
  if ( is_array($_REQUEST['cftsearch']) ) :
1801
  foreach ( $_REQUEST['cftsearch'] as $key => $val ) :
1802
- if ( $val ) :
1803
- $where .= " AND ROW(ID,1) IN (SELECT post_id,count(post_id) FROM wp_postmeta WHERE (" . $wpdb->postmeta . ".meta_key = '" . urldecode($key) . "' AND " . $wpdb->postmeta . ".meta_value LIKE '%" . $val . "%') GROUP BY post_id) ";
1804
- endif;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1805
  endforeach;
1806
  endif;
1807
 
1808
  return $where;
1809
  }
1810
-
1811
- function custom_field_template_posts_orderby($orderby) {
1812
- $orderby = $_REQUEST['custom_f_orderby'];
1813
- if (!empty($orderby)) :
1814
- $sql = $orderby;
1815
- $ascdesc = $_REQUEST['custom_f_ascdesc'];
1816
- if (!empty($ascdesc)) $sql .= " ".$ascdesc;
1817
- endif;
1818
- return $sql;
1819
- }
1820
  }
1821
 
1822
  $custom_field_template = new 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: 1.0.2
8
  Author URI: http://wordpressgogo.com/
9
  */
10
 
21
  add_action( 'admin_print_scripts', array(&$this, 'custom_field_template_admin_scripts') );
22
  add_action( 'admin_head', array(&$this, 'custom_field_template_admin_head'), 100 );
23
 
24
+ //add_action( 'edit_post', array(&$this, 'edit_meta_value'), 100 );
25
  add_action( 'save_post', array(&$this, 'edit_meta_value'), 100 );
26
+ //add_action( 'publish_post', array(&$this, 'edit_meta_value'), 100 );
27
 
28
  add_filter( 'media_send_to_editor', array(&$this, 'media_send_to_custom_field'), 15 );
29
  add_filter( 'plugin_action_links', array(&$this, 'wpaq_filter_plugin_actions'), 10, 2 );
32
 
33
  if ( $_REQUEST['cftsearch'] ) :
34
  add_filter( 'posts_where', array(&$this, 'custom_field_template_posts_where') );
 
35
  endif;
36
 
37
  if ( function_exists('add_shortcode') ) :
92
  }
93
 
94
  function add_quick_edit_custom_box($column_name, $type) {
95
+ if( $column_name == 'custom-fields' ) :
96
+ global $wp_version;
97
+ $options = $this->get_custom_field_template_data();
98
 
99
+ if( $options == null)
100
+ return;
101
 
102
+ if ( !$options['css'] ) {
103
+ $this->install_custom_field_template_css();
104
+ $options = $this->get_custom_field_template_data();
105
+ }
106
+
107
+ $out .= '<fieldset style="clear:both;">' . "\n";
108
+ $out .= '<div class="inline-edit-group">';
109
+ $out .= '<style type="text/css">' . "\n" .
110
+ '<!--' . "\n";
111
+ $out .= $options['css'] . "\n";
112
+ $out .= '-->' . "\n" .
113
+ '</style>';
114
 
115
+ if ( count($options['custom_fields'])>1 ) {
116
+ $out .= '<select id="custom_field_template_select" onchange="jQuery.ajax({type: \'GET\', url: \'?page=custom-field-template/custom-field-template.php&id=\'+jQuery(this).val()+\'&post=\'+jQuery(this).parent().parent().parent().parent().attr(\'id\').replace(\'edit-\',\'\'), success: function(html) {jQuery(\'#cft\').html(html);}});">';
117
+ for ( $i=0; $i < count($options['custom_fields']); $i++ ) {
118
+ if ( $i == $options['posts'][$_REQUEST['post']] ) {
119
+ $out .= '<option value="' . $i . '" selected="selected">' . stripcslashes($options['custom_fields'][$i]['title']) . '</option>';
120
+ } else
121
+ $out .= '<option value="' . $i . '">' . stripcslashes($options['custom_fields'][$i]['title']) . '</option>';
122
+ }
123
+ $out .= '</select>';
124
  }
 
 
125
 
126
+ $out .= '<input type="hidden" name="custom-field-template-verify-key" id="custom-field-template-verify-key" value="' . wp_create_nonce('custom-field-template') . '" />';
127
+ $out .= '<div id="cft">';
128
+ $out .= '</div>';
129
 
130
+ $out .= '</div>' . "\n";
131
+ $out .= '</fieldset>' . "\n";
132
 
133
+ echo $out;
134
+ endif;
135
  }
136
 
137
  function custom_field_template_admin_head() {
523
  <br class="clear"/>
524
 
525
  <div id="poststuff" class="meta-box-sortables" style="position: relative; margin-top:10px;">
526
+ <div class="postbox">
527
  <h3><?php _e('Custom Field Template Options', 'custom-field-template'); ?></h3>
528
  <div class="inside">
529
  <form method="post">
535
  <tr><td>
536
  <p><strong>TEMPLATE #<?php echo $i; ?></strong></p>
537
  <p><label for="custom_field_template_title[<?php echo $i; ?>]"><?php echo sprintf(__('Template Title', 'custom-field-template'), $i); ?></label>:<br />
538
+ <input type="text" name="custom_field_template_title[<?php echo $i; ?>]" id="custom_field_template_title[<?php echo $i; ?>]" value="<?php echo stripcslashes($options['custom_fields'][$i]['title']); ?>" size="80" /></p>
539
  <p><label for="custom_field_template_instruction[<?php echo $i; ?>]"><a href="javascript:void(0);" onclick="jQuery(this).parent().next().next().toggle();"><?php echo sprintf(__('Template Instruction', 'custom-field-template'), $i); ?></a></label>:<br />
540
+ <textarea name="custom_field_template_instruction[<?php echo $i; ?>]" id="custom_field_template_instruction[<?php echo $i; ?>]" rows="5" cols="80"<?php if ( empty($options['custom_fields'][$i]['instruction']) ) : echo ' style="display:none;"'; endif; ?>><?php echo stripcslashes($options['custom_fields'][$i]['instruction']); ?></textarea></p>
541
  <p><label for="custom_field_template_category[<?php echo $i; ?>]"><a href="javascript:void(0);" onclick="jQuery(this).parent().next().next().toggle();"><?php echo sprintf(__('Category ID (comma-deliminated)', 'custom-field-template'), $i); ?></a></label>:<br />
542
+ <input type="text" name="custom_field_template_category[<?php echo $i; ?>]" id="custom_field_template_category[<?php echo $i; ?>]" value="<?php echo stripcslashes($options['custom_fields'][$i]['category']); ?>" size="80"<?php if ( empty($options['custom_fields'][$i]['category']) ) : echo ' style="display:none;"'; endif; ?> /></p>
543
  <p><label for="custom_field_template_content[<?php echo $i; ?>]"><?php echo sprintf(__('Template Content', 'custom-field-template'), $i); ?></label>:<br />
544
+ <textarea name="custom_field_template_content[<?php echo $i; ?>]" id="custom_field_template_content[<?php echo $i; ?>]" rows="10" cols="80"><?php echo stripcslashes($options['custom_fields'][$i]['content']); ?></textarea></p>
545
  </td></tr>
546
  <?php
547
  }
582
  <table class="form-table" style="margin-bottom:5px;">
583
  <tbody>
584
  <tr><td>
585
+ <p><textarea name="custom_field_template_css" id="custom_field_template_css" rows="10" cols="80"><?php echo stripcslashes($options['css']); ?></textarea></p>
586
  </td></tr>
587
  <tr><td>
588
  <p><input type="submit" name="custom_field_template_css_submit" value="<?php _e('Update Options &raquo;', 'custom-field-template'); ?>" class="button-primary" /></p>
607
  ?>
608
  <tr><th><strong>FORMAT #<?php echo $i; ?></strong></th></tr>
609
  <tr><td>
610
+ <p><textarea name="custom_field_template_shortcode_format[]" rows="10" cols="80"><?php echo stripcslashes($options['shortcode_format'][$i]); ?></textarea></p>
611
  </td></tr>
612
  <?php
613
  endfor;
638
  ?>
639
  <tr><th><strong>CODE #<?php echo $i; ?></strong></th></tr>
640
  <tr><td>
641
+ <p><textarea name="custom_field_template_php[]" rows="10" cols="80"><?php echo stripcslashes($options['php'][$i]); ?></textarea></p>
642
  </td></tr>
643
  <?php
644
  endfor;
669
  <input type="radio" name="custom_field_template_hook_position[<?php echo $i; ?>]" value="0" <?php if($options['hook'][$i]['position']==0) echo ' checked="checked"'; ?> /> <?php _e('After the conetnt', 'custom-field-template'); ?>
670
  </p>
671
  <p><label for="custom_field_template_hook_category[<?php echo $i; ?>]"><?php echo sprintf(__('Category ID (comma-deliminated)', 'custom-field-template'), $i); ?></label>:<br />
672
+ <input type="text" name="custom_field_template_hook_category[<?php echo $i; ?>]" id="custom_field_template_hook_category[<?php echo $i; ?>]" value="<?php echo stripcslashes($options['hook'][$i]['category']); ?>" size="80" /></p>
673
+ <p><label for="custom_field_template_hook_content[<?php echo $i; ?>]"><?php echo sprintf(__('Content', 'custom-field-template'), $i); ?></label>:<br /><textarea name="custom_field_template_hook_content[<?php echo $i; ?>]" rows="5" cols="80"><?php echo stripcslashes($options['hook'][$i]['content']); ?></textarea></p>
674
  </td></tr>
675
  <?php
676
  endfor;
1417
  if ( is_numeric($data[$i]['editCode']) ) :
1418
  eval(stripcslashes($options['php'][$data[$i]['editCode']]));
1419
  endif;
1420
+ add_post_meta( $id, $title, apply_filters('cft_'.urlencode($title), $value) );
1421
  if ( $data[$i]['insertTag'] == true ) $tags_input[] = $value;
1422
 
1423
  if ( $_REQUEST['TinyMCE_' . $name . trim($_REQUEST[ $name."_rand" ][$i]) . '_size'] ) {
1647
  for ($i=0;$i<$count;$i++) :
1648
  $fields = $this->get_custom_fields( $i );
1649
  foreach ( $fields as $key => $val ) :
1650
+
1651
+ $replace[0] = $val;
1652
+
1653
+ $search = array();
1654
+ if($val[0]['searchType']) eval('$search["type"] =' . stripslashes($val[0]['searchType']));
1655
+ if($val[0]['searchValue']) eval('$search["value"] =' . stripslashes($val[0]['searchValue']));
1656
+ if($val[0]['searchOperator']) eval('$search["operator"] =' . stripslashes($val[0]['searchOperator']));
1657
+ if($val[0]['searchValueLabel']) eval('$search["valueLabel"] =' . stripslashes($val[0]['searchValueLabel']));
1658
+
1659
+ foreach ( $search as $skey => $sval ) :
1660
+ $j = 1;
1661
+ foreach ( $sval as $sval2 ) :
1662
+ $replace[$j][0][$skey] = $sval2;
1663
+ $j++;
1664
+ endforeach;
1665
+ endforeach;
1666
+
1667
+ foreach( $replace as $rkey => $rval ) :
1668
+ $replace_val[$rkey] = "";
1669
+ switch ( $rval[0]['type'] ) :
1670
+ case 'text':
1671
+ case 'textarea':
1672
+ $replace_val[$rkey] .= '<input type="text" name="cftsearch[' . urlencode($key) . '][' . $rkey . '][]" value="' . attribute_escape($_REQUEST['cftsearch'][urlencode($key)]) . '" />';
1673
+ break;
1674
+ case 'checkbox':
1675
+ $values = $valueLabels = array();
1676
+ if ( $rkey == 0 ) :
1677
+ foreach( $rval as $rval2 ) :
1678
+ $values[] = $rval2['value'];
1679
+ $valueLabels[] = $rval2['valueLabel'];
1680
+ endforeach;
1681
+ else :
1682
+ $values = explode( '#', $rval[0]['value'] );
1683
+ $valueLabels = explode( '#', $rval[0]['valueLabel'] );
1684
+ endif;
1685
+ if ( count($values) > 1 ) :
1686
+ $replace_val[$rkey] .= '<ul>';
1687
+ $j=0;
1688
+ foreach( $values as $metavalue ) :
1689
+ $replace_val[$rkey] .= '<li><input type="checkbox" name="cftsearch[' . urlencode($key) . '][' . $rkey . '][]" value="' . attribute_escape($metavalue) . '" /> ';
1690
+ if ( $valueLabels[$j] ) $replace_val[$rkey] .= stripcslashes($valueLabels[$j]);
1691
+ else $replace_val[$rkey] .= stripcslashes($metavalue);
1692
+ $replace_val[$rkey] .= '</li>';
1693
+ $j++;
1694
+ endforeach;
1695
+ else :
1696
+ $replace_val[$rkey] .= '<input type="checkbox" name="cftsearch[' . urlencode($key) . '][' . $rkey . '][]" value="' . attribute_escape(trim($values[0])) . '" /> ';
1697
+ if ( $valueLabel[0] ) $replace_val[$rkey] .= stripcslashes(trim($valueLabels[0]));
1698
+ else $replace_val[$rkey] .= stripcslashes(trim($values[0]));
1699
+ endif;
1700
+ break;
1701
+ case 'radio':
1702
+ $values = explode( '#', $rval[0]['value'] );
1703
+ $valueLabels = explode( '#', $rval[0]['valueLabel'] );
1704
+ if ( count($values) > 1 ) :
1705
+ $replace_val[$rkey] .= '<ul>';
1706
+ $j=0;
1707
+ foreach ( $values as $metaval ) :
1708
+ $metaval = trim($metaval);
1709
+ $replace_val[$rkey] .= '<li><input type="radio" name="cftsearch[' . urlencode($key) . '][' . $rkey . '][]" value="' . attribute_escape($metaval) . '" /> ';
1710
+ if ( $valueLabels[$j] ) $replace_val[$rkey] .= stripcslashes(trim($valueLabels[$j]));
1711
+ else $replace_val[$rkey] .= stripcslashes($metaval);
1712
+ $replace_val[$rkey] .= '</li>';
1713
+ $j++;
1714
+ endforeach;
1715
+ else :
1716
+ $replace_val[$rkey] .= '<input type="radio" name="cftsearch[' . urlencode($key) . '][]" value="' . attribute_escape(trim($values[0])) . '" /> ';
1717
+ if ( $valueLabels[0] ) $replace_val[$rkey] .= stripcslashes(trim($valueLabels[0]));
1718
+ else $replace_val[$rkey] .= stripcslashes(trim($values[0]));
1719
+ endif;
1720
+ break;
1721
+ case 'select':
1722
+ $values = explode( '#', $rval[0]['value'] );
1723
+ $valueLabels = explode( '#', $rval[0]['valueLabel'] );
1724
+ $replace_val[$rkey] .= '<select name="cftsearch[' . urlencode($key) . '][' . $rkey . '][]">';
1725
+ $replace_val[$rkey] .= '<option value=""></option>';
1726
+ $j=0;
1727
+ foreach ( $values as $metaval ) :
1728
+ $metaval = trim($metaval);
1729
+ if ( $_REQUEST['cftsearch'][urlencode($key)] == $metaval ) $selected = ' selected="selected"';
1730
+ else $selected = "";
1731
+ $replace_val[$rkey] .= '<option value="' . attribute_escape($metaval) . '"' . $selected . '>';
1732
+ if ( $valueLabels[$j] )
1733
+ $replace_val[$rkey] .= stripcslashes(trim($valueLabels[$j]));
1734
  else
1735
+ $replace_val[$rkey] .= stripcslashes($metaval);
1736
+ $replace_val[$rkey] .= '</option>' . "\n";
1737
+ $j++;
1738
  endforeach;
1739
+ $replace_val[$rkey] .= '</select>' . "\n";
1740
+ break;
1741
+ endswitch;
1742
+ endforeach;
1743
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1744
  $key = preg_quote($key, '/');
1745
+ $output = preg_replace('/\['.$key.'\](?!\[[0-9]+\])/', $replace_val[0], $output);
1746
+ $output = preg_replace('/\['.$key.'\]\[([0-9]+)\](?!\[\])/e', '$replace_val[${1}]', $output);
1747
+
1748
+ $s_replace = '<p><input type="text" name="s" class="cft_s" value="' . attribute_escape($_REQUEST['s']) .'" /></p>';
1749
+ $output = preg_replace('/\[\[searchbox\]\]/', $s_replace, $output);
1750
  endforeach;
1751
  endfor;
1752
  endif;
1770
  switch ( $val2['type'] ) :
1771
  case 'text':
1772
  case 'textarea':
1773
+ $output .= '<dd><input type="text" name="cftsearch[' . urlencode($key) . '][' . $rkey . '][]" value="' . attribute_escape($_REQUEST['cftsearch'][urlencode($key)]) . '" /></dd>';
1774
  break;
1775
  case 'checkbox':
1776
+ $output .= '<dd><input type="checkbox" name="cftsearch[' . urlencode($key) . '][' . $rkey . '][]" value="' . attribute_escape($val2['value']) . '" /> ';
1777
  if ( $val2['valueLabel'] )
1778
  $output .= stripcslashes($val2['valueLabel']);
1779
  else
1783
  case 'radio':
1784
  $values = explode( '#', $val2['value'] );
1785
  $valueLabels = explode( '#', $val2['valueLabel'] );
 
1786
  $i=0;
1787
  foreach ( $values as $metaval ) :
1788
  $metaval = trim($metaval);
1789
+ $output .= '<dd>' . '<input type="radio" name="cftsearch[' . urlencode($key) . '][' . $rkey . '][]" value="' . attribute_escape($metaval) . '" /> ';
1790
  if ( $val2['valueLabel'] )
1791
  $output .= stripcslashes(trim($valueLabels[$i]));
1792
  else
1793
  $output .= stripcslashes($metaval);
1794
  $i++;
1795
+ $output .= '</dd>' . "\n";
1796
  endforeach;
 
1797
  break;
1798
  case 'select':
1799
  $values = explode( '#', $val2['value'] );
1800
  $valueLabels = explode( '#', $val2['valueLabel'] );
1801
+ $output .= '<dd><select name="cftsearch[' . urlencode($key) . '][' . $rkey . '][]">';
1802
  $output .= '<option value=""></option>';
1803
  $i=0;
1804
  foreach ( $values as $metaval ) :
1829
 
1830
  function custom_field_template_posts_where($where) {
1831
  global $wp_query, $wp_version, $wpdb;
1832
+ $options = $this->get_custom_field_template_data();
1833
 
1834
  if ( isset($_REQUEST['ss']) ) :
1835
  $wp_query->query_vars['s'] = $_REQUEST['ss'];
1836
  endif;
1837
+
1838
+ $count = count($options['custom_fields']);
1839
+ if ( $count ) :
1840
+ for ($i=0;$i<$count;$i++) :
1841
+ $fields = $this->get_custom_fields( $i );
1842
+ foreach ( $fields as $key => $val ) :
1843
+ $replace[$key][0] = $val;
1844
+ $search = array();
1845
+ if($val[0]['searchType']) eval('$search["type"] =' . stripslashes($val[0]['searchType']));
1846
+ if($val[0]['searchValue']) eval('$search["value"] =' . stripslashes($val[0]['searchValue']));
1847
+ if($val[0]['searchOperator']) eval('$search["operator"] =' . stripslashes($val[0]['searchOperator']));
1848
+
1849
+ foreach ( $search as $skey => $sval ) :
1850
+ $j = 1;
1851
+ foreach ( $sval as $sval2 ) :
1852
+ $replace[$key][$j][0][$skey] = $sval2;
1853
+ $j++;
1854
+ endforeach;
1855
+ endforeach;
1856
+ endforeach;
1857
+ endfor;
1858
+ endif;
1859
+
1860
  if ( is_array($_REQUEST['cftsearch']) ) :
1861
  foreach ( $_REQUEST['cftsearch'] as $key => $val ) :
1862
+ foreach( $val as $key2 => $val2 ) :
1863
+ foreach( $val2 as $val3 ) :
1864
+ if ( $val3 ) :
1865
+ switch( $replace[$key][$key2][0]['operator'] ) :
1866
+ case '<=' :
1867
+ case '>=' :
1868
+ case '<' :
1869
+ case '>' :
1870
+ case '=' :
1871
+ case '<>' :
1872
+ case '<=>':
1873
+ $where .= " AND ROW(ID,1) IN (SELECT post_id,count(post_id) FROM wp_postmeta WHERE (" . $wpdb->postmeta . ".meta_key = '" . urldecode($key) . "' AND " . $wpdb->postmeta . ".meta_value " . $replace[$key][$key2][0]['operator'] . " '" . trim($val3) . "') GROUP BY post_id) ";
1874
+ break;
1875
+ default :
1876
+ $where .= " AND ROW(ID,1) IN (SELECT post_id,count(post_id) FROM wp_postmeta WHERE (" . $wpdb->postmeta . ".meta_key = '" . urldecode($key) . "' AND " . $wpdb->postmeta . ".meta_value LIKE '%" . trim($val3) . "%') GROUP BY post_id) ";
1877
+ break;
1878
+ endswitch;
1879
+ endif;
1880
+ endforeach;
1881
+ endforeach;
1882
  endforeach;
1883
  endif;
1884
 
1885
  return $where;
1886
  }
 
 
 
 
 
 
 
 
 
 
1887
  }
1888
 
1889
  $custom_field_template = new custom_field_template();
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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
7
- Stable tag: 1.0.1
8
 
9
  This plugin adds the default custom fields on the Write Post/Page.
10
 
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
7
+ Stable tag: 1.0.2
8
 
9
  This plugin adds the default custom fields on the Write Post/Page.
10