Custom Field Template - Version 1.2.6

Version Description

Download this release

Release Info

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

Code changes from version 1.2.5 to 1.2.6

Files changed (2) hide show
  1. custom-field-template.php +45 -37
  2. readme.txt +2 -2
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.2.5
8
  Author URI: http://wordpressgogo.com/
9
  */
10
 
@@ -1289,20 +1289,22 @@ jQuery(this).addClass("closed");
1289
  if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
1290
  $out .= '<p class="label">' . stripcslashes($label) . '</p>';
1291
  $i = 0;
1292
- foreach( $values as $val ) {
1293
- $id = $name . $sid . '_' . $this->sanitize_name( $val );
 
1294
 
1295
- $checked = ( trim( $val ) == trim( $selected ) ) ? 'checked="checked"' : '';
1296
 
1297
- $out .=
1298
- '<label for="' . $id . '" class="selectit"><input id="' . $id . '" name="' . $name . '[' . $sid . ']" value="' . attribute_escape(trim($val)) . '" ' . $checked . ' type="radio"' . $class . $style . $event_output . ' /> ';
1299
- if ( $valueLabel[$i] )
1300
- $out .= stripcslashes(trim($valueLabel[$i]));
1301
- else
1302
- $out .= stripcslashes(trim($val));
1303
- $out .= '</label><br />';
1304
- $i++;
1305
- }
 
1306
  $out .= '</dd></dl>'."\n";
1307
 
1308
  return $out;
@@ -1363,17 +1365,19 @@ jQuery(this).addClass("closed");
1363
  $out .= '<option value="">' . __('Select', 'custom-field-template') . '</option>';
1364
 
1365
  $i = 0;
1366
- foreach( $values as $val ) {
1367
- $checked = ( trim( $val ) == trim( $selected ) ) ? 'selected="selected"' : '';
1368
-
1369
- $out .= '<option value="' . attribute_escape(trim($val)) . '" ' . $checked . '>';
1370
- if ( $valueLabel[$i] )
1371
- $out .= stripcslashes(trim($valueLabel[$i]));
1372
- else
1373
- $out .= stripcslashes(trim($val));
1374
- $out .= '</option>';
1375
- $i++;
1376
- }
 
 
1377
  $out .= '</select>'.trim($after).'</dd></dl>'."\n";
1378
 
1379
  return $out;
@@ -1585,11 +1589,12 @@ EOF;
1585
  <div class="dbx-content">';
1586
  }
1587
 
1588
- $out .= '<script type="text/javascript">' . "\n" .
1589
- '// <![CDATA[' . "\n" .
1590
- 'function send_to_custom_field(h) {' . "\n" .
1591
  ' if ( tmpFocus ) ed = tmpFocus;' . "\n" .
1592
- ' else {ed = tinyMCE.get("content"); if(ed) {if(!ed.isHidden()) isTinyMCE = true;}}' . "\n" .
 
1593
  ' if ( typeof tinyMCE != "undefined" && isTinyMCE && !ed.isHidden() ) {' . "\n" .
1594
  ' ed.focus();' . "\n" .
1595
  ' //if (tinymce.isIE)' . "\n" .
@@ -1617,7 +1622,9 @@ EOF;
1617
  'var tmpFocus;' . "\n" .
1618
  'function focusTextArea(id) {' . "\n" .
1619
  ' jQuery(document).ready(function() {' . "\n" .
1620
- ' var elm = tinyMCE.get(id);' . "\n" .
 
 
1621
  ' if ( ! elm || elm.isHidden() ) {' . "\n" .
1622
  ' elm = document.getElementById(id);' . "\n" .
1623
  ' isTinyMCE = false;' . "\n" .
@@ -1633,14 +1640,6 @@ EOF;
1633
  ' }' . "\n" .
1634
  ' });' . "\n" .
1635
  '}' . "\n" .
1636
- 'function thickbox(link) {' . "\n" .
1637
- ' var t = link.title || link.name || null;' . "\n" .
1638
- ' var a = link.href || link.alt;' . "\n" .
1639
- ' var g = link.rel || false;' . "\n" .
1640
- ' tb_show(t,a,g);' . "\n" .
1641
- ' link.blur();' . "\n" .
1642
- ' return false;' . "\n" .
1643
- '}' . "\n" .
1644
  'function switchMode(id) {' . "\n" .
1645
  ' var ed = tinyMCE.get(id);' . "\n" .
1646
  ' if ( ! ed || ed.isHidden() ) {' . "\n" .
@@ -1652,6 +1651,15 @@ EOF;
1652
  ' }' . "\n" .
1653
  '}' . "\n";
1654
 
 
 
 
 
 
 
 
 
 
1655
  if(count($options['custom_fields'])>$options['posts'][$_REQUEST['post']] && $options['posts'][$_REQUEST['post']]) $init_id = $options['posts'][$_REQUEST['post']];
1656
  else $init_id = 0;
1657
 
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.2.6
8
  Author URI: http://wordpressgogo.com/
9
  */
10
 
