Custom Field Template - Version 1.1.5

Version Description

Download this release

Release Info

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

Code changes from version 1.1.4 to 1.1.5

Files changed (2) hide show
  1. custom-field-template.php +45 -34
  2. readme.txt +2 -1
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.1.4
8
  Author URI: http://wordpressgogo.com/
9
  */
10
 
@@ -934,6 +934,9 @@ hideKey = true<br />
934
  <th>class</th><td>class = text</td><td>class = checkbox</td><td>class = radio</td><td>class = select</td><td>class = textarea</td>
935
  </tr>
936
  <tr>
 
 
 
937
  <th>before</th><td>before = abcde</td><td></td><td></td><td>before = abcde</td><td></td>
938
  </tr>
939
  <tr>
@@ -1069,7 +1072,7 @@ jQuery(this).addClass("closed");
1069
  return $custom_fields;
1070
  }
1071
 
1072
- function make_textfield( $name, $sid, $size = 25, $default, $hideKey, $label, $code, $class, $before, $after,
1073
  $onclick, $ondblclick, $onkeydown, $onkeypress, $onkeyup, $onmousedown, $onmouseup, $onmouseover, $onmouseout, $onmousemove, $onfocus, $onblur, $onchange, $onselect ) {
1074
  $options = $this->get_custom_field_template_data();
1075
 
@@ -1095,6 +1098,7 @@ jQuery(this).addClass("closed");
1095
 
1096
  if ( $hideKey == true ) $hide = ' class="hideKey"';
1097
  if ( !empty($class) ) $class = ' class="' . $class . '"';
 
1098
 
1099
  if ( !empty($label) && $options['custom_field_template_replace_keys_by_labels'] )
1100
  $title = stripcslashes($label);
@@ -1107,18 +1111,18 @@ jQuery(this).addClass("closed");
1107
  endforeach;
1108
 
1109
  $out .=
1110
- '<dl>' .
1111
  '<dt><span' . $hide . '>' . $title . '</span></dt>' .
1112
  '<dd>';
1113
 
1114
  if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
1115
  $out .= '<p class="label">' . stripcslashes($label) . '</p>';
1116
- $out .= trim($before).'<input id="' . $name . $sid . '" name="' . $name . '[]" value="' . attribute_escape(trim($value)) . '" type="text" size="' . $size . '"' . $class . $event_output . ' />'.trim($after).'</dd>' .
1117
- '</dl>';
1118
  return $out;
1119
  }
1120
 
1121
- function make_checkbox( $name, $sid, $value, $valueLabel, $checked, $hideKey, $label, $code, $class,
1122
  $onclick, $ondblclick, $onkeydown, $onkeypress, $onkeyup, $onmousedown, $onmouseup, $onmouseover, $onmouseout, $onmousemove, $onfocus, $onblur, $onchange, $onselect ) {
1123
  $options = $this->get_custom_field_template_data();
1124
 
@@ -1133,11 +1137,12 @@ jQuery(this).addClass("closed");
1133
  if ( in_array(stripcslashes($value), $selected) ) $checked = 'checked="checked"';
1134
  }
1135
  } else {
1136
- if( $checked == true ) $checked = 'checked="checked"';
1137
  }
1138
 
1139
  if ( $hideKey == true ) $hide = ' class="hideKey"';
1140
  if ( !empty($class) ) $class = ' class="' . $class . '"';
 
1141
 
1142
  if ( !empty($label) && $options['custom_field_template_replace_keys_by_labels'] )
1143
  $title = stripcslashes($label);
@@ -1150,7 +1155,7 @@ jQuery(this).addClass("closed");
1150
  endforeach;
1151
 
1152
  $out .=
1153
- '<dl>' .
1154
  '<dt><span' . $hide . '>' . $title . '</span></dt>' .
1155
  '<dd>';
1156
 
@@ -1158,19 +1163,19 @@ jQuery(this).addClass("closed");
1158
 
1159
  if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
1160
  $out .= '<p class="label">' . stripcslashes($label) . '</p>';
1161
- $out .= '<label for="' . $id . '" class="selectit"><input id="' . $id . '" name="' . $name . '[' . $sid . ']" value="' . attribute_escape(trim($value)) . '" ' . $checked . ' type="checkbox"' . $class . $event_output . ' /> ';
1162
  if ( $valueLabel )
1163
  $out .= stripcslashes(trim($valueLabel));