1289
  if ( !empty($label) && !$options['custom_field_template_replace_keys_by_labels'] )
1290
  $out .= '<p class="label">' . stripcslashes($label) . '</p>';
1291
  $i = 0;
1292
+ if ( is_array($values) ) :
1293
+ foreach( $values as $val ) {
1294
+ $id = $name . $sid . '_' . $this->sanitize_name( $val );
1295
 
1296
+ $checked = ( trim( $val ) == trim( $selected ) ) ? 'checked="checked"' : '';
1297
 
1298
+ $out .=
1299
+ '<label for="' . $id . '" class="selectit"><input id="' . $id . '" name="' . $name . '[' . $sid . ']" value="' . attribute_escape(trim($val)) . '" ' . $checked . ' type="radio"' . $class . $style . $event_output . ' /> ';
1300
+ if ( $valueLabel[$i] )
1301
+ $out .= stripcslashes(trim($valueLabel[$i]));
1302
+ else
1303
+ $out .= stripcslashes(trim($val));
1304
+ $out .= '</label><br />';
1305
+ $i++;
1306
+ }
1307
+ endif;
1308
  $out .= '</dd></dl>'."\n";
1309
 
1310
  return $out;
1365
  $out .= '<option value="">' . __('Select', 'custom-field-template') . '</option>';
1366
 
1367
  $i = 0;
1368
+ if ( is_array($values) ) :
1369
+ foreach( $values as $val ) {
1370
+ $checked = ( trim( $val ) == trim( $selected ) ) ? 'selected="selected"' : '';
1371
+
1372
+ $out .= '<option value="' . attribute_escape(trim($val)) . '" ' . $checked . '>';
1373
+ if ( $valueLabel[$i] )
1374
+ $out .= stripcslashes(trim($valueLabel[$i]));
1375
+ else
1376
+ $out .= stripcslashes(trim($val));
1377
+ $out .= '</option>';
1378
+ $i++;
1379
+ }
1380
+ endif;
1381
  $out .= '</select>'.trim($after).'</dd></dl>'."\n";
1382
 
1383
  return $out;
1589
  <div class="dbx-content">';
1590
  }
1591
 
1592
+ $out .= '<script type="text/javascript">' . "\n" .
1593
+ '// <![CDATA[' . "\n";
1594
+ $out .= 'function send_to_custom_field(h) {' . "\n" .
1595
  ' if ( tmpFocus ) ed = tmpFocus;' . "\n" .
1596
+ ' else if ( typeof tinyMCE == "undefined" ) ed = document.getElementById("content");' . "\n" .
1597
+ ' else { ed = tinyMCE.get("content"); if(ed) {if(!ed.isHidden()) isTinyMCE = true;}}' . "\n" .
1598
  ' if ( typeof tinyMCE != "undefined" && isTinyMCE && !ed.isHidden() ) {' . "\n" .
1599
  ' ed.focus();' . "\n" .
1600
  ' //if (tinymce.isIE)' . "\n" .
1622
  'var tmpFocus;' . "\n" .
1623
  'function focusTextArea(id) {' . "\n" .
1624
  ' jQuery(document).ready(function() {' . "\n" .
1625
+ ' if ( typeof tinyMCE != "undefined" ) {' . "\n" .
1626
+ ' var elm = tinyMCE.get(id);' . "\n" .
1627
+ ' }' . "\n" .
1628
  ' if ( ! elm || elm.isHidden() ) {' . "\n" .
1629
  ' elm = document.getElementById(id);' . "\n" .
1630
  ' isTinyMCE = false;' . "\n" .
1640
  ' }' . "\n" .
1641
  ' });' . "\n" .
1642
  '}' . "\n" .
 
 
 
 
 
 
 
 
1643
  'function switchMode(id) {' . "\n" .
1644
  ' var ed = tinyMCE.get(id);' . "\n" .
1645
  ' if ( ! ed || ed.isHidden() ) {' . "\n" .
1651
  ' }' . "\n" .
1652
  '}' . "\n";
1653
 
1654
+ $out .= 'function thickbox(link) {' . "\n" .
1655
+ ' var t = link.title || link.name || null;' . "\n" .
1656
+ ' var a = link.href || link.alt;' . "\n" .
1657
+ ' var g = link.rel || false;' . "\n" .
1658
+ ' tb_show(t,a,g);' . "\n" .
1659
+ ' link.blur();' . "\n" .
1660
+ ' return false;' . "\n" .
1661
+ '}' . "\n";
1662
+
1663
  if(count($options['custom_fields'])>$options['posts'][$_REQUEST['post']] && $options['posts'][$_REQUEST['post']]) $init_id = $options['posts'][$_REQUEST['post']];
1664
  else $init_id = 0;
1665
 
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.1
7
- Stable tag: 1.2.5
8
 
9
  This plugin adds the default custom fields on the Write Post/Page.
10
 
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.8 Bata 2
7
+ Stable tag: 1.2.6
8
 
9
  This plugin adds the default custom fields on the Write Post/Page.
10