1164
  else
1165
  $out .= stripcslashes(trim($value));
1166
- $out .= '</label><br />';
1167
 
1168
- $out .= '</dd></dl>';
1169
 
1170
  return $out;
1171
  }
1172
 
1173
- function make_radio( $name, $sid, $values, $valueLabel, $clearButton, $default, $hideKey, $label, $code, $class,
1174
  $onclick, $ondblclick, $onkeydown, $onkeypress, $onkeyup, $onmousedown, $onmouseup, $onmouseover, $onmouseout, $onmousemove, $onfocus, $onblur, $onchange, $onselect ) {
1175
  $options = $this->get_custom_field_template_data();
1176
 
@@ -1190,6 +1195,7 @@ jQuery(this).addClass("closed");
1190
 
1191
  if ( $hideKey == true ) $hide = ' class="hideKey"';
1192
  if ( !empty($class) ) $class = ' class="' . $class . '"';
 
1193
 
1194
  if ( !empty($label) && $options['custom_field_template_replace_keys_by_labels'] )
1195
  $title = stripcslashes($label);
@@ -1202,7 +1208,7 @@ jQuery(this).addClass("closed");
1202
  endforeach;
1203
 
1204
  $out .=
1205
- '<dl>' .
1206
  '<dt><span' . $hide . '>' . $title . '</span>';
1207
 
1208
  if( $clearButton == true ) {
@@ -1224,7 +1230,7 @@ jQuery(this).addClass("closed");
1224
  $checked = ( trim( $val ) == trim( $selected ) ) ? 'checked="checked"' : '';
1225
 
1226
  $out .=
1227
- '<label for="' . $id . '" class="selectit"><input id="' . $id . '" name="' . $name . '[' . $sid . ']" value="' . attribute_escape(trim($val)) . '" ' . $checked . ' type="radio"' . $class . $event_output . ' /> ';
1228
  if ( $valueLabel[$i] )
1229
  $out .= stripcslashes(trim($valueLabel[$i]));
1230
  else
@@ -1232,12 +1238,12 @@ jQuery(this).addClass("closed");
1232
  $out .= '</label><br />';
1233
  $i++;
1234
  }
1235
- $out .= '</dd></dl>';
1236
 
1237
  return $out;
1238
  }
1239
 
1240
- function make_select( $name, $sid, $values, $valueLabel, $default, $hideKey, $label, $code, $class, $before, $after, $selectLabel,
1241
  $onclick, $ondblclick, $onkeydown, $onkeypress, $onkeyup, $onmousedown, $onmouseup, $onmouseover, $onmouseout, $onmousemove, $onfocus, $onblur, $onchange, $onselect ) {
1242
  $options = $this->get_custom_field_template_data();
1243
 
@@ -1259,6 +1265,7 @@ jQuery(this).addClass("closed");
1259
 
1260
  if ( $hideKey == true ) $hide = ' class="hideKey"';
1261
  if ( !empty($class) ) $class = ' class="' . $class . '"';
 
1262
 
1263
  if ( !empty($label) && $options['custom_field_template_replace_keys_by_labels'] )
1264
  $title = stripcslashes($label);
@@ -1271,24 +1278,24 @@ jQuery(this).addClass("closed");
1271
  endforeach;
1272
 
1273
  $out .=
1274
- '<dl>' .
1275
  '<dt><span' . $hide . '>' . $title . '</span></dt>' .
1276
  '<dd>';
1277
 
1278
  if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
1279
  $out .= '<p class="label">' . stripcslashes($label) . '</p>';
1280
- $out .= trim($before).'<select id="' . $name . $sid . '" name="' . $name . '[]"' . $class . $event_output . '>';
1281
 
1282
  if ( $selectLabel )
1283
- $out .= '<option value="" >' . stripcslashes(trim($selectLabel)) . '</option>';
1284
  else
1285
- $out .= '<option value="" >' . __('Select', 'custom-field-template') . '</option>';
1286
 
1287
  $i = 0;
1288
  foreach( $values as $val ) {
1289
  $checked = ( trim( $val ) == trim( $selected ) ) ? 'selected="selected"' : '';
1290
 
1291
- $out .= '<option value="' . attribute_escape(trim($val)) . '" ' . $checked . ' > ';
1292
  if ( $valueLabel[$i] )
1293
  $out .= stripcslashes(trim($valueLabel[$i]));
1294
  else
@@ -1296,12 +1303,12 @@ jQuery(this).addClass("closed");
1296
  $out .= '</option>';
1297
  $i++;
1298
  }
1299
- $out .= '</select>'.trim($after).'</dd></dl>';
1300
 
1301
  return $out;
1302
  }
1303
 
1304
- function make_textarea( $name, $sid, $rows, $cols, $tinyMCE, $htmlEditor, $mediaButton, $default, $hideKey, $label, $code, $class,
1305
  $onclick, $ondblclick, $onkeydown, $onkeypress, $onkeyup, $onmousedown, $onmouseup, $onmouseover, $onmouseout, $onmousemove, $onfocus, $onblur, $onchange, $onselect ) {
1306
  $options = $this->get_custom_field_template_data();
1307
 
@@ -1370,6 +1377,7 @@ EOF;
1370
  if ( $htmlEditor == true ) $content_class .= 'content';
1371
  if ( !empty($class) ) $content_class .= ' ' . $class;
1372
  $content_class .= '"';
 
1373
 
1374
  if ( !empty($label) && $options['custom_field_template_replace_keys_by_labels'] )
1375
  $title = stripcslashes($label);
@@ -1382,7 +1390,7 @@ EOF;
1382
  endforeach;
1383
 
1384
  $out .=
1385
- '<dl>' .
1386
  '<dt><span' . $hide . '>' . $title . '</span><br />' . $media . $switch . '</dt>' .
1387
  '<dd>';
1388
 
@@ -1396,9 +1404,9 @@ EOF;
1396
  $editorcontainer_class .= ' class="editorcontainer"';
1397
  endif;
1398
 
1399
- $out .= '<div' . $editorcontainer_class . ' id="editorcontainer_' . $name . $rand . '"><textarea id="' . $name . $rand . '" name="' . $name . '[' . $sid . ']" rows="' .$rows. '" cols="' . $cols . '" style="color:#000000"' . $content_class . $event_output . '>' . attribute_escape(trim($value)) . '</textarea><input type="hidden" name="'.$name.'_rand['.$sid.']" value="'.$rand.'" /></div>';
1400
  if ( $htmlEditor == true ) $out .= '</div>';
1401
- $out .= '</dd></dl>';
1402
 
1403
  return $out;
1404
  }
@@ -1449,30 +1457,30 @@ EOF;
1449
  $out .= '</div><div' . $class . '>';
1450
  }
1451
  else if( $data[$i]['type'] == 'textfield' || $data[$i]['type'] == 'text' ) {
1452
- $out .= $this->make_textfield( $title, $i, $data[$i]['size'], $data[$i]['default'], $data[$i]['hideKey'], $data[$i]['label'], $data[$i]['code'], $data[$i]['class'], $data[$i]['before'], $data[$i]['after'],
1453
  $data[$i]['onclick'], $data[$i]['ondblclick'], $data[$i]['onkeydown'], $data[$i]['onkeypress'], $data[$i]['onkeyup'], $data[$i]['onmousedown'], $data[$i]['onmouseup'], $data[$i]['onmouseover'], $data[$i]['onmouseout'], $data[$i]['onmousemove'], $data[$i]['onfocus'], $data[$i]['onblur'], $data[$i]['onchange'], $data[$i]['onselect'] );
1454
  }
1455
  else if( $data[$i]['type'] == 'checkbox' ) {
1456
  $out .=
1457
- $this->make_checkbox( $title, $i, $data[$i]['value'], $data[$i]['valueLabel'], $data[$i]['checked'], $data[$i]['hideKey'], $data[$i]['label'], $data[$i]['code'], $data[$i]['class'],
1458
  $data[$i]['onclick'], $data[$i]['ondblclick'], $data[$i]['onkeydown'], $data[$i]['onkeypress'], $data[$i]['onkeyup'], $data[$i]['onmousedown'], $data[$i]['onmouseup'], $data[$i]['onmouseover'], $data[$i]['onmouseout'], $data[$i]['onmousemove'], $data[$i]['onfocus'], $data[$i]['onblur'], $data[$i]['onchange'], $data[$i]['onselect'] );
1459
  }
1460
  else if( $data[$i]['type'] == 'radio' ) {
1461
  $out .=
1462
  $this->make_radio(
1463
- $title, $i, explode( '#', $data[$i]['value'] ), explode( '#', $data[$i]['valueLabel'] ), $data[$i]['clearButton'], $data[$i]['default'], $data[$i]['hideKey'], $data[$i]['label'], $data[$i]['code'], $data[$i]['class'],
1464
  $data[$i]['onclick'], $data[$i]['ondblclick'], $data[$i]['onkeydown'], $data[$i]['onkeypress'], $data[$i]['onkeyup'], $data[$i]['onmousedown'], $data[$i]['onmouseup'], $data[$i]['onmouseover'], $data[$i]['onmouseout'], $data[$i]['onmousemove'], $data[$i]['onfocus'], $data[$i]['onblur'], $data[$i]['onchange'], $data[$i]['onselect'] );
1465
  }
1466
  else if( $data[$i]['type'] == 'select' ) {
1467
  $out .=
1468
  $this->make_select(
1469
- $title, $i, explode( '#', $data[$i]['value'] ), explode( '#', $data[$i]['valueLabel'] ), $data[$i]['default'], $data[$i]['hideKey'], $data[$i]['label'], $data[$i]['code'], $data[$i]['class'], $data[$i]['before'], $data[$i]['after'], $data[$i]['selectLabel'],
1470
  $data[$i]['onclick'], $data[$i]['ondblclick'], $data[$i]['onkeydown'], $data[$i]['onkeypress'], $data[$i]['onkeyup'], $data[$i]['onmousedown'], $data[$i]['onmouseup'], $data[$i]['onmouseover'], $data[$i]['onmouseout'], $data[$i]['onmousemove'], $data[$i]['onfocus'], $data[$i]['onblur'], $data[$i]['onchange'], $data[$i]['onselect'] );
1471
  }
1472
  else if( $data[$i]['type'] == 'textarea' ) {
1473
  if ( $options['tinyMCE'][$_REQUEST['post']][$this->sanitize_name($title)][$i] ) $data[$i]['rows'] = $options['tinyMCE'][$_REQUEST['post']][$this->sanitize_name($title)][$i];
1474
  $out .=
1475
- $this->make_textarea( $title, $i, $data[$i]['rows'], $data[$i]['cols'], $data[$i]['tinyMCE'], $data[$i]['htmlEditor'], $data[$i]['mediaButton'], $data[$i]['default'], $data[$i]['hideKey'], $data[$i]['label'], $data[$i]['code'], $data[$i]['class'],
1476
  $data[$i]['onclick'], $data[$i]['ondblclick'], $data[$i]['onkeydown'], $data[$i]['onkeypress'], $data[$i]['onkeyup'], $data[$i]['onmousedown'], $data[$i]['onmouseup'], $data[$i]['onmouseover'], $data[$i]['onmouseout'], $data[$i]['onmousemove'], $data[$i]['onfocus'], $data[$i]['onblur'], $data[$i]['onchange'], $data[$i]['onselect'] );
1477
  }
1478
  }
@@ -1955,7 +1963,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";
1955
  if ( is_numeric($format) && $output = $options['shortcode_format'][$format] ) :
1956
  $data = get_post_custom($post_id);
1957
  $output = stripcslashes($output);
1958
-
1959
  if( $data == null)
1960
  return;
1961
 
@@ -1998,7 +2006,9 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";
1998
  if ( $options['shortcode_format_use_php'][$format] )
1999
  $output = preg_replace_callback("/(<\?php|<\?|< \?php)(.*?)\?>/si", array($this, 'EvalBuffer'), $output);
2000
  $key = preg_quote($key, '/');
2001
- $output = preg_replace('/\['.$key.'\]/', $replace_val, $output);
 
 
2002
  endforeach;
2003
  endfor;
2004
  endif;
@@ -2028,6 +2038,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";
2028
  $hide = '';
2029
  if ( $val2['output'] == true ) :
2030
  $value = $values[$key2];
 
2031
  if ( is_numeric($val2['outputCode']) ) :
2032
  eval(stripcslashes($options['php'][$val2['outputCode']]));
2033
  endif;
@@ -2049,7 +2060,7 @@ jQuery("#edButtonPreview").trigger("click"); }' . "\n";
2049
  endforeach;
2050
  $output .= '</dl>' . "\n";
2051
  endif;
2052
-
2053
  return stripcslashes($output);
2054
  }
2055
 
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.1.5
8
  Author URI: http://wordpressgogo.com/
9
  */
10
 
934
  <th>class</th><td>class = text</td><td>class = checkbox</td><td>class = radio</td><td>class = select</td><td>class = textarea</td>
935
  </tr>
936
  <tr>
937
+ <th>style</th><td>style = color:#FF0000;</td><td>style = color:#FF0000;</td><td>style = color:#FF0000;</td><td>style = color:#FF0000;</td><td>style = color:#FF0000;</td>
938
+ </tr>
939
+ <tr>
940
  <th>before</th><td>before = abcde</td><td></td><td></td><td>before = abcde</td><td></td>
941
  </tr>
942
  <tr>
1072
  return $custom_fields;
1073
  }
1074
 
1075
+ function make_textfield( $name, $sid, $size = 25, $default, $hideKey, $label, $code, $class, $style, $before, $after,
1076
  $onclick, $ondblclick, $onkeydown, $onkeypress, $onkeyup, $onmousedown, $onmouseup, $onmouseover, $onmouseout, $onmousemove, $onfocus, $onblur, $onchange, $onselect ) {
1077
  $options = $this->get_custom_field_template_data();
1078
 
1098
 
1099
  if ( $hideKey == true ) $hide = ' class="hideKey"';
1100
  if ( !empty($class) ) $class = ' class="' . $class . '"';
1101
+ if ( !empty($style) ) $class = ' style="' . $style . '"';
1102
 
1103
  if ( !empty($label) && $options['custom_field_template_replace_keys_by_labels'] )
1104
  $title = stripcslashes($label);
1111
  endforeach;
1112
 
1113
  $out .=
1114
+ '<dl id="dl_' . $name . $sid . '">' .
1115
  '<dt><span' . $hide . '>' . $title . '</span></dt>' .
1116
  '<dd>';
1117
 
1118
  if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
1119
  $out .= '<p class="label">' . stripcslashes($label) . '</p>';
1120
+ $out .= trim($before).'<input id="' . $name . $sid . '" name="' . $name . '[]" value="' . attribute_escape(trim($value)) . '" type="text" size="' . $size . '"' . $class . $style . $event_output . ' />'.trim($after).'</dd>' .
1121
+ '</dl>'."\n";
1122
  return $out;
1123
  }
1124
 
1125
+ function make_checkbox( $name, $sid, $value, $valueLabel, $checked, $hideKey, $label, $code, $class, $style,
1126
  $onclick, $ondblclick, $onkeydown, $onkeypress, $onkeyup, $onmousedown, $onmouseup, $onmouseover, $onmouseout, $onmousemove, $onfocus, $onblur, $onchange, $onselect ) {
1127
  $options = $this->get_custom_field_template_data();
1128
 
1137
  if ( in_array(stripcslashes($value), $selected) ) $checked = 'checked="checked"';
1138
  }
1139
  } else {
1140
+ if( $checked == true ) $checked = ' checked="checked"';
1141
  }
1142
 
1143
  if ( $hideKey == true ) $hide = ' class="hideKey"';
1144
  if ( !empty($class) ) $class = ' class="' . $class . '"';
1145
+ if ( !empty($style) ) $class = ' style="' . $style . '"';
1146
 
1147
  if ( !empty($label) && $options['custom_field_template_replace_keys_by_labels'] )
1148
  $title = stripcslashes($label);
1155
  endforeach;
1156
 
1157
  $out .=
1158
+ '<dl id="dl_' . $name . $sid . '">' .
1159
  '<dt><span' . $hide . '>' . $title . '</span></dt>' .
1160
  '<dd>';
1161
 
1163
 
1164
  if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
1165
  $out .= '<p class="label">' . stripcslashes($label) . '</p>';
1166
+ $out .= '<label for="' . $id . '" class="selectit"><input id="' . $id . '" name="' . $name . '[' . $sid . ']" value="' . attribute_escape(trim($value)) . '"' . $checked . ' type="checkbox"' . $class . $style . $event_output . ' /> ';
1167
  if ( $valueLabel )
1168
  $out .= stripcslashes(trim($valueLabel));
1169
  else
1170
  $out .= stripcslashes(trim($value));
1171
+ $out .= '</label>';
1172
 
1173
+ $out .= '</dd></dl>'."\n";
1174
 
1175
  return $out;
1176
  }
1177
 
1178
+ function make_radio( $name, $sid, $values, $valueLabel, $clearButton, $default, $hideKey, $label, $code, $class, $style,
1179
  $onclick, $ondblclick, $onkeydown, $onkeypress, $onkeyup, $onmousedown, $onmouseup, $onmouseover, $onmouseout, $onmousemove, $onfocus, $onblur, $onchange, $onselect ) {
1180
  $options = $this->get_custom_field_template_data();
1181
 
1195
 
1196
  if ( $hideKey == true ) $hide = ' class="hideKey"';
1197
  if ( !empty($class) ) $class = ' class="' . $class . '"';
1198
+ if ( !empty($style) ) $class = ' style="' . $style . '"';
1199
 
1200
  if ( !empty($label) && $options['custom_field_template_replace_keys_by_labels'] )
1201
  $title = stripcslashes($label);
1208
  endforeach;
1209
 
1210
  $out .=
1211
+ '<dl id="dl_' . $name . $sid . '">' .
1212
  '<dt><span' . $hide . '>' . $title . '</span>';
1213
 
1214
  if( $clearButton == true ) {
1230
  $checked = ( trim( $val ) == trim( $selected ) ) ? 'checked="checked"' : '';
1231
 
1232
  $out .=
1233
+ '<label for="' . $id . '" class="selectit"><input id="' . $id . '" name="' . $name . '[' . $sid . ']" value="' . attribute_escape(trim($val)) . '" ' . $checked . ' type="radio"' . $class . $style . $event_output . ' /> ';
1234
  if ( $valueLabel[$i] )
1235
  $out .= stripcslashes(trim($valueLabel[$i]));
1236
  else
1238
  $out .= '</label><br />';
1239
  $i++;
1240
  }
1241
+ $out .= '</dd></dl>'."\n";
1242
 
1243
  return $out;
1244
  }
1245
 
1246
+ function make_select( $name, $sid, $values, $valueLabel, $default, $hideKey, $label, $code, $class, $style, $before, $after, $selectLabel,
1247
  $onclick, $ondblclick, $onkeydown, $onkeypress, $onkeyup, $onmousedown, $onmouseup, $onmouseover, $onmouseout, $onmousemove, $onfocus, $onblur, $onchange, $onselect ) {
1248
  $options = $this->get_custom_field_template_data();
1249
 
1265
 
1266
  if ( $hideKey == true ) $hide = ' class="hideKey"';
1267
  if ( !empty($class) ) $class = ' class="' . $class . '"';
1268
+ if ( !empty($style) ) $class = ' style="' . $style . '"';
1269
 
1270
  if ( !empty($label) && $options['custom_field_template_replace_keys_by_labels'] )
1271
  $title = stripcslashes($label);
1278
  endforeach;
1279
 
1280
  $out .=
1281
+ '<dl id="dl_' . $name . $sid . '">' .
1282
  '<dt><span' . $hide . '>' . $title . '</span></dt>' .
1283
  '<dd>';
1284
 
1285
  if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
1286
  $out .= '<p class="label">' . stripcslashes($label) . '</p>';
1287
+ $out .= trim($before).'<select id="' . $name . $sid . '" name="' . $name . '[]"' . $class . $style . $event_output . '>';
1288
 
1289
  if ( $selectLabel )
1290
+ $out .= '<option value="">' . stripcslashes(trim($selectLabel)) . '</option>';
1291
  else
1292
+ $out .= '<option value="">' . __('Select', 'custom-field-template') . '</option>';
1293
 
1294
  $i = 0;
1295
  foreach( $values as $val ) {
1296
  $checked = ( trim( $val ) == trim( $selected ) ) ? 'selected="selected"' : '';
1297
 
1298
+ $out .= '<option value="' . attribute_escape(trim($val)) . '" ' . $checked . '>';
1299
  if ( $valueLabel[$i] )
1300
  $out .= stripcslashes(trim($valueLabel[$i]));
1301
  else
1303
  $out .= '</option>';
1304
  $i++;
1305
  }
1306
+ $out .= '</select>'.trim($after).'</dd></dl>'."\n";
1307
 
1308
  return $out;
1309
  }
1310
 
1311
+ function make_textarea( $name, $sid, $rows, $cols, $tinyMCE, $htmlEditor, $mediaButton, $default, $hideKey, $label, $code, $class, $style,
1312
  $onclick, $ondblclick, $onkeydown, $onkeypress, $onkeyup, $onmousedown, $onmouseup, $onmouseover, $onmouseout, $onmousemove, $onfocus, $onblur, $onchange, $onselect ) {
1313
  $options = $this->get_custom_field_template_data();
1314
 
1377
  if ( $htmlEditor == true ) $content_class .= 'content';
1378
  if ( !empty($class) ) $content_class .= ' ' . $class;
1379
  $content_class .= '"';
1380
+ if ( !empty($style) ) $class = ' style="' . $style . '"';
1381
 
1382
  if ( !empty($label) && $options['custom_field_template_replace_keys_by_labels'] )
1383
  $title = stripcslashes($label);
1390
  endforeach;
1391
 
1392
  $out .=
1393
+ '<dl id="dl_' . $name . $sid . '">' .
1394
  '<dt><span' . $hide . '>' . $title . '</span><br />' . $media . $switch . '</dt>' .
1395
  '<dd>';
1396
 
1404
  $editorcontainer_class .= ' class="editorcontainer"';
1405
  endif;
1406
 
1407
+ $out .= '<div' . $editorcontainer_class . ' id="editorcontainer_' . $name . $rand . '"><textarea id="' . $name . $rand . '" name="' . $name . '[' . $sid . ']" rows="' .$rows. '" cols="' . $cols . '" style="color:#000000"' . $content_class . $style . $event_output . '>' . attribute_escape(trim($value)) . '</textarea><input type="hidden" name="'.$name.'_rand['.$sid.']" value="'.$rand.'" /></div>';
1408
  if ( $htmlEditor == true ) $out .= '</div>';
1409
+ $out .= '</dd></dl>'."\n";
1410
 
1411
  return $out;
1412
  }
1457
  $out .= '</div><div' . $class . '>';
1458
  }
1459
  else if( $data[$i]['type'] == 'textfield' || $data[$i]['type'] == 'text' ) {
1460
+ $out .= $this->make_textfield( $title, $i, $data[$i]['size'], $data[$i]['default'], $data[$i]['hideKey'], $data[$i]['label'], $data[$i]['code'], $data[$i]['class'], $data[$i]['style'], $data[$i]['before'], $data[$i]['after'],
1461
  $data[$i]['onclick'], $data[$i]['ondblclick'], $data[$i]['onkeydown'], $data[$i]['onkeypress'], $data[$i]['onkeyup'], $data[$i]['onmousedown'], $data[$i]['onmouseup'], $data[$i]['onmouseover'], $data[$i]['onmouseout'], $data[$i]['onmousemove'], $data[$i]['onfocus'], $data[$i]['onblur'], $data[$i]['onchange'], $data[$i]['onselect'] );
1462
  }
1463
  else if( $data[$i]['type'] == 'checkbox' ) {
1464
  $out .=
1465
+ $this->make_checkbox( $title, $i, $data[$i]['value'], $data[$i]['valueLabel'], $data[$i]['checked'], $data[$i]['hideKey'], $data[$i]['label'], $data[$i]['code'], $data[$i]['class'], $data[$i]['style'],
1466
  $data[$i]['onclick'], $data[$i]['ondblclick'], $data[$i]['onkeydown'], $data[$i]['onkeypress'], $data[$i]['onkeyup'], $data[$i]['onmousedown'], $data[$i]['onmouseup'], $data[$i]['onmouseover'], $data[$i]['onmouseout'], $data[$i]['onmousemove'], $data[$i]['onfocus'], $data[$i]['onblur'], $data[$i]['onchange'], $data[$i]['onselect'] );
1467
  }
1468
  else if( $data[$i]['type'] == 'radio' ) {
1469
  $out .=
1470
  $this->make_radio(
1471
+ $title, $i, explode( '#', $data[$i]['value'] ), explode( '#', $data[$i]['valueLabel'] ), $data[$i]['clearButton'], $data[$i]['default'], $data[$i]['hideKey'], $data[$i]['label'], $data[$i]['code'], $data[$i]['class'], $data[$i]['style'],
1472
  $data[$i]['onclick'], $data[$i]['ondblclick'], $data[$i]['onkeydown'], $data[$i]['onkeypress'], $data[$i]['onkeyup'], $data[$i]['onmousedown'], $data[$i]['onmouseup'], $data[$i]['onmouseover'], $data[$i]['onmouseout'], $data[$i]['onmousemove'], $data[$i]['onfocus'], $data[$i]['onblur'], $data[$i]['onchange'], $data[$i]['onselect'] );
1473
  }
1474
  else if( $data[$i]['type'] == 'select' ) {
1475
  $out .=
1476
  $this->make_select(
1477
+ $title, $i, explode( '#', $data[$i]['value'] ), explode( '#', $data[$i]['valueLabel'] ), $data[$i]['default'], $data[$i]['hideKey'], $data[$i]['label'], $data[$i]['code'], $data[$i]['class'], $data[$i]['style'], $data[$i]['before'], $data[$i]['after'], $data[$i]['selectLabel'],
1478
  $data[$i]['onclick'], $data[$i]['ondblclick'], $data[$i]['onkeydown'], $data[$i]['onkeypress'], $data[$i]['onkeyup'], $data[$i]['onmousedown'], $data[$i]['onmouseup'], $data[$i]['onmouseover'], $data[$i]['onmouseout'], $data[$i]['onmousemove'], $data[$i]['onfocus'], $data[$i]['onblur'], $data[$i]['onchange'], $data[$i]['onselect'] );
1479
  }
1480
  else if( $data[$i]['type'] == 'textarea' ) {
1481
  if ( $options['tinyMCE'][$_REQUEST['post']][$this->sanitize_name($title)][$i] ) $data[$i]['rows'] = $options['tinyMCE'][$_REQUEST['post']][$this->sanitize_name($title)][$i];
1482
  $out .=
1483
+ $this->make_textarea( $title, $i, $data[$i]['rows'], $data[$i]['cols'], $data[$i]['tinyMCE'], $data[$i]['htmlEditor'], $data[$i]['mediaButton'], $data[$i]['default'], $data[$i]['hideKey'], $data[$i]['label'], $data[$i]['code'], $data[$i]['class'], $data[$i]['style'],
1484
  $data[$i]['onclick'], $data[$i]['ondblclick'], $data[$i]['onkeydown'], $data[$i]['onkeypress'], $data[$i]['onkeyup'], $data[$i]['onmousedown'], $data[$i]['onmouseup'], $data[$i]['onmouseover'], $data[$i]['onmouseout'], $data[$i]['onmousemove'], $data[$i]['onfocus'], $data[$i]['onblur'], $data[$i]['onchange'], $data[$i]['onselect'] );
1485
  }
1486
  }
1963
  if ( is_numeric($format) && $output = $options['shortcode_format'][$format] ) :
1964
  $data = get_post_custom($post_id);
1965
  $output = stripcslashes($output);
1966
+
1967
  if( $data == null)
1968
  return;
1969
 
2006
  if ( $options['shortcode_format_use_php'][$format] )
2007
  $output = preg_replace_callback("/(<\?php|<\?|< \?php)(.*?)\?>/si", array($this, 'EvalBuffer'), $output);
2008
  $key = preg_quote($key, '/');
2009
+ $replace_val = str_replace('\\', '\\\\', $replace_val);
2010
+ $replace_val = str_replace('$', '\$', $replace_val);
2011
+ $output = preg_replace('/\['.$key.'\]/', $replace_val, $output);
2012
  endforeach;
2013
  endfor;
2014
  endif;
2038
  $hide = '';
2039
  if ( $val2['output'] == true ) :
2040
  $value = $values[$key2];
2041
+ $value = str_replace('\\', '\\\\', $value);
2042
  if ( is_numeric($val2['outputCode']) ) :
2043
  eval(stripcslashes($options['php'][$val2['outputCode']]));
2044
  endif;
2060
  endforeach;
2061
  $output .= '</dl>' . "\n";
2062
  endif;
2063
+
2064
  return stripcslashes($output);
2065
  }
2066
 
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.1
7
- Stable tag: 1.1.4
8
 
9
  This plugin adds the default custom fields on the Write Post/Page.
10
 
@@ -49,6 +49,7 @@ The Custom Field Template plugin adds the default custom fields on the Write Pos
49
  * Adds the Initialize button.
50
  * Adds the attributes of before and after text. (`before = blah`, `after = blah`)
51
  * Adds the export and import functionality.
 
52
 
53
  Localization
54
 
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.1
7
+ Stable tag: 1.1.5
8
 
9
  This plugin adds the default custom fields on the Write Post/Page.
10
 
49
  * Adds the Initialize button.
50
  * Adds the attributes of before and after text. (`before = blah`, `after = blah`)
51
  * Adds the export and import functionality.
52
+ * Adds the style attribute. (`style = color:#FF0000;`)
53
 
54
  Localization
